Class KeycloakIdentity
java.lang.Object
org.keycloak.authorization.common.KeycloakIdentity
- All Implemented Interfaces:
Identity
- Author:
- Pedro Igor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AccessTokenprotected final Attributesprotected final KeycloakSessionprotected final RealmModel -
Constructor Summary
ConstructorsConstructorDescriptionKeycloakIdentity(KeycloakSession keycloakSession) KeycloakIdentity(KeycloakSession keycloakSession, IDToken token) KeycloakIdentity(AccessToken accessToken, KeycloakSession keycloakSession) KeycloakIdentity(AccessToken accessToken, KeycloakSession keycloakSession, RealmModel realm, boolean ignoreTokenRoles) KeycloakIdentity(IDToken token, KeycloakSession keycloakSession, RealmModel realm) -
Method Summary
Modifier and TypeMethodDescriptionReturns the attributes or claims associated with this identity.getId()Returns the unique identifier of this identity.booleanhasClientRole(String clientId, String roleName) Indicates if this identity is granted with a client role with the givenroleName.booleanhasRealmRole(String roleName) Indicates if this identity is granted with a realm role with the givenroleName.booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.authorization.identity.Identity
hasOneClientRole
-
Field Details
-
accessToken
-
realm
-
keycloakSession
-
attributes
-
-
Constructor Details
-
KeycloakIdentity
-
KeycloakIdentity
-
KeycloakIdentity
-
KeycloakIdentity
-
KeycloakIdentity
public KeycloakIdentity(AccessToken accessToken, KeycloakSession keycloakSession, RealmModel realm, boolean ignoreTokenRoles)
-
-
Method Details
-
getId
Description copied from interface:IdentityReturns the unique identifier of this identity. -
getAttributes
Description copied from interface:IdentityReturns the attributes or claims associated with this identity.- Specified by:
getAttributesin interfaceIdentity- Returns:
- the attributes or claims associated with this identity
-
hasClientRole
Description copied from interface:IdentityIndicates if this identity is granted with a client role with the givenroleName.- Specified by:
hasClientRolein interfaceIdentity- Parameters:
clientId- the client idroleName- the name of the role- Returns:
- true if the identity has the given role. Otherwise, it returns false.
-
hasRealmRole
Description copied from interface:IdentityIndicates if this identity is granted with a realm role with the givenroleName.- Specified by:
hasRealmRolein interfaceIdentity- Parameters:
roleName- the name of the role- Returns:
- true if the identity has the given role. Otherwise, it returns false.
-
getAccessToken
-
isResourceServer
public boolean isResourceServer()
-