Package org.springframework.security.access

Examples of org.springframework.security.access.SecurityConfig


    String[] allAttrs = StringUtils.stripAll(
                StringUtils.splitPreserveAllTokens(roles, ',')
            );
    this.configAttributes = new ArrayList<ConfigAttribute>();
    for (String attr : allAttrs) {
      this.configAttributes.add(new SecurityConfig(attr));
    }

    }
View Full Code Here


      for (Resources resource : resources) {
        Collection<ConfigAttribute> configAttributes = new ArrayList<ConfigAttribute>();
        // TODO:ZZQ 通过资源名称来表示具体的权限 注意:必须"ROLE_"开头
        // 关联代码:applicationContext-security.xml
        // 关联代码:com.huaxin.security.MyUserDetailServiceImpl#obtionGrantedAuthorities
        ConfigAttribute configAttribute = new SecurityConfig("ROLE_" + resource.getResKey());
        configAttributes.add(configAttribute);
        resourceMap.put(resource.getResUrl(), configAttributes);
      }
    }
  }
View Full Code Here

    String[] allAttrs = StringUtils.stripAll(
                StringUtils.splitPreserveAllTokens(roles, ',')
            );
    this.configAttributes = new ArrayList<ConfigAttribute>();
    for (String attr : allAttrs) {
      this.configAttributes.add(new SecurityConfig(attr));
    }

    }
View Full Code Here

            final PlasticClass plasticClass,
            final Secured annotation) {

        List<ConfigAttribute> configAttributeDefinition = new ArrayList<ConfigAttribute>();
        for (String annValue : annotation.value()) {
            configAttributeDefinition.add(new SecurityConfig(annValue));
        }
        ConfigAttributeHolder configAttributeHolder = new ConfigAttributeHolder(configAttributeDefinition);
        plasticClass.introduceField(
                ConfigAttributeHolder.class,
                "_$configAttributeDefinition").inject(configAttributeHolder);
View Full Code Here

            }
            return false;
        }
        final Collection<ConfigAttribute> configAttributes = new ArrayList<ConfigAttribute>(securityConfigurationAttributes.length);
        for (String securityConfigString : securityConfigurationAttributes) {
            configAttributes.add(new SecurityConfig(securityConfigString));
        }
        try {
            accessDecisionManager.decide(authentication, securedObject, configAttributes);
            return true;
        } catch (AccessDeniedException ex) {
View Full Code Here

                "   <intercept-url pattern='/**' access='ROLE_A'/>" +
                "</filter-security-metadata-source>");
        DefaultFilterInvocationSecurityMetadataSource fids = (DefaultFilterInvocationSecurityMetadataSource) appContext.getBean("fids");
        Collection<ConfigAttribute> cad = fids.getAttributes(createFilterInvocation("/anything", "GET"));
        assertNotNull(cad);
        assertTrue(cad.contains(new SecurityConfig("ROLE_A")));
    }
View Full Code Here

                "</filter-security-metadata-source>");
        DefaultFilterInvocationSecurityMetadataSource fids = (DefaultFilterInvocationSecurityMetadataSource) appContext.getBean("fids");
        Collection<ConfigAttribute> cad = fids.getAttributes(createFilterInvocation("/secure", "GET"));
        assertNotNull(cad);
        assertEquals(1, cad.size());
        assertTrue(cad.contains(new SecurityConfig("ROLE_A")));
    }
View Full Code Here

    }


    private ChannelRequestMatcherRegistry addAttribute(String attribute, List<RequestMatcher> matchers) {
        for(RequestMatcher matcher : matchers) {
            Collection<ConfigAttribute> attrs = Arrays.<ConfigAttribute>asList(new SecurityConfig(attribute));
            requestMap.put(matcher, attrs);
        }
        return REGISTRY;
    }
View Full Code Here

        }
    }

    public void testSupports() {
        SecureChannelProcessor processor = new SecureChannelProcessor();
        assertTrue(processor.supports(new SecurityConfig("REQUIRES_SECURE_CHANNEL")));
        assertFalse(processor.supports(null));
        assertFalse(processor.supports(new SecurityConfig("NOT_SUPPORTED")));
    }
View Full Code Here

    public Collection<ConfigAttribute> extractAttributes(Secured secured) {
        String[] attributeTokens = secured.value();
        List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>(attributeTokens.length);

        for(String token : attributeTokens) {
            attributes.add(new SecurityConfig(token));
        }

        return attributes;
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.access.SecurityConfig

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.