org.keycloak.authorization.identity

## Interface Identity

- All Known Implementing Classes:
    KeycloakIdentity

      public interface Identity

  Represents a security identity, which can be a person or non-person entity that was previously authenticated.

  An `Identity` plays an important role during the evaluation of policies as they represent the entity to which one or more permissions should be granted or not, providing additional information and attributes that can be relevant to the different access control methods involved during the evaluation of policies.

  Author:
    Pedro Igor

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Attributes` | `getAttributes()` Returns the attributes or claims associated with this identity.
    `String` | `getId()` Returns the unique identifier of this identity.
    `default boolean` | `hasClientRole(String roleName)` Indicates if this identity is granted with a client role with the given `roleName`.
    `default boolean` | `hasClientRole(String clientId, String roleName)` Indicates if this identity is granted with a client role with the given `roleName`.
    `default boolean` | `hasRealmRole(String roleName)` Indicates if this identity is granted with a realm role with the given `roleName`.
    `default boolean` | `hasRole(String roleName)` Indicates if this identity is granted with a role (realm or client) with the given `roleName`.

- - ### Method Detail

    - #### getId

          String getId()

      Returns the unique identifier of this identity.
      Returns:
        the unique identifier of this identity

    - #### getAttributes

          Attributes getAttributes()

      Returns the attributes or claims associated with this identity.
      Returns:
        the attributes or claims associated with this identity

    - #### hasRole

          default boolean hasRole(String roleName)

      Indicates if this identity is granted with a role (realm or client) with the given `roleName`.
      Parameters:
        `roleName` - the name of the role
      Returns:
        true if the identity has the given role. Otherwise, it returns false.

    - #### hasRealmRole

          default boolean hasRealmRole(String roleName)

      Indicates if this identity is granted with a realm role with the given `roleName`.
      Parameters:
        `roleName` - the name of the role
      Returns:
        true if the identity has the given role. Otherwise, it returns false.

    - #### hasClientRole

          default boolean hasClientRole(String clientId,
                                        String roleName)

      Indicates if this identity is granted with a client role with the given `roleName`.
      Parameters:
        `clientId` - the client id
        `roleName` - the name of the role
      Returns:
        true if the identity has the given role. Otherwise, it returns false.

    - #### hasClientRole

          default boolean hasClientRole(String roleName)

      Indicates if this identity is granted with a client role with the given `roleName`.
      Parameters:
        `roleName` - the name of the role
      Returns:
        true if the identity has the given role. Otherwise, it returns false.

Copyright © 2016 JBoss by Red Hat. All rights reserved.