use of com.evolveum.midpoint.authentication.impl.factory.module.AbstractModuleFactory in project midpoint by Evolveum.
the class AuthSequenceUtil method buildModuleFilters.
public static List<AuthModule> buildModuleFilters(AuthModuleRegistryImpl authRegistry, AuthenticationSequenceType sequence, HttpServletRequest request, AuthenticationModulesType authenticationModulesType, CredentialsPolicyType credentialPolicy, Map<Class<?>, Object> sharedObjects, AuthenticationChannel authenticationChannel) {
Validate.notNull(authRegistry, "Registry for module factories is null");
if (isSpecificSequence(request)) {
return getSpecificModuleFilter(authRegistry, sequence.getChannel().getUrlSuffix(), request, sharedObjects, authenticationModulesType, credentialPolicy);
}
Validate.notEmpty(sequence.getModule(), "Sequence " + sequence.getName() + " don't contains authentication modules");
List<AuthenticationSequenceModuleType> sequenceModules = SecurityPolicyUtil.getSortedModules(sequence);
List<AuthModule> authModules = new ArrayList<>();
sequenceModules.forEach(sequenceModule -> {
try {
AbstractAuthenticationModuleType module = getModuleByName(sequenceModule.getName(), authenticationModulesType);
AbstractModuleFactory moduleFactory = authRegistry.findModelFactory(module, authenticationChannel);
AuthModule authModule = moduleFactory.createModuleFilter(module, sequence.getChannel().getUrlSuffix(), request, sharedObjects, authenticationModulesType, credentialPolicy, authenticationChannel);
authModules.add(authModule);
} catch (Exception e) {
LOGGER.error("Couldn't build filter for module moduleFactory", e);
}
});
if (authModules.isEmpty()) {
return null;
}
return authModules;
}
Aggregations