Package org.springframework.security.config.util

Examples of org.springframework.security.config.util.InMemoryXmlApplicationContext


    private BusinessService target;

    @Before
    public void loadContext() {
        appContext = new InMemoryXmlApplicationContext(
                "<b:bean id='target' class='org.springframework.security.access.annotation.Jsr250BusinessServiceImpl'/>" +
                "<global-method-security jsr250-annotations='enabled'/>" + ConfigTestUtils.AUTH_PROVIDER_XML
                );
        target = (BusinessService) appContext.getBean("target");
    }
View Full Code Here


        }
    }

    @Test
    public void embeddedServerCreationContainsExpectedContextSourceAndData() {
        appCtx = new InMemoryXmlApplicationContext("<ldap-server ldif='classpath:test-server.ldif'/>");

        DefaultSpringSecurityContextSource contextSource = (DefaultSpringSecurityContextSource) appCtx.getBean(BeanIds.CONTEXT_SOURCE);

        // Check data is loaded
        LdapTemplate template = new LdapTemplate(contextSource);
View Full Code Here

    @Test
    public void useOfUrlAttributeCreatesCorrectContextSource() throws Exception {
        int port = getDefaultPort();
        // Create second "server" with a url pointing at embedded one
        appCtx = new InMemoryXmlApplicationContext("<ldap-server ldif='classpath:test-server.ldif' port='" + port + "'/>" +
                "<ldap-server ldif='classpath:test-server.ldif' id='blah' url='ldap://127.0.0.1:" + port + "/dc=springframework,dc=org' />");

        // Check the default context source is still there.
        appCtx.getBean(BeanIds.CONTEXT_SOURCE);
View Full Code Here

        template.lookup("uid=ben,ou=people");
    }

    @Test
    public void loadingSpecificLdifFileIsSuccessful() {
        appCtx = new InMemoryXmlApplicationContext(
                "<ldap-server ldif='classpath*:test-server2.xldif' root='dc=monkeymachine,dc=co,dc=uk' />");
        DefaultSpringSecurityContextSource contextSource = (DefaultSpringSecurityContextSource) appCtx.getBean(BeanIds.CONTEXT_SOURCE);

        LdapTemplate template = new LdapTemplate(contextSource);
        template.lookup("uid=pg,ou=gorillas");
View Full Code Here

        template.lookup("uid=pg,ou=gorillas");
    }

    @Test
    public void defaultLdifFileIsSuccessful() {
        appCtx = new InMemoryXmlApplicationContext(
                "<ldap-server/>");
        ApacheDSContainer dsContainer = appCtx.getBean(ApacheDSContainer.class);

        assertEquals("classpath*:*.ldif", ReflectionTestUtils.getField(dsContainer, "ldifResources"));
    }
View Full Code Here

        assertTrue(ben instanceof InetOrgPerson);
    }


    private void setContext(String context) {
        appCtx = new InMemoryXmlApplicationContext(context);
    }
View Full Code Here

    private BusinessService target;

    @Before
    public void loadContext() {
        SecurityContextHolder.clearContext();
        appContext = new InMemoryXmlApplicationContext(
                "<b:bean id='target' class='org.springframework.security.access.annotation.BusinessServiceImpl'/>" +
                "<global-method-security secured-annotations='enabled'/>" + ConfigTestUtils.AUTH_PROVIDER_XML
                );
        target = (BusinessService) appContext.getBean("target");
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.config.util.InMemoryXmlApplicationContext

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.