Ok, swinging back around for my PrincipalCollection question.

In one of my realms in the doGetAuthenticationInfo method I am creating a SimplePrincipalCollection and adding 2 items to it. Then I create a SimpleAuthentication info passing that SPC as the first parameter, the credentials and the realm name.

My question is later on if I do SecurityUtils.getSubject().getPrincipals() I get a PrincipalCollection which seems like it should be the SPC that I created above.  So if I call getPrimaryPrincipal() I would expect the first principal (one of the Objects I toss in like username or userid).  But what I get back is a....PrincipalCollection.  So I need to cast the result of the getPrimaryPrincipal to a PrincipalCollection...then I can getPrimary or I've been using oneByType to pick out the object I want.

Since the getPrimaryPrincipal javadoc mentioned the AuthenticationStrategy and we were using the "at least one", I tried with "first successful" but got the same wrapping.

Am I doing something wrong or is this PrincipalCollection inception expected?

All of my realms only support one token type, so there shouldn't be info from multiple realms in the top-level principal collection.

Thanks!

Reply via email to