Class UserModelIdentity

java.lang.Object
org.keycloak.authorization.identity.UserModelIdentity
All Implemented Interfaces:
Identity

public class UserModelIdentity extends Object implements Identity
Version:
$Revision: 1 $
Author:
Bill Burke
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.keycloak.models.RealmModel
     
    protected org.keycloak.models.UserModel
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    UserModelIdentity(org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the attributes or claims associated with this identity.
    Returns the unique identifier of this identity.
    boolean
    hasClientRole(String clientId, String roleName)
    Indicates if this identity is granted with a client role with the given roleName.
    boolean
    hasOneClientRole(String clientId, String... roleNames)
    Indicates if this identity is granted with a client role of one of the given roleNames.
    boolean
    hasRealmRole(String roleName)
    Indicates if this identity is granted with a realm role with the given roleName.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • realm

      protected org.keycloak.models.RealmModel realm
    • user

      protected org.keycloak.models.UserModel user
  • Constructor Details

    • UserModelIdentity

      public UserModelIdentity(org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user)
  • Method Details

    • getId

      public String getId()
      Description copied from interface: Identity
      Returns the unique identifier of this identity.
      Specified by:
      getId in interface Identity
      Returns:
      the unique identifier of this identity
    • getAttributes

      public Attributes getAttributes()
      Description copied from interface: Identity
      Returns the attributes or claims associated with this identity.
      Specified by:
      getAttributes in interface Identity
      Returns:
      the attributes or claims associated with this identity
    • hasRealmRole

      public boolean hasRealmRole(String roleName)
      Description copied from interface: Identity
      Indicates if this identity is granted with a realm role with the given roleName.
      Specified by:
      hasRealmRole in interface Identity
      Parameters:
      roleName - the name of the role
      Returns:
      true if the identity has the given role. Otherwise, it returns false.
    • hasOneClientRole

      public boolean hasOneClientRole(String clientId, String... roleNames)
      Description copied from interface: Identity
      Indicates if this identity is granted with a client role of one of the given roleNames.
      Specified by:
      hasOneClientRole in interface Identity
      Parameters:
      clientId - the client id
      roleNames - list
      Returns:
      true if the identity has any of the given roles. Otherwise, it returns false.
    • hasClientRole

      public boolean hasClientRole(String clientId, String roleName)
      Description copied from interface: Identity
      Indicates if this identity is granted with a client role with the given roleName.
      Specified by:
      hasClientRole in interface Identity
      Parameters:
      clientId - the client id
      roleName - the name of the role
      Returns:
      true if the identity has the given role. Otherwise, it returns false.