Hi,
The JbdcRealm :
- verifies a user and a password according to the users table and returns
the username as the first principal of the PrincipalCollection
- grants roles and permissions according to the user_roles and
roles_permissions tables.
If you want to return additionnal information stored in your database, you
will have to create a new Realm inheriting from the JdbcRealm and override
the doGetAuthenticationInfo method to get your additionnal information. It
could be something like :
/public class ExtendedJbdcRealm extends JdbcRealm {
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
token) throws AuthenticationException {
AuthenticationInfo info = super.doGetAuthenticationInfo(token);
SimplePrincipalCollection princColl = new
SimplePrincipalCollection();
// retrieve username
princColl.add(info.getPrincipals().getPrimaryPrincipal(),
getName());
// add email or another information
princColl.add("email", getName());
princColl.add("other information", getName());
// ...
return new SimpleAuthenticationInfo(princColl,
info.getCredentials());
}
}/
Best regards,
Jérôme
--
View this message in context:
http://shiro-user.582556.n2.nabble.com/Getting-more-user-information-tp7559398p7562217.html
Sent from the Shiro User mailing list archive at Nabble.com.