Skip to content

Commit

Permalink
feat(jans-config-api): user mgmt endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
pujavs committed Mar 31, 2022
1 parent 9c8094a commit 0ea10fd
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public User getUserByDn(String dn, String... returnAttributes) {
return persistenceEntryManager.find(dn, User.class, returnAttributes);
}

public User getUserByInum(String inum, String... returnAttributes) {
public Person getUserByInum(String inum, String... returnAttributes) {
if (StringHelper.isEmpty(inum)) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,25 @@

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 com.fasterxml.jackson.annotation.JsonProperty;
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")
@AttributeName(name = "value")
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")
@AttributeName(name = "ref")
private String ref;

@Attribute(description = "A human readable name, primarily used for display purposes.",
mutability = AttributeDefinition.Mutability.READ_ONLY)
@AttributeName(name = "display")
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)
@AttributeName(name = "type")
private String type;

public String getValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,29 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang.StringUtils;

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")
@AttributeName(name = "familyName")
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")
@AttributeName(name = "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")
@AttributeName(name = "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")
@AttributeName(name = "honorificPrefix")
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")
@AttributeName(name = "honorificSuffix")
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")
@AttributeName(name = "formatted")
private String formatted;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@

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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright (c) 2020, Janssen Project
*/

package io.jans.configapi.rest.model;
package io.jans.configapi.rest.model.user;

import io.jans.as.model.exception.InvalidClaimException;
import org.json.JSONArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import com.github.fge.jsonpatch.JsonPatchException;
import static io.jans.as.model.util.Util.escapeLog;
import io.jans.as.common.model.common.User;
import io.jans.as.common.model.common.User;
//import io.jans.configapi.rest.model.user.User;
import io.jans.as.common.service.common.EncryptionService;
import io.jans.as.common.service.common.InumService;
import io.jans.configapi.core.rest.ProtectedApi;
Expand Down

0 comments on commit 0ea10fd

Please sign in to comment.