Package org.keycloak.protocol.oidc.utils
Class PairwiseSubMapperUtils
java.lang.Object
org.keycloak.protocol.oidc.utils.PairwiseSubMapperUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<ProtocolMapperRepresentation>static booleanisPairwiseSubjectMatching(KeycloakSession session, RealmModel realm, UserModel user, JsonWebToken token) Tries to re-create "sub" claim from the ID of given user assuming that client, which the token was issued for, uses the pairwise subject mapper.static booleanChecks if the the registered client redirect URIs matches the set of redirect URIs from the sector identifier URI.resolveValidRedirectUris(String clientRootUrl, Collection<String> clientRedirectUris) Returns a set of valid redirect URIs from the root url and redirect URIs registered on a client.static StringresolveValidSectorIdentifier(String sectorIdentifierUri) Tries to resolve a valid sector identifier from a sector identifier URI.static StringresolveValidSectorIdentifier(String clientRootUrl, Set<String> clientRedirectUris) Tries to resolve a valid sector identifier from the redirect URIs registered on a client.
-
Constructor Details
-
PairwiseSubMapperUtils
public PairwiseSubMapperUtils()
-
-
Method Details
-
resolveValidRedirectUris
public static Set<String> resolveValidRedirectUris(String clientRootUrl, Collection<String> clientRedirectUris) Returns a set of valid redirect URIs from the root url and redirect URIs registered on a client.- Parameters:
clientRootUrl-clientRedirectUris-- Returns:
-
resolveValidSectorIdentifier
Tries to resolve a valid sector identifier from a sector identifier URI.- Parameters:
sectorIdentifierUri-- Returns:
- a sector identifier iff. the sector identifier URI is a valid URI, contains a valid scheme and contains a valid host component.
-
resolveValidSectorIdentifier
public static String resolveValidSectorIdentifier(String clientRootUrl, Set<String> clientRedirectUris) Tries to resolve a valid sector identifier from the redirect URIs registered on a client.- Parameters:
clientRootUrl- Root url registered on the client.clientRedirectUris- Redirect URIs registered on the client.- Returns:
- a sector identifier iff. all the registered redirect URIs are located at the same host, otherwise
null.
-
matchesRedirects
public static boolean matchesRedirects(String clientRootUrl, Set<String> clientRedirectUris, Set<String> sectorRedirects) Checks if the the registered client redirect URIs matches the set of redirect URIs from the sector identifier URI.- Parameters:
clientRootUrl- root url registered on the client.clientRedirectUris- redirect URIs registered on the client.sectorRedirects- value of the sector identifier URI.- Returns:
trueiff. the all the redirect URIs can be described by thesectorRedirects, i.e if the registered redirect URIs is a subset of thesectorRedirects, otherwisefalse.
-
getPairwiseSubMappers
-
isPairwiseSubjectMatching
public static boolean isPairwiseSubjectMatching(KeycloakSession session, RealmModel realm, UserModel user, JsonWebToken token) Tries to re-create "sub" claim from the ID of given user assuming that client, which the token was issued for, uses the pairwise subject mapper. Method returns true if "sub" computed from the userId by the pairwise mapper of referenced client matches with the "sub" claim from the token
-