Examples of JaasAuthenticationToken


Examples of org.springframework.security.authentication.jaas.JaasAuthenticationToken

            return null;
        }
        if (!(authentication instanceof JaasAuthenticationToken)) {
            return null;
        }
        JaasAuthenticationToken token = (JaasAuthenticationToken) authentication;
        LoginContext loginContext = token.getLoginContext();
        if (loginContext == null) {
            return null;
        }
        return loginContext.getSubject();
    }
View Full Code Here

Examples of org.springframework.security.authentication.jaas.JaasAuthenticationToken

            }
        };
        LoginContext ctx = new LoginContext("SubjectDoAsFilterTest", authenticatedSubject, callbackHandler,
                testConfiguration);
        ctx.login();
        token = new JaasAuthenticationToken("username", "password", AuthorityUtils.createAuthorityList("ROLE_ADMIN"),
                ctx);

        // just in case someone forgot to clear the context
        SecurityContextHolder.clearContext();
    }
View Full Code Here

Examples of org.springframework.security.authentication.jaas.JaasAuthenticationToken

        assertNullSubject(filter.obtainSubject(request));
    }

    @Test
    public void obtainSubjectNullLoginContext() {
        token = new JaasAuthenticationToken("un", "pwd", AuthorityUtils.createAuthorityList("ROLE_ADMIN"), null);
        SecurityContextHolder.getContext().setAuthentication(token);
        assertNullSubject(filter.obtainSubject(request));
    }
View Full Code Here

Examples of org.springframework.security.authentication.jaas.JaasAuthenticationToken

    @Test
    public void obtainSubjectNullSubject() throws Exception {
        LoginContext ctx = new LoginContext("obtainSubjectNullSubject", null, callbackHandler, testConfiguration);
        assertNull(ctx.getSubject());
        token = new JaasAuthenticationToken("un", "pwd", AuthorityUtils.createAuthorityList("ROLE_ADMIN"), ctx);
        SecurityContextHolder.getContext().setAuthentication(token);
        assertNullSubject(filter.obtainSubject(request));
    }
View Full Code Here

Examples of org.springframework.security.providers.jaas.JaasAuthenticationToken

     */
    @Test
    public void testAuthenticate()
    {
        final JaasAuthenticationProvider provider = context.mock(JaasAuthenticationProvider.class);
        final JaasAuthenticationToken token = context.mock(JaasAuthenticationToken.class);
        final UsernamePasswordAuthenticationToken auth = context.mock(UsernamePasswordAuthenticationToken.class);
        final UserDetailsService uds = context.mock(UserDetailsService.class);
        final UserDetails ud = context.mock(UserDetails.class);
       
        context.checking(new Expectations()
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.