use of com.evolveum.midpoint.authentication.impl.module.authentication.LdapModuleAuthentication in project midpoint by Evolveum.
the class MidPointLdapAuthenticationProvider method doAuthentication.
protected DirContextOperations doAuthentication(DirContextOperations originalDirContextOperations) {
if (originalDirContextOperations instanceof DirContextAdapter) {
Authentication actualAuthentication = SecurityContextHolder.getContext().getAuthentication();
if (actualAuthentication instanceof MidpointAuthentication) {
MidpointAuthentication mpAuthentication = (MidpointAuthentication) actualAuthentication;
ModuleAuthenticationImpl moduleAuthentication = (ModuleAuthenticationImpl) getProcessingModule(mpAuthentication);
if (moduleAuthentication instanceof LdapModuleAuthentication) {
// HACK because of NP in DirContextAdapter(DirContextAdapter master)
if (!originalDirContextOperations.isUpdateMode()) {
((DirContextAdapter) originalDirContextOperations).setUpdateMode(true);
((DirContextAdapter) originalDirContextOperations).setUpdateMode(false);
}
LdapDirContextAdapter mpDirContextAdapter = new LdapDirContextAdapter((DirContextAdapter) originalDirContextOperations);
mpDirContextAdapter.setNamingAttr(((LdapModuleAuthentication) moduleAuthentication).getNamingAttribute());
if (moduleAuthentication.getFocusType() != null) {
Class<FocusType> focusType = PrismContext.get().getSchemaRegistry().determineCompileTimeClass(moduleAuthentication.getFocusType());
mpDirContextAdapter.setFocusType(focusType);
}
return mpDirContextAdapter;
}
}
}
return originalDirContextOperations;
}
use of com.evolveum.midpoint.authentication.impl.module.authentication.LdapModuleAuthentication in project midpoint by Evolveum.
the class LdapModuleFactory method createEmptyModuleAuthentication.
protected ModuleAuthenticationImpl createEmptyModuleAuthentication(LdapAuthenticationModuleType moduleType, ModuleWebSecurityConfiguration configuration) {
LdapModuleAuthentication moduleAuthentication = new LdapModuleAuthentication();
moduleAuthentication.setPrefix(configuration.getPrefixOfModule());
if (moduleType.getSearch() != null) {
moduleAuthentication.setNamingAttribute(moduleType.getSearch().getNamingAttr());
}
moduleAuthentication.setNameOfModule(configuration.getNameOfModule());
return moduleAuthentication;
}
Aggregations