Package org.keycloak.models.jpa
Class JpaIdentityProviderStorageProvider
java.lang.Object
org.keycloak.models.jpa.JpaIdentityProviderStorageProvider
- All Implemented Interfaces:
IdentityProviderStorageProvider
,Provider
public class JpaIdentityProviderStorageProvider
extends Object
implements IdentityProviderStorageProvider
A JPA based implementation of
IdentityProviderStorageProvider
.- Author:
- Stefan Guilhen
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.models.IdentityProviderStorageProvider
IdentityProviderStorageProvider.FetchMode, IdentityProviderStorageProvider.LoginFilter
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
long
count()
Returns the number of IDPs in the realm.create
(IdentityProviderModel identityProvider) Creates a new identity provider from the specified model.Creates a new identity provider mapper from the specified model.Returns all identity providers in the realm filtered according to the specified search options.getByAlias
(String alias) Obtains the identity provider with the specified alias.Returns the aliases of all identity providers whosefirstBrokerLoginFlowId
orpostBrokerLoginFlowId
matches the providedflowId
.Obtains the identity provider with the specified internal id.getMapperById
(String id) Obtains the identity provider mapper with the specified id.getMapperByName
(String identityProviderAlias, String name) Obtains the identity provider mapper with the provided identity provider alias and name.getMappersByAliasStream
(String identityProviderAlias) Returns identity provider mappers by the provided alias as a stream.Returns all identity provider mappers in the realm filtered according to the specified search options.boolean
Removes the identity provider with the specified alias.void
Removes all identity providers from the realm.void
Removes all identity provider mappers from the realm.boolean
Removes the given identity provider mapper.void
update
(IdentityProviderModel identityProvider) Updates the identity provider using the specified model.void
Updates the identity provider mapper using the specified model.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.keycloak.models.IdentityProviderStorageProvider
getAllStream, getByIdOrAlias, getByOrganization, getForLogin, getMappersStream, isIdentityFederationEnabled
-
Field Details
-
logger
protected static final org.jboss.logging.Logger logger
-
-
Constructor Details
-
JpaIdentityProviderStorageProvider
-
-
Method Details
-
create
Description copied from interface:IdentityProviderStorageProvider
Creates a new identity provider from the specified model.- Specified by:
create
in interfaceIdentityProviderStorageProvider
- Parameters:
identityProvider
- aIdentityProviderModel
containing the identity provider's data.- Returns:
- the model of the created identity provider.
-
update
Description copied from interface:IdentityProviderStorageProvider
Updates the identity provider using the specified model.- Specified by:
update
in interfaceIdentityProviderStorageProvider
- Parameters:
identityProvider
- aIdentityProviderModel
containing the identity provider's data.
-
remove
Description copied from interface:IdentityProviderStorageProvider
Removes the identity provider with the specified alias.- Specified by:
remove
in interfaceIdentityProviderStorageProvider
- Parameters:
alias
- the alias of the identity provider to be removed.- Returns:
true
if an IDP with the specified alias was found and removed;false
otherwise.
-
removeAll
public void removeAll()Description copied from interface:IdentityProviderStorageProvider
Removes all identity providers from the realm.- Specified by:
removeAll
in interfaceIdentityProviderStorageProvider
-
getById
Description copied from interface:IdentityProviderStorageProvider
Obtains the identity provider with the specified internal id.- Specified by:
getById
in interfaceIdentityProviderStorageProvider
- Parameters:
internalId
- the identity provider's internal id.- Returns:
- a reference to the identity provider, or
null
if no provider is found.
-
getByAlias
Description copied from interface:IdentityProviderStorageProvider
Obtains the identity provider with the specified alias.- Specified by:
getByAlias
in interfaceIdentityProviderStorageProvider
- Parameters:
alias
- the identity provider's alias.- Returns:
- a reference to the identity provider, or
null
if no provider is found.
-
getAllStream
public Stream<IdentityProviderModel> getAllStream(Map<String, String> attrs, Integer first, Integer max) Description copied from interface:IdentityProviderStorageProvider
Returns all identity providers in the realm filtered according to the specified search options. The options include:- Regular fields found in
IdentityProviderModel
, such asALIAS
,ENABLED
,HIDE_ON_LOGIN
, etc; - Special search keys also present in
IdentityProviderModel
. Those includeSEARCH
, used to perform exact, prefix, and infix searches by alias, andALIAS_NOT_IN
, used to perform searches for identity providers whose alias doesn't match any of the specified aliases (separated by comma); - Any attribute found in the identity provider's config. If the option key doesn't match any of the previous cases, the implementations must search the providers whose config contains a pair that matches the specified search option
- Specified by:
getAllStream
in interfaceIdentityProviderStorageProvider
- Parameters:
attrs
- aMap
containing identity provider search options that must be matched.first
- the position of the first result to be processed (pagination offset). Ignored if negative ornull
.max
- the maximum number of results to be returned. Ignored if negative ornull
.- Returns:
- a non-null stream of
IdentityProviderModel
s that match the search criteria.
- Regular fields found in
-
getByFlow
Description copied from interface:IdentityProviderStorageProvider
Returns the aliases of all identity providers whosefirstBrokerLoginFlowId
orpostBrokerLoginFlowId
matches the providedflowId
.- Specified by:
getByFlow
in interfaceIdentityProviderStorageProvider
- Parameters:
flowId
- the id of the flow.search
- an optionalString
representing an identity provider alias (partial or exact). If the value is enclosed in double quotes, the method treats it as an exact search (e.g."name"
). If the value is enclosed in wildcards, the method treats it as an infix search (e.g.*name*
). Otherwise, the method treats it as a prefix search (i.e.name*
andname
return the same results).first
- the position of the first result to be processed (pagination offset). Ignored if negative ornull
.max
- the maximum number of results to be returned. Ignored if negative ornull
.- Returns:
- a non-null stream of
IdentityProviderModel
s that match the search criteria.
-
count
public long count()Description copied from interface:IdentityProviderStorageProvider
Returns the number of IDPs in the realm.- Specified by:
count
in interfaceIdentityProviderStorageProvider
- Returns:
- the number of IDPs found in the realm.
-
close
public void close() -
createMapper
Description copied from interface:IdentityProviderStorageProvider
Creates a new identity provider mapper from the specified model.- Specified by:
createMapper
in interfaceIdentityProviderStorageProvider
- Parameters:
model
- aIdentityProviderMapperModel
containing the identity provider mapper's data.- Returns:
- the model of the created identity provider mapper.
-
updateMapper
Description copied from interface:IdentityProviderStorageProvider
Updates the identity provider mapper using the specified model.- Specified by:
updateMapper
in interfaceIdentityProviderStorageProvider
- Parameters:
model
- aIdentityProviderMapperModel
containing the identity provider mapper's data.
-
removeMapper
Description copied from interface:IdentityProviderStorageProvider
Removes the given identity provider mapper.- Specified by:
removeMapper
in interfaceIdentityProviderStorageProvider
- Parameters:
model
- aIdentityProviderMapperModel
to be deleted.- Returns:
true
if an identity provider mapper was removed;false
otherwise.
-
removeAllMappers
public void removeAllMappers()Description copied from interface:IdentityProviderStorageProvider
Removes all identity provider mappers from the realm.- Specified by:
removeAllMappers
in interfaceIdentityProviderStorageProvider
-
getMapperById
Description copied from interface:IdentityProviderStorageProvider
Obtains the identity provider mapper with the specified id.- Specified by:
getMapperById
in interfaceIdentityProviderStorageProvider
- Parameters:
id
- the identity provider mapper's id.- Returns:
- a reference to the identity provider mapper, or
null
if no mapper is found.
-
getMapperByName
Description copied from interface:IdentityProviderStorageProvider
Obtains the identity provider mapper with the provided identity provider alias and name.- Specified by:
getMapperByName
in interfaceIdentityProviderStorageProvider
- Parameters:
identityProviderAlias
- the identity provider alias.name
- the identity provider mapper's name.- Returns:
- a reference to the identity provider mapper, or
null
if no provider is found.
-
getMappersStream
public Stream<IdentityProviderMapperModel> getMappersStream(Map<String, String> options, Integer first, Integer max) Description copied from interface:IdentityProviderStorageProvider
Returns all identity provider mappers in the realm filtered according to the specified search options.- Specified by:
getMappersStream
in interfaceIdentityProviderStorageProvider
- Parameters:
options
- aMap
containing identity provider search options that must be matched.first
- the position of the first result to be processed (pagination offset). Ignored if negative ornull
.max
- the maximum number of results to be returned. Ignored if negative ornull
.- Returns:
- a non-null stream of
IdentityProviderModel
s that match the search criteria.
-
getMappersByAliasStream
Description copied from interface:IdentityProviderStorageProvider
Returns identity provider mappers by the provided alias as a stream.- Specified by:
getMappersByAliasStream
in interfaceIdentityProviderStorageProvider
- Parameters:
identityProviderAlias
-String
Identity provider alias to filter results.- Returns:
- Stream of
IdentityProviderMapperModel
Never returnsnull
.
-