Package org.keycloak.protocol
Interface LoginProtocolFactory
- All Superinterfaces:
org.keycloak.provider.ProviderFactory<LoginProtocol>
- All Known Implementing Classes:
AbstractLoginProtocolFactory
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientScopeDefaults(org.keycloak.representations.idm.ClientScopeRepresentation clientScope) Add default values toClientScopeRepresentations that refer to the specific login-protocoldefault booleanReturns whether this protocol can be used as a client protocol.voidcreateDefaultClientScopes(org.keycloak.models.RealmModel newRealm, boolean addScopesToExistingClients) Called when new realm is createdcreateProtocolEndpoint(org.keycloak.models.KeycloakSession session, EventBuilder event) List of built in protocol mappers that can be used to apply to clients.default booleanisValidClientScope(org.keycloak.models.KeycloakSession session, org.keycloak.models.ClientModel client, org.keycloak.models.ClientScopeModel clientScope) Test if the clientScope is valid for particular client.default voidonConsentRevoked(org.keycloak.models.KeycloakSession session, org.keycloak.models.ClientModel client, org.keycloak.models.UserModel user) Callback method invoked when consent of specified user is being revoked for the specified clientvoidsetupClientDefaults(org.keycloak.representations.idm.ClientRepresentation rep, org.keycloak.models.ClientModel newClient) Setup default values for new clients.default voidvalidateClientScope(org.keycloak.models.KeycloakSession session, org.keycloak.representations.idm.ClientScopeRepresentation clientScope) Invoked during client-scope creation or update to add additional validation hooks specific to target protocol.default voidvalidateClientScopeAssignment(org.keycloak.models.KeycloakSession session, org.keycloak.models.ClientScopeModel clientScope, boolean defaultScope, org.keycloak.models.RealmModel realm) Validates whether a client scope can be assigned as Default or Optional to a client or realm.Methods inherited from interface org.keycloak.provider.ProviderFactory
close, create, dependsOn, getConfigMetadata, getId, init, order, postInit
-
Method Details
-
getBuiltinMappers
List of built in protocol mappers that can be used to apply to clients.- Returns:
-
createProtocolEndpoint
-
createDefaultClientScopes
void createDefaultClientScopes(org.keycloak.models.RealmModel newRealm, boolean addScopesToExistingClients) Called when new realm is created- Parameters:
newRealm-addScopesToExistingClients- If true, then existing realm clients will be updated (created realm default scopes will be added to them)
-
setupClientDefaults
void setupClientDefaults(org.keycloak.representations.idm.ClientRepresentation rep, org.keycloak.models.ClientModel newClient) Setup default values for new clients. This expects that the representation has already set up the client- Parameters:
rep-newClient-
-
addClientScopeDefaults
void addClientScopeDefaults(org.keycloak.representations.idm.ClientScopeRepresentation clientScope) Add default values toClientScopeRepresentations that refer to the specific login-protocol -
validateClientScope
default void validateClientScope(org.keycloak.models.KeycloakSession session, org.keycloak.representations.idm.ClientScopeRepresentation clientScope) throws jakarta.ws.rs.WebApplicationException Invoked during client-scope creation or update to add additional validation hooks specific to target protocol. May throw errorResponseException in case- Parameters:
session- Keycloak sessionclientScope- client scope to create or update- Throws:
jakarta.ws.rs.WebApplicationException- or some of it's subclass if validation fails
-
isValidClientScope
default boolean isValidClientScope(org.keycloak.models.KeycloakSession session, org.keycloak.models.ClientModel client, org.keycloak.models.ClientScopeModel clientScope) Test if the clientScope is valid for particular client. Usually called during protocol requests -
validateClientScopeAssignment
default void validateClientScopeAssignment(org.keycloak.models.KeycloakSession session, org.keycloak.models.ClientScopeModel clientScope, boolean defaultScope, org.keycloak.models.RealmModel realm) Validates 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.- 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- Throws:
jakarta.ws.rs.BadRequestException- if the assignment is not allowed
-
allowAsClientProtocol
default boolean allowAsClientProtocol()Returns whether this protocol can be used as a client protocol.- Returns:
- true if the protocol can be used for clients, false otherwise
-
onConsentRevoked
default void onConsentRevoked(org.keycloak.models.KeycloakSession session, org.keycloak.models.ClientModel client, org.keycloak.models.UserModel user) Callback method invoked when consent of specified user is being revoked for the specified client- Parameters:
session- Keycloak sessionclient- Clientuser- user
-