Skip to content
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
8 changes: 8 additions & 0 deletions src/main/java/com/auth0/client/mgmt/ManagementAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,14 @@ public NetworkAclsEntity networkAcls() {
return new NetworkAclsEntity(client, baseUrl, tokenProvider);
}

/**
* Getter for the User Attribute Profiles Entity
* @return the User Attribute Profiles Entity
*/
public UserAttributeProfilesEntity userAttributeProfiles() {
return new UserAttributeProfilesEntity(client, baseUrl, tokenProvider);
}

/**
* Builder for {@link ManagementAPI} API client instances.
*/
Expand Down
151 changes: 151 additions & 0 deletions src/main/java/com/auth0/client/mgmt/UserAttributeProfilesEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
package com.auth0.client.mgmt;

import com.auth0.client.mgmt.filter.UserAttributeProfilesFilter;
import com.auth0.json.mgmt.userAttributeProfiles.*;
import com.auth0.net.BaseRequest;
import com.auth0.net.Request;
import com.auth0.net.VoidRequest;
import com.auth0.net.client.Auth0HttpClient;
import com.auth0.net.client.HttpMethod;
import com.auth0.utils.Asserts;
import com.fasterxml.jackson.core.type.TypeReference;
import okhttp3.HttpUrl;

public class UserAttributeProfilesEntity extends BaseManagementEntity {

private final static String ORGS_PATH = "api/v2/user-attribute-profiles";

UserAttributeProfilesEntity(Auth0HttpClient client, HttpUrl baseUrl, TokenProvider tokenProvider) {
super(client, baseUrl, tokenProvider);
}

/**
* Get a user attribute profile by its ID. A token with {@code read:user_attribute_profiles} scope is required.
* @param id the ID of the user attribute profile to retrieve.
* @return a Request to execute.
*/
public Request<UserAttributeProfile> get(String id) {
Asserts.assertNotNull(id, "id");

String url = baseUrl.newBuilder()
.addPathSegments(ORGS_PATH)
.addPathSegment(id)
.build().toString();

return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<UserAttributeProfile>() {
});
}

/**
* Get all user attribute profiles. A token with {@code read:user_attribute_profiles} scope is required.
*
* @param filter an optional pagination filter
* @return a Request to execute
*
*/
public Request<ListUserAttributeProfile> getAll(UserAttributeProfilesFilter filter) {
HttpUrl.Builder builder = baseUrl.newBuilder()
.addPathSegments(ORGS_PATH);

if (filter != null) {
filter.getAsMap().forEach((k, v) -> builder.addQueryParameter(k, String.valueOf(v)));
}

String url = builder.build().toString();

return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<ListUserAttributeProfile>() {
});
}

/**
* Update a user attribute profile. A token with {@code update:user_attribute_profiles} scope is required.
*
* @param userAttributeProfile the user attribute profile to update.
* @return a Request to execute.
*/
public Request<UserAttributeProfile> update(String id, UserAttributeProfile userAttributeProfile) {
Asserts.assertNotNull(id, "id");
Asserts.assertNotNull(userAttributeProfile, "userAttributeProfile");

String url = baseUrl.newBuilder()
.addPathSegments(ORGS_PATH)
.addPathSegment(id)
.build().toString();

BaseRequest<UserAttributeProfile> request = new BaseRequest<>(client, tokenProvider, url, HttpMethod.PATCH, new TypeReference<UserAttributeProfile>() {
});

request.setBody(userAttributeProfile);
return request;
}

/**
* Create a new user attribute profile. A token with {@code create:user_attribute_profiles} scope is required.
* @param userAttributeProfile the user attribute profile to create.
* @return a Request to execute.
*/
public Request<UserAttributeProfile> create(UserAttributeProfile userAttributeProfile) {
Asserts.assertNotNull(userAttributeProfile.getName(), "name");
Asserts.assertNotNull(userAttributeProfile.getUserAttributes(), "userAttributes");

String url = baseUrl.newBuilder()
.addPathSegments(ORGS_PATH)
.build().toString();

BaseRequest<UserAttributeProfile> request = new BaseRequest<>(client, tokenProvider, url, HttpMethod.POST, new TypeReference<UserAttributeProfile>() {
});

request.setBody(userAttributeProfile);
return request;
}

/**
* Delete a user attribute profile by its ID. A token with {@code delete:user_attribute_profiles} scope is required.
* @param id the ID of the user attribute profile to delete.
* @return a Request to execute.
*/
public Request<Void> delete(String id) {
Asserts.assertNotNull(id, "id");

HttpUrl.Builder builder = baseUrl
.newBuilder()
.addPathSegments(ORGS_PATH)
.addPathSegment(id);

String url = builder.build().toString();
return new VoidRequest(client, tokenProvider, url, HttpMethod.DELETE);
}

/**
* Get a user attribute profile template by its ID. A token with {@code read:user_attribute_profiles} scope is required.
* @param id the ID of the user attribute profile template to retrieve.
* @return a Request to execute.
*/
public Request<UserAttributeProfileTemplate> getTemplate(String id) {
Asserts.assertNotNull(id, "id");

String url = baseUrl.newBuilder()
.addPathSegments(ORGS_PATH)
.addPathSegment("templates")
.addPathSegment(id)
.build().toString();

return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<UserAttributeProfileTemplate>() {
});
}

/**
* Get all user attribute profile templates. A token with {@code read:user_attribute_profiles} scope is required.
*
* @return a Request to execute
*/
public Request<ListUserAttributeProfileTemplate> getAllTemplates() {
String url = baseUrl.newBuilder()
.addPathSegments(ORGS_PATH)
.addPathSegment("templates")
.build().toString();

return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<ListUserAttributeProfileTemplate>() {
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.auth0.client.mgmt.filter;

public class UserAttributeProfilesFilter extends BaseFilter {

/**
* Filter by checkpoint pagination support
*
* @param from the starting index identifier
* @param take the number of items to retrieve
* @return this filter instance
*/
public UserAttributeProfilesFilter withCheckpointPagination(String from, int take) {
parameters.put("from", from);
parameters.put("take", take);
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.auth0.json.mgmt.selfserviceprofiles;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ProvisioningConfig {
@JsonProperty("scopes")
private List<String> scopes;
@JsonProperty("token_lifetime")
private int tokenLifetime;


/**
* Getter for the scopes.
* @return the scopes.
*/
@JsonProperty("scopes")
public List<String> getScopes() {
return scopes;
}

/**
* Setter for the scopes.
* @param scopes the scopes to set.
*/
@JsonProperty("scopes")
public void setScopes(List<String> scopes) {
this.scopes = scopes;
}

/**
* Getter for the token lifetime.
* @return the token lifetime.
*/
@JsonProperty("token_lifetime")
public int getTokenLifetime() {
return tokenLifetime;
}

/**
* Setter for the token lifetime.
* @param tokenLifetime the token lifetime to set.
*/
@JsonProperty("token_lifetime")
public void setTokenLifetime(int tokenLifetime) {
this.tokenLifetime = tokenLifetime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class SelfServiceProfile {
private Branding branding;
@JsonProperty("allowed_strategies")
private List<String> allowedStrategies;
@JsonProperty("user_attribute_profile_id")
private String userAttributeProfileId;

/**
* Getter for the name of the self-service profile.
Expand Down Expand Up @@ -100,4 +102,20 @@ public List<String> getAllowedStrategies() {
public void setAllowedStrategies(List<String> allowedStrategies) {
this.allowedStrategies = allowedStrategies;
}

/**
* Getter for user attribute profile ID.
* @return the user attribute profile ID.
*/
public String getUserAttributeProfileId() {
return userAttributeProfileId;
}

/**
* Setter for user attribute profile ID.
* @param userAttributeProfileId the user attribute profile ID to set.
*/
public void setUserAttributeProfileId(String userAttributeProfileId) {
this.userAttributeProfileId = userAttributeProfileId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class SsoAccessTicketRequest {
private int ttlSec;
@JsonProperty("domain_aliases_config")
private DomainAliasesConfig domainAliasesConfig;
@JsonProperty("provisioning_config")
private ProvisioningConfig provisioningConfig;

/**
* Creates a new instance.
Expand Down Expand Up @@ -118,4 +120,20 @@ public DomainAliasesConfig getDomainAliasesConfig() {
public void setDomainAliasesConfig(DomainAliasesConfig domainAliasesConfig) {
this.domainAliasesConfig = domainAliasesConfig;
}

/**
* Getter for the provisioning configuration.
* @return the provisioning configuration.
*/
public ProvisioningConfig getProvisioningConfig() {
return provisioningConfig;
}

/**
* Setter for the provisioning configuration.
* @param provisioningConfig the provisioning configuration to set.
*/
public void setProvisioningConfig(ProvisioningConfig provisioningConfig) {
this.provisioningConfig = provisioningConfig;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.auth0.json.mgmt.userAttributeProfiles;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListUserAttributeProfile {
@JsonProperty("user_attribute_profiles")
private List<UserAttributeProfile> userAttributeProfiles;

@JsonProperty("next")
private String next;

/**
* Gets the user attribute profiles.
* @return the user attribute profiles
*/
@JsonProperty("user_attribute_profiles")
public List<UserAttributeProfile> getUserAttributeProfiles() {
return userAttributeProfiles;
}

/**
* Sets the user attribute profiles.
* @param userAttributeProfiles the user attribute profiles
*/
@JsonProperty("user_attribute_profiles")
public void setUserAttributeProfiles(List<UserAttributeProfile> userAttributeProfiles) {
this.userAttributeProfiles = userAttributeProfiles;
}

@JsonProperty("next")
public String getNext() {
return next;
}

@JsonProperty("next")
public void setNext(String next) {
this.next = next;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.auth0.json.mgmt.userAttributeProfiles;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListUserAttributeProfileTemplate {
@JsonProperty("user_attribute_profile_templates")
private List<UserAttributeProfileTemplate> userAttributeProfileTemplateResponses;

/**
* Gets the user attribute profile templates
* @return the user attribute profile templates
*/
@JsonProperty("user_attribute_profile_templates")
public List<UserAttributeProfileTemplate> getUserAttributeProfileTemplates() {
return userAttributeProfileTemplateResponses;
}

/**
* Sets the user attribute profile templates
* @param userAttributeProfileTemplateResponses the user attribute profile templates
*/
@JsonProperty("user_attribute_profile_templates")
public void setUserAttributeProfileTemplates(List<UserAttributeProfileTemplate> userAttributeProfileTemplateResponses) {
this.userAttributeProfileTemplateResponses = userAttributeProfileTemplateResponses;
}
}
Loading