Search in sources :

Example 1 with RemoteAuthenticationEntryPoint

use of com.evolveum.midpoint.authentication.impl.entry.point.RemoteAuthenticationEntryPoint 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)

Aggregations

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 MidpointExceptionHandlingConfigurer (com.evolveum.midpoint.authentication.impl.filter.configurers.MidpointExceptionHandlingConfigurer)1 AnonymousAuthenticationToken (org.springframework.security.authentication.AnonymousAuthenticationToken)1 Authentication (org.springframework.security.core.Authentication)1 AntPathRequestMatcher (org.springframework.security.web.util.matcher.AntPathRequestMatcher)1