Package org.springframework.security

Examples of org.springframework.security.ConfigAttribute


        if (details == null) {
            return ACCESS_DENIED;
        }
       
        for (Object obj : config.getConfigAttributes()) {
            ConfigAttribute attribute = (ConfigAttribute) obj;
            List<String> subAttibutes = StringHelper.toList(attribute.getAttribute(), ",");
           
            if (subAttibutes.contains(Authority.ROLE_FOUSER) && details.getUser().getType() != UserType.NA) {
                return ACCESS_GRANTED;
            }
        }
View Full Code Here


            return ACCESS_DENIED;
        }
       
        GrantedAuthority[] authorities = details.getAuthorities();
        for (Object obj : config.getConfigAttributes()) {
            ConfigAttribute attribute = (ConfigAttribute) obj;
            List<String> subAttibutes = StringHelper.toList(attribute.getAttribute(), ",");
           
            if (subAttibutes.contains(Authority.ROLE_BOUSER) && details.getUser().getType() == UserType.BO) {
                return ACCESS_GRANTED;
            }
View Full Code Here

        ConfigAttributeDefinition cad = controller.getParsedConfigs();
        assertTrue( "Should be 2 roles", cad.getConfigAttributes().size() == 2 );

        Iterator iter = cad.getConfigAttributes().iterator();
        ConfigAttribute attr1 = (ConfigAttribute) iter.next();
        ConfigAttribute attr2 = (ConfigAttribute) iter.next();

        assertEquals( "Should be ROLE_1", attr1.getAttribute(), "ROLE_1" );
        assertEquals( "Should be ROLE_2", attr2.getAttribute(), "ROLE_2" );
    }
View Full Code Here

    int result = ACCESS_ABSTAIN;
    Iterator iter = config.getConfigAttributes().iterator();
    GrantedAuthority[] authorities = extractAuthorities( authentication );

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

      if ( this.supports( attribute ) ) {
        result = ACCESS_DENIED;

        // Attempt to find a matching granted authority
        for ( int i = 0; i < authorities.length; i++ ) {
          if ( attribute.getAttribute().substring( processConfigAttributePrefix.length() ).equals(
              authorities[i].getAuthority() ) ) {
            return ACCESS_GRANTED;
          }
        }
      }
View Full Code Here

  public int vote( final Authentication authentication, final Object object, final ConfigAttributeDefinition config ) {
    int result = ACCESS_ABSTAIN;
    Iterator iter = config.getConfigAttributes().iterator();

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

      if ( supports( attribute ) ) {
        String actionName = attribute.getAttribute().substring( prefix.length() );

        if ( policy.isAllowed( actionName ) ) {
          return ACCESS_GRANTED;
        } else {
          return ACCESS_DENIED;
View Full Code Here

TOP

Related Classes of org.springframework.security.ConfigAttribute

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.