use of com.evolveum.midpoint.authentication.impl.factory.module.HttpClusterModuleFactory in project midpoint by Evolveum.
the class AuthSequenceUtil method getSpecificModuleFilter.
private static List<AuthModule> getSpecificModuleFilter(AuthModuleRegistryImpl authRegistry, String urlSuffix, HttpServletRequest httpRequest, Map<Class<?>, Object> sharedObjects, AuthenticationModulesType authenticationModulesType, CredentialsPolicyType credentialPolicy) {
String localePath = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length());
String channel = searchChannelByPath(localePath);
if (LOCAL_PATH_AND_CHANNEL.get("ws").equals(channel)) {
String header = httpRequest.getHeader("Authorization");
if (header != null) {
String type = header.split(" ")[0];
if (AuthenticationModuleNameConstants.CLUSTER.equalsIgnoreCase(type)) {
List<AuthModule> authModules = new ArrayList<>();
HttpClusterModuleFactory factory = authRegistry.findModelFactoryByClass(HttpClusterModuleFactory.class);
AbstractAuthenticationModuleType module = new AbstractAuthenticationModuleType() {
};
module.setName(AuthenticationModuleNameConstants.CLUSTER.toLowerCase() + "-module");
try {
authModules.add(factory.createModuleFilter(module, urlSuffix, httpRequest, sharedObjects, authenticationModulesType, credentialPolicy, null));
} catch (Exception e) {
LOGGER.error("Couldn't create module for cluster authentication");
return null;
}
return authModules;
}
}
}
return null;
}
Aggregations