Search in sources :

Example 1 with MidpointExceptionHandlingConfigurer

use of com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer in project midpoint by Evolveum.

the class MailNonceFormModuleWebSecurityConfigurer method configure.

@Override
protected void configure(HttpSecurity http) throws Exception {
    super.configure(http);
    http.antMatcher(AuthUtil.stripEndingSlashes(getPrefix()) + "/**");
    getOrApply(http, new MidpointFormLoginConfigurer<>(new MailNonceAuthenticationFilter())).loginPage(getConfiguration().getSpecificLoginUrl() == null ? "/emailNonce" : getConfiguration().getSpecificLoginUrl()).failureHandler(new MidpointAuthenticationFailureHandler()).successHandler(getObjectPostProcessor().postProcess(new MidPointAuthenticationSuccessHandler())).permitAll();
    getOrApply(http, new MidpointExceptionHandlingConfigurer<>()).authenticationEntryPoint(new WicketLoginUrlAuthenticationEntryPoint(getConfiguration().getSpecificLoginUrl() == null ? "/emailNonce" : getConfiguration().getSpecificLoginUrl()));
    http.logout().clearAuthentication(true).logoutRequestMatcher(getLogoutMatcher(http, getPrefix() + "/logout")).invalidateHttpSession(true).deleteCookies("JSESSIONID").logoutSuccessHandler(createLogoutHandler());
}
Also used : MidPointAuthenticationSuccessHandler(com.evolveum.midpoint.authentication.impl.handler.MidPointAuthenticationSuccessHandler) MidpointAuthenticationFailureHandler(com.evolveum.midpoint.authentication.impl.handler.MidpointAuthenticationFailureHandler) WicketLoginUrlAuthenticationEntryPoint(com.evolveum.midpoint.authentication.impl.entry.point.WicketLoginUrlAuthenticationEntryPoint) MailNonceAuthenticationFilter(com.evolveum.midpoint.authentication.impl.filter.MailNonceAuthenticationFilter) MidpointExceptionHandlingConfigurer(com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer)

Example 2 with MidpointExceptionHandlingConfigurer

use of com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer in project midpoint by Evolveum.

the class RemoteModuleWebSecurityConfigurer method configure.

@Override
protected void configure(HttpSecurity http) throws Exception {
    super.configure(http);
    http.antMatcher(AuthUtil.stripEndingSlashes(getPrefix()) + "/**");
    http.csrf().disable();
    MidpointExceptionHandlingConfigurer exceptionConfigurer = new MidpointExceptionHandlingConfigurer() {

        @Override
        protected Authentication createNewAuthentication(AnonymousAuthenticationToken anonymousAuthenticationToken) {
            if (anonymousAuthenticationToken.getDetails() != null && getAuthTokenClass().isAssignableFrom(anonymousAuthenticationToken.getDetails().getClass())) {
                return (Authentication) anonymousAuthenticationToken.getDetails();
            }
            return null;
        }
    };
    getOrApply(http, exceptionConfigurer).authenticationEntryPoint(new RemoteAuthenticationEntryPoint(getAuthEntryPointUrl()));
    http.logout().clearAuthentication(true).logoutRequestMatcher(new AntPathRequestMatcher(getPrefix() + "/logout")).invalidateHttpSession(true).deleteCookies("JSESSIONID").logoutSuccessHandler(getLogoutRequestSuccessHandler());
}
Also used : ModuleAuthentication(com.evolveum.midpoint.authentication.api.config.ModuleAuthentication) MidpointAuthentication(com.evolveum.midpoint.authentication.api.config.MidpointAuthentication) Authentication(org.springframework.security.core.Authentication) AntPathRequestMatcher(org.springframework.security.web.util.matcher.AntPathRequestMatcher) AnonymousAuthenticationToken(org.springframework.security.authentication.AnonymousAuthenticationToken) MidpointExceptionHandlingConfigurer(com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer) RemoteAuthenticationEntryPoint(com.evolveum.midpoint.authentication.impl.entry.point.RemoteAuthenticationEntryPoint)

Example 3 with MidpointExceptionHandlingConfigurer

use of com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer in project midpoint by Evolveum.

the class HttpHeaderModuleWebSecurityConfigurer method configure.

@Override
protected void configure(HttpSecurity http) throws Exception {
    super.configure(http);
    getOrApply(http, getMidpointFormLoginConfigurer()).loginPage("/error/401");
    getOrApply(http, new MidpointExceptionHandlingConfigurer<>()).authenticationEntryPoint(new WicketLoginUrlAuthenticationEntryPoint("/error/401"));
    http.addFilterBefore(requestHeaderAuthenticationFilter(), LogoutFilter.class);
    http.logout().logoutSuccessHandler(createLogoutHandler(getConfiguration().getDefaultSuccessLogoutURL()));
}
Also used : WicketLoginUrlAuthenticationEntryPoint(com.evolveum.midpoint.authentication.impl.entry.point.WicketLoginUrlAuthenticationEntryPoint) MidpointExceptionHandlingConfigurer(com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer)

Example 4 with MidpointExceptionHandlingConfigurer

use of com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer in project midpoint by Evolveum.

the class LoginFormModuleWebSecurityConfigurer method configure.

