Examples of SAMLUserDetailsService


Examples of org.springframework.security.saml.userdetails.SAMLUserDetailsService

    @Test
    public void testAuthenticateUserDetails() throws Exception {
        SAMLMessageContext context = new SAMLMessageContext();
        context.setCommunicationProfileId(SAMLConstants.SAML2_WEBSSO_PROFILE_URI);

        SAMLUserDetailsService details = createMock(SAMLUserDetailsService.class);
        provider.setUserDetails(details);

        SAMLAuthenticationToken token = new SAMLAuthenticationToken(context);
        SAMLCredential result = new SAMLCredential(nameID, assertion, "IDP", "localSP");

        expect(consumer.processAuthenticationResponse(context)).andReturn(result);
        expect(assertion.getAuthnStatements()).andReturn(new LinkedList<AuthnStatement>());
        User user = new User("test", "test", true, true, true, true, Arrays.asList(new SimpleGrantedAuthority("role1"), new SimpleGrantedAuthority("role2")));
        expect(details.loadUserBySAML(result)).andReturn(user);

        provider.setForcePrincipalAsString(false);

        replayMock();
        replay(details);
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.