Search in sources :

Example 31 with ModuleAuthentication

use of com.evolveum.midpoint.authentication.api.config.ModuleAuthentication in project midpoint by Evolveum.

the class MidPointAbstractAuthenticationProvider method initAuthRequirements.

private Authentication initAuthRequirements(Authentication processingAuthentication, Authentication originalAuthentication, Authentication actualAuthentication, AuthenticationRequirements authRequirements) {
    if (originalAuthentication instanceof MidpointAuthentication) {
        MidpointAuthentication mpAuthentication = (MidpointAuthentication) originalAuthentication;
        ModuleAuthentication moduleAuthentication = getProcessingModule(mpAuthentication);
        if (moduleAuthentication.getFocusType() != null) {
            authRequirements.focusType = PrismContext.get().getSchemaRegistry().determineCompileTimeClass(moduleAuthentication.getFocusType());
        }
        authRequirements.requireAssignment = mpAuthentication.getSequence().getRequireAssignmentTarget();
        authRequirements.channel = mpAuthentication.getAuthenticationChannel();
        return moduleAuthentication.getAuthentication();
    } else if (actualAuthentication instanceof MidpointAuthentication) {
        MidpointAuthentication mpAuthentication = (MidpointAuthentication) actualAuthentication;
        ModuleAuthentication moduleAuthentication = getProcessingModule(mpAuthentication);
        if (moduleAuthentication != null && moduleAuthentication.getFocusType() != null) {
            authRequirements.focusType = PrismContext.get().getSchemaRegistry().determineCompileTimeClass(moduleAuthentication.getFocusType());
        }
        authRequirements.requireAssignment = mpAuthentication.getSequence().getRequireAssignmentTarget();
        authRequirements.channel = mpAuthentication.getAuthenticationChannel();
    }
    return processingAuthentication;
}
Also used : ModuleAuthentication(com.evolveum.midpoint.authentication.api.config.ModuleAuthentication) MidpointAuthentication(com.evolveum.midpoint.authentication.api.config.MidpointAuthentication)

Example 32 with ModuleAuthentication

use of com.evolveum.midpoint.authentication.api.config.ModuleAuthentication in project midpoint by Evolveum.

the class MidPointAbstractAuthenticationProvider method supports.

public boolean supports(Class<?> authenticationClass, Authentication authentication) {
    if (!(authentication instanceof MidpointAuthentication)) {
        return supports(authenticationClass);
    }
    MidpointAuthentication mpAuthentication = (MidpointAuthentication) authentication;
    ModuleAuthentication moduleAuthentication = getProcessingModule(mpAuthentication);
    if (moduleAuthentication == null || moduleAuthentication.getAuthentication() == null) {
        return false;
    }
    if (moduleAuthentication.getAuthentication() instanceof AnonymousAuthenticationToken) {
        // hack for specific situation when user is anonymous, but accessDecisionManager resolve it
        return true;
    }
    return supports(moduleAuthentication.getAuthentication().getClass());
}
Also used : ModuleAuthentication(com.evolveum.midpoint.authentication.api.config.ModuleAuthentication) AnonymousAuthenticationToken(org.springframework.security.authentication.AnonymousAuthenticationToken) MidpointAuthentication(com.evolveum.midpoint.authentication.api.config.MidpointAuthentication)

Aggregations

ModuleAuthentication (com.evolveum.midpoint.authentication.api.config.ModuleAuthentication)32 MidpointAuthentication (com.evolveum.midpoint.authentication.api.config.MidpointAuthentication)29 Authentication (org.springframework.security.core.Authentication)21 HttpModuleAuthentication (com.evolveum.midpoint.authentication.impl.module.authentication.HttpModuleAuthentication)6 RemoteModuleAuthentication (com.evolveum.midpoint.authentication.api.config.RemoteModuleAuthentication)5 AnonymousAuthenticationToken (org.springframework.security.authentication.AnonymousAuthenticationToken)4 IdentityProvider (com.evolveum.midpoint.authentication.api.IdentityProvider)3 CredentialModuleAuthentication (com.evolveum.midpoint.authentication.api.config.CredentialModuleAuthentication)2 MailNonceModuleAuthenticationImpl (com.evolveum.midpoint.authentication.impl.module.authentication.MailNonceModuleAuthenticationImpl)2 ModuleAuthenticationImpl (com.evolveum.midpoint.authentication.impl.module.authentication.ModuleAuthenticationImpl)2 ArrayList (java.util.ArrayList)2 AuthenticationServiceException (org.springframework.security.authentication.AuthenticationServiceException)2 OAuth2LoginAuthenticationToken (org.springframework.security.oauth2.client.authentication.OAuth2LoginAuthenticationToken)2 Saml2AuthenticationToken (org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationToken)2 PreAuthenticatedAuthenticationToken (org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken)2 AuthenticationModuleState (com.evolveum.midpoint.authentication.api.AuthenticationModuleState)1 MidpointAnonymousAuthenticationFilter (com.evolveum.midpoint.authentication.impl.filter.MidpointAnonymousAuthenticationFilter)1 OidcClientModuleAuthenticationImpl (com.evolveum.midpoint.authentication.impl.module.authentication.OidcClientModuleAuthenticationImpl)1 RemoteModuleAuthenticationImpl (com.evolveum.midpoint.authentication.impl.module.authentication.RemoteModuleAuthenticationImpl)1 Saml2ModuleAuthenticationImpl (com.evolveum.midpoint.authentication.impl.module.authentication.Saml2ModuleAuthenticationImpl)1