Package org.keycloak.protocol.oid4vc
Class OID4VCLoginProtocolFactory
java.lang.Object
org.keycloak.protocol.oid4vc.OID4VCLoginProtocolFactory
- All Implemented Interfaces:
LoginProtocolFactory,OID4VCEnvironmentProviderFactory,EnvironmentDependentProviderFactory,ProviderFactory<LoginProtocol>
public class OID4VCLoginProtocolFactory
extends Object
implements LoginProtocolFactory, OID4VCEnvironmentProviderFactory
Factory for creating all OID4VC related endpoints and the default mappers.
- Author:
- Stefan Wiedemann
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientScopeDefaults(ClientScopeRepresentation clientScope) Add default values toClientScopeRepresentations that refer to the specific login-protocolvoidclose()This is called when the server shuts down.create(KeycloakSession session) voidcreateDefaultClientScopes(RealmModel newRealm, boolean addScopesToExistingClients) Called when new realm is createdcreateProtocolEndpoint(KeycloakSession keycloakSession, EventBuilder event) List of built in protocol mappers that can be used to apply to clients.getId()voidinit(Config.Scope config) Only called once when the factory is first created.booleanisValidClientScope(KeycloakSession session, ClientModel client, ClientScopeModel clientScope) Test if the clientScope is valid for particular client.intorder()defines the option-order in the admin-uivoidpostInit(KeycloakSessionFactory factory) Called after all provider factories have been initializedvoidsetupClientDefaults(ClientRepresentation rep, ClientModel newClient) Setup default values for new clients.voidvalidateClientScope(KeycloakSession session, ClientScopeRepresentation clientScope) Invoked during client-scope creation or update to add additional validation hooks specific to target protocol.voidvalidateClientScopeAssignment(KeycloakSession session, ClientScopeModel clientScope, boolean defaultScope, RealmModel realm) Validates whether a client scope can be assigned as Default or Optional to a client or realm.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.protocol.oid4vc.OID4VCEnvironmentProviderFactory
isSupportedMethods inherited from interface org.keycloak.provider.ProviderFactory
dependsOn, getConfigMetadata
-
Field Details
-
PROTOCOL_ID
- See Also:
-
-
Constructor Details
-
OID4VCLoginProtocolFactory
public OID4VCLoginProtocolFactory()
-
-
Method Details
-
init
Description copied from interface:ProviderFactoryOnly called once when the factory is first created.- Specified by:
initin interfaceProviderFactory<LoginProtocol>
-
postInit
Description copied from interface:ProviderFactoryCalled after all provider factories have been initialized- Specified by:
postInitin interfaceProviderFactory<LoginProtocol>
-
close
public void close()Description copied from interface:ProviderFactoryThis is called when the server shuts down.- Specified by:
closein interfaceProviderFactory<LoginProtocol>
-
getBuiltinMappers
Description copied from interface:LoginProtocolFactoryList of built in protocol mappers that can be used to apply to clients.- Specified by:
getBuiltinMappersin interfaceLoginProtocolFactory- Returns:
-
createProtocolEndpoint
- Specified by:
createProtocolEndpointin interfaceLoginProtocolFactory
-
createDefaultClientScopes
Description copied from interface:LoginProtocolFactoryCalled when new realm is created- Specified by:
createDefaultClientScopesin interfaceLoginProtocolFactoryaddScopesToExistingClients- If true, then existing realm clients will be updated (created realm default scopes will be added to them)
-
setupClientDefaults
Description copied from interface:LoginProtocolFactorySetup default values for new clients. This expects that the representation has already set up the client- Specified by:
setupClientDefaultsin interfaceLoginProtocolFactory
-
addClientScopeDefaults
Description copied from interface:LoginProtocolFactoryAdd default values toClientScopeRepresentations that refer to the specific login-protocol- Specified by:
addClientScopeDefaultsin interfaceLoginProtocolFactory
-
validateClientScope
public void validateClientScope(KeycloakSession session, ClientScopeRepresentation clientScope) throws ErrorResponseException Description copied from interface:LoginProtocolFactoryInvoked during client-scope creation or update to add additional validation hooks specific to target protocol. May throw errorResponseException in case- Specified by:
validateClientScopein interfaceLoginProtocolFactory- Parameters:
session- Keycloak sessionclientScope- client scope to create or update- Throws:
ErrorResponseException
-
isValidClientScope
public boolean isValidClientScope(KeycloakSession session, ClientModel client, ClientScopeModel clientScope) Description copied from interface:LoginProtocolFactoryTest if the clientScope is valid for particular client. Usually called during protocol requests- Specified by:
isValidClientScopein interfaceLoginProtocolFactory
-
create
- Specified by:
createin interfaceProviderFactory<LoginProtocol>
-
getId
- Specified by:
getIdin interfaceProviderFactory<LoginProtocol>
-
order
public int order()defines the option-order in the admin-ui- Specified by:
orderin interfaceProviderFactory<LoginProtocol>
-
validateClientScopeAssignment
public void validateClientScopeAssignment(KeycloakSession session, ClientScopeModel clientScope, boolean defaultScope, RealmModel realm) Description copied from interface:LoginProtocolFactoryValidates whether a client scope can be assigned as Default or Optional to a client or realm. This method is called before assigning a client scope to ensure protocol-specific restrictions are enforced.- Specified by:
validateClientScopeAssignmentin interfaceLoginProtocolFactory- Parameters:
session- the Keycloak sessionclientScope- the client scope to be assigneddefaultScope- true if assigning as Default scope, false if Optionalrealm- the realm where the assignment is happening
-