List of usage examples for org.apache.shiro.subject SimplePrincipalCollection addAll
public void addAll(Collection principals, String realmName)
From source file:org.fcrepo.auth.common.ServletContainerAuthenticatingRealm.java
License:Apache License
@Override protected AuthenticationInfo doGetAuthenticationInfo(final AuthenticationToken token) throws AuthenticationException { final ContainerAuthToken authToken = (ContainerAuthToken) token; final SimplePrincipalCollection principals = new SimplePrincipalCollection(); log.debug("Creating principals from servlet container principal and roles"); // container-managed auth username principals.add(authToken.getPrincipal(), getName()); // container-managed auth roles final Set<ContainerRolesPrincipal> roles = authToken.getRoles(); if (!roles.isEmpty()) { principals.addAll(roles, getName()); }/*from ww w.j av a2 s . co m*/ return new SimpleAuthenticationInfo(principals, ContainerAuthToken.AUTHORIZED); }