Package com.auth0.client.mgmt
Class RolesEntity
java.lang.Object
com.auth0.client.mgmt.RolesEntity
Class that provides an implementation of the Roles methods of the Management API as defined in https://auth0.com/docs/api/management/v2#!/Roles/
This class is not thread-safe.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final okhttp3.HttpUrl
protected final Auth0HttpClient
protected final TokenProvider
-
Method Summary
Modifier and TypeMethodDescriptionaddPermissions
(String roleId, List<Permission> permissions) Associate permissions with a role.assignUsers
(String roleId, List<String> userIds) Assign users to a role.Create a Role.Delete an existing Role.Get a single role created by this tenant that can be assigned to a given user or user group.list
(RolesFilter filter) Request all Roles created by this tenant that can be assigned to a given user or user group.listPermissions
(String roleId, PageFilter filter) Get the permissions associated to the role.listUsers
(String roleId, PageFilter filter) Lists the users that have been associated with a given role.removePermissions
(String roleId, List<Permission> permissions) Un-associate permissions from a role.protected <T> Request<T>
request
(HttpMethod method, com.fasterxml.jackson.core.type.TypeReference<T> target, Consumer<com.auth0.client.mgmt.RequestBuilder<T>> customizer) Update an existing Role.voidRequest
(HttpMethod method, Consumer<com.auth0.client.mgmt.RequestBuilder<Void>> customizer)
-
Field Details
-
client
-
baseUrl
protected final okhttp3.HttpUrl baseUrl -
tokenProvider
-
-
Method Details
-
list
Request all Roles created by this tenant that can be assigned to a given user or user group. A token with read:roles is needed See https://auth0.com/docs/api/management/v2#!/Roles/get_roles- Parameters:
filter
- optional filtering and pagination criteria- Returns:
- a Request to execute
-
get
Get a single role created by this tenant that can be assigned to a given user or user group. A token with scope read:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/get_roles_by_id- Parameters:
roleId
- the id of the user to retrieve.- Returns:
- a Request to execute.
-
create
Create a Role. A token with scope create:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/post_roles- Parameters:
role
- the role data to set- Returns:
- a Request to execute.
-
delete
Delete an existing Role. A token with scope delete:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/delete_roles_by_id- Parameters:
roleId
- The id of the role to delete.- Returns:
- a Request to execute.
-
update
Update an existing Role. A token with scope update:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/patch_roles_by_id- Parameters:
roleId
- the role idrole
- the role data to set. It can't include id.- Returns:
- a Request to execute.
-
listUsers
Lists the users that have been associated with a given role. A token with scope read:users and read:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/get_role_user- Parameters:
roleId
- the role idfilter
- an optional pagination filter- Returns:
- a Request to execute
-
assignUsers
Assign users to a role. A token with update:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/post_role_users- Parameters:
roleId
- the role iduserIds
- a list of user ids to assign to the role- Returns:
- a Request to execute.
-
listPermissions
Get the permissions associated to the role. A token with read:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/get_permissions- Parameters:
roleId
- the role idfilter
- an optional pagination filter- Returns:
- a Request to execute
-
removePermissions
Un-associate permissions from a role. A token with update:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/delete_role_permission_assignment- Parameters:
roleId
- the role idpermissions
- a list of permission objects to un-associate from the role- Returns:
- a Request to execute
-
addPermissions
Associate permissions with a role. Only the `permission_name` and `resource_server_identifier` Permission attributes should be specified. A token with update:roles is needed. See https://auth0.com/docs/api/management/v2#!/Roles/post_role_permission_assignment- Parameters:
roleId
- the role idpermissions
- a list of permission objects to associate to the role- 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)
-