Class ClientModelIdentity
- java.lang.Object
-
- org.keycloak.authorization.common.ClientModelIdentity
-
- All Implemented Interfaces:
Identity
public class ClientModelIdentity extends Object implements Identity
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Field Summary
Fields Modifier and Type Field Description protected ClientModel
client
protected RealmModel
realm
protected UserModel
serviceAccount
-
Constructor Summary
Constructors Constructor Description ClientModelIdentity(KeycloakSession session, ClientModel client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attributes
getAttributes()
Returns the attributes or claims associated with this identity.String
getId()
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 givenroleName
.boolean
hasOneClientRole(String clientId, String... roleNames)
Indicates if this identity is granted with a client role of one of the givenroleNames
.boolean
hasRealmRole(String roleName)
Indicates if this identity is granted with a realm role with the givenroleName
.
-
-
-
Field Detail
-
realm
protected RealmModel realm
-
client
protected ClientModel client
-
serviceAccount
protected UserModel serviceAccount
-
-
Constructor Detail
-
ClientModelIdentity
public ClientModelIdentity(KeycloakSession session, ClientModel client)
-
-
Method Detail
-
getId
public String getId()
Description copied from 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 interfaceIdentity
- 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 givenroleName
.- Specified by:
hasRealmRole
in interfaceIdentity
- Parameters:
roleName
- the name of the role- Returns:
- true if the identity has the given role. 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 givenroleName
.- Specified by:
hasClientRole
in interfaceIdentity
- Parameters:
clientId
- the client idroleName
- 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 givenroleNames
.- Specified by:
hasOneClientRole
in interfaceIdentity
- Parameters:
clientId
- the client idroleNames
- list- Returns:
- true if the identity has any of the given roles. Otherwise, it returns false.
-
-