Package com.cloudseal.client.saml2

Examples of com.cloudseal.client.saml2.AuthResponseValidatorImpl


    private IdpXmlParser idpXmlParser;
    private AuthRequestBuilder authRequestBuilder;

    public CloudsealManagerImpl() {
        idpXmlParser = new IdpXmlParser();
        authRequestBuilder = new AuthRequestBuilder();
    }
View Full Code Here


    private IdpXmlParser idpXmlParser;
    private AuthRequestBuilderImpl authRequestBuilder;

    public CloudsealManagerImpl() {
        idpXmlParser = new IdpXmlParser();
        authRequestBuilder = new AuthRequestBuilderImpl();
    }
View Full Code Here

        InputStream keystoreIs = keystore.getInputStream();
        byte[] keystoreData = IOUtils.toByteArray(keystoreIs);
        IOUtils.closeQuietly(keystoreIs);

        AuthRequestContext authRequestContext = new AuthRequestContext();
        authRequestContext.setKeystore(keystoreData);
        authRequestContext.setKeyName(keyName);
        authRequestContext.setKeystorePassword(keystorePassword);
        authRequestContext.setKeyPassword(keyPassword);
        if (appId != null && appId.length() > 0) {
            authRequestContext.setProviderName(appId);
        }

        authRequestBuilder.init(authRequestContext);
    }
View Full Code Here

        InputStream keystoreIs = keystore.getInputStream();
        byte[] keystoreData = IOUtils.toByteArray(keystoreIs);
        IOUtils.closeQuietly(keystoreIs);

        AuthRequestContext authRequestContext = new AuthRequestContext();
        authRequestContext.setKeystore(keystoreData);
        authRequestContext.setKeyName(keyName);
        authRequestContext.setKeystorePassword(keystorePassword);
        authRequestContext.setKeyPassword(keyPassword);
        if (appId != null && appId.length() > 0) {
            authRequestContext.setProviderName(appId);
        }

        authRequestBuilder.init(authRequestContext);
    }
View Full Code Here

    @Override
    public void afterPropertiesSet() throws Exception {
        Assert.notNull(cloudsealManager, "cloudsealManager must be set");
        if (responseValidator == null) {
            responseValidator = new AuthResponseValidator();
        }
    }
View Full Code Here

    @Override
    public void afterPropertiesSet() throws Exception {
        Assert.notNull(cloudsealManager, "cloudsealManager must be set");
        if (responseValidator == null) {
            responseValidator = new AuthResponseValidatorImpl();
        }
    }
View Full Code Here

        classUnderTest = new CloudsealAuthenticationProvider();
    }

    @Test
    public void testSuccessfulAuthentication() throws VerificationException {
        CloudsealPrincipal cloudsealPrincipal = new CloudsealPrincipal();
        cloudsealPrincipal.setUsername("jdoe");
        CloudsealAssertionAuthenticationToken token = new CloudsealAssertionAuthenticationToken("http://localhost:8080/saml/sp", "123", "SAMLResponse");
        when(cloudsealManager.getPublicKey()).thenReturn(publicKey);
        when(authResponseValidator.validateAuthResponse(any(PublicKey.class), anyString(), anyString(), anyString())).thenReturn(cloudsealPrincipal);
        classUnderTest.setCloudsealManager(cloudsealManager);
        classUnderTest.setResponseValidator(authResponseValidator);
View Full Code Here

        assertTrue(authToken.isAuthenticated());
    }

    @Test
    public void testSuccessfulAuthenticationWithRoles() throws VerificationException {
        CloudsealPrincipal cloudsealPrincipal = new CloudsealPrincipal();
        cloudsealPrincipal.getRoles().add("ROLE_USER");
        cloudsealPrincipal.getRoles().add("ROLE_ADMIN");

        CloudsealAssertionAuthenticationToken token = new CloudsealAssertionAuthenticationToken("http://localhost:8080/saml/sp", "123", "SAMLResponse");
        when(cloudsealManager.getPublicKey()).thenReturn(publicKey);
        when(authResponseValidator.validateAuthResponse(any(PublicKey.class), anyString(), anyString(), anyString())).thenReturn(cloudsealPrincipal);
        classUnderTest.setCloudsealManager(cloudsealManager);
View Full Code Here

    @Override
    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
        CloudsealAssertionAuthenticationToken token = (CloudsealAssertionAuthenticationToken) authentication;
        CloudsealAssertionAuthenticationToken.TokenDetails tokenDetails = (CloudsealAssertionAuthenticationToken.TokenDetails) token.getDetails();
        try {
            CloudsealPrincipal cloudsealPrincipal = responseValidator.validateResponse(cloudsealManager.getPublicKey(),
                    tokenDetails.getSamlResponse(), tokenDetails.getRequestId(), tokenDetails.getAudience());

            Collection<? extends GrantedAuthority> authorities = mapAuthorities(cloudsealPrincipal);
            CloudsealUserDetails userDetails = new CloudsealUserDetails(cloudsealPrincipal, authorities);
            CloudsealAuthenticationToken authenticationToken = new CloudsealAuthenticationToken(userDetails);
View Full Code Here

    @Override
    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
        CloudsealAssertionAuthenticationToken token = (CloudsealAssertionAuthenticationToken) authentication;
        CloudsealAssertionAuthenticationToken.TokenDetails tokenDetails = (CloudsealAssertionAuthenticationToken.TokenDetails) token.getDetails();
        try {
            CloudsealPrincipal cloudsealPrincipal = responseValidator.validateAuthResponse(cloudsealManager.getPublicKey(),
                    tokenDetails.getSamlResponse(), tokenDetails.getRequestId(), tokenDetails.getAudience());

            Collection<? extends GrantedAuthority> authorities = mapAuthorities(cloudsealPrincipal);
            CloudsealUserDetails userDetails = new CloudsealUserDetails(cloudsealPrincipal, authorities);
            CloudsealAuthenticationToken authenticationToken = new CloudsealAuthenticationToken(userDetails);
View Full Code Here

TOP

Related Classes of com.cloudseal.client.saml2.AuthResponseValidatorImpl

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.