Examples of GrantedAuthorityImpl


Examples of org.acegisecurity.GrantedAuthorityImpl

        {
            UserRoleVO[] roles = userDetailsVO.getRoles();
            authorities = new GrantedAuthorityImpl[roles.length];
            for (int i=0; i<roles.length; i++)
            {
                authorities[i] = new GrantedAuthorityImpl(roles[i].toString());
            }
        }
        return authorities;
    }
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

*/
public class MockAcegiUserDetailsService implements UserDetailsService {
   
    public UserDetails loadUserByUsername(String string) throws UsernameNotFoundException, DataAccessException {
        GrantedAuthority[] authorities =  new GrantedAuthority[] {
            new GrantedAuthorityImpl("editor"),
            new GrantedAuthorityImpl("admin")};     
        return new User("test", "test", true, true, true, true, authorities);
    }
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

*/
public class AcegiWorkflowContextHandlerInterceptorDifferentProviderTests extends AbstractWorkflowContextHandlerInterceptorTests {


  protected MockHttpServletRequest getMockRequest(String userName) {
    Authentication auth = new AnonymousAuthenticationToken(userName, userName, new GrantedAuthority[]{ new GrantedAuthorityImpl(userName) });
    SecurityContext context = new SecurityContextImpl();
    context.setAuthentication(auth);
    SecurityContextHolder.setContext(context);

    return new MockHttpServletRequest();
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

    }

    public void testParser39InRoleRule() {

        SecurityContext context = new SecurityContextImpl();
        GrantedAuthority[] roles = new GrantedAuthority[] { new GrantedAuthorityImpl("ADMIN_ROLE"),
                new GrantedAuthorityImpl("USER_ROLE") };
        context.setAuthentication(new TestingAuthenticationToken("username", "username", roles));
        SecurityContextHolder.setContext(context);

        String text = "{firstName: inRole('USER_ROLE') == true : 'Current user must be in USER_ROLE'}";
        assertTrue(validate(new Person(30, "Steven"), text));
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

* @author robh
*/
public class AcegiRoleConditionTests extends TestCase {

  public void setUp() {
    GrantedAuthority[] roles = new GrantedAuthority[]{new GrantedAuthorityImpl("manager"), new GrantedAuthorityImpl("vp")};

    Authentication authentication = new UsernamePasswordAuthenticationToken(new Object(), new Object(), roles);

    SecurityContext context = new SecurityContextImpl();
    context.setAuthentication(authentication);
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

    protected Object mapRow(ResultSet rs, int rownum) 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

Examples of org.acegisecurity.GrantedAuthorityImpl

 
  protected class CustomAuthoritiesByUsernameMapping extends MappingSqlQuery {

        protected Object mapRow(ResultSet rs, int rownum)throws SQLException {
            String roleName = CustomJdbcDaoImpl.this.getRolePrefix() + rs.getString(2);
            GrantedAuthorityImpl authority = new GrantedAuthorityImpl(roleName);
            return authority;
        }
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

        // Servlet API doesn't provide a way to list up all roles the current user
        // has, so we need to ask AuthorizationStrategy what roles it is going to check against.
        List<GrantedAuthority> l = new ArrayList<GrantedAuthority>();
        for( String g : Jenkins.getInstance().getAuthorizationStrategy().getGroups()) {
            if(request.isUserInRole(g))
                l.add(new GrantedAuthorityImpl(g));
        }
        l.add(SecurityRealm.AUTHENTICATED_AUTHORITY);
        authorities = l.toArray(new GrantedAuthority[l.size()]);
    }
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

    private static GrantedAuthority[] toAuthorities(UnixUser u) {
        Set<String> grps = u.getGroups();
        GrantedAuthority[] groups = new GrantedAuthority[grps.size()+1];
        int i=0;
        for (String g : grps)
            groups[i++] = new GrantedAuthorityImpl(g);
        groups[i++] = AUTHENTICATED_AUTHORITY;
        return groups;
    }
View Full Code Here

Examples of org.acegisecurity.GrantedAuthorityImpl

                String role = ga.getAuthority();

                // backward compatible name mangling
                if (convertToUpperCase)
                    role = role.toUpperCase();
                r.add(new GrantedAuthorityImpl(rolePrefix + role));
            }

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