Search in sources :

Example 1 with Saml2AuthenticationRequestFactory

use of org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationRequestFactory in project midpoint by Evolveum.

the class MidpointSaml2LoginConfigurer method configure.

public void configure(B http) throws Exception {
    Saml2AuthenticationRequestFactory authenticationRequestResolver = new OpenSaml4AuthenticationRequestFactory();
    Saml2AuthenticationRequestContextResolver contextResolver = new DefaultSaml2AuthenticationRequestContextResolver((RelyingPartyRegistrationResolver) new DefaultRelyingPartyRegistrationResolver(MidpointSaml2LoginConfigurer.this.relyingPartyRegistrationRepository));
    http.addFilter(new MidpointSaml2WebSsoAuthenticationRequestFilter(contextResolver, authenticationRequestResolver));
    super.configure(http);
    if (this.authenticationManager != null) {
        this.saml2WebSsoAuthenticationFilter.setAuthenticationManager(this.authenticationManager);
    }
}
Also used : OpenSaml4AuthenticationRequestFactory(org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationRequestFactory) Saml2AuthenticationRequestFactory(org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationRequestFactory)

Example 2 with Saml2AuthenticationRequestFactory

use of org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationRequestFactory in project spring-security by spring-projects.

the class Saml2WebSsoAuthenticationRequestFilterTests method doFilterWhenSetAuthenticationRequestFactoryThenUses.

@Test
public void doFilterWhenSetAuthenticationRequestFactoryThenUses() throws Exception {
    Saml2AuthenticationRequestContext context = authenticationRequestContext().build();
    Saml2RedirectAuthenticationRequest authenticationRequest = redirectAuthenticationRequest(context).build();
    Saml2AuthenticationRequestFactory factory = mock(Saml2AuthenticationRequestFactory.class);
    given(this.resolver.resolve(any())).willReturn(context);
    given(factory.createRedirectAuthenticationRequest(any())).willReturn(authenticationRequest);
    this.filter.setAuthenticationRequestFactory(factory);
    this.filter.doFilterInternal(this.request, this.response, this.filterChain);
    verify(factory).createRedirectAuthenticationRequest(any());
}
Also used : Saml2RedirectAuthenticationRequest(org.springframework.security.saml2.provider.service.authentication.Saml2RedirectAuthenticationRequest) Saml2AuthenticationRequestContext(org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationRequestContext) Saml2AuthenticationRequestFactory(org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationRequestFactory) Test(org.junit.jupiter.api.Test)

Aggregations

Saml2AuthenticationRequestFactory (org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationRequestFactory)2 Test (org.junit.jupiter.api.Test)1 OpenSaml4AuthenticationRequestFactory (org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationRequestFactory)1 Saml2AuthenticationRequestContext (org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationRequestContext)1 Saml2RedirectAuthenticationRequest (org.springframework.security.saml2.provider.service.authentication.Saml2RedirectAuthenticationRequest)1