-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add group name attribute for FromGroupSearchLDAPGroupMembershipStrategy
- Loading branch information
Showing
11 changed files
with
94 additions
and
15 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
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
3 changes: 3 additions & 0 deletions
3
...kins/security/plugins/ldap/FromGroupSearchLDAPGroupMembershipStrategy/help-attribute.html
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
The LDAP attribute name which contains the group name (default = "cn"). | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...s/security/plugins/ldap/FromGroupSearchLDAPGroupMembershipStrategy/help-attribute_fr.html
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
Le nom de l'attribut LDAP contenant le nom du groupe (valeur par défaut = "cn") | ||
</div> |
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 | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,4 @@ | |
<f:checkbox /> | ||
</f:entry> | ||
</f:advanced> | ||
</j:jelly> | ||
</j:jelly> |
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 | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,43 @@ public void userLookup_rolesFromUserRecord_modern() throws Exception { | |
assertThat(userGetAuthorities(details), containsInAnyOrder("HMS_Victory")); | ||
} | ||
|
||
@Test | ||
@LDAPSchema(ldif = "sevenSeas", id = "sevenSeas", dn = "o=sevenSeas") | ||
public void userLookup_rolesFromGroupSearchWithGroupAttribute() throws Exception { | ||
LDAPSecurityRealm realm = new LDAPSecurityRealm( | ||
ads.getUrl(), | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
new FromGroupSearchLDAPGroupMembershipStrategy(null, "description"), | ||
"uid=admin,ou=system", | ||
Secret.fromString("pass"), | ||
false, | ||
false, | ||
new LDAPSecurityRealm.CacheConfiguration(100, 1000), | ||
new LDAPSecurityRealm.EnvironmentProperty[0], | ||
"cn", | ||
null, | ||
IdStrategy.CASE_INSENSITIVE, | ||
IdStrategy.CASE_INSENSITIVE); | ||
r.jenkins.setSecurityRealm(realm); | ||
User user = User.get("hhornblo", true, Collections.emptyMap()); | ||
List<String> authorities = user.getAuthorities(); | ||
assertThat(user.getAuthorities(), containsInAnyOrder("HMS_Lydia", "ROLE_HMS_LYDIA")); | ||
assertThat(user.getDisplayName(), is("Horatio Hornblower")); | ||
assertThat(user.getProperty(Mailer.UserProperty.class).getAddress(), is("[email protected]")); | ||
UserDetails details = realm.authenticate2("hhornblo", "pass"); | ||
assertThat(userGetAuthorities(details), containsInAnyOrder("HMS_Lydia", "ROLE_HMS_LYDIA")); | ||
user = User.get("hnelson", true, Collections.emptyMap()); | ||
assertThat(user.getAuthorities(), containsInAnyOrder("HMS_Victory", "ROLE_HMS_VICTORY")); | ||
assertThat(user.getDisplayName(), is("Horatio Nelson")); | ||
assertThat(user.getProperty(Mailer.UserProperty.class).getAddress(), is("[email protected]")); | ||
details = realm.authenticate2("hnelson", "pass"); | ||
assertThat(userGetAuthorities(details), containsInAnyOrder("HMS_Victory", "ROLE_HMS_VICTORY")); | ||
} | ||
|
||
private Set<String> userGetAuthorities(UserDetails details) { | ||
Set<String> authorities = new LinkedHashSet<>(); | ||
for (GrantedAuthority a : details.getAuthorities()) { | ||
|
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
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