Package org.springframework.security.access

Examples of org.springframework.security.access.SecurityConfig


    voter.setThrowException(false);
    client.setScope(Arrays.asList("none"));
    assertEquals(
        AccessDecisionVoter.ACCESS_DENIED,
        voter.vote(authentication, null,
            Arrays.<ConfigAttribute> asList(new SecurityConfig("CLIENT_HAS_SCOPE"))));
  }
View Full Code Here


  public void testAbstainIfNotOAuth2() throws Exception {
    Authentication clientAuthentication = new UsernamePasswordAuthenticationToken("foo", "bar");
    assertEquals(
        AccessDecisionVoter.ACCESS_ABSTAIN,
        voter.vote(clientAuthentication, null,
            Collections.<ConfigAttribute> singleton(new SecurityConfig("SCOPE_READ"))));
  }
View Full Code Here

    Authentication userAuthentication = null;
    OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(clientAuthentication, userAuthentication);
    assertEquals(
        AccessDecisionVoter.ACCESS_DENIED,
        voter.vote(oAuth2Authentication, null,
            Collections.<ConfigAttribute> singleton(new SecurityConfig("DENY_OAUTH"))));
  }
View Full Code Here

    Authentication userAuthentication = null;
    OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(clientAuthentication, userAuthentication);
    assertEquals(
        AccessDecisionVoter.ACCESS_GRANTED,
        voter.vote(oAuth2Authentication, null,
            Collections.<ConfigAttribute> singleton(new SecurityConfig("SCOPE_READ"))));
  }
View Full Code Here

    Authentication userAuthentication = null;
    OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(clientAuthentication, userAuthentication);
    assertEquals(
        AccessDecisionVoter.ACCESS_GRANTED,
        voter.vote(oAuth2Authentication, null,
            Collections.<ConfigAttribute> singleton(new SecurityConfig("scope=read"))));
  }
View Full Code Here

    OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(clientAuthentication, userAuthentication);
    voter.setThrowException(false);
    assertEquals(
        AccessDecisionVoter.ACCESS_DENIED,
        voter.vote(oAuth2Authentication, null,
            Collections.<ConfigAttribute> singleton(new SecurityConfig("SCOPE_WRITE"))));
  }
View Full Code Here

    Authentication userAuthentication = null;
    OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(clientAuthentication, userAuthentication);
    assertEquals(
        AccessDecisionVoter.ACCESS_DENIED,
        voter.vote(oAuth2Authentication, null,
            Collections.<ConfigAttribute> singleton(new SecurityConfig("SCOPE_WRITE"))));
  }
View Full Code Here

    private Collection<ConfigAttribute> createAttributes(RequestMatcher matcher, String access) {
        LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> map = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
        Collection<ConfigAttribute> atts = new LinkedList<ConfigAttribute>();
        map.put(matcher, atts);

        atts.add(new SecurityConfig(access));

        ExpressionBasedFilterInvocationSecurityMetadataSource ms = new ExpressionBasedFilterInvocationSecurityMetadataSource(map,
                new DefaultWebSecurityExpressionHandler());
       
        return ms.getAllConfigAttributes();
View Full Code Here

            String[] tokens = StringUtils.commaDelimitedListToStringArray(value);
            List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>(tokens.length);

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

            mappings.put(name, attributes);
        }
View Full Code Here

    List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>();
    Authority authory = null;
    if (url.contains(".xhmtl") || url.contains(".jsf"))
      authory = authoryDao.findByUrl(url);
    if (authory != null)
      attributes.add(new SecurityConfig(authory.getName()));
    else {
      attributes.add(new SecurityConfig("authory_anonymous"));
    }

    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.