Examples of ConfigAttribute


Examples of org.springframework.security.access.ConfigAttribute

    @Test
    public void returnsDelegateAttributes() throws Exception {
        List sources = new ArrayList();
        MethodSecurityMetadataSource delegate = mock(MethodSecurityMetadataSource.class);
        ConfigAttribute ca = mock(ConfigAttribute.class);
        List attributes = Arrays.asList(ca);
        Method toString = String.class.getMethod("toString");
        when(delegate.getAttributes(toString, String.class)).thenReturn(attributes);
        sources.add(delegate);
        mds = new DelegatingMethodSecurityMetadataSource(sources);
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

        DenyAgainVoter denyVoter = new DenyAgainVoter();
        list.add(voter);
        list.add(denyVoter);
        mock.setDecisionVoters(list);

        ConfigAttribute attr = new SecurityConfig("DENY_AGAIN_FOR_SURE");
        assertTrue(mock.supports(attr));

        ConfigAttribute badAttr = new SecurityConfig("WE_DONT_SUPPORT_THIS");
        assertTrue(!mock.supports(badAttr));
    }
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

    public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> attributes) {
        Iterator<ConfigAttribute> iter = attributes.iterator();

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

            if (this.supports(attribute)) {
                return ACCESS_DENIED;
            }
        }
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

    public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> attributes) {
        Iterator<ConfigAttribute> iter = attributes.iterator();

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

            if (this.supports(attribute)) {
                return ACCESS_DENIED;
            }
        }
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

        when(matcher1.matches(message)).thenReturn(true);

        Collection<ConfigAttribute> attrs = source.getAttributes(message);

        assertThat(attrs.size()).isEqualTo(1);
        ConfigAttribute attr = attrs.iterator().next();
        assertThat(attr).isInstanceOf(MessageExpressionConfigAttribute.class);
        assertThat(((MessageExpressionConfigAttribute)attr).getAuthorizeExpression().getValue(rootObject)).isEqualTo(true);
    }
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

        when(matcher2.matches(message)).thenReturn(true);

        Collection<ConfigAttribute> attrs = source.getAttributes(message);

        assertThat(attrs.size()).isEqualTo(1);
        ConfigAttribute attr = attrs.iterator().next();
        assertThat(attr).isInstanceOf(MessageExpressionConfigAttribute.class);
        assertThat(((MessageExpressionConfigAttribute)attr).getAuthorizeExpression().getValue(rootObject)).isEqualTo(false);
    }
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

    int result = ACCESS_ABSTAIN;

    if (authentication.getDetails() instanceof OAuthAuthenticationDetails) {
      OAuthAuthenticationDetails details = (OAuthAuthenticationDetails) authentication.getDetails();
      for (Object configAttribute : configAttributes) {
        ConfigAttribute attribute = (ConfigAttribute) configAttribute;

        if (ConsumerSecurityConfig.PERMIT_ALL_ATTRIBUTE.equals(attribute)) {
          return ACCESS_GRANTED;
        }
        else if (ConsumerSecurityConfig.DENY_ALL_ATTRIBUTE.equals(attribute)) {
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

    public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config) throws IOException, ServletException {

        Iterator<ConfigAttribute> attrs = config.iterator();

        while (attrs.hasNext()) {
            ConfigAttribute attribute = attrs.next();
            if (ANY_CHANNEL.equals(attribute.getAttribute())) {
                return;
            }
        }

        for (ChannelProcessor processor : channelProcessors) {
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

    Iterator iter = attributes.iterator();
    Collection<? extends GrantedAuthority> authorities = authentication
        .getAuthorities();

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

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

        FilterInvocation filterInvocation = (FilterInvocation) object;
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

        return;
      }

      for(Map.Entry<String, String> entry : interceptUrl.entrySet()) {
        Collection<ConfigAttribute> atts = new ArrayList<ConfigAttribute>();
            ConfigAttribute ca = null;
            if(entry.getValue()==null) {
              continue;
            }
            for(String configAttribute : entry.getValue().split(",")) {
              ca = new SecurityConfig(configAttribute);
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.