Package org.acegisecurity

Examples of org.acegisecurity.GrantedAuthorityImpl


    }

    //~ Methods ================================================================

    public GrantedAuthority[] getauthorities() {
        GrantedAuthority[] toReturn = {new GrantedAuthorityImpl("demo")};

        return (GrantedAuthority[]) this.authorities.toArray(toReturn);
    }
View Full Code Here


                    if (currentToken.toLowerCase().equals("enabled")) {
                        userAttrib.setEnabled(true);
                    } else if (currentToken.toLowerCase().equals("disabled")) {
                        userAttrib.setEnabled(false);
                    } else {
                        userAttrib.addauthority(new GrantedAuthorityImpl(
                                currentToken));
                    }
                }
            }
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

            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

    protected void setUp() throws Exception {
        super.setUp();
        SecurityContext context = new SecurityContextImpl();
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken("user",
                "password",
                new GrantedAuthority[] {new GrantedAuthorityImpl(Constants.USER_ROLE)});
        context.setAuthentication(token);
        SecurityContextHolder.setContext(context);
    }
View Full Code Here

    public void testAddUserAsAdmin() throws Exception {
        SecurityContext context = new SecurityContextImpl();
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken("admin",
                "password",
                new GrantedAuthority[] {new GrantedAuthorityImpl(Constants.ADMIN_ROLE)});
        context.setAuthentication(token);
        SecurityContextHolder.setContext(context);

        UserManager userManager = (UserManager) makeInterceptedTarget();
        User user = new User("admin");
View Full Code Here

        // Test fix to http://issues.appfuse.org/browse/APF-96
    public void testAddUserRoleWhenHasAdminRole() throws Exception {
        SecurityContext context = new SecurityContextImpl();
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken("user",
                "password",
                new GrantedAuthority[] {new GrantedAuthorityImpl(Constants.ADMIN_ROLE)});
        context.setAuthentication(token);
        SecurityContextHolder.setContext(context);

        UserManager userManager = (UserManager) makeInterceptedTarget();
        User user = new User("user");
View Full Code Here

    // Test removing user from cache after update
    public void testRemoveUserFromCache() throws Exception {
        SecurityContext context = new SecurityContextImpl();
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken("user",
                "password",
                new GrantedAuthority[] {new GrantedAuthorityImpl(Constants.ADMIN_ROLE)});
        context.setAuthentication(token);
        SecurityContextHolder.setContext(context);
       
        UserManager userManager = (UserManager) makeInterceptedTarget();
       
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,
View Full Code Here

         role = StringUtils.replace(role, "\t", "");
         role = StringUtils.replace(role, "\r", "");
         role = StringUtils.replace(role, "\n", "");
         role = StringUtils.replace(role, "\f", "");

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

        return requiredauthorities;
    }
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.