Skip to content

Commit

Permalink
feat(jans-config-api): enhancement to expose user inum at root level …
Browse files Browse the repository at this point in the history
…of response (#1477)
  • Loading branch information
pujavs authored May 31, 2022
1 parent 5556f36 commit 1e4b6bc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,69 @@ public class CustomUser extends User {

private static final long serialVersionUID = 1L;

private String inum;
private String mail;
private String displayName;
private String jansStatus;
private String givenName;
private String userPassword;


public String getInum() {
return inum;
}

public void setInum(String inum) {
this.inum = inum;
}

public String getMail() {
return mail;
}

public void setMail(String mail) {
this.mail = mail;
}

public String getDisplayName() {
return displayName;
}

public void setDisplayName(String displayName) {
this.displayName = displayName;
}

public String getJansStatus() {
return jansStatus;
}

public void setJansStatus(String jansStatus) {
this.jansStatus = jansStatus;
}

public String getGivenName() {
return givenName;
}

public void setGivenName(String givenName) {
this.givenName = givenName;
}

public String getUserPassword() {
return userPassword;
}

public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}

@Override
public String toString() {
return "CustomUser [mail=" + mail + ", displayName=" + displayName + ", jansStatus=" + jansStatus + ", givenName="
+ givenName + ", userPassword= XXXXX ]";
return "CustomUser [inum=" + inum + ", mail=" + mail + ", displayName=" + displayName + ", jansStatus="
+ jansStatus + ", givenName=" + givenName + ", userPassword=" + userPassword + "]";
}




}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class UserResource extends BaseResource {
private static final String JANS_STATUS = "jansStatus";
private static final String GIVEN_NAME = "givenName";
private static final String USER_PWD = "userPassword";
private static final String INUM = "inum";

@Inject
Logger logger;
Expand Down Expand Up @@ -287,12 +288,14 @@ public CustomUser setCustomUserAttributes(CustomUser customUser, User user) {
customUser.setJansStatus(user.getAttribute(JANS_STATUS));
customUser.setGivenName(user.getAttribute(GIVEN_NAME));
customUser.setUserPassword(user.getAttribute(USER_PWD));
customUser.setInum(user.getAttribute(INUM));

customUser.removeAttribute(MAIL);
customUser.removeAttribute(DISPLAY_NAME);
customUser.removeAttribute(JANS_STATUS);
customUser.removeAttribute(GIVEN_NAME);
customUser.removeAttribute(USER_PWD);
customUser.removeAttribute(INUM);

return customUser;
}
Expand All @@ -316,6 +319,7 @@ private User setUserCustomAttributes(CustomUser customUser, User user) {
user.setAttribute(JANS_STATUS, customUser.getJansStatus(), false);
user.setAttribute(GIVEN_NAME, customUser.getGivenName(), false);
user.setAttribute(USER_PWD, customUser.getUserPassword(), false);
user.setAttribute(INUM, customUser.getInum(), false);

logger.debug("Custom User - user:{}", user);
return user;
Expand Down

0 comments on commit 1e4b6bc

Please sign in to comment.