Examples of GrantedAuthorityImpl


Examples of org.acegisecurity.GrantedAuthorityImpl

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

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

        return authorities;
    }
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

     *
     * @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

Examples of org.acegisecurity.GrantedAuthorityImpl

        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

Examples of org.springframework.security.GrantedAuthorityImpl

        TestingAuthenticationToken auth = new TestingAuthenticationToken(
                username,
                username,
                new GrantedAuthority[] {
                        new GrantedAuthorityImpl("ROLE_TELLER"),
                        new GrantedAuthorityImpl("ROLE_PERMISSION_LIST") });

        SecurityContext secureContext = new SecurityContextImpl();
        secureContext.setAuthentication(auth);
        SecurityContextHolder.setContext(secureContext);
View Full Code Here

Examples of org.springframework.security.GrantedAuthorityImpl

        TestingAuthenticationToken auth = new TestingAuthenticationToken(
                username,
                username,
                new GrantedAuthority[] {
                        new GrantedAuthorityImpl("ROLE_TELLER"),
                        new GrantedAuthorityImpl("ROLE_PERMISSION_LIST") });

        SecurityContext secureContext = new SecurityContextImpl();
        secureContext.setAuthentication(auth);
        SecurityContextHolder.setContext(secureContext);
View Full Code Here

Examples of org.springframework.security.GrantedAuthorityImpl

      this.account = account;
      List<String> roles = account.getRoleList();

      grantedAuthorities = new GrantedAuthority[roles.size()];
      for (int i = 0; i < roles.size(); i++) {
        grantedAuthorities[i] = new GrantedAuthorityImpl(roles.get(i));
      }
    }
  }
View Full Code Here

Examples of org.springframework.security.GrantedAuthorityImpl

    rule.setAttributes(attributes);
    return rule;
  }

  private Authentication getAuthentication() {
    GrantedAuthority[] authorities = { new GrantedAuthorityImpl("ROLE_1"), new GrantedAuthorityImpl("ROLE_2"),
        new GrantedAuthorityImpl("ROLE_3") };
    return new UsernamePasswordAuthenticationToken("test", "", authorities);
  }
View Full Code Here

Examples of org.springframework.security.GrantedAuthorityImpl

            // Remove the role's whitespace characters without depending on JDK 1.4+
            // Includes space, tab, new line, carriage return and form feed.
            String role = authority.trim(); // trim, don't use spaces, as per SEC-378
            role = StringUtils.deleteAny(role, "\t\n\r\f");

            requiredAuthorities.add(new GrantedAuthorityImpl(role));
        }

        return requiredAuthorities;
    }
View Full Code Here

Examples of org.springframework.security.GrantedAuthorityImpl

    private Authentication createAuthenticationToken(String username, String password, String... roles) {
        Authentication authToken;
        if (roles != null && roles.length > 0) {
            GrantedAuthority[] authorities = new GrantedAuthority[roles.length];
            for (int i = 0; i < roles.length; i++) {
                authorities[i] = new GrantedAuthorityImpl(roles[i]);
            }
            authToken = new UsernamePasswordAuthenticationToken(username, password, authorities);
        } else {
            authToken = new UsernamePasswordAuthenticationToken(username, password);
        }
View Full Code Here

Examples of org.springframework.security.GrantedAuthorityImpl

    /**
     * Construct a token with the given id, password, and role
     */
    public static Authentication makeAuthentication( String user, String password, String role ) {
        return new TestingAuthenticationToken( user, password,
            new GrantedAuthority[] { new GrantedAuthorityImpl( role ) } );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.