80 String roleObjectClasses = LDAPConstants.GROUP_OF_NAMES;
81 String mode = LDAPGroupMapperMode.LDAP_ONLY.toString();
82 String membershipUserAttribute = LDAPConstants.UID;
83 boolean importEnabled =
true;
85 LDAPConfig config =
new LDAPConfig(parent.getConfig());
86 roleObjectClasses = config.isActiveDirectory() ? LDAPConstants.GROUP : LDAPConstants.GROUP_OF_NAMES;
87 mode = config.getEditMode() == UserStorageProvider.EditMode.WRITABLE ? LDAPGroupMapperMode.LDAP_ONLY.toString() : LDAPGroupMapperMode.READ_ONLY.toString();
88 membershipUserAttribute = config.getUsernameLdapAttribute();
89 importEnabled =
new UserStorageProviderModel(parent).isImportEnabled();
92 ProviderConfigurationBuilder config = ProviderConfigurationBuilder.create()
93 .property().name(GroupMapperConfig.GROUPS_DN)
94 .label(
"LDAP Groups DN")
95 .helpText(
"LDAP DN where are groups of this tree saved. For example 'ou=groups,dc=example,dc=org' ")
96 .type(ProviderConfigProperty.STRING_TYPE)
98 .property().name(GroupMapperConfig.GROUP_NAME_LDAP_ATTRIBUTE)
99 .label(
"Group Name LDAP Attribute")
100 .helpText(
"Name of LDAP attribute, which is used in group objects for name and RDN of group. Usually it will be 'cn' . In this case typical group/role object may have DN like 'cn=Group1,ou=groups,dc=example,dc=org' ")
101 .type(ProviderConfigProperty.STRING_TYPE)
102 .defaultValue(LDAPConstants.CN)
104 .property().name(GroupMapperConfig.GROUP_OBJECT_CLASSES)
105 .label(
"Group Object Classes")
106 .helpText(
"Object class (or classes) of the group object. It's divided by comma if more classes needed. In typical LDAP deployment it could be 'groupOfNames' . In Active Directory it's usually 'group' ")
107 .type(ProviderConfigProperty.STRING_TYPE)
108 .defaultValue(roleObjectClasses)
110 .property().name(GroupMapperConfig.PRESERVE_GROUP_INHERITANCE)
111 .label(
"Preserve Group Inheritance")
112 .helpText(
"Flag whether group inheritance from LDAP should be propagated to Keycloak. If false, then all LDAP groups will be mapped as flat top-level groups in Keycloak. Otherwise group inheritance is " +
113 "preserved into Keycloak, but the group sync might fail if LDAP structure contains recursions or multiple parent groups per child groups")
114 .type(ProviderConfigProperty.BOOLEAN_TYPE)
115 .defaultValue(
"true")
117 .property().name(GroupMapperConfig.IGNORE_MISSING_GROUPS)
118 .label(
"Ignore Missing Groups")
119 .helpText(
"Ignore missing groups in the group hierarchy")
120 .type(ProviderConfigProperty.BOOLEAN_TYPE)
121 .defaultValue(
"false")
123 .property().name(GroupMapperConfig.MEMBERSHIP_LDAP_ATTRIBUTE)
124 .label(
"Membership LDAP Attribute")
125 .helpText(
"Name of LDAP attribute on group, which is used for membership mappings. Usually it will be 'member' ." +
126 "However when 'Membership Attribute Type' is 'UID' then 'Membership LDAP Attribute' could be typically 'memberUid' .")
127 .type(ProviderConfigProperty.STRING_TYPE)
128 .defaultValue(LDAPConstants.MEMBER)
130 .property().name(GroupMapperConfig.MEMBERSHIP_ATTRIBUTE_TYPE)
131 .label(
"Membership Attribute Type")
132 .helpText(
"DN means that LDAP group has it's members declared in form of their full DN. For example 'member: uid=john,ou=users,dc=example,dc=com' . " +
133 "UID means that LDAP group has it's members declared in form of pure user uids. For example 'memberUid: john' .")
134 .type(ProviderConfigProperty.LIST_TYPE)
136 .defaultValue(MembershipType.DN.toString())
138 .property().name(RoleMapperConfig.MEMBERSHIP_USER_LDAP_ATTRIBUTE)
139 .label(
"Membership User LDAP Attribute")
140 .helpText(
"Used just if Membership Attribute Type is UID. It is name of LDAP attribute on user, which is used for membership mappings. Usually it will be 'uid' . For example if value of " +
141 "'Membership User LDAP Attribute' is 'uid' and " +
142 " LDAP group has 'memberUid: john', then it is expected that particular LDAP user will have attribute 'uid: john' .")
143 .type(ProviderConfigProperty.STRING_TYPE)
144 .defaultValue(membershipUserAttribute)
146 .property().name(GroupMapperConfig.GROUPS_LDAP_FILTER)
147 .label(
"LDAP Filter")
148 .helpText(
"LDAP Filter adds additional custom filter to the whole query for retrieve LDAP groups. Leave this empty if no additional filtering is needed and you want to retrieve all groups from LDAP. Otherwise make sure that filter starts with '(' and ends with ')'")
149 .type(ProviderConfigProperty.STRING_TYPE)
152 config.property().name(GroupMapperConfig.MODE)
154 .helpText(
"LDAP_ONLY means that all group mappings of users are retrieved from LDAP and saved into LDAP. READ_ONLY is Read-only LDAP mode where group mappings are " +
155 "retrieved from both LDAP and DB and merged together. New group joins are not saved to LDAP but to DB. IMPORT is Read-only LDAP mode where group mappings are " +
156 "retrieved from LDAP just at the time when user is imported from LDAP and then " +
157 "they are saved to local keycloak DB.")
158 .type(ProviderConfigProperty.LIST_TYPE)
163 config.property().name(GroupMapperConfig.MODE)
165 .helpText(
"LDAP_ONLY means that specified group mappings are writable to LDAP. " 166 +
"READ_ONLY means that group mappings are not writable to LDAP.")
167 .type(ProviderConfigProperty.LIST_TYPE)
173 config.property().name(GroupMapperConfig.USER_ROLES_RETRIEVE_STRATEGY)
174 .label(
"User Groups Retrieve Strategy")
175 .helpText(
"Specify how to retrieve groups of user. LOAD_GROUPS_BY_MEMBER_ATTRIBUTE means that roles of user will be retrieved by sending LDAP query to retrieve all groups where 'member' is our user. " +
176 "GET_GROUPS_FROM_USER_MEMBEROF_ATTRIBUTE means that groups of user will be retrieved from 'memberOf' attribute of our user. Or from the other attribute specified by 'Member-Of LDAP Attribute' . " +
177 "LOAD_GROUPS_BY_MEMBER_ATTRIBUTE_RECURSIVELY is applicable just in Active Directory and it means that groups of user will be retrieved recursively with usage of LDAP_MATCHING_RULE_IN_CHAIN Ldap extension.")
178 .type(ProviderConfigProperty.LIST_TYPE)
180 .defaultValue(GroupMapperConfig.LOAD_GROUPS_BY_MEMBER_ATTRIBUTE)
182 .property().name(GroupMapperConfig.MEMBEROF_LDAP_ATTRIBUTE)
183 .label(
"Member-Of LDAP Attribute")
184 .helpText(
"Used just when 'User Roles Retrieve Strategy' is GET_GROUPS_FROM_USER_MEMBEROF_ATTRIBUTE . " +
185 "It specifies the name of the LDAP attribute on the LDAP user, which contains the groups, which the user is member of. " +
186 "Usually it will be 'memberOf' and that's also the default value.")
187 .type(ProviderConfigProperty.STRING_TYPE)
188 .defaultValue(LDAPConstants.MEMBER_OF)
190 .property().name(GroupMapperConfig.MAPPED_GROUP_ATTRIBUTES)
191 .label(
"Mapped Group Attributes")
192 .helpText(
"List of names of attributes divided by comma. This points to the list of attributes on LDAP group, which will be mapped as attributes of Group in Keycloak. " +
193 "Leave this empty if no additional group attributes are required to be mapped in Keycloak. ")
194 .type(ProviderConfigProperty.STRING_TYPE)
196 .property().name(GroupMapperConfig.DROP_NON_EXISTING_GROUPS_DURING_SYNC)
197 .label(
"Drop non-existing groups during sync")
198 .helpText(
"If this flag is true, then during sync of groups from LDAP to Keycloak, we will keep just those Keycloak groups, which still exists in LDAP. Rest will be deleted")
199 .type(ProviderConfigProperty.BOOLEAN_TYPE)
200 .defaultValue(
"false")
202 return config.build();
static final List< String > ROLE_RETRIEVERS
Definition: GroupLDAPStorageMapperFactory.java:58
static final List< String > MODES
Definition: GroupLDAPStorageMapperFactory.java:56
static final List< String > MEMBERSHIP_TYPES
Definition: GroupLDAPStorageMapperFactory.java:55
static final List< String > NO_IMPORT_MODES
Definition: GroupLDAPStorageMapperFactory.java:57