Package org.apache.shiro.authz

Examples of org.apache.shiro.authz.SimpleAuthorizationInfo


     * @param roleNames   the names of the roles assigned to this account.
     * @param permissions the permissions assigned to this account directly (not those assigned to any of the realms).
     */
    public SimpleAccount(Object principal, Object credentials, String realmName, Set<String> roleNames, Set<Permission> permissions) {
        this.authcInfo = new SimpleAuthenticationInfo(new SimplePrincipalCollection(principal, realmName), credentials);
        this.authzInfo = new SimpleAuthorizationInfo(roleNames);
        this.authzInfo.setObjectPermissions(permissions);
    }
View Full Code Here


     * @param roleNames   the names of the roles assigned to this account.
     * @param permissions the permissions assigned to this account directly (not those assigned to any of the realms).
     */
    public SimpleAccount(Collection principals, Object credentials, String realmName, Set<String> roleNames, Set<Permission> permissions) {
        this.authcInfo = new SimpleAuthenticationInfo(new SimplePrincipalCollection(principals, realmName), credentials);
        this.authzInfo = new SimpleAuthorizationInfo(roleNames);
        this.authzInfo.setObjectPermissions(permissions);
    }
View Full Code Here

     * @param roleNames   the names of the roles assigned to this account.
     * @param permissions the permissions assigned to this account directly (not those assigned to any of the realms).
     */
    public SimpleAccount(PrincipalCollection principals, Object credentials, Set<String> roleNames, Set<Permission> permissions) {
        this.authcInfo = new SimpleAuthenticationInfo(principals, credentials);
        this.authzInfo = new SimpleAuthorizationInfo(roleNames);
        this.authzInfo.setObjectPermissions(permissions);
    }
View Full Code Here

        return buildAuthorizationInfo(roleNames);
    }

    protected AuthorizationInfo buildAuthorizationInfo(Set<String> roleNames) {
        return new SimpleAuthorizationInfo(roleNames);
    }
View Full Code Here

        }

        protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
            Set<String> roles = new HashSet<String>();
            roles.add(ROLE);
            return new SimpleAuthorizationInfo(roles);
        }
View Full Code Here

        }

        protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
            Set<String> roles = new HashSet<String>();
            roles.add(ROLE);
            return new SimpleAuthorizationInfo(roles);
        }
View Full Code Here

    String username = (String) principals.fromRealm(getName()).iterator().next();
   
    if( username != null ){
      LoginAccount la = accountManager.get( username );
      if( la != null && la.getRoles() != null ){
        SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
        for( Role each:la.getRoles() ){
          if( each.getName() != null )
            info.addRole(each.getName());
          Collection<String> pers = each.getPermissionsAsString();
          if( pers != null )
            info.addStringPermissions( pers );
        }
       
        return info;
      }
    }
View Full Code Here

    String username = (String) principals.fromRealm(getName()).iterator().next();
   
    if( username != null ){
      LoginAccount la = accountManager.get( username );
      if( la != null && la.getRoles() != null ){
        SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
        for( Role each:la.getRoles() ){
          if( !each.isEffective() )
            continue;
          if( each.getName() != null )
            info.addRole(each.getName());
          Collection<String> pers = each.getPermissionsAsString();
          if( pers != null )
            info.addStringPermissions( pers );
        }
       
        return info;
      }
    }
View Full Code Here

        final LdapContextFactory ldapContextFactory) throws NamingException {
      if (!isAuthorizationEnabled()) {
        return null;
      }
      final Set<String> roleNames = getRoles(principals, ldapContextFactory);
        SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(roleNames);
        Set<String> stringPermissions = permsFor(roleNames);
        simpleAuthorizationInfo.setStringPermissions(stringPermissions);
        return simpleAuthorizationInfo;
    }
View Full Code Here

  protected AuthorizationInfo doGetAuthorizationInfo(
      PrincipalCollection principals) {
    Long userId = (Long) principals.fromRealm(getName()).iterator().next();
    User user = userDAO.getUser(userId);
    if (user != null) {
      SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
      for (Role role : user.getRoles()) {
        info.addRole(role.getName());
        info.addStringPermissions(role.getPermissions());
      }
      return info;
    } else {
      return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.shiro.authz.SimpleAuthorizationInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.