1
0
mirror of synced 2026-05-22 21:33:16 +00:00

SEC-2559: Added missing givenName attribute to Person

This commit is contained in:
Chris Bonham
2014-04-18 14:30:36 -04:00
committed by Rob Winch
parent c0fbd30e65
commit d579d00892
2 changed files with 14 additions and 0 deletions
@@ -37,6 +37,7 @@ public class Person extends LdapUserDetailsImpl {
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
private String givenName;
private String sn;
private String description;
private String telephoneNumber;
@@ -45,6 +46,10 @@ public class Person extends LdapUserDetailsImpl {
protected Person() {
}
public String getGivenName() {
return givenName;
}
public String getSn() {
return sn;
}
@@ -62,6 +67,7 @@ public class Person extends LdapUserDetailsImpl {
}
protected void populateContext(DirContextAdapter adapter) {
adapter.setAttributeValue("givenName", givenName);
adapter.setAttributeValue("sn", sn);
adapter.setAttributeValues("cn", getCn());
adapter.setAttributeValue("description", getDescription());
@@ -81,6 +87,7 @@ public class Person extends LdapUserDetailsImpl {
public Essence(DirContextOperations ctx) {
super(ctx);
setCn(ctx.getStringAttributes("cn"));
setGivenName(ctx.getStringAttribute("givenName"));
setSn(ctx.getStringAttribute("sn"));
setDescription(ctx.getStringAttribute("description"));
setTelephoneNumber(ctx.getStringAttribute("telephoneNumber"));
@@ -94,6 +101,7 @@ public class Person extends LdapUserDetailsImpl {
public Essence(Person copyMe) {
super(copyMe);
setGivenName(copyMe.givenName);
setSn(copyMe.sn);
setDescription(copyMe.getDescription());
setTelephoneNumber(copyMe.getTelephoneNumber());
@@ -104,6 +112,10 @@ public class Person extends LdapUserDetailsImpl {
return new Person();
}
public void setGivenName(String givenName) {
((Person) instance).givenName = givenName;
}
public void setSn(String sn) {
((Person) instance).sn = sn;
}
@@ -50,6 +50,7 @@ public class InetOrgPersonTests {
assertEquals("HORS1", p.getCarLicense());
assertEquals("ghengis@mongolia", p.getMail());
assertEquals("Ghengis", p.getGivenName());
assertEquals("Khan", p.getSn());
assertEquals("Ghengis Khan", p.getCn()[0]);
assertEquals("00001", p.getEmployeeNumber());
@@ -111,6 +112,7 @@ public class InetOrgPersonTests {
ctx.setAttributeValue("description", "Scary");
ctx.setAttributeValue("destinationIndicator", "West");
ctx.setAttributeValue("displayName", "Ghengis McCann");
ctx.setAttributeValue("givenName", "Ghengis");
ctx.setAttributeValue("homePhone", "+467575436521");
ctx.setAttributeValue("initials", "G");
ctx.setAttributeValue("employeeNumber", "00001");