From ac35327db9183bd75d314ff162e304e70132a035 Mon Sep 17 00:00:00 2001 From: Puja Sharma Date: Tue, 29 Mar 2022 21:46:15 +0530 Subject: [PATCH] feat(jans-config-api): user mgmt endpoint -wip --- .../io/jans/configapi/model/user/Address.java | 120 +++++++++ .../io/jans/configapi/model/user/Device.java | 62 +++++ .../io/jans/configapi/model/user/Email.java | 128 ++++++++++ .../configapi/model/user/Entitlement.java | 67 +++++ .../io/jans/configapi/model/user/Group.java | 134 ++++++++++ .../model/user/InstantMessagingAddress.java | 70 ++++++ .../io/jans/configapi/model/user/Name.java | 121 +++++++++ .../jans/configapi/model/user/OTPDevice.java | 31 +++ .../configapi/model/user/PhoneNumber.java | 73 ++++++ .../io/jans/configapi/model/user/Photo.java | 74 ++++++ .../io/jans/configapi/model/user/Role.java | 67 +++++ .../configapi/model/user/X509Certificate.java | 67 +++++ .../io/jans/configapi/rest/model/Person.java | 197 ++++++++++++++- .../docs/jans-config-api-swagger.yaml | 236 +++++++++++++++++- 14 files changed, 1433 insertions(+), 14 deletions(-) create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/Address.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/Device.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/Email.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/Entitlement.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/Group.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/InstantMessagingAddress.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/Name.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/OTPDevice.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/PhoneNumber.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/Photo.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/Role.java create mode 100644 jans-config-api/common/src/main/java/io/jans/configapi/model/user/X509Certificate.java diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Address.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Address.java new file mode 100644 index 00000000000..626a9a8ca57 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Address.java @@ -0,0 +1,120 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Address { + + public enum Type {WORK, HOME, OTHER} + + @AttributeName(name = "formatted") + private String formatted; + + @AttributeName(name = "streetAddress") + private String streetAddress; + + @AttributeName(name = "locality") + private String locality; + + @AttributeName(name = "region") + private String region; + + @AttributeName(name = "postalCode") + private String postalCode; + + @AttributeName(name = "country") + private String country; + + @AttributeName(name = "type") + private String type; + + @AttributeName(name = "primary") + private Boolean primary; + + public String getFormatted() { + return formatted; + } + + public void setFormatted(String formatted) { + this.formatted = formatted; + } + + public String getStreetAddress() { + return streetAddress; + } + + public void setStreetAddress(String streetAddress) { + this.streetAddress = streetAddress; + } + + public String getLocality() { + return locality; + } + + public void setLocality(String locality) { + this.locality = locality; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public void setType(Type type){ + setType(type.name().toLowerCase()); + } + + public Boolean getPrimary() { + return primary; + } + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + @Override + public String toString() { + return "Address [formatted=" + formatted + ", streetAddress=" + streetAddress + ", locality=" + locality + + ", region=" + region + ", postalCode=" + postalCode + ", country=" + country + ", type=" + type + + ", primary=" + primary + "]"; + } + +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Device.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Device.java new file mode 100644 index 00000000000..e5909103cd4 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Device.java @@ -0,0 +1,62 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + + +public class Device { + private String addedOn; + + private String id; + + private String nickName; + + private boolean soft = false; + + public String getAddedOn() { + return addedOn; + } + + public void setAddedOn(String addedOn) { + this.addedOn = addedOn; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getNickName() { + return nickName; + } + + @Override + public String toString() { + return "Device [addedOn=" + addedOn + ", id=" + id + ", nickName=" + nickName + ", soft=" + soft + "]"; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public boolean isSoft() { + return soft; + } + + public void setSoft(boolean soft) { + this.soft = soft; + } +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Email.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Email.java new file mode 100644 index 00000000000..a0d0394dbe7 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Email.java @@ -0,0 +1,128 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Email { + + public enum Type {WORK, HOME, OTHER} + + @AttributeName(name = "value") + private String value; + + @AttributeName(name = "display") + private String display; + + @AttributeName(name = "type") + private String type; + + @AttributeName(name = "primary") + private Boolean primary; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getType() { + return type; + } + + @JsonProperty + public void setType(String type) { + this.type = type; + } + + public void setType(Type type){ + setType(type.name().toLowerCase()); + } + + public Boolean getPrimary() { + return primary; + } + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((value == null) ? 0 : value.hashCode()); + result = prime * result + ((display == null) ? 0 : display.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((primary == null) ? 0 : primary.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + Email other = (Email) obj; + if (value == null) { + if (other.value != null) { + return false; + } + } else if (!value.equals(other.value)) { + return false; + } + if (display == null) { + if (other.display != null) { + return false; + } + } else if (!display.equals(other.display)) { + return false; + } + if (type == null) { + if (other.type != null) { + return false; + } + } else if (!type.equals(other.type)) { + return false; + } + if (primary == null) { + if (other.primary != null) { + return false; + } + } else if (!primary.equals(other.primary)) { + return false; + } + return true; + } + + @Override + public String toString() { + return "Email [value=" + value + ", display=" + display + ", type=" + type + ", primary=" + primary + "]"; + } +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Entitlement.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Entitlement.java new file mode 100644 index 00000000000..39a9a16a720 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Entitlement.java @@ -0,0 +1,67 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Entitlement { + + @AttributeName(name = "value") + private String value; + + @AttributeName(name = "display") + private String display; + + @AttributeName(name = "type") + private String type; + + @AttributeName(name = "primary") + private Boolean primary; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Boolean getPrimary() { + return primary; + } + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + @Override + public String toString() { + return "Entitlement [value=" + value + ", display=" + display + ", type=" + type + ", primary=" + primary + "]"; + } + +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Group.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Group.java new file mode 100644 index 00000000000..71422955106 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Group.java @@ -0,0 +1,134 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Group { + + public enum Type {DIRECT, INDIRECT} + + @Attribute(description = "The identifier of the User's group.", + isRequired = true, //Specs says the converse, but doesn't make sense + mutability = AttributeDefinition.Mutability.READ_ONLY) + @StoreReference(ref = "memberOf") + private String value; + + @Attribute(description = "The URI of the corresponding Group resource to which the user belongs", + referenceTypes = { "User", "Group" }, + mutability = AttributeDefinition.Mutability.READ_ONLY, + type = AttributeDefinition.Type.REFERENCE) + @JsonProperty("$ref") + private String ref; + + @Attribute(description = "A human readable name, primarily used for display purposes.", + mutability = AttributeDefinition.Mutability.READ_ONLY) + private String display; + + @Attribute(description = "A label indicating the attribute's function; e.g., 'direct' or 'indirect'.", + canonicalValues = { "direct", "indirect" }, + mutability = AttributeDefinition.Mutability.READ_ONLY) + private String type; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getRef() { + return ref; + } + + public void setRef(String ref) { + this.ref = ref; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getType() { + return type; + } + + @JsonProperty + public void setType(String type) { + this.type = type; + } + + public void setType(Type type){ + setType(type.name().toLowerCase()); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((value == null) ? 0 : value.hashCode()); + result = prime * result + ((ref == null) ? 0 : ref.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((display == null) ? 0 : display.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + Group other = (Group) obj; + if (value == null) { + if (other.value != null) { + return false; + } + } else if (!value.equals(other.value)) { + return false; + } + if (ref == null) { + if (other.ref != null) { + return false; + } + } else if (!ref.equals(other.ref)) { + return false; + } + if (type == null) { + if (other.type != null) { + return false; + } + } else if (!type.equals(other.type)) { + return false; + } + if (display == null) { + if (other.display != null) { + return false; + } + } else if (!display.equals(other.display)) { + return false; + } + return true; + } + +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/InstantMessagingAddress.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/InstantMessagingAddress.java new file mode 100644 index 00000000000..a17d558b578 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/InstantMessagingAddress.java @@ -0,0 +1,70 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class InstantMessagingAddress { + + public enum Type {AIM, GTALK, ICQ, XMPP, MSN, SKYPE, QQ, YAHOO, OTHER} + + @AttributeName(name = "value") + private String value; + + @AttributeName(name = "display") + private String display; + + @AttributeName(name = "type") + private String type; + + @AttributeName(name = "primary") + private Boolean primary; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getType() { + return type; + } + + @JsonProperty + public void setType(String type) { + this.type = type; + } + + public void setType(Type type){ + setType(type.name().toLowerCase()); + } + + public Boolean getPrimary() { + return primary; + } + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Name.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Name.java new file mode 100644 index 00000000000..60b649b4e28 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Name.java @@ -0,0 +1,121 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Name { + + @Attribute(description = "The family name of the User, or Last Name in most Western languages (for example, Jensen " + + "given the full name Ms. Barbara J Jensen, III.).") + @StoreReference(ref = "sn") + private String familyName; + + @Attribute(description = "The given name of the User, or First Name in most Western languages (for example, Barbara " + + "given the full name Ms. Barbara J Jensen, III.).") + @StoreReference(ref = "givenName") + private String givenName; + + @Attribute(description = "The middle name(s) of the User (for example, Robert given the full name Ms. Barbara J " + + "Jensen, III.).") + @StoreReference(ref = "middleName") + private String middleName; + + @Attribute(description = "The honorific prefix(es) of the User, or Title in most Western languages (for example, Ms. " + + "given the full name Ms. Barbara J Jensen, III.).") + @StoreReference(ref = "jansHonorificPrefix") + private String honorificPrefix; + + @Attribute(description = "The honorific suffix(es) of the User, or Suffix in most Western languages (for example, " + + "III. given the full name Ms. Barbara J Jensen, III.)") + @StoreReference(ref = "jansHonorificSuffix") + private String honorificSuffix; + + @Attribute(description = "The full name, including all middle names, titles, and suffixes as appropriate, formatted " + + "for display (for example, Ms. Barbara J Jensen, III.).") + //This field is computed iff a value is not passed (ie is null) + @StoreReference(ref = "jansNameFormatted") + private String formatted; + + /** + * From this Name instance, it builds a string depicting a full name including all middle names, titles, and suffixes + * as appropriate for display if the {@link #getFormatted() formatted} field of this object is null or empty + * @return A string representing a full name. The formatted field will be set to this value + */ + public String computeFormattedName(){ + + if (StringUtils.isEmpty(formatted)) { + String formattedName = ""; + + formattedName+=StringUtils.isEmpty(honorificPrefix) ? "" : honorificPrefix + " "; + formattedName+=StringUtils.isEmpty(givenName) ? "" : givenName + " "; + formattedName+=StringUtils.isEmpty(middleName) ? "" : middleName + " "; + formattedName+=StringUtils.isEmpty(familyName) ? "" : familyName + " "; + formattedName+=StringUtils.isEmpty(honorificSuffix) ? "" : honorificSuffix; + formattedName=formattedName.trim(); + + formatted=formattedName.length()==0 ? null : formattedName; + } + return formatted; + + } + + public String getFormatted() { + return formatted; + } + + public void setFormatted(String formatted) { + this.formatted = formatted; + } + + public String getFamilyName() { + return familyName; + } + + public void setFamilyName(String familyName) { + this.familyName = familyName; + } + + public String getGivenName() { + return givenName; + } + + public void setGivenName(String givenName) { + this.givenName = givenName; + } + + public String getMiddleName() { + return middleName; + } + + public void setMiddleName(String middleName) { + this.middleName = middleName; + } + + public String getHonorificPrefix() { + return honorificPrefix; + } + + public void setHonorificPrefix(String honorificPrefix) { + this.honorificPrefix = honorificPrefix; + } + + public String getHonorificSuffix() { + return honorificSuffix; + } + + public void setHonorificSuffix(String honorificSuffix) { + this.honorificSuffix = honorificSuffix; + } + +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/OTPDevice.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/OTPDevice.java new file mode 100644 index 00000000000..9b3b1bf0ca0 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/OTPDevice.java @@ -0,0 +1,31 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + + +import java.util.ArrayList; + +public class OTPDevice { + + private ArrayList devices; + + public ArrayList getDevices() { + return this.devices; + } + + public void setDevices(ArrayList devices) { + this.devices = devices; + } + +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/PhoneNumber.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/PhoneNumber.java new file mode 100644 index 00000000000..acb2a6dc248 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/PhoneNumber.java @@ -0,0 +1,73 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class PhoneNumber { + + public enum Type {WORK, HOME, MOBILE, FAX, PAGER, OTHER} + + @AttributeName(name = "value") + private String value; + + @AttributeName(name = "display") + private String display; + + @AttributeName(name = "type") + private String type; + + @AttributeName(name = "primary") + private Boolean primary; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public void setType(Type type){ + setType(type.name().toLowerCase()); + } + + public Boolean getPrimary() { + return primary; + } + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + @Override + public String toString() { + return "PhoneNumber [value=" + value + ", display=" + display + ", type=" + type + ", primary=" + primary + "]"; + } +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Photo.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Photo.java new file mode 100644 index 00000000000..63306f4bf1d --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Photo.java @@ -0,0 +1,74 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Photo { + + public enum Type {PHOTO, THUMBNAIL} + + @AttributeName(name = "value") + private String value; + + @AttributeName(name = "display") + private String display; + + @AttributeName(name = "type") + private String type; + + @AttributeName(name = "primary") + private Boolean primary; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getType() { + return type; + } + + @JsonProperty + public void setType(String type) { + this.type = type; + } + + public void setType(Type type){ + setType(type.name().toLowerCase()); + } + + public Boolean getPrimary() { + return primary; + } + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + @Override + public String toString() { + return "Photo [value=" + value + ", display=" + display + ", type=" + type + ", primary=" + primary + "]"; + } + +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Role.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Role.java new file mode 100644 index 00000000000..c3516bee571 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/Role.java @@ -0,0 +1,67 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; +@JsonIgnoreProperties(ignoreUnknown = true) +public class Role { + + @AttributeName(name = "value") + private String value; + + @AttributeName(name = "display") + private String display; + + @AttributeName(name = "type") + private String type; + + @AttributeName(name = "primary") + private Boolean primary; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Boolean getPrimary() { + return primary; + } + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + @Override + public String toString() { + return "Role [value=" + value + ", display=" + display + ", type=" + type + ", primary=" + primary + "]"; + } + +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/model/user/X509Certificate.java b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/X509Certificate.java new file mode 100644 index 00000000000..372c9bf2094 --- /dev/null +++ b/jans-config-api/common/src/main/java/io/jans/configapi/model/user/X509Certificate.java @@ -0,0 +1,67 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.model.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.orm.annotation.AttributeName; +@JsonIgnoreProperties(ignoreUnknown = true) +public class X509Certificate { + + @AttributeName(name = "value") + private String value; + + @AttributeName(name = "display") + private String display; + + @AttributeName(name = "type") + private String type; + + @AttributeName(name = "primary") + private Boolean primary; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Boolean getPrimary() { + return primary; + } + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + @Override + public String toString() { + return "X509Certificate [value=" + value + ", display=" + display + ", type=" + type + ", primary=" + primary + + "]"; + } +} diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/rest/model/Person.java b/jans-config-api/common/src/main/java/io/jans/configapi/rest/model/Person.java index 03d1b57307f..ec90e44f9be 100644 --- a/jans-config-api/common/src/main/java/io/jans/configapi/rest/model/Person.java +++ b/jans-config-api/common/src/main/java/io/jans/configapi/rest/model/Person.java @@ -4,9 +4,18 @@ * Copyright (c) 2020, Janssen Project */ -package io.jans.configapi.rest.model; +package io.jans.configapi.rest.model.user; -import io.jans.model.GluuStatus; +import io.jans.configapi.model.user.Address; +import io.jans.configapi.model.user.Email; +import io.jans.configapi.model.user.Entitlement; +import io.jans.configapi.model.user.InstantMessagingAddress; +import io.jans.configapi.model.user.OTPDevice; +import io.jans.configapi.model.user.PhoneNumber; +import io.jans.configapi.model.user.Photo; +import io.jans.configapi.model.user.Role; +import io.jans.configapi.model.user.X509Certificate; +import io.jans.model.GluuStatus; import io.jans.orm.annotation.AttributeName; import io.jans.orm.annotation.DataEntry; import io.jans.orm.annotation.ObjectClass; @@ -20,10 +29,11 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; - +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @DataEntry @ObjectClass(value = "jansPerson") +@JsonIgnoreProperties(ignoreUnknown = true) public class Person extends BasePerson { private static final long serialVersionUID = 6634191420188575733L; @@ -63,7 +73,7 @@ public class Person extends BasePerson { private String organization; @AttributeName(name = "jansExtUid") - private List extUid; + private List externalUid; @AttributeName(name = "jansOTPCache") private List otpCache; @@ -75,16 +85,191 @@ public class Person extends BasePerson { private boolean active; @AttributeName(name = "jansAddres") - private List addres; + private List
addres; @AttributeName(name = "jansEmail") - private List email; + private List email; @AttributeName(name = "jansEntitlements") private List entitlements; + @AttributeName(name = "jansExtId") + private String extId; + + @AttributeName(name = "jansImsValue") + private List imsValue; + + @AttributeName(name = "jansLastLogonTime") + private Date created; + + @AttributeName(name = "jansMetaLastMod") + private Date lastModified; + + @AttributeName(name = "jansMetaLocation") + private String location; + + @AttributeName(name = "jansMetaVer") + private String version; + + @AttributeName(name = "jansNameFormatted") + private String nameFormatted; + + @AttributeName(name = "jansPhoneValue") + private List phoneValue; + + @AttributeName(name = "jansPhotos") + private List photos; + + @AttributeName(name = "jansProfileURL") + private String profileURL; + + @AttributeName(name = "jansRole") + private List roles; + + @AttributeName(name = "jansTitle") + private String title; + + @AttributeName(name = "jansUsrTyp") + private String userType; + + @AttributeName(name = "jansHonorificPrefix") + private String honorificPrefix; + @AttributeName(name = "jansHonorificSuffix") + private String honorificSuffix; + + @AttributeName(name = "jans509Certificate") + private List x509Certificates; + + @AttributeName(name = "jansPassExpDate") + private Date passwordExpirationDate; + + @AttributeName(name = "persistentId") + private String persistentId; + + @AttributeName(name = "middleName") + private String middleName; + + @AttributeName(name = "nickname") + private String nickname; + + @AttributeName(name = "jansPrefUsrName") + private String preferredUsername; + @AttributeName(name = "profile") + private String profile; + + @AttributeName(name = "picture") + private String picture; + + @AttributeName(name = "website") + private String website; + + @AttributeName(name = "emailVerified") + private boolean emailVerified; + + @AttributeName(name = "gender") + private String gender; + + @AttributeName(name = "birthdate") + private Date birthdate; + + @AttributeName(name = "zoneinfo") + private String timezone; + + @AttributeName(name = "locale") + private String locale; + + @AttributeName(name = "phoneNumberVerified") + private boolean phoneNumberVerified; + + @AttributeName(name = "address") + private List
address; + + @AttributeName(name = "updatedAt") + private Date updatedAt; + + @AttributeName(name = "preferredLanguage") + private String preferredLanguage; + + @AttributeName(name = "role") + private String role; + + @AttributeName(name = "secretAnswer") + private String secretAnswer; + + @AttributeName(name = "secretQuestion") + private String secretQuestion; + + @AttributeName(name = "seeAlso") + private String seeAlso; + + @AttributeName(name = "sn") + private String sn; + + @AttributeName(name = "cn") + private String cn; + + @AttributeName(name = "transientId") + private String transientId; + + @AttributeName(name = "uid") + private String uid; + + @AttributeName(name = "userPassword") + private String userPassword; + + @AttributeName(name = "st") + private String st; + + @AttributeName(name = "street") + private String street; + + @AttributeName(name = "l") + private String l; + + @AttributeName(name = "jansCountInvalidLogin") + private Integer countInvalidLogin; + + @AttributeName(name = "jansEnrollmentCode") + private String enrollmentCode; + + @AttributeName(name = "jansIMAPData") + private String imapData; + + @AttributeName(name = "jansPPID") + private List ppid; + + @AttributeName(name = "jansGuid") + private String guid; + + @AttributeName(name = "jansPreferredMethod") + private String preferredMethod; + + @AttributeName(name = "userCertificate") + private String userCertificate; + + @AttributeName(name = "jansOTPDevices") + private OTPDevice otpDevices; + + @AttributeName(name = "jansMobileDevices") + private String mobileDevices; + + @AttributeName(name = "jansTrustedDevices") + private String trustedDevices; + + @AttributeName(name = "jansStrongAuthPolicy") + private String strongAuthPolicy; + + @AttributeName(name = "jansUnlinkedExternalUids") + private List unlinkedExternalUids; + + @AttributeName(name = "jansBackchannelDeviceRegistrationTkn") + private String backchannelDeviceRegistrationTkn; + + @AttributeName(name = "jansBackchannelUsrCode") + private String backchannelUsrCode; + public void setAttribute(String attributeName, String attributeValue, Boolean multiValued) { CustomObjectAttribute attribute = new CustomObjectAttribute(attributeName, attributeValue); if (multiValued != null) { diff --git a/jans-config-api/docs/jans-config-api-swagger.yaml b/jans-config-api/docs/jans-config-api-swagger.yaml index 7ec9f7010a8..19297c4b1b4 100644 --- a/jans-config-api/docs/jans-config-api-swagger.yaml +++ b/jans-config-api/docs/jans-config-api-swagger.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +# openapi: 3.0.1 info: title: jans-config-api description: jans-config-api - Authorization services @@ -6285,11 +6285,14 @@ components: type: object properties: value: + description: E-mail addresses for the user. type: string example: gossow@nsfw.com display: + description: A human readable name, primarily used for display purposes. type: string type: + description: 'A label indicating the attribute's function; e.g., 'work' or 'home'.' type: string example: work primary: @@ -6300,25 +6303,30 @@ components: type: object properties: value: + description: Phone number of the User type: string example: +1-555-555-8377 display: + description: A human readable name, primarily used for display purposes. type: string type: + description: A label indicating the attribute's function; e.g., 'work' or 'home' or 'mobile' etc. type: string example: fax primary: + description: A Boolean value indicating the 'primary' or preferred attribute value for this attribute. type: boolean - description: Denotes if this is the preferred phone number among others, if any - description: See section 4.1.2 of RFC 7643 InstantMessagingAddress: type: object properties: value: + description: Instant messaging address for the User. type: string display: + description: A human readable name, primarily used for display purposes. type: string type: + description: A label indicating the attribute's function; e.g., 'aim', 'gtalk', 'mobile' etc. type: string example: gtalk primary: @@ -6329,11 +6337,14 @@ components: type: object properties: value: + description: URI of a photo of the User. type: string example: https://pics.nsfw.com/gossow.png display: + description: A human readable name, primarily used for display purposes. type: string type: + description: 'A label indicating the attribute's function; e.g., 'photo' or 'thumbnail'.' type: string example: thumbnail primary: @@ -6345,8 +6356,9 @@ components: properties: formatted: type: string - description: Full mailing address, formatted for display or use with a mailing label + description: The full mailing address, formatted for display or use with a mailing label. streetAddress: + description: The full street address component, which may include house number, street name,PO BOX,etc. type: string example: 56 Acacia Avenue locality: @@ -6363,6 +6375,7 @@ components: description: Country expressed in ISO 3166-1 "alpha-2" code format example: UK type: + description: 'A label indicating the attribute's function; e.g., 'work' or 'home'.' type: string example: home primary: @@ -6373,11 +6386,14 @@ components: type: object properties: value: + description: The value of a role type: string example: Project manager display: + description: A human readable name, primarily used for display purposes. type: string type: + description: A label indicating the attribute's function. type: string primary: type: boolean @@ -6408,6 +6424,7 @@ components: description: URI associated to the group example: https://nsfw.com/scim/restv1/v2/Groups/180ee84f0671b1 display: + description: A human readable name, primarily used for display purposes. type: string example: Cult managers type: @@ -6419,11 +6436,14 @@ components: type: object properties: value: + description: The value of an entitlement. type: string example: Stakeholder display: + description: A human readable name, primarily used for display purposes. type: string type: + description: A label indicating the attribute's function. type: string primary: type: boolean @@ -6433,11 +6453,13 @@ components: type: object properties: value: + description: The value of a X509 certificate. type: string - description: DER-encoded X.509 certificate display: + description: A human readable name, primarily used for display purposes. type: string type: + description: A label indicating the attribute's function. type: string primary: type: boolean @@ -6801,7 +6823,7 @@ components: description: User creation date. type: string format: date-time - extUid: + externalUid: description: List of associated external uid. type: array items: @@ -6828,9 +6850,207 @@ components: description: List of users email address. type: array items: - type: string + $ref: '#/components/schemas/Email' entitlements: description: List of users entitlement. type: array items: - $ref: '#/components/schemas/Entitlement' \ No newline at end of file + $ref: '#/components/schemas/Entitlement' + extId: + description: 'User's external id.' + type: string + imsValue: + description: Instant messaging address value. + type: array + items: + $ref: '#/components/schemas/InstantMessagingAddress' + created: + description: 'Integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating creation time.' + type: string + format: date-time + lastModified: + description: 'Integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating last modified time.' + type: string + format: date-time + location: + description: The location (URI) of the user + type: string + version: + description: The version of the user data + type: string + nameFormatted: + description: The full name, including all middle names, titles, and suffixes as appropriate, formatted. + type: string + phoneValue: + description: Phone numbers of the user + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + photos: + description: User's photos + type: array + items: + $ref: '#/components/schemas/Photo' + profileURL: + description: URI pointing to a location representing the User's online profile + type: string + roles: + description: Users various roles + type: array + items: + $ref: '#/components/schemas/Role' + title: + description: Users titles + type: string + example: Vice President + userType: + description: Used to identify the relationship between the organization and the user + type: string + example: Contractor + honorificPrefix: + description: The honorific prefix(es) of the User, or Title in most Western languages (for example, Ms. given the full name Ms. Barbara J Jensen, III.) + type: string + example: Ms.,Mr.,Miss. + honorificSuffix: + description: The honorific suffix(es) of the User, or Suffix in most Western languages (for example,III. given the full name Ms. Barbara J Jensen, III.) + type: string + x509Certificates: + description: List of public certificate of the user + type: array + items: + $ref: '#/components/schemas/X509Certificate' + passwordExpirationDate: + description: 'Integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating password expiration date.' + type: string + format: date-time + persistentId: + description: Persistent Id of the user + type: string + middleName: + type: string + description: Middle name of the user. + nickName: + type: string + description: Casual way to address the user in real life + preferredUsername: + type: string + description: Preferred name of the user. + profile: + type: string + description: Profile page URL of the user + picture: + type: string + description: Profile picture URL of the user + website: + type: string + description: Web page or blog URL of the person + emailVerified: + type: boolean + description: True if the e-mail address of the person has been verified; otherwise false + gender: + type: boolean + description: Gender of the person + birthdate: + description: Date of birth of the user. Year of birth (four digits),Month of birth (1-12),Day of birth + type: string + format: date-time + timezone: + description: Time zone database representing the End-Usrs time zone. For example, Europe/Paris or America/Los_Angeles + type: string + example: America/Los_Angeles + locale: + description: Locale of the person, represented as a BCP47 [RFC5646] language tag. Used for purposes of localizing items such as currency and dates. + type: string + example: en-US + phoneNumberVerified: + type: boolean + description: True if the phone number of the person has been verified, otherwise false + address: + description: OpenID Connect formatted JSON object representing the address of the person + type: array + items: + $ref: '#/components/schemas/Address' + updatedAt: + description: Time the information of the person was last updated. Seconds from 1970-01-01T0:0:0Z + type: string + format: date-time + preferredLanguage: + description: Preferred language as used in the Accept-Language HTTP header + type: string + example: en + secretAnswer: + description: Secret Answer + type: string + secretQuestion: + description: Secret Question + type: string + seeAlso: + type: string + sn: + description: This would be referred to as last name or surname. + type: string + cn: + description: Common Name + type: string + transientId: + description: Transient Id + type: string + uid: + description: unique identifier + type: string + userPassword: + description: user password + type: string + st: + type: string + street: + type: string + l: + type: string + countInvalidLogin: + description: Invalid login attempts count + type: integer + enrollmentCode: + description: Users enrollment code + type: string + imapData: + description: This data has information about your imap connection + type: string + ppid: + description: Persistent Pairwise ID for OpenID Connect + type: array + items: + type: string + guid: + description: A random string to mark temporary tokens + type: string + preferredMethod: + description: Casa - Preferred method to use for user authentication + type: string + userCertificate: + description: Casa - Preferred method to use for user authentication + type: string + otpDevices: + description: Casa - Json representation of OTP devices. Complementary to jansExtUid attribute + type: string + mobileDevices: + description: Casa - Json representation of mobile devices. Complementary to mobile attribute + type: string + trustedDevices: + description: Casa - Devices with which strong authentication may be skipped + type: string + strongAuthPolicy: + description: Casa - 2FA Enforcement Policy for User + type: string + unlinkedExternalUids: + description: Casa - List of unlinked social accounts (ie disabled jansExtUids) + type: array + items: + type: string + backchannelDeviceRegistrationTkn: + description: Backchannel Device Registration Tkn + type: string + backchannelUsrCode: + description: jans Backchannel User Code + type: string + \ No newline at end of file