For my application I need to keep some user info. However to keep principal
as list (not hashmap) is not very good. So I have three questions:
1) Are principals linked with subject - I mean that subject.getPrincipals()
will return ONLY THIS SUBJECT PRINCIPALS?
2) When will PrincipalMap be ready for production mode? I mean, I want to
use:
Object principal = subject.getPrincipals().get(principalName);
3) Can I do like this - I mean will the following code be right and safe?:
public class SubjectPrincipals{
private int id;
private String name;
settters+getters
}
After that in custom jdbcrealm in doGetAuthenticationInfo method:
this line:
info = new SimpleAuthenticationInfo(username, password.toCharArray(),
getName());
replace for:
SubjectPrincipals princip=SubjectPrincipals(id,username);
info = new SimpleAuthenticationInfo(princip, password.toCharArray(),
getName());
After that in any code:
Subject currentUser = SecurityUtils.getSubject();
SubjectPrincipals princip=(SubjectPrincipals)currentUser.getPrincipal();
System.out.println("THE NAME OF CURRENT USER IS:"+princip.getName)
--
View this message in context:
http://shiro-user.582556.n2.nabble.com/Shiro-principals-tp7580344.html
Sent from the Shiro User mailing list archive at Nabble.com.