mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-28 06:42:49 +00:00
SEC-2559: Added missing givenName attribute to Person
This commit is contained in:
parent
c0fbd30e65
commit
d579d00892
@ -37,6 +37,7 @@ public class Person extends LdapUserDetailsImpl {
|
|||||||
|
|
||||||
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
||||||
|
|
||||||
|
private String givenName;
|
||||||
private String sn;
|
private String sn;
|
||||||
private String description;
|
private String description;
|
||||||
private String telephoneNumber;
|
private String telephoneNumber;
|
||||||
@ -45,6 +46,10 @@ public class Person extends LdapUserDetailsImpl {
|
|||||||
protected Person() {
|
protected Person() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGivenName() {
|
||||||
|
return givenName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSn() {
|
public String getSn() {
|
||||||
return sn;
|
return sn;
|
||||||
}
|
}
|
||||||
@ -62,6 +67,7 @@ public class Person extends LdapUserDetailsImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void populateContext(DirContextAdapter adapter) {
|
protected void populateContext(DirContextAdapter adapter) {
|
||||||
|
adapter.setAttributeValue("givenName", givenName);
|
||||||
adapter.setAttributeValue("sn", sn);
|
adapter.setAttributeValue("sn", sn);
|
||||||
adapter.setAttributeValues("cn", getCn());
|
adapter.setAttributeValues("cn", getCn());
|
||||||
adapter.setAttributeValue("description", getDescription());
|
adapter.setAttributeValue("description", getDescription());
|
||||||
@ -81,6 +87,7 @@ public class Person extends LdapUserDetailsImpl {
|
|||||||
public Essence(DirContextOperations ctx) {
|
public Essence(DirContextOperations ctx) {
|
||||||
super(ctx);
|
super(ctx);
|
||||||
setCn(ctx.getStringAttributes("cn"));
|
setCn(ctx.getStringAttributes("cn"));
|
||||||
|
setGivenName(ctx.getStringAttribute("givenName"));
|
||||||
setSn(ctx.getStringAttribute("sn"));
|
setSn(ctx.getStringAttribute("sn"));
|
||||||
setDescription(ctx.getStringAttribute("description"));
|
setDescription(ctx.getStringAttribute("description"));
|
||||||
setTelephoneNumber(ctx.getStringAttribute("telephoneNumber"));
|
setTelephoneNumber(ctx.getStringAttribute("telephoneNumber"));
|
||||||
@ -94,6 +101,7 @@ public class Person extends LdapUserDetailsImpl {
|
|||||||
|
|
||||||
public Essence(Person copyMe) {
|
public Essence(Person copyMe) {
|
||||||
super(copyMe);
|
super(copyMe);
|
||||||
|
setGivenName(copyMe.givenName);
|
||||||
setSn(copyMe.sn);
|
setSn(copyMe.sn);
|
||||||
setDescription(copyMe.getDescription());
|
setDescription(copyMe.getDescription());
|
||||||
setTelephoneNumber(copyMe.getTelephoneNumber());
|
setTelephoneNumber(copyMe.getTelephoneNumber());
|
||||||
@ -104,6 +112,10 @@ public class Person extends LdapUserDetailsImpl {
|
|||||||
return new Person();
|
return new Person();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGivenName(String givenName) {
|
||||||
|
((Person) instance).givenName = givenName;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSn(String sn) {
|
public void setSn(String sn) {
|
||||||
((Person) instance).sn = sn;
|
((Person) instance).sn = sn;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ public class InetOrgPersonTests {
|
|||||||
|
|
||||||
assertEquals("HORS1", p.getCarLicense());
|
assertEquals("HORS1", p.getCarLicense());
|
||||||
assertEquals("ghengis@mongolia", p.getMail());
|
assertEquals("ghengis@mongolia", p.getMail());
|
||||||
|
assertEquals("Ghengis", p.getGivenName());
|
||||||
assertEquals("Khan", p.getSn());
|
assertEquals("Khan", p.getSn());
|
||||||
assertEquals("Ghengis Khan", p.getCn()[0]);
|
assertEquals("Ghengis Khan", p.getCn()[0]);
|
||||||
assertEquals("00001", p.getEmployeeNumber());
|
assertEquals("00001", p.getEmployeeNumber());
|
||||||
@ -111,6 +112,7 @@ public class InetOrgPersonTests {
|
|||||||
ctx.setAttributeValue("description", "Scary");
|
ctx.setAttributeValue("description", "Scary");
|
||||||
ctx.setAttributeValue("destinationIndicator", "West");
|
ctx.setAttributeValue("destinationIndicator", "West");
|
||||||
ctx.setAttributeValue("displayName", "Ghengis McCann");
|
ctx.setAttributeValue("displayName", "Ghengis McCann");
|
||||||
|
ctx.setAttributeValue("givenName", "Ghengis");
|
||||||
ctx.setAttributeValue("homePhone", "+467575436521");
|
ctx.setAttributeValue("homePhone", "+467575436521");
|
||||||
ctx.setAttributeValue("initials", "G");
|
ctx.setAttributeValue("initials", "G");
|
||||||
ctx.setAttributeValue("employeeNumber", "00001");
|
ctx.setAttributeValue("employeeNumber", "00001");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user