org.keycloak.services

## Class DefaultKeycloakSession

- java.lang.Object
- - org.keycloak.services.DefaultKeycloakSession

- All Implemented Interfaces:
    KeycloakSession

      public class DefaultKeycloakSession
      extends Object
      implements KeycloakSession

  Author:
    Stian Thorgersen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultKeycloakSession(DefaultKeycloakSessionFactory factory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `enlistForClose(Provider provider)`
    `<T extends Provider> Set<T>` | `getAllProviders(Class<T> clazz)`
    `Object` | `getAttribute(String attribute)`
    `KeycloakContext` | `getContext()`
    `KeycloakSessionFactory` | `getKeycloakSessionFactory()`
    `<T extends Provider> T` | `getProvider(Class<T> clazz)` Get dedicated provider instance of provider type clazz that was created for this session.
    `<T extends Provider> T` | `getProvider(Class<T> clazz, String id)` Get dedicated provider instance for a specific provider factory of id of provider type clazz that was created for this session.
    `KeycloakTransactionManager` | `getTransactionManager()`
    `<T extends Provider> Set<String>` | `listProviderIds(Class<T> clazz)` Get all provider factories that manage provider instances of class.
    `RealmProvider` | `realms()` Returns a managed provider instance.
    `Object` | `removeAttribute(String attribute)`
    `ScriptingProvider` | `scripting()` Keycloak scripting support.
    `UserSessionProvider` | `sessions()` Returns a managed provider instance.
    `void` | `setAttribute(String name, Object value)`
    `UserFederatedStorageProvider` | `userFederatedStorage()` Hybrid storage for UserStorageProviders that can't store a specific piece of keycloak data in their external storage.
    `UserProvider` | `userLocalStorage()` Keycloak specific local storage for users.
    `UserFederationManager` | `users()` A cached view of all users in system.
    `UserProvider` | `userStorage()` A cached view of all users in system that does NOT include users available from the deprecated UserFederationProvider SPI.
    `UserProvider` | `userStorageManager()` Un-cached view of all users in system that does NOT include users available from the deprecated UserFederationProvider SPI.

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

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

- - ### Constructor Detail

    - #### DefaultKeycloakSession

          public DefaultKeycloakSession(DefaultKeycloakSessionFactory factory)

  - ### Method Detail

    - #### getContext

          public KeycloakContext getContext()

      Specified by:
        `getContext` in interface `KeycloakSession`

    - #### enlistForClose

          public void enlistForClose(Provider provider)

      Specified by:
        `enlistForClose` in interface `KeycloakSession`

    - #### getAttribute

          public Object getAttribute(String attribute)

      Specified by:
        `getAttribute` in interface `KeycloakSession`

    - #### removeAttribute

          public Object removeAttribute(String attribute)

      Specified by:
        `removeAttribute` in interface `KeycloakSession`

    - #### setAttribute

          public void setAttribute(String name,
                                   Object value)

      Specified by:
        `setAttribute` in interface `KeycloakSession`

    - #### getTransactionManager

          public KeycloakTransactionManager getTransactionManager()

      Specified by:
        `getTransactionManager` in interface `KeycloakSession`

    - #### getKeycloakSessionFactory

          public KeycloakSessionFactory getKeycloakSessionFactory()

      Specified by:
        `getKeycloakSessionFactory` in interface `KeycloakSession`

    - #### userFederatedStorage

          public UserFederatedStorageProvider userFederatedStorage()

      Description copied from interface: `KeycloakSession`
      Hybrid storage for UserStorageProviders that can't store a specific piece of keycloak data in their external storage.
      Specified by:
        `userFederatedStorage` in interface `KeycloakSession`
      Returns:

    - #### userLocalStorage

          public UserProvider userLocalStorage()

      Description copied from interface: `KeycloakSession`
      Keycloak specific local storage for users. No cache in front, this api talks directly to database.
      Specified by:
        `userLocalStorage` in interface `KeycloakSession`
      Returns:

    - #### userStorageManager

          public UserProvider userStorageManager()

      Description copied from interface: `KeycloakSession`
      Un-cached view of all users in system that does NOT include users available from the deprecated UserFederationProvider SPI.
      Specified by:
        `userStorageManager` in interface `KeycloakSession`
      Returns:

    - #### userStorage

          public UserProvider userStorage()

      Description copied from interface: `KeycloakSession`
      A cached view of all users in system that does NOT include users available from the deprecated UserFederationProvider SPI.
      Specified by:
        `userStorage` in interface `KeycloakSession`

    - #### getProvider

          public <T extends Provider> T getProvider(Class<T> clazz)

      Description copied from interface: `KeycloakSession`
      Get dedicated provider instance of provider type clazz that was created for this session. If one hasn't been created yet, find the factory and allocate by calling ProviderFactory.create(KeycloakSession). The provider to use is determined by the "provider" config entry in keycloak-server boot configuration. (keycloak-server.json)
      Specified by:
        `getProvider` in interface `KeycloakSession`
      Returns:

    - #### getProvider

          public <T extends Provider> T getProvider(Class<T> clazz,
                                                    String id)

      Description copied from interface: `KeycloakSession`
      Get dedicated provider instance for a specific provider factory of id of provider type clazz that was created for this session. If one hasn't been created yet, find the factory and allocate by calling ProviderFactory.create(KeycloakSession).
      Specified by:
        `getProvider` in interface `KeycloakSession`
      Returns:

    - #### listProviderIds

          public <T extends Provider> Set<String> listProviderIds(Class<T> clazz)

      Description copied from interface: `KeycloakSession`
      Get all provider factories that manage provider instances of class.
      Specified by:
        `listProviderIds` in interface `KeycloakSession`
      Returns:

    - #### getAllProviders

          public <T extends Provider> Set<T> getAllProviders(Class<T> clazz)

      Specified by:
        `getAllProviders` in interface `KeycloakSession`

    - #### realms

          public RealmProvider realms()

      Description copied from interface: `KeycloakSession`
      Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.
      Specified by:
        `realms` in interface `KeycloakSession`
      Returns:

    - #### users

          public UserFederationManager users()

      Description copied from interface: `KeycloakSession`
      A cached view of all users in system.
      Specified by:
        `users` in interface `KeycloakSession`
      Returns:

    - #### sessions

          public UserSessionProvider sessions()

      Description copied from interface: `KeycloakSession`
      Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.
      Specified by:
        `sessions` in interface `KeycloakSession`
      Returns:

    - #### close

          public void close()

      Specified by:
        `close` in interface `KeycloakSession`

    - #### scripting

          public ScriptingProvider scripting()

      Description copied from interface: `KeycloakSession`
      Keycloak scripting support.
      Specified by:
        `scripting` in interface `KeycloakSession`

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