@Override
protected void configure(HttpSecurity http) throws Exception {
    super.configure(http);
    http.antMatcher(AuthUtil.stripEndingSlashes(getPrefix()) + "/**");
    getOrApply(http, getMidpointFormLoginConfigurer()).loginPage("/login").loginProcessingUrl(AuthUtil.stripEndingSlashes(getPrefix()) + "/spring_security_login").failureHandler(new MidpointAuthenticationFailureHandler()).successHandler(getObjectPostProcessor().postProcess(new MidPointAuthenticationSuccessHandler())).permitAll();
    getOrApply(http, new MidpointExceptionHandlingConfigurer<>()).authenticationEntryPoint(new WicketLoginUrlAuthenticationEntryPoint("/login"));
    http.logout().clearAuthentication(true).logoutRequestMatcher(getLogoutMatcher(http, getPrefix() + "/logout")).invalidateHttpSession(true).deleteCookies("JSESSIONID").logoutSuccessHandler(createLogoutHandler());
    if (Arrays.stream(environment.getActiveProfiles()).anyMatch(p -> p.equalsIgnoreCase("cas"))) {
        http.addFilterAt(casFilter, CasAuthenticationFilter.class);
        http.addFilterBefore(requestSingleLogoutFilter, LogoutFilter.class);
    }
    if (Arrays.stream(environment.getActiveProfiles()).anyMatch(p -> p.equalsIgnoreCase("ssoenv"))) {
        http.addFilterBefore(requestAttributeAuthenticationFilter, LogoutFilter.class);
    }
}
Also used : MidPointAuthenticationSuccessHandler(com.evolveum.midpoint.authentication.impl.handler.MidPointAuthenticationSuccessHandler) MidpointAuthenticationFailureHandler(com.evolveum.midpoint.authentication.impl.handler.MidpointAuthenticationFailureHandler) WicketLoginUrlAuthenticationEntryPoint(com.evolveum.midpoint.authentication.impl.entry.point.WicketLoginUrlAuthenticationEntryPoint) MidpointExceptionHandlingConfigurer(com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer)

Example 5 with MidpointExceptionHandlingConfigurer

use of com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer in project midpoint by Evolveum.

the class SecurityQuestionsFormModuleWebSecurityConfigurer method configure.

@Override
protected void configure(HttpSecurity http) throws Exception {
    super.configure(http);
    http.antMatcher(AuthUtil.stripEndingSlashes(getPrefix()) + "/**");
    getOrApply(http, new MidpointFormLoginConfigurer<>(new SecurityQuestionsAuthenticationFilter())).loginPage("/securityquestions").loginProcessingUrl(AuthUtil.stripEndingSlashes(getPrefix()) + "/spring_security_login").failureHandler(new MidpointAuthenticationFailureHandler()).successHandler(getObjectPostProcessor().postProcess(new MidPointAuthenticationSuccessHandler())).permitAll();
    getOrApply(http, new MidpointExceptionHandlingConfigurer<>()).authenticationEntryPoint(new WicketLoginUrlAuthenticationEntryPoint("/securityquestions"));
    http.logout().clearAuthentication(true).logoutRequestMatcher(getLogoutMatcher(http, getPrefix() + "/logout")).invalidateHttpSession(true).deleteCookies("JSESSIONID").logoutSuccessHandler(createLogoutHandler());
}
Also used : MidPointAuthenticationSuccessHandler(com.evolveum.midpoint.authentication.impl.handler.MidPointAuthenticationSuccessHandler) MidpointFormLoginConfigurer(com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointFormLoginConfigurer) MidpointAuthenticationFailureHandler(com.evolveum.midpoint.authentication.impl.handler.MidpointAuthenticationFailureHandler) SecurityQuestionsAuthenticationFilter(com.evolveum.midpoint.authentication.impl.filter.SecurityQuestionsAuthenticationFilter) WicketLoginUrlAuthenticationEntryPoint(com.evolveum.midpoint.authentication.impl.entry.point.WicketLoginUrlAuthenticationEntryPoint) MidpointExceptionHandlingConfigurer(com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer)

Aggregations

MidpointExceptionHandlingConfigurer (com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer)5 WicketLoginUrlAuthenticationEntryPoint (com.evolveum.midpoint.authentication.impl.entry.point.WicketLoginUrlAuthenticationEntryPoint)4 MidPointAuthenticationSuccessHandler (com.evolveum.midpoint.authentication.impl.handler.MidPointAuthenticationSuccessHandler)3 MidpointAuthenticationFailureHandler (com.evolveum.midpoint.authentication.impl.handler.MidpointAuthenticationFailureHandler)3 MidpointAuthentication (com.evolveum.midpoint.authentication.api.config.MidpointAuthentication)1 ModuleAuthentication (com.evolveum.midpoint.authentication.api.config.ModuleAuthentication)1 RemoteAuthenticationEntryPoint (com.evolveum.midpoint.authentication.impl.entry.point.RemoteAuthenticationEntryPoint)1 MailNonceAuthenticationFilter (com.evolveum.midpoint.authentication.impl.filter.MailNonceAuthenticationFilter)1 SecurityQuestionsAuthenticationFilter (com.evolveum.midpoint.authentication.impl.filter.SecurityQuestionsAuthenticationFilter)1 MidpointFormLoginConfigurer (com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointFormLoginConfigurer)1 AnonymousAuthenticationToken (org.springframework.security.authentication.AnonymousAuthenticationToken)1 Authentication (org.springframework.security.core.Authentication)1 AntPathRequestMatcher (org.springframework.security.web.util.matcher.AntPathRequestMatcher)1