public class UserResource extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.keycloak.common.ClientConnection |
clientConnection |
protected javax.ws.rs.core.HttpHeaders |
headers |
protected RealmModel |
realm |
protected KeycloakSession |
session |
protected javax.ws.rs.core.UriInfo |
uriInfo |
| Constructor and Description |
|---|
UserResource(RealmModel realm,
UserModel user,
AdminPermissionEvaluator auth,
AdminEventBuilder adminEvent) |
| Modifier and Type | Method and Description |
|---|---|
javax.ws.rs.core.Response |
addFederatedIdentity(String provider,
FederatedIdentityRepresentation rep)
Add a social login provider to the user
|
javax.ws.rs.core.Response |
deleteUser()
Delete the user
|
void |
disableCredentialType(List<String> credentialTypes)
Disable all credentials for a user of a specific type
|
javax.ws.rs.core.Response |
executeActionsEmail(String redirectUri,
String clientId,
Integer lifespan,
List<String> actions)
Send a update account email to the user
An email contains a link the user can click to perform a set of required actions.
|
List<Map<String,Object>> |
getConsents()
Get consents granted by the user
|
List<FederatedIdentityRepresentation> |
getFederatedIdentity()
Get social logins associated with the user
|
List<UserSessionRepresentation> |
getOfflineSessions(String clientId)
Get offline sessions associated with the user and client
|
RoleMapperResource |
getRoleMappings() |
List<UserSessionRepresentation> |
getSessions()
Get sessions associated with the user
|
UserRepresentation |
getUser()
Get representation of the user
|
List<GroupRepresentation> |
groupMembership() |
Map<String,Object> |
impersonate()
Impersonate the user
|
void |
joinGroup(String groupId) |
void |
logout()
Remove all user sessions associated with the user
Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user.
|
void |
removeFederatedIdentity(String provider)
Remove a social login provider from user
|
void |
removeMembership(String groupId) |
void |
removeTotp()
Remove TOTP from the user
|
void |
resetPassword(CredentialRepresentation pass)
Set up a temporary password for the user
User will have to reset the temporary password next time they log in.
|
javax.ws.rs.core.Response |
resetPasswordEmail(String redirectUri,
String clientId)
Deprecated.
|
void |
revokeConsent(String clientId)
Revoke consent and offline tokens for particular client from user
|
javax.ws.rs.core.Response |
sendVerifyEmail(String redirectUri,
String clientId)
Send an email-verification email to the user
An email contains a link the user can click to verify their email address.
|
javax.ws.rs.core.Response |
updateUser(UserRepresentation rep)
Update the user
|
static void |
updateUserFromRep(UserModel user,
UserRepresentation rep,
Set<String> attrsToRemove,
RealmModel realm,
KeycloakSession session,
boolean removeMissingRequiredActions) |
protected RealmModel realm
@Context protected org.keycloak.common.ClientConnection clientConnection
@Context protected javax.ws.rs.core.UriInfo uriInfo
@Context protected KeycloakSession session
@Context protected javax.ws.rs.core.HttpHeaders headers
public UserResource(RealmModel realm, UserModel user, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent)
@PUT @Consumes(value="application/json") public javax.ws.rs.core.Response updateUser(UserRepresentation rep)
rep - public static void updateUserFromRep(UserModel user, UserRepresentation rep, Set<String> attrsToRemove, RealmModel realm, KeycloakSession session, boolean removeMissingRequiredActions)
@GET @Produces(value="application/json") public UserRepresentation getUser()
@Path(value="impersonation") @POST @Produces(value="application/json") public Map<String,Object> impersonate()
@Path(value="sessions") @GET @Produces(value="application/json") public List<UserSessionRepresentation> getSessions()
@Path(value="offline-sessions/{clientId}")
@GET
@Produces(value="application/json")
public List<UserSessionRepresentation> getOfflineSessions(@PathParam(value="clientId")
String clientId)
@Path(value="federated-identity") @GET @Produces(value="application/json") public List<FederatedIdentityRepresentation> getFederatedIdentity()
@Path(value="federated-identity/{provider}")
@POST
public javax.ws.rs.core.Response addFederatedIdentity(@PathParam(value="provider")
String provider,
FederatedIdentityRepresentation rep)
provider - Social login provider idrep - @Path(value="federated-identity/{provider}")
@DELETE
public void removeFederatedIdentity(@PathParam(value="provider")
String provider)
provider - Social login provider id@Path(value="consents") @GET @Produces(value="application/json") public List<Map<String,Object>> getConsents()
@Path(value="consents/{client}")
@DELETE
public void revokeConsent(@PathParam(value="client")
String clientId)
clientId - Client id@Path(value="logout") @POST public void logout()
@DELETE public javax.ws.rs.core.Response deleteUser()
@Path(value="role-mappings") public RoleMapperResource getRoleMappings()
@Path(value="disable-credential-types") @PUT @Consumes(value="application/json") public void disableCredentialType(List<String> credentialTypes)
credentialTypes - @Path(value="reset-password") @PUT @Consumes(value="application/json") public void resetPassword(CredentialRepresentation pass)
pass - A Temporary password@Path(value="remove-totp") @PUT @Consumes(value="application/json") public void removeTotp()
@Deprecated @Path(value="reset-password-email") @PUT @Consumes(value="application/json") public javax.ws.rs.core.Response resetPasswordEmail(@QueryParam(value="redirect_uri") String redirectUri, @QueryParam(value="client_id") String clientId)
redirectUri - redirect uriclientId - client id@Path(value="execute-actions-email")
@PUT
@Consumes(value="application/json")
public javax.ws.rs.core.Response executeActionsEmail(@QueryParam(value="redirect_uri")
String redirectUri,
@QueryParam(value="client_id")
String clientId,
@QueryParam(value="lifespan")
Integer lifespan,
List<String> actions)
redirectUri - Redirect uriclientId - Client idlifespan - Number of seconds after which the generated token expiresactions - required actions the user needs to complete@Path(value="send-verify-email")
@PUT
@Consumes(value="application/json")
public javax.ws.rs.core.Response sendVerifyEmail(@QueryParam(value="redirect_uri")
String redirectUri,
@QueryParam(value="client_id")
String clientId)
redirectUri - Redirect uriclientId - Client id@GET @Path(value="groups") @Produces(value="application/json") public List<GroupRepresentation> groupMembership()
@DELETE
@Path(value="groups/{groupId}")
public void removeMembership(@PathParam(value="groupId")
String groupId)
@PUT
@Path(value="groups/{groupId}")
public void joinGroup(@PathParam(value="groupId")
String groupId)
Copyright © 2018 JBoss by Red Hat. All rights reserved.