Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KEYCLOAK-886 User Federation Mappers - admin console
- Loading branch information
Showing
24 changed files
with
990 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...c/main/java/org/keycloak/federation/ldap/mappers/AbstractLDAPFederationMapperFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,25 +1,65 @@ | |||
package org.keycloak.federation.ldap.mappers; | package org.keycloak.federation.ldap.mappers; | ||
|
|
||
import java.util.List; | |||
import java.util.Map; | |||
|
|||
import org.keycloak.Config; | import org.keycloak.Config; | ||
import org.keycloak.federation.ldap.LDAPFederationProviderFactory; | |||
import org.keycloak.mappers.MapperConfigValidationException; | |||
import org.keycloak.mappers.UserFederationMapperFactory; | import org.keycloak.mappers.UserFederationMapperFactory; | ||
import org.keycloak.models.KeycloakSessionFactory; | import org.keycloak.models.KeycloakSessionFactory; | ||
import org.keycloak.models.UserFederationMapperModel; | |||
import org.keycloak.provider.ProviderConfigProperty; | |||
|
|
||
/** | /** | ||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> | * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> | ||
*/ | */ | ||
public abstract class AbstractLDAPFederationMapperFactory implements UserFederationMapperFactory { | public abstract class AbstractLDAPFederationMapperFactory implements UserFederationMapperFactory { | ||
|
|
||
// Used to map attributes from LDAP to UserModel attributes | |||
public static final String ATTRIBUTE_MAPPER_CATEGORY = "Attribute Mapper"; | |||
|
|||
// Used to map roles from LDAP to UserModel users | |||
public static final String ROLE_MAPPER_CATEGORY = "Role Mapper"; | |||
|
|||
@Override | @Override | ||
public void init(Config.Scope config) { | public void init(Config.Scope config) { | ||
} | } | ||
|
|
||
@Override | |||
public String getFederationProviderType() { | |||
return LDAPFederationProviderFactory.PROVIDER_NAME; | |||
} | |||
|
|||
@Override | @Override | ||
public void postInit(KeycloakSessionFactory factory) { | public void postInit(KeycloakSessionFactory factory) { | ||
} | } | ||
|
|
||
@Override | |||
public List<ProviderConfigProperty> getConfigProperties() { | |||
throw new IllegalStateException("Method not supported for this implementation"); | |||
} | |||
|
|||
@Override | @Override | ||
public void close() { | public void close() { | ||
} | } | ||
|
|
||
public static ProviderConfigProperty createConfigProperty(String name, String label, String helpText, String type, Object defaultValue) { | |||
ProviderConfigProperty configProperty = new ProviderConfigProperty(); | |||
configProperty.setName(name); | |||
configProperty.setLabel(label); | |||
configProperty.setHelpText(helpText); | |||
configProperty.setType(type); | |||
configProperty.setDefaultValue(defaultValue); | |||
return configProperty; | |||
} | |||
|
|||
protected void checkMandatoryConfigAttribute(String name, String displayName, UserFederationMapperModel mapperModel) throws MapperConfigValidationException { | |||
String attrConfigValue = mapperModel.getConfig().get(name); | |||
if (attrConfigValue == null || attrConfigValue.trim().isEmpty()) { | |||
throw new MapperConfigValidationException("Missing configuration for '" + displayName + "'"); | |||
} | |||
} | |||
|
|||
|
|
||
} | } |
42 changes: 37 additions & 5 deletions
42
...c/main/java/org/keycloak/federation/ldap/mappers/FullNameLDAPFederationMapperFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 88 additions & 5 deletions
93
...p/src/main/java/org/keycloak/federation/ldap/mappers/RoleLDAPFederationMapperFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.