Search in sources :

Example 1 with RelyingPartyRegistrations

use of org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrations in project midpoint by Evolveum.

the class SamlModuleWebSecurityConfigurer method configure.

@Override
protected void configure(HttpSecurity http) throws Exception {
    super.configure(http);
    MidpointSaml2LoginConfigurer configurer = new MidpointSaml2LoginConfigurer<>(auditProvider);
    configurer.relyingPartyRegistrationRepository(relyingPartyRegistrations()).loginProcessingUrl(getConfiguration().getPrefixOfModule() + SamlModuleWebSecurityConfiguration.SSO_LOCATION_URL_SUFFIX).successHandler(getObjectPostProcessor().postProcess(new MidPointAuthenticationSuccessHandler())).failureHandler(new MidpointAuthenticationFailureHandler());
    try {
        configurer.authenticationManager(new ProviderManager(Collections.emptyList(), authenticationManager()));
    } catch (Exception e) {
        LOGGER.error("Couldn't initialize authentication manager for saml2 module");
    }
    getOrApply(http, configurer);
    Saml2MetadataFilter filter = new Saml2MetadataFilter(new MidpointMetadataRelyingPartyRegistrationResolver(relyingPartyRegistrations()), new OpenSamlMetadataResolver());
    filter.setRequestMatcher(new AntPathRequestMatcher(getConfiguration().getPrefixOfModule() + "/metadata/*"));
    http.addFilterAfter(filter, Saml2WebSsoAuthenticationFilter.class);
}
Also used : MidPointAuthenticationSuccessHandler(com.evolveum.midpoint.authentication.impl.handler.MidPointAuthenticationSuccessHandler) MidpointAuthenticationFailureHandler(com.evolveum.midpoint.authentication.impl.handler.MidpointAuthenticationFailureHandler) Saml2MetadataFilter(org.springframework.security.saml2.provider.service.web.Saml2MetadataFilter) ProviderManager(org.springframework.security.authentication.ProviderManager) AntPathRequestMatcher(org.springframework.security.web.util.matcher.AntPathRequestMatcher) MidpointSaml2LoginConfigurer(com.evolveum.midpoint.authentication.impl.saml.MidpointSaml2LoginConfigurer) MidpointMetadataRelyingPartyRegistrationResolver(com.evolveum.midpoint.authentication.impl.saml.MidpointMetadataRelyingPartyRegistrationResolver) OpenSamlMetadataResolver(org.springframework.security.saml2.provider.service.metadata.OpenSamlMetadataResolver)

Example 2 with RelyingPartyRegistrations

use of org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrations in project midpoint by Evolveum.

the class SamlModuleWebSecurityConfigurer method getLogoutRequestSuccessHandler.

@Override
protected LogoutSuccessHandler getLogoutRequestSuccessHandler() {
    RelyingPartyRegistrationResolver registrationResolver = new DefaultRelyingPartyRegistrationResolver(relyingPartyRegistrations());
    Saml2LogoutRequestResolver logoutRequestResolver = new MidpointSaml2LogoutRequestResolver(new OpenSaml4LogoutRequestResolver(registrationResolver));
    Saml2RelyingPartyInitiatedLogoutSuccessHandler handler = new Saml2RelyingPartyInitiatedLogoutSuccessHandler(logoutRequestResolver);
    return getObjectPostProcessor().postProcess(new MidpointSaml2LogoutRequestSuccessHandler(handler));
}
Also used : MidpointSaml2LogoutRequestResolver(com.evolveum.midpoint.authentication.impl.saml.MidpointSaml2LogoutRequestResolver) Saml2LogoutRequestResolver(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver) MidpointSaml2LogoutRequestResolver(com.evolveum.midpoint.authentication.impl.saml.MidpointSaml2LogoutRequestResolver) MidpointMetadataRelyingPartyRegistrationResolver(com.evolveum.midpoint.authentication.impl.saml.MidpointMetadataRelyingPartyRegistrationResolver) DefaultRelyingPartyRegistrationResolver(org.springframework.security.saml2.provider.service.web.DefaultRelyingPartyRegistrationResolver) RelyingPartyRegistrationResolver(org.springframework.security.saml2.provider.service.web.RelyingPartyRegistrationResolver) DefaultRelyingPartyRegistrationResolver(org.springframework.security.saml2.provider.service.web.DefaultRelyingPartyRegistrationResolver) OpenSaml4LogoutRequestResolver(org.springframework.security.saml2.provider.service.web.authentication.logout.OpenSaml4LogoutRequestResolver) MidpointSaml2LogoutRequestSuccessHandler(com.evolveum.midpoint.authentication.impl.saml.MidpointSaml2LogoutRequestSuccessHandler) Saml2RelyingPartyInitiatedLogoutSuccessHandler(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2RelyingPartyInitiatedLogoutSuccessHandler)

Aggregations

MidpointMetadataRelyingPartyRegistrationResolver (com.evolveum.midpoint.authentication.impl.saml.MidpointMetadataRelyingPartyRegistrationResolver)2 MidPointAuthenticationSuccessHandler (com.evolveum.midpoint.authentication.impl.handler.MidPointAuthenticationSuccessHandler)1 MidpointAuthenticationFailureHandler (com.evolveum.midpoint.authentication.impl.handler.MidpointAuthenticationFailureHandler)1 MidpointSaml2LoginConfigurer (com.evolveum.midpoint.authentication.impl.saml.MidpointSaml2LoginConfigurer)1 MidpointSaml2LogoutRequestResolver (com.evolveum.midpoint.authentication.impl.saml.MidpointSaml2LogoutRequestResolver)1 MidpointSaml2LogoutRequestSuccessHandler (com.evolveum.midpoint.authentication.impl.saml.MidpointSaml2LogoutRequestSuccessHandler)1 ProviderManager (org.springframework.security.authentication.ProviderManager)1 OpenSamlMetadataResolver (org.springframework.security.saml2.provider.service.metadata.OpenSamlMetadataResolver)1 DefaultRelyingPartyRegistrationResolver (org.springframework.security.saml2.provider.service.web.DefaultRelyingPartyRegistrationResolver)1 RelyingPartyRegistrationResolver (org.springframework.security.saml2.provider.service.web.RelyingPartyRegistrationResolver)1 Saml2MetadataFilter (org.springframework.security.saml2.provider.service.web.Saml2MetadataFilter)1 OpenSaml4LogoutRequestResolver (org.springframework.security.saml2.provider.service.web.authentication.logout.OpenSaml4LogoutRequestResolver)1 Saml2LogoutRequestResolver (org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver)1 Saml2RelyingPartyInitiatedLogoutSuccessHandler (org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2RelyingPartyInitiatedLogoutSuccessHandler)1 AntPathRequestMatcher (org.springframework.security.web.util.matcher.AntPathRequestMatcher)1