Package org.acegisecurity

Examples of org.acegisecurity.GrantedAuthorityImpl


            if (convertToUpperCase) {
                role = role.toUpperCase();
            }

            authorities.add(new GrantedAuthorityImpl(rolePrefix + role));
        }

        return authorities;
    }
View Full Code Here


     *
     * @param defaultRole the role name, including any desired prefix.
     */
    public void setDefaultRole(String defaultRole) {
        Assert.notNull(defaultRole, "The defaultRole property cannot be set to null");
        this.defaultRole = new GrantedAuthorityImpl(defaultRole);
    }
View Full Code Here

        while (iter.hasNext()) {
            ConfigAttribute attribute = (ConfigAttribute) iter.next();

            if (this.supports(attribute)) {
                GrantedAuthorityImpl extraAuthority = new GrantedAuthorityImpl(getRolePrefix()
                        + attribute.getAttribute());
                newAuthorities.add(extraAuthority);
            }
        }

        if (newAuthorities.size() == 0) {
            return null;
        } else {
            for (int i = 0; i < authentication.getAuthorities().length; i++) {
                newAuthorities.add(authentication.getAuthorities()[i]);
            }

            GrantedAuthority[] resultType = {new GrantedAuthorityImpl("holder")};
            GrantedAuthority[] newAuthoritiesAsArray = (GrantedAuthority[]) newAuthorities.toArray(resultType);

            return new RunAsUserToken(this.key, authentication.getPrincipal(), authentication.getCredentials(),
                newAuthoritiesAsArray, authentication.getClass());
        }
View Full Code Here

    protected GrantedAuthority createAuthority(Object role) {
        if (role instanceof String) {
            if (convertToUpperCase) {
                role = ((String) role).toUpperCase();
            }
            return new GrantedAuthorityImpl(rolePrefix + role);
        }
        return null;
    }
View Full Code Here

        }

        protected Object mapRow(ResultSet rs, int rownum)
            throws SQLException {
            String roleName = rolePrefix + rs.getString(2);
            GrantedAuthorityImpl authority = new GrantedAuthorityImpl(roleName);

            return authority;
        }
View Full Code Here

            throws SQLException {
            String username = rs.getString(1);
            String password = rs.getString(2);
            boolean enabled = rs.getBoolean(3);
            UserDetails user = new User(username, password, enabled, true, true, true,
                    new GrantedAuthority[] {new GrantedAuthorityImpl("HOLDER")});

            return user;
        }
View Full Code Here

    GrantedAuthority[] authorities = new GrantedAuthority[permissions
        .size()];
    int i = 0;
    for (Object permission : permissions) {
      if (permission instanceof Permission) {
        authorities[i] = new GrantedAuthorityImpl(
            ((Permission) permission).getAuthority());
      } else if (permission instanceof Map) {
        authorities[i] = new GrantedAuthorityImpl(((Map) permission)
            .get("permission").toString());
      } else {
        authorities[i] = new GrantedAuthorityImpl(permission.toString());
      }
      i++;
    }

    return authorities;
View Full Code Here

    String defaultRole = "user";

    GrantedAuthority[] roles = null;

    if ((roles == null) && (null != defaultRole)) {
      roles = new GrantedAuthority[] { new GrantedAuthorityImpl(
          defaultRole) };
    }

    if (null != roles) {
      return new User(username, password, true, true, true, true, roles);
View Full Code Here

                if(role instanceof String) {
                    if(convertToUpperCase) {
                        role = ((String)role).toUpperCase();
                    }

                    roles.add(new GrantedAuthorityImpl(rolePrefix + role));
                } else {
                    logger.warn("Non-String value found for role attribute " + roleAttribute.getID());
                }
            }
        } catch(NamingException ne) {
View Full Code Here

     *
     * @param defaultRole the role name, including any desired prefix.
     */
    public void setDefaultRole(String defaultRole) {
        Assert.notNull(defaultRole, "The defaultRole property cannot be set to null");
        this.defaultRole = new GrantedAuthorityImpl(defaultRole);
    }
View Full Code Here

TOP

Related Classes of org.acegisecurity.GrantedAuthorityImpl

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.