Package org.springframework.security.access.hierarchicalroles

Examples of org.springframework.security.access.hierarchicalroles.RoleHierarchy


        assertEquals("C", ((GrantedAuthoritySid) sids.get(3)).getGrantedAuthority());
    }

    @Test
    public void roleHierarchyIsUsedWhenSet() throws Exception {
        RoleHierarchy rh =  mock(RoleHierarchy.class);
        List rhAuthorities = AuthorityUtils.createAuthorityList("D");
        when(rh.getReachableGrantedAuthorities(anyCollection())).thenReturn(rhAuthorities);
        SidRetrievalStrategy strat = new SidRetrievalStrategyImpl(rh);

        List<Sid> sids = strat.getSids(authentication);
        assertEquals(2, sids.size());
        assertNotNull(sids.get(0));
View Full Code Here


    @Test
    public void roleHierarchySupportIsCorrectlyUsedInEvaluatingRoles() throws Exception {
        SecurityExpressionRoot root = new SecurityExpressionRoot(JOE) {};

        root.setRoleHierarchy(new RoleHierarchy() {
            public Collection<GrantedAuthority> getReachableGrantedAuthorities(Collection<? extends GrantedAuthority> authorities) {
                return AuthorityUtils.createAuthorityList("C");
            }
        });
View Full Code Here

    return config;
  }

  private static Collection<? extends GrantedAuthority> findInferredAuthorities(
      final Collection<GrantedAuthority> granted) {
    RoleHierarchy roleHierarchy = getBean("roleHierarchy");
    Collection<? extends GrantedAuthority> reachable = roleHierarchy.getReachableGrantedAuthorities(granted);
    if (reachable == null) {
      return Collections.emptyList();
    }
    return reachable;
  }
View Full Code Here

TOP

Related Classes of org.springframework.security.access.hierarchicalroles.RoleHierarchy

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.