-
Notifications
You must be signed in to change notification settings - Fork 145
Self service provisioning java support #765
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
Merged
tanya732
merged 4 commits into
master
from
sdk-6843-self-service-provisioning-java-support
Sep 29, 2025
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 156 additions & 0 deletions
156
src/main/java/com/auth0/client/mgmt/UserAttributeProfilesEntity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| 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); | ||
|
|
||
| applyFilter(filter, builder); | ||
|
|
||
| String url = builder.build().toString(); | ||
|
|
||
| return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<ListUserAttributeProfile>() { | ||
| }); | ||
| } | ||
|
|
||
| private void applyFilter(UserAttributeProfilesFilter filter, HttpUrl.Builder builder) { | ||
| if (filter != null) { | ||
| filter.getAsMap().forEach((k, v) -> builder.addQueryParameter(k, String.valueOf(v))); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * 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>() { | ||
| }); | ||
| } | ||
| } | ||
17 changes: 17 additions & 0 deletions
17
src/main/java/com/auth0/client/mgmt/filter/UserAttributeProfilesFilter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } |
53 changes: 53 additions & 0 deletions
53
src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ProvisioningConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/com/auth0/json/mgmt/userAttributeProfiles/ListUserAttributeProfile.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ListUserAttributeProfile { | ||
| @JsonProperty("user_attribute_profiles") | ||
| private List<UserAttributeProfile> userAttributeProfiles; | ||
|
|
||
| /** | ||
| * 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; | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
...main/java/com/auth0/json/mgmt/userAttributeProfiles/ListUserAttributeProfileTemplate.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need a separate method for this ,as it is used only from the
getAllmethod ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the method