Package org.keycloak.ipatuura_user_spi
Class IpatuuraUserStorageProvider
java.lang.Object
org.keycloak.ipatuura_user_spi.IpatuuraUserStorageProvider
- All Implemented Interfaces:
CredentialAuthentication,CredentialInputValidator,Provider,ImportedUserValidation,UserCountMethodsProvider,UserLookupProvider,UserQueryMethodsProvider,UserQueryProvider,UserRegistrationProvider,UserStorageProvider
public class IpatuuraUserStorageProvider
extends Object
implements UserStorageProvider, UserLookupProvider, CredentialInputValidator, CredentialAuthentication, UserRegistrationProvider, UserQueryProvider, ImportedUserValidation
- Version:
- $Revision: 1 $
- Author:
- Justin Stephenson
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.storage.UserStorageProvider
UserStorageProvider.EditMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IpatuuraUserStorageProviderFactoryprotected Ipatuuraprotected ComponentModelprotected KeycloakSession -
Constructor Summary
ConstructorsConstructorDescriptionIpatuuraUserStorageProvider(KeycloakSession session, ComponentModel model, Ipatuura ipatuura, IpatuuraUserStorageProviderFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionaddUser(RealmModel realm, String username) All storage providers that implement this interface will be looped through.authenticate(RealmModel realm, CredentialInput input) voidclose()protected UserModelcreateUserInKeycloak(RealmModel realm, String username) getGroupMembersStream(RealmModel arg0, GroupModel arg1, Integer arg2, Integer arg3) Obtains users that belong to a specific group.getUserByEmail(RealmModel realm, String email) Returns a user with the given email belonging to the realmgetUserById(RealmModel realm, String id) Returns a user with the given id belonging to the realmgetUserByUsername(RealmModel realm, String username) Exact search for a user by its username.intgetUsersCount(RealmModel realm) Returns the number of users, without consider any service account.booleanisConfiguredFor(RealmModel realm, UserModel user, String credentialType) booleanisValid(RealmModel realm, UserModel user, CredentialInput input) Tests whether a credential is validbooleanremoveUser(RealmModel realm, UserModel user) Called if user originated from this provider.searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue) Searches for users that have a specific attribute with a specific value.searchForUserStream(RealmModel realm, Map<String, String> params, Integer firstResult, Integer maxResults) Searches for user by parameter.booleanbooleansupportsCredentialType(String credentialType) validate(RealmModel realm, UserModel local) If this method returns null, then the user in local storage will be removedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.storage.user.UserCountMethodsProvider
getUsersCount, getUsersCount, getUsersCount, getUsersCount, getUsersCount, getUsersCountMethods inherited from interface org.keycloak.storage.user.UserLookupProvider
getUserByCredentialMethods inherited from interface org.keycloak.storage.user.UserQueryMethodsProvider
getGroupMembersStream, getGroupMembersStream, getRoleMembersStream, getRoleMembersStream, searchForUserStream, searchForUserStream, searchForUserStreamMethods inherited from interface org.keycloak.storage.UserStorageProvider
preRemove, preRemove, preRemove
-
Field Details
-
session
-
model
-
ipatuura
-
supportedCredentialTypes
-
factory
-
-
Constructor Details
-
IpatuuraUserStorageProvider
public IpatuuraUserStorageProvider(KeycloakSession session, ComponentModel model, Ipatuura ipatuura, IpatuuraUserStorageProviderFactory factory)
-
-
Method Details
-
getUserByEmail
Description copied from interface:UserLookupProviderReturns a user with the given email belonging to the realm- Specified by:
getUserByEmailin interfaceUserLookupProvider- Parameters:
realm- the realm modelemail- email address- Returns:
- found user model, or
nullif no such user exists
-
getUserById
Description copied from interface:UserLookupProviderReturns a user with the given id belonging to the realm- Specified by:
getUserByIdin interfaceUserLookupProvider- Parameters:
realm- the realm modelid- id of the user- Returns:
- found user model, or
nullif no such user exists
-
getUserByUsername
Description copied from interface:UserLookupProviderExact search for a user by its username. Returns a user with the given username belonging to the realm- Specified by:
getUserByUsernamein interfaceUserLookupProvider- Parameters:
realm- the realm modelusername- (case-sensitivity is controlled by storage)- Returns:
- found user model, or
nullif no such user exists
-
createUserInKeycloak
-
close
public void close() -
getSupportedCredentialTypes
-
isConfiguredFor
- Specified by:
isConfiguredForin interfaceCredentialInputValidator
-
supportsCredentialType
- Specified by:
supportsCredentialTypein interfaceCredentialInputValidator
-
isValid
Description copied from interface:CredentialInputValidatorTests whether a credential is valid- Specified by:
isValidin interfaceCredentialInputValidator- Parameters:
realm- The realm in which to which the credential belongs touser- The user for which to test the credentialinput- the credential details to verify- Returns:
- true if the passed secret is correct
-
validate
Description copied from interface:ImportedUserValidationIf this method returns null, then the user in local storage will be removed- Specified by:
validatein interfaceImportedUserValidation- Returns:
- null if user no longer valid
-
addUser
Description copied from interface:UserRegistrationProviderAll storage providers that implement this interface will be looped through. If this method returns null, then the next storage provider's addUser() method will be called. If no storage providers handle the add, then the user will be created in local storage. Returning null is useful when you want optional support for adding users. For example, our LDAP provider can enable and disable the ability to add users.- Specified by:
addUserin interfaceUserRegistrationProvider- Parameters:
realm- a reference to the realmusername- a username the created user will be assigned- Returns:
- a model of created user
-
removeUser
Description copied from interface:UserRegistrationProviderCalled if user originated from this provider. If a local user is linked to this provider, this method will be called before local storage's removeUser() method is invoked. If you are using an import strategy, and this is a local user linked to this provider, this method will be called before local storage's removeUser() method is invoked. Also, you DO NOT need to remove the imported user. The runtime will handle this for you.- Specified by:
removeUserin interfaceUserRegistrationProvider- Parameters:
realm- a reference to the realmuser- a reference to the user that is removed- Returns:
- true if the user was removed, false otherwise
-
getGroupMembersStream
public Stream<UserModel> getGroupMembersStream(RealmModel arg0, GroupModel arg1, Integer arg2, Integer arg3) Description copied from interface:UserQueryMethodsProviderObtains users that belong to a specific group.- Specified by:
getGroupMembersStreamin interfaceUserQueryMethodsProvider- Parameters:
arg0- a reference to the realm.arg1- a reference to the group.arg2- first result to return. Ignored if negative, zero, ornull.arg3- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that belong to the group.
-
getUsersCount
Description copied from interface:UserCountMethodsProviderReturns the number of users, without consider any service account.- Specified by:
getUsersCountin interfaceUserCountMethodsProvider- Parameters:
realm- the realm- Returns:
- the number of users
-
searchForUserByUserAttributeStream
public Stream<UserModel> searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue) Description copied from interface:UserQueryMethodsProviderSearches for users that have a specific attribute with a specific value.- Specified by:
searchForUserByUserAttributeStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.attrName- the attribute name.attrValue- the attribute value.- Returns:
- a non-null
Streamof users that match the search criteria.
-
searchForUserStream
public Stream<UserModel> searchForUserStream(RealmModel realm, Map<String, String> params, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProviderSearches for user by parameter. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). Valid parameters are:UserModel.SEARCH- search for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace, whenSEARCHis set all other params are ignoredUserModel.FIRST_NAME- first name (case insensitive string)UserModel.LAST_NAME- last name (case insensitive string)UserModel.EMAIL- email (case insensitive string)UserModel.USERNAME- username (case insensitive string)UserModel.EXACT- whether search with FIRST_NAME, LAST_NAME, USERNAME or EMAIL should be exact matchUserModel.EMAIL_VERIFIED- search only for users with verified/non-verified email (true/false)UserModel.ENABLED- search only for enabled/disabled users (true/false)UserModel.IDP_ALIAS- search only for users that have a federated identity from idp with the given alias configured (case sensitive string)UserModel.IDP_USER_ID- search for users with federated identity with the given userId (case sensitive string)
Any other parameters will be treated as custom user attributes.
This method is used by the REST API when querying users.
- Specified by:
searchForUserStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.params- a map containing the search parameters.firstResult- first result to return. Ignored if negative, zero, ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that match the search criteria.
-
supportsCredentialAuthenticationFor
- Specified by:
supportsCredentialAuthenticationForin interfaceCredentialAuthentication
-
authenticate
- Specified by:
authenticatein interfaceCredentialAuthentication
-