Does Shiro provide any functionality out of the box to verify that a username
exists within a realm (without authenticating the user), or is this
something that I would need to check independently of Shiro?

The reason for the question is I'm looking to use Shiro's RunAs feature by
using the following code in a backing bean, however I've found that Shiro
does not check whether the username specified exists before running as the
new identity. 

Subject currentUser = SecurityUtils.getSubject();
PrincipalCollection newIdentity = new SimplePrincipalCollection(username,
realmname);
currentUser.runAs(newIdentity);

Also, is there a better way of building the PrincipalCollection for the user
whose identity we want to assume, so that the realm(s) specified in
shiro.ini are used rather than being hard coded?



--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/Verify-if-username-exists-within-a-realm-without-authenticating-the-user-tp7578783.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to