On Wed, Mar 13, 2013 at 4:50 PM, NabbleReallySucks <[email protected]> wrote: > Les Hazlewood-2 wrote >> >> Do you mean SimplePrincipalMap? if so, the PrincipalMap and the >> SimplePrincipalMap concepts are not to be used - they are >> experimental, not documented anywhere, and their JavaDoc clearly >> explains this. >> >> HTH, >> >> Les > > Oops. ;) I guess I was hoping to be able to distinguish between a userId and > a userName in the Set/Collection of Principals. If it is just a Set then > there is no way to distinguish in a nice easy named way. And no, I will not > use instanceof. ;)
Yep, this isn't so nice at the moment. What most people do is wrap the value in a trivial typed object and then look up that object: principals.oneByType(MyWrapperType.class); This is one of the very first things that will immediately remedied in Shiro 2 (which hopefully we can start working on very soon) - subject.getPrincipals() will return a Map of named pairs (e.g. subject 'attributes'). Best, Les
