List of usage examples for org.apache.shiro.authc SimpleAccount getRoles
public Collection<String> getRoles()
this.authzInfo.getRoles(); From source file:org.apache.zeppelin.utils.ZeppelinRealm.java
License:Apache License
public Collection<String> getRoles(String userName) { SimpleAccount account = users.get(userName); return account.getRoles(); }
From source file:org.icgc.dcc.submission.shiro.DccWrappingRealm.java
License:Open Source License
/** * TODO: <code>{@link DccRealm#getPermissions(String)}</code> *//*from w w w.j ava2 s .c o m*/ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { log.debug("Putting together authorizations for user {}", principals.getPrimaryPrincipal()); String username = super.getUsername(principals); SimpleAccount simpleAccount = super.getUser(username); // this gives access to implementation of // AuthorizationInfo... Collection<String> iniRoles = simpleAccount.getRoles(); Set<String> projectSpecificPermissions = buildProjectSpecificPermissions(username, iniRoles); log.debug( "Dynamically adding Project-specific permissions for user {}: {}, top of existing roles from INI: {} ({})", new Object[] { username, projectSpecificPermissions, iniRoles, simpleAccount.getObjectPermissions() }); simpleAccount.addStringPermissions(projectSpecificPermissions); return simpleAccount; }