org.keycloak.services.util

## Class DefaultClientSessionContext

- java.lang.Object
- - org.keycloak.services.util.DefaultClientSessionContext

- All Implemented Interfaces:
    ClientSessionContext

      public class DefaultClientSessionContext
      extends Object
      implements ClientSessionContext

  Not thread safe. It's per-request object
  Author:
    Marek Posolda

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DefaultClientSessionContext` | `fromClientSessionAndClientScopeIds(AuthenticatedClientSessionModel clientSession, Set<String> clientScopeIds, KeycloakSession session)`
    `static DefaultClientSessionContext` | `fromClientSessionAndClientScopes(AuthenticatedClientSessionModel clientSession, Stream<ClientScopeModel> clientScopes, KeycloakSession session)`
    `static DefaultClientSessionContext` | `fromClientSessionAndScopeParameter(AuthenticatedClientSessionModel clientSession, String scopeParam, KeycloakSession session)`
    `static DefaultClientSessionContext` | `fromClientSessionScopeParameter(AuthenticatedClientSessionModel clientSession, KeycloakSession session)` Useful if we want to "re-compute" client scopes based on the scope parameter
    `<T> T` | `getAttribute(String name, Class<T> clazz)`
    `Set<String>` | `getClientScopeIds()`
    `Stream<ClientScopeModel>` | `getClientScopesStream()` Returns client scopes as a stream.
    `AuthenticatedClientSessionModel` | `getClientSession()`
    `Stream<ProtocolMapperModel>` | `getProtocolMappersStream()` Returns protocol mappers as a stream.
    `Stream<RoleModel>` | `getRolesStream()`
    `String` | `getScopeString()`
    `void` | `setAttribute(String name, Object value)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.keycloak.models.ClientSessionContext

      `getClientScopes, getProtocolMappers, getRoles`

- - ### Method Detail

    - #### fromClientSessionScopeParameter

          public static DefaultClientSessionContext fromClientSessionScopeParameter(AuthenticatedClientSessionModel clientSession,
                                                                                    KeycloakSession session)

      Useful if we want to "re-compute" client scopes based on the scope parameter

    - #### fromClientSessionAndScopeParameter

          public static DefaultClientSessionContext fromClientSessionAndScopeParameter(AuthenticatedClientSessionModel clientSession,
                                                                                       String scopeParam,
                                                                                       KeycloakSession session)

    - #### fromClientSessionAndClientScopeIds

          public static DefaultClientSessionContext fromClientSessionAndClientScopeIds(AuthenticatedClientSessionModel clientSession,
                                                                                       Set<String> clientScopeIds,
                                                                                       KeycloakSession session)

    - #### fromClientSessionAndClientScopes

          public static DefaultClientSessionContext fromClientSessionAndClientScopes(AuthenticatedClientSessionModel clientSession,
                                                                                     Stream<ClientScopeModel> clientScopes,
                                                                                     KeycloakSession session)

    - #### getClientSession

          public AuthenticatedClientSessionModel getClientSession()

      Specified by:
        `getClientSession` in interface `ClientSessionContext`

    - #### getClientScopeIds

          public Set<String> getClientScopeIds()

      Specified by:
        `getClientScopeIds` in interface `ClientSessionContext`

    - #### getClientScopesStream

          public Stream<ClientScopeModel> getClientScopesStream()

      Description copied from interface: `ClientSessionContext`
      Returns client scopes as a stream.
      Specified by:
        `getClientScopesStream` in interface `ClientSessionContext`
      Returns:
        Stream of client scopes.

    - #### getRolesStream

          public Stream<RoleModel> getRolesStream()

      Specified by:
        `getRolesStream` in interface `ClientSessionContext`

    - #### getProtocolMappersStream

          public Stream<ProtocolMapperModel> getProtocolMappersStream()

      Description copied from interface: `ClientSessionContext`
      Returns protocol mappers as a stream.
      Specified by:
        `getProtocolMappersStream` in interface `ClientSessionContext`
      Returns:
        Stream of protocol mappers.

    - #### getScopeString

          public String getScopeString()

      Specified by:
        `getScopeString` in interface `ClientSessionContext`

    - #### setAttribute

          public void setAttribute(String name,
                                   Object value)

      Specified by:
        `setAttribute` in interface `ClientSessionContext`

    - #### getAttribute

          public <T> T getAttribute(String name,
                                    Class<T> clazz)

      Specified by:
        `getAttribute` in interface `ClientSessionContext`

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