Package org.keycloak.cache
Interface AlternativeLookupProvider
- All Superinterfaces:
org.keycloak.provider.Provider
public interface AlternativeLookupProvider
extends org.keycloak.provider.Provider
-
Method Summary
Modifier and TypeMethodDescriptionorg.keycloak.models.ClientModellookupClientFromClientAttributes(org.keycloak.models.KeycloakSession session, Map<String, String> attributes) org.keycloak.models.IdentityProviderModellookupIdentityProviderFromIssuer(org.keycloak.models.KeycloakSession session, org.keycloak.models.IdentityProviderType type, String issuerUrl) org.keycloak.models.RoleModellookupRoleFromString(org.keycloak.models.RealmModel realm, String roleName) Looks up a role from its string representation, supporting both realm and client roles.Methods inherited from interface org.keycloak.provider.Provider
close
-
Method Details
-
lookupIdentityProviderFromIssuer
org.keycloak.models.IdentityProviderModel lookupIdentityProviderFromIssuer(org.keycloak.models.KeycloakSession session, org.keycloak.models.IdentityProviderType type, String issuerUrl) -
lookupClientFromClientAttributes
-
lookupRoleFromString
org.keycloak.models.RoleModel lookupRoleFromString(org.keycloak.models.RealmModel realm, String roleName) Looks up a role from its string representation, supporting both realm and client roles.The method interprets the
roleNameparameter as follows:- For realm roles: the role name directly (e.g.,
"admin") - For client roles: the format
"client-id.role-name"where the client ID and role name are separated by a dot separator
Since client IDs can contain dots, the method attempts multiple splits from right to left to resolve ambiguous role names. For example,
"my.client.app.role"will first try to look up client"my.client.app"with role"role", then client"my.client"with role"app.role", and so on.The lookup uses caching to reduce database load. If a role is not found in the cache, the method performs a database lookup and caches the result for subsequent calls.
- Parameters:
realm- the realm in which to look up the roleroleName- the string representation of the role name, which can be a realm role name or a client role in the format"client-id.role-name". May benull.- Returns:
- the corresponding
RoleModelif found, ornullif the role does not exist or ifroleNameisnull
- For realm roles: the role name directly (e.g.,
-