From: lhazlewood (s. by Nabble.com) <li...@na...> - 2005-12-07 02:54:18
|
Relay from old forum --------------------------------- Yes. I was actually arguing that we could have the best of both worlds in my post. See the "And of course, we would keep the setPrincipal and getPrincipal methods so that applications that only use a single principal could ignore the complexity of multiple principals." comment in the previous post. I would actually see the method looking something more like this: public Principal getPrincipal() { if( getPrincipals().size() > 1 ) { throw new IllegalStateException( ... ); } return getPrincipals().iterator().next(); } Of course, that also depends on the implementation of your AuthorizationContext. The example above would be for an unordered set of principals like the current JSecurity default implementation, where returning the first principal in an iterator would have non-deterministic behavior and therefore be illegal. Jeremy Haile -- Sent from the JSecurity-Authorization forum at Nabble.com: http://www.nabble.com/AuthorizationContext-multiple-principals-t691831c13668.html#a1826029 |