public class UsersResource extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.keycloak.common.ClientConnection |
clientConnection |
protected javax.ws.rs.core.HttpHeaders |
headers |
protected static org.jboss.logging.Logger |
logger |
protected BruteForceProtector |
protector |
protected RealmModel |
realm |
protected KeycloakSession |
session |
protected javax.ws.rs.core.UriInfo |
uriInfo |
| Constructor and Description |
|---|
UsersResource(RealmModel realm,
RealmAuth auth,
TokenManager tokenManager,
AdminEventBuilder adminEvent) |
| Modifier and Type | Method and Description |
|---|---|
javax.ws.rs.core.Response |
addFederatedIdentity(String id,
String provider,
FederatedIdentityRepresentation rep)
Add a social login provider to the user
|
javax.ws.rs.core.Response |
createUser(javax.ws.rs.core.UriInfo uriInfo,
UserRepresentation rep)
Create a new user
Username must be unique.
|
javax.ws.rs.core.Response |
deleteUser(String id)
Delete the user
|
javax.ws.rs.core.Response |
executeActionsEmail(String id,
String redirectUri,
String clientId,
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(String id)
Get consents granted by the user
|
List<FederatedIdentityRepresentation> |
getFederatedIdentity(String id)
Get social logins associated with the user
|
RoleMapperResource |
getRoleMappings(String id) |
List<UserSessionRepresentation> |
getSessions(String id)
Get sessions associated with the user
|
List<UserSessionRepresentation> |
getSessions(String id,
String clientId)
Get offline sessions associated with the user and client
|
UserRepresentation |
getUser(String id)
Get represenation of the user
|
List<UserRepresentation> |
getUsers(String search,
String last,
String first,
String email,
String username,
Integer firstResult,
Integer maxResults)
Get users
Returns a list of users, filtered according to query parameters
|
List<GroupRepresentation> |
groupMembership(String id) |
Map<String,Object> |
impersonate(String id)
Impersonate the user
|
void |
joinGroup(String id,
String groupId) |
void |
logout(String id)
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 id,
String provider)
Remove a social login provider from user
|
void |
removeMembership(String id,
String groupId) |
void |
removeTotp(String id)
Remove TOTP from the user
|
void |
resetPassword(String id,
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 id,
String redirectUri,
String clientId)
Deprecated.
|
void |
revokeConsent(String id,
String clientId)
Revoke consent and offline tokens for particular client from user
|
javax.ws.rs.core.Response |
sendVerifyEmail(String id,
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(String id,
UserRepresentation rep)
Update the user
|
static void |
updateUserFromRep(UserModel user,
UserRepresentation rep,
Set<String> attrsToRemove,
RealmModel realm,
KeycloakSession session) |
protected static final org.jboss.logging.Logger logger
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
@Context protected BruteForceProtector protector
public UsersResource(RealmModel realm, RealmAuth auth, TokenManager tokenManager, AdminEventBuilder adminEvent)
public javax.ws.rs.core.Response updateUser(String id, UserRepresentation rep)
id - User idrep - public javax.ws.rs.core.Response createUser(@Context
javax.ws.rs.core.UriInfo uriInfo,
UserRepresentation rep)
uriInfo - rep - public static void updateUserFromRep(UserModel user, UserRepresentation rep, Set<String> attrsToRemove, RealmModel realm, KeycloakSession session)
public UserRepresentation getUser(String id)
id - User idpublic Map<String,Object> impersonate(String id)
id - User idpublic List<UserSessionRepresentation> getSessions(String id)
id - User idpublic List<UserSessionRepresentation> getSessions(String id, String clientId)
id - User idpublic List<FederatedIdentityRepresentation> getFederatedIdentity(String id)
id - User idpublic javax.ws.rs.core.Response addFederatedIdentity(String id, String provider, FederatedIdentityRepresentation rep)
id - User idprovider - Social login provider idrep - public void removeFederatedIdentity(String id, String provider)
id - User idprovider - Social login provider idpublic List<Map<String,Object>> getConsents(String id)
id - User idpublic void revokeConsent(String id, String clientId)
id - User idclientId - Client idpublic void logout(String id)
id - User idpublic javax.ws.rs.core.Response deleteUser(String id)
id - User idpublic List<UserRepresentation> getUsers(String search, String last, String first, String email, String username, Integer firstResult, Integer maxResults)
search - A String contained in username, first or last name, or emaillast - first - email - username - first - Pagination offsetmaxResults - Pagination sizepublic RoleMapperResource getRoleMappings(String id)
public void resetPassword(String id, CredentialRepresentation pass)
id - User idpass - A Temporary passwordpublic void removeTotp(String id)
id - User id@Deprecated public javax.ws.rs.core.Response resetPasswordEmail(String id, String redirectUri, String clientId)
id - redirectUri - redirect uriclientId - client idpublic javax.ws.rs.core.Response executeActionsEmail(String id, String redirectUri, String clientId, List<String> actions)
id - User isredirectUri - Redirect uriclientId - Client idactions - required actions the user needs to completepublic javax.ws.rs.core.Response sendVerifyEmail(String id, String redirectUri, String clientId)
id - User idredirectUri - Redirect uriclientId - Client idpublic List<GroupRepresentation> groupMembership(String id)
Copyright © 2016 JBoss by Red Hat. All rights reserved.