Package org.springframework.security.access

Examples of org.springframework.security.access.SecurityConfig


        list.add(cpXyz);
        list.add(cpAbc);
        cdm.setChannelProcessors(list);
        cdm.afterPropertiesSet();

        assertTrue(cdm.supports(new SecurityConfig("xyz")));
        assertTrue(cdm.supports(new SecurityConfig("abc")));
        assertFalse(cdm.supports(new SecurityConfig("UNSUPPORTED")));
    }
View Full Code Here


                "<global-method-security>" +
                "   <protect-pointcut expression='execution(* org..*Foo.foo(..))' access='ROLE_USER'/>" +
                "</global-method-security>" + AUTH_PROVIDER_XML
        );
        Foo foo = (Foo) appContext.getBean("target");
        foo.foo(new SecurityConfig("A"));
    }
View Full Code Here

                "<b:bean id='target' class='" + ConcreteFoo.class.getName()  + "'/>" +
                "<global-method-security pre-post-annotations='enabled'/>" + AUTH_PROVIDER_XML
        );
        SecurityContextHolder.getContext().setAuthentication(bob);
        Foo foo = (Foo) appContext.getBean("target");
        foo.foo(new SecurityConfig("A"));
    }
View Full Code Here

        );
        // External MDS should take precedence over PreAuthorize
        SecurityContextHolder.getContext().setAuthentication(bob);
        Foo foo = (Foo) appContext.getBean("target");
        try {
            foo.foo(new SecurityConfig("A"));
            fail("Bob can't invoke admin methods");
        } catch (AccessDeniedException expected) {
        }
        SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken("admin", "password"));
        foo.foo(new SecurityConfig("A"));
    }
View Full Code Here

                AUTH_PROVIDER_XML
        );
        SecurityContextHolder.getContext().setAuthentication(bob);
        Foo foo = (Foo) appContext.getBean("target");
        try {
            foo.foo(new SecurityConfig("A"));
            fail("Bob can't invoke admin methods");
        } catch (AccessDeniedException expected) {
        }
        SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken("admin", "password"));
        foo.foo(new SecurityConfig("A"));
    }
View Full Code Here

        }
    }

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

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

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

            pointcutMap.put(expression, attributes);
        }
View Full Code Here

    //~ Methods ========================================================================================================

    @Test
    public void testHashCode() {
        SecurityConfig config = new SecurityConfig("TEST");
        Assert.assertEquals("TEST".hashCode(), config.hashCode());
    }
View Full Code Here

        Assert.assertEquals("TEST".hashCode(), config.hashCode());
    }

    @Test(expected=IllegalArgumentException.class)
    public void testCannotConstructWithNullAttribute() {
           new SecurityConfig(null); // SEC-727
    }
View Full Code Here

           new SecurityConfig(null); // SEC-727
    }

    @Test(expected=IllegalArgumentException.class)
    public void testCannotConstructWithEmptyAttribute() {
           new SecurityConfig(""); // SEC-727
    }
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.