Examples of buildRunAs()


Examples of org.springframework.security.access.intercept.NullRunAsManager.buildRunAs()

        super.setUp();
    }

    public void testAlwaysReturnsNull() {
        NullRunAsManager runAs = new NullRunAsManager();
        assertNull(runAs.buildRunAs(null, null, null));
    }

    public void testAlwaysSupportsClass() {
        NullRunAsManager runAs = new NullRunAsManager();
        assertTrue(runAs.supports(String.class));
View Full Code Here

Examples of org.springframework.security.access.intercept.RunAsManager.buildRunAs()

        Authentication token = new TestingAuthenticationToken("Test", "Password", "NOT_USED");
        token.setAuthenticated(true);
        ctx.setAuthentication(token);

        RunAsManager runAsManager = mock(RunAsManager.class);
        when(runAsManager.buildRunAs(eq(token), any(), anyCollection())).thenReturn(new RunAsUserToken("key", "someone", "creds", token.getAuthorities(), token.getClass()));
        interceptor.setRunAsManager(runAsManager);

        FilterInvocation fi = createinvocation();
        FilterChain chain = fi.getChain();
View Full Code Here

Examples of org.springframework.security.access.intercept.RunAsManager.buildRunAs()

        token.setAuthenticated(true);
        final RunAsManager runAs = mock(RunAsManager.class);
        final RunAsUserToken runAsToken =
            new RunAsUserToken("key", "someone", "creds", token.getAuthorities(), TestingAuthenticationToken.class);
        interceptor.setRunAsManager(runAs);
        when(runAs.buildRunAs(eq(token), any(MethodInvocation.class), any(List.class))).thenReturn(runAsToken);
        when(aspectJCallback.proceedWithObject()).thenThrow(new RuntimeException());

        try {
            interceptor.invoke(joinPoint, aspectJCallback);
            fail("Expected Exception");
View Full Code Here

Examples of org.springframework.security.access.intercept.RunAsManager.buildRunAs()

        token.setAuthenticated(true);
        final RunAsManager runAs = mock(RunAsManager.class);
        final RunAsUserToken runAsToken =
            new RunAsUserToken("key", "someone", "creds", token.getAuthorities(), TestingAuthenticationToken.class);
        interceptor.setRunAsManager(runAs);
        when(runAs.buildRunAs(eq(token), any(MethodInvocation.class), any(List.class))).thenReturn(runAsToken);
        when(joinPoint.proceed()).thenThrow(new RuntimeException());

        try {
            interceptor.invoke(joinPoint);
            fail("Expected Exception");
View Full Code Here

Examples of org.springframework.security.access.intercept.RunAsManager.buildRunAs()

        final RunAsManager runAs = mock(RunAsManager.class);
        final RunAsUserToken runAsToken =
            new RunAsUserToken("key", "someone", "creds", token.getAuthorities(), TestingAuthenticationToken.class);
        interceptor.setRunAsManager(runAs);
        mdsReturnsUserRole();
        when(runAs.buildRunAs(eq(token), any(MethodInvocation.class), any(List.class))).thenReturn(runAsToken);

        String result = advisedTarget.makeUpperCase("hello");
        assertEquals("HELLO org.springframework.security.access.intercept.RunAsUserToken true", result);
        // Check we've changed back
        assertSame(ctx, SecurityContextHolder.getContext());
View Full Code Here

Examples of org.springframework.security.access.intercept.RunAsManager.buildRunAs()

        final RunAsManager runAs = mock(RunAsManager.class);
        final RunAsUserToken runAsToken =
            new RunAsUserToken("key", "someone", "creds", token.getAuthorities(), TestingAuthenticationToken.class);
        interceptor.setRunAsManager(runAs);
        mdsReturnsUserRole();
        when(runAs.buildRunAs(eq(token), any(MethodInvocation.class), any(List.class))).thenReturn(runAsToken);

        try {
            advisedTarget.makeUpperCase("hello");
            fail("Expected Exception");
        }catch(RuntimeException success) {}
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.