Search in sources :

Example 1 with HttpHeaderAuthenticationModuleType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.HttpHeaderAuthenticationModuleType in project midpoint by Evolveum.

the class HttpHeaderModuleFactory method createModuleFilter.

@Override
public AuthModule createModuleFilter(AbstractAuthenticationModuleType moduleType, String sequenceSuffix, ServletRequest request, Map<Class<?>, Object> sharedObjects, AuthenticationModulesType authenticationsPolicy, CredentialsPolicyType credentialPolicy, AuthenticationChannel authenticationChannel) throws Exception {
    if (!(moduleType instanceof HttpHeaderAuthenticationModuleType)) {
        LOGGER.error("This factory support only HttpHeaderAuthenticationModuleType, but modelType is " + moduleType);
        return null;
    }
    isSupportedChannel(authenticationChannel);
    HttpHeaderAuthenticationModuleType httpModuleType = (HttpHeaderAuthenticationModuleType) moduleType;
    HttpHeaderModuleWebSecurityConfiguration configuration = HttpHeaderModuleWebSecurityConfiguration.build(httpModuleType, sequenceSuffix);
    configuration.addAuthenticationProvider(getObjectObjectPostProcessor().postProcess(new PasswordProvider()));
    HttpHeaderModuleWebSecurityConfigurer<HttpHeaderModuleWebSecurityConfiguration> module = getObjectObjectPostProcessor().postProcess(new HttpHeaderModuleWebSecurityConfigurer<>(configuration));
    HttpSecurity http = getNewHttpSecurity(module);
    setSharedObjects(http, sharedObjects);
    ModuleAuthenticationImpl moduleAuthentication = createEmptyModuleAuthentication(configuration);
    moduleAuthentication.setFocusType(httpModuleType.getFocusType());
    SecurityFilterChain filter = http.build();
    return AuthModuleImpl.build(filter, configuration, moduleAuthentication);
}
Also used : SecurityFilterChain(org.springframework.security.web.SecurityFilterChain) ModuleAuthenticationImpl(com.evolveum.midpoint.authentication.impl.module.authentication.ModuleAuthenticationImpl) HttpHeaderModuleWebSecurityConfiguration(com.evolveum.midpoint.authentication.impl.module.configuration.HttpHeaderModuleWebSecurityConfiguration) HttpSecurity(org.springframework.security.config.annotation.web.builders.HttpSecurity) HttpHeaderAuthenticationModuleType(com.evolveum.midpoint.xml.ns._public.common.common_3.HttpHeaderAuthenticationModuleType) PasswordProvider(com.evolveum.midpoint.authentication.impl.provider.PasswordProvider)

Aggregations

ModuleAuthenticationImpl (com.evolveum.midpoint.authentication.impl.module.authentication.ModuleAuthenticationImpl)1 HttpHeaderModuleWebSecurityConfiguration (com.evolveum.midpoint.authentication.impl.module.configuration.HttpHeaderModuleWebSecurityConfiguration)1 PasswordProvider (com.evolveum.midpoint.authentication.impl.provider.PasswordProvider)1 HttpHeaderAuthenticationModuleType (com.evolveum.midpoint.xml.ns._public.common.common_3.HttpHeaderAuthenticationModuleType)1 HttpSecurity (org.springframework.security.config.annotation.web.builders.HttpSecurity)1 SecurityFilterChain (org.springframework.security.web.SecurityFilterChain)1