Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jans-config-api): swagger spec change to expose user inum at root level of response #1483

Merged
merged 2 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6841,6 +6841,9 @@ components:
userPassword:
type: string
description: User password
inum:
description: XRI i-number. Identifier to uniquely identify the user.
type: string

UserPatchRequest:
title: User Patch Request object
Expand Down
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