On Sat, May 5, 2012 at 1:42 AM, tarka <[email protected]> wrote:
> So after some investigation I have concluded that the only logical place I
> can see to inject the desired credentials into my Principal Object is in the
> doGetAuthenticationInfo() in my realm. Specifically:
>
> new SimpleAuthenticationInfo(username, password.toCharArray(), getName());
> Where the username is a String. I have a new method called
> getUuidForUser(String username) that I'm using to retrieve the user uuid...
> this is where I come unstuck! I now have two strings; username and uuid and
> I just can't seem to be able to find a way of adding them to the
> SimpleAuthenticationInfo! I have tried a String[], hash, list etc. but
> whenever I have more than just the username the authentication fails.
You mean something like:
SimplePrincipalCollection principals = new
SimplePrincipalCollection();
principals.add(username, getName());
principals.add(user.getUuid(), getName());
return new SimpleAuthenticationInfo(principals,
user.getEncodedPassword(), new SimpleByteSource(
user.getPasswordSalt()));
Use methods of PrincipalCollection to return a specific principal.
Kalle
> tarka wrote
>>
>> At the moment when I place a request to
>> SecurityUtils.getSubject().getPrincipal().toString(); I get the username
>> returned. I would like to be able to obtain the user uuid.
>>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/How-to-set-Principals-tp7490972p7529722.html
> Sent from the Shiro User mailing list archive at Nabble.com.