Examples of ConfigAttribute


Examples of org.acegisecurity.ConfigAttribute

        }

        Iterator iter = config.getConfigAttributes();

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

            if (supports(attribute)) {
                if (invocation.getHttpRequest().isSecure()) {
                    entryPoint.commence(invocation.getRequest(),
                        invocation.getResponse());
View Full Code Here

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

Examples of org.springframework.security.ConfigAttribute

            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

Examples of org.springframework.security.ConfigAttribute

        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

Examples of org.springframework.security.ConfigAttribute

    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

Examples of org.springframework.security.ConfigAttribute

  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

Examples of org.springframework.security.access.ConfigAttribute

      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

Examples of org.springframework.security.access.ConfigAttribute

      return;
    }
    //所请求的资源拥有的权限(一个资源对多个权限)
    Iterator<ConfigAttribute> iterator = configAttributes.iterator();
    while(iterator.hasNext()) {
      ConfigAttribute configAttribute = iterator.next();
      //访问所请求资源所需要的权限
      String needPermission = configAttribute.getAttribute();
      //System.out.println("needPermission is " + needPermission);
      //用户所拥有的权限authentication
      for(GrantedAuthority ga : authentication.getAuthorities()) {
        if(needPermission.equals(ga.getAuthority())) {
          return;
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

        for(Map.Entry<MessageMatcher<?>,String> entry : matcherToExpression.entrySet()) {
            MessageMatcher<?> matcher = entry.getKey();
            String rawExpression = entry.getValue();
            Expression expression = handler.getExpressionParser().parseExpression(rawExpression);
            ConfigAttribute attribute = new MessageExpressionConfigAttribute(expression);
            matcherToAttrs.put(matcher, Arrays.asList(attribute));
        }
        return new DefaultMessageSecurityMetadataSource(matcherToAttrs);
    }
View Full Code Here

Examples of org.springframework.security.access.ConfigAttribute

            if (failIfCalled) {
                fail("Should not have called this channel processor: " + configAttribute);
            }

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

                if (attr.getAttribute().equals(configAttribute)) {
                    invocation.getHttpResponse().sendRedirect("/redirected");

                    return;
                }
            }
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.