Package com.auth0.client.mgmt
Class UsersEntity
java.lang.Object
com.auth0.client.mgmt.UsersEntity
Class that provides an implementation of the Users methods of the Management API as defined in https://auth0.com/docs/api/management/v2#!/Users and https://auth0.com/docs/api/management/v2#!/Users_By_Email
This class is not thread-safe.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final okhttp3.HttpUrlprotected final Auth0HttpClientprotected final TokenProvider -
Method Summary
Modifier and TypeMethodDescriptionaddPermissions(String userId, List<Permission> permissions) Assign permissions to a user.Assign roles to a user.Create a User.createAuthenticationMethods(String userId, AuthenticationMethod authenticationMethod) Create an authentication method for a given user.Delete an existing User.deleteAllAuthenticationMethods(String userId) Deletes all authentication methods for the given user.deleteAllAuthenticators(String userId) Delete all an user's authenticators.deleteAuthenticationMethodById(String userId, String authenticationMethodId) Deletes an authentication method by ID.deleteMultifactorProvider(String userId, String provider) Delete an existing User's Multifactor Provider.deleteRefreshTokens(String userId) Delete all refresh tokens for a user.deleteSessions(String userId) Delete sessions for user A token with scopedelete:sessionsis needed.get(String userId, UserFilter filter) Request a User.getAuthenticationMethodById(String userId, String authenticationMethodId) Gets an authentication method by ID.getAuthenticationMethods(String userId, PageFilter filter) Get the authentication methods of the user.getEnrollments(String userId) Retreive the first confirmed enrollment, or a pending enrollment if none are confirmed.getLogEvents(String userId, LogEventFilter filter) Request all the Events Log for a given User.getOrganizations(String userId, PageFilter filter) Get the organizations a user belongs to.invalidateRememberedBrowsers(String userId) Invalidate all remembered browsers across all authentication factors for a user.linkIdentity(String primaryUserId, String secondaryIdToken) A token with scope update:current_user_identities is needed.linkIdentity(String primaryUserId, String secondaryUserId, String provider, String connectionId) Links two User's Identities.list(UserFilter filter) Request all the Users.listByEmail(String email, FieldsFilter filter) Request all the Users that match a given email.listPermissions(String userId, PageFilter filter) Get the permissions associated to the user.listRefreshTokens(String userId, PageFilter filter) Get refresh tokens for a user A token withread:refresh_tokensis needed.listRoles(String userId, PageFilter filter) Get the roles associated with a user.listSessions(String userId, PageFilter filter) Get sessions for user A token withread:sessionsis needed.removePermissions(String userId, List<Permission> permissions) Remove permissions from a user.removeRoles(String userId, List<String> roleIds) Remove roles from a user.protected <T> Request<T>request(HttpMethod method, com.fasterxml.jackson.core.type.TypeReference<T> target, Consumer<com.auth0.client.mgmt.RequestBuilder<T>> customizer) rotateRecoveryCode(String userId) Rotates a User's Guardian recovery code.unlinkIdentity(String primaryUserId, String secondaryUserId, String provider) Un-links two User's Identities.Update an existing User.updateAuthenticationMethodById(String userId, String authenticationMethodId, AuthenticationMethod authenticationMethod) Updates an authentication method.updateAuthenticationMethods(String userId, List<AuthenticationMethod> authenticationMethods) Updates an authentication method for a given user.voidRequest(HttpMethod method, Consumer<com.auth0.client.mgmt.RequestBuilder<Void>> customizer)
-
Field Details
-
client
-
baseUrl
protected final okhttp3.HttpUrl baseUrl -
tokenProvider
-
-
Method Details
-
listByEmail
Request all the Users that match a given email. A token with scope read:users is needed. If you want the identities.access_token property to be included, you will also need the scope read:user_idp_tokens. See https://auth0.com/docs/api/management/v2#!/Users_By_Email/get_users_by_email- Parameters:
email- the email of the users to look up.filter- the filter to use. Can be null.- Returns:
- a Request to execute.
-
list
Request all the Users. A token with scope read:users is needed. If you want the identities.access_token property to be included, you will also need the scope read:user_idp_tokens. See https://auth0.com/docs/api/management/v2#!/Users/get_users- Parameters:
filter- the filter to use. Can be null.- Returns:
- a Request to execute.
-
get
Request a User. A token with scope read:users is needed. If you want the identities.access_token property to be included, you will also need the scope read:user_idp_tokens. See https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id- Parameters:
userId- the id of the user to retrieve.filter- the filter to use. Can be null.- Returns:
- a Request to execute.
-
create
Create a User. A token with scope create:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/post_users- Parameters:
user- the user data to set- Returns:
- a Request to execute.
-
delete
Delete an existing User. A token with scope delete:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/delete_users_by_id- Parameters:
userId- the user id- Returns:
- a Request to execute.
-
update
Update an existing User. A token with scope update:users is needed. If you're updating app_metadata you'll also need update:users_app_metadata scope. See https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id- Parameters:
userId- the user iduser- the user data to set. It can't include id.- Returns:
- a Request to execute.
-
getEnrollments
Retreive the first confirmed enrollment, or a pending enrollment if none are confirmed. A token with scope read:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/get_enrollments- Parameters:
userId- the id of the user to retrieve.- Returns:
- a Request to execute.
-
getLogEvents
Request all the Events Log for a given User. A token with scope read:logs is needed. See https://auth0.com/docs/api/management/v2#!/Users/get_logs_by_user- Parameters:
userId- the id of the user to retrieve.filter- the filter to use.- Returns:
- a Request to execute.
-
deleteAllAuthenticators
Delete all an user's authenticators. A token with scope delete:guardian_enrollments is needed. See API docs- Parameters:
userId- the user id- Returns:
- a Request to execute.
-
deleteMultifactorProvider
Delete an existing User's Multifactor Provider. A token with scope update:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/delete_multifactor_by_provider- Parameters:
userId- the user idprovider- the multifactor provider- Returns:
- a Request to execute.
-
rotateRecoveryCode
Rotates a User's Guardian recovery code. A token with scope update:users is needed.- Parameters:
userId- the user id- Returns:
- a Request to execute.
- See Also:
-
linkIdentity
public Request<List<Identity>> linkIdentity(String primaryUserId, String secondaryUserId, String provider, String connectionId) Links two User's Identities. A token with scope update:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/post_identities- Parameters:
primaryUserId- the primary identity's user idsecondaryUserId- the secondary identity's user idprovider- the provider name of the secondary identity.connectionId- the connection id of the secondary account being linked, useful if the provider is 'auth0' and you have several connections. Can be null.- Returns:
- a Request to execute.
-
linkIdentity
A token with scope update:current_user_identities is needed. It only works for the user the access token represents. See https://auth0.com/docs/api/management/v2#!/Users/post_identities- Parameters:
primaryUserId- the primary identity's user id associated with the access token this client was configured with.secondaryIdToken- the user ID token representing the identity to link with the current user- Returns:
- a Request to execute.
-
unlinkIdentity
public Request<List<Identity>> unlinkIdentity(String primaryUserId, String secondaryUserId, String provider) Un-links two User's Identities. A token with scope update:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/delete_provider_by_user_id- Parameters:
primaryUserId- the primary identity's user idsecondaryUserId- the secondary identity's user idprovider- the provider name of the secondary identity.- Returns:
- a Request to execute.
-
invalidateRememberedBrowsers
Invalidate all remembered browsers across all authentication factors for a user. A token with scopeupdate:usersis required.- Parameters:
userId- the ID of the user to invalidate all remembered browsers and authentication factors for.- See Also:
-
listPermissions
Get the permissions associated to the user. A token with read:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/get_permissions- Parameters:
userId- the role idfilter- an optional pagination filter- Returns:
- a Request to execute
-
removePermissions
Remove permissions from a user. A token with update:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/delete_permissions- Parameters:
userId- the user idpermissions- a list of permission objects to remove from the user- Returns:
- a Request to execute
-
addPermissions
Assign permissions to a user. A token with update:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/post_permissions- Parameters:
userId- the user idpermissions- a list of permission objects to assign to the user- Returns:
- a Request to execute
-
listRoles
Get the roles associated with a user. A token with read:users and read:roles is needed. See https://auth0.com/docs/api/management/v2#!/Users/get_user_roles- Parameters:
userId- the role idfilter- an optional pagination filter- Returns:
- a Request to execute
-
removeRoles
Remove roles from a user. A token with update:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/delete_user_roles- Parameters:
userId- the user idroleIds- a list of role ids to remove from the user- Returns:
- a Request to execute
-
addRoles
Assign roles to a user. A token with update:users is needed. See https://auth0.com/docs/api/management/v2#!/Users/post_user_roles- Parameters:
userId- the user idroleIds- a list of role ids to assign to the user- Returns:
- a Request to execute
-
getOrganizations
Get the organizations a user belongs to. A token withread:usersandread:organizationsis required.- Parameters:
userId- the user IDfilter- an optional pagination filter- Returns:
- a Request to execute
- See Also:
-
getAuthenticationMethods
public Request<AuthenticationMethodsPage> getAuthenticationMethods(String userId, PageFilter filter) Get the authentication methods of the user. A token withread:authentication_methodsis required.- Parameters:
userId- the user IDfilter- an optional pagination filter- Returns:
- a Request to execute
- See Also:
-
createAuthenticationMethods
public Request<AuthenticationMethod> createAuthenticationMethods(String userId, AuthenticationMethod authenticationMethod) Create an authentication method for a given user. A token with scopecreate:authentication_methodsis needed.- Parameters:
userId- the user to add authentication method toauthenticationMethod- the authentication method to be created- Returns:
- a Request to execute.
- See Also:
-
updateAuthenticationMethods
public Request<List<AuthenticationMethod>> updateAuthenticationMethods(String userId, List<AuthenticationMethod> authenticationMethods) Updates an authentication method for a given user. A token with scopeupdate:authentication_methodsis needed.- Parameters:
userId- the user to update authentication methodauthenticationMethods- the list of authentication method information to be updated- Returns:
- a Request to execute.
- See Also:
-
getAuthenticationMethodById
public Request<AuthenticationMethod> getAuthenticationMethodById(String userId, String authenticationMethodId) Gets an authentication method by ID. A token with scoperead:authentication_methodsis needed.- Parameters:
userId- the user to get authentication method forauthenticationMethodId- the authentication method to be fetched- Returns:
- a Request to execute.
- See Also:
-
deleteAuthenticationMethodById
Deletes an authentication method by ID. A token with scopedelete:authentication_methodsis needed.- Parameters:
userId- the user to delete the authentication method forauthenticationMethodId- the authentication method to be deleted- Returns:
- a Request to execute.
- See Also:
-
deleteAllAuthenticationMethods
Deletes all authentication methods for the given user. A token with scopedelete:authentication_methodsis needed.- Parameters:
userId- the user to delete the authentication method for- Returns:
- a Request to execute.
- See Also:
-
updateAuthenticationMethodById
public Request<AuthenticationMethod> updateAuthenticationMethodById(String userId, String authenticationMethodId, AuthenticationMethod authenticationMethod) Updates an authentication method. A token with scopeupdate:authentication_methodsis needed.- Parameters:
userId- the user to delete the authentication method forauthenticationMethodId- the authentication method to be deletedauthenticationMethod- the information to be updated- Returns:
- a Request to execute.
- See Also:
-
listRefreshTokens
Get refresh tokens for a user A token withread:refresh_tokensis needed. See https://auth0.com/docs/api/management/v2/users/get-refresh-tokens-for-user- Parameters:
userId- the role idfilter- an optional pagination filter- Returns:
- a Request to execute
-
deleteRefreshTokens
Delete all refresh tokens for a user. A token with scopedelete:refresh_tokensis needed. See https://auth0.com/docs/api/management/v2/users/delete-refresh-tokens-for-user- Parameters:
userId- the user to delete the refresh tokens for- Returns:
- a Request to execute.
-
listSessions
Get sessions for user A token withread:sessionsis needed. See https://auth0.com/docs/api/management/v2/users/get-sessions-for-user- Parameters:
userId- the role idfilter- an optional pagination filter- Returns:
- a Request to execute
-
deleteSessions
Delete sessions for user A token with scopedelete:sessionsis needed. See https://auth0.com/docs/api/management/v2/users/delete-sessions-for-user- Parameters:
userId- the user to delete the sessions for- Returns:
- a Request to execute.
-
voidRequest
protected Request<Void> voidRequest(HttpMethod method, Consumer<com.auth0.client.mgmt.RequestBuilder<Void>> customizer) -
request
protected <T> Request<T> request(HttpMethod method, com.fasterxml.jackson.core.type.TypeReference<T> target, Consumer<com.auth0.client.mgmt.RequestBuilder<T>> customizer)
-