Package org.springframework.security.authentication.jaas

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


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

        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

    @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

TOP

Related Classes of org.springframework.security.authentication.jaas.JaasAuthenticationToken

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.