org.keycloak.models

## Interface KeycloakSession

- All Known Implementing Classes:
    DefaultKeycloakSession

      public interface KeycloakSession

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Method Summary

    All Methods Instance Methods Abstract 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.

- - ### Method Detail

    - #### getContext

          KeycloakContext getContext()

    - #### getTransactionManager

          KeycloakTransactionManager getTransactionManager()

    - #### getProvider

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

      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)
      Type Parameters:
        `T` -
      Parameters:
        `clazz` -
      Returns:

    - #### getProvider

          <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. If one hasn't been created yet, find the factory and allocate by calling ProviderFactory.create(KeycloakSession).
      Type Parameters:
        `T` -
      Parameters:
        `clazz` -
        `id` -
      Returns:

    - #### listProviderIds

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

      Get all provider factories that manage provider instances of class.
      Type Parameters:
        `T` -
      Parameters:
        `clazz` -
      Returns:

    - #### getAllProviders

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

    - #### getAttribute

          Object getAttribute(String attribute)

    - #### removeAttribute

          Object removeAttribute(String attribute)

    - #### setAttribute

          void setAttribute(String name,
                            Object value)

    - #### enlistForClose

          void enlistForClose(Provider provider)

    - #### getKeycloakSessionFactory

          KeycloakSessionFactory getKeycloakSessionFactory()

    - #### realms

          RealmProvider realms()

      Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.
      Returns:
      Throws:
        `IllegalStateException` - if transaction is not active

    - #### sessions

          UserSessionProvider sessions()

      Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.
      Returns:
      Throws:
        `IllegalStateException` - if transaction is not active

    - #### close

          void close()

    - #### users

          UserFederationManager users()

      A cached view of all users in system.
      Returns:

    - #### userStorageManager

          UserProvider userStorageManager()

      Un-cached view of all users in system that does NOT include users available from the deprecated UserFederationProvider SPI.
      Returns:

    - #### userStorage

          UserProvider userStorage()

      A cached view of all users in system that does NOT include users available from the deprecated UserFederationProvider SPI.

    - #### userLocalStorage

          UserProvider userLocalStorage()

      Keycloak specific local storage for users. No cache in front, this api talks directly to database.
      Returns:

    - #### userFederatedStorage

          UserFederatedStorageProvider userFederatedStorage()

      Hybrid storage for UserStorageProviders that can't store a specific piece of keycloak data in their external storage.
      Returns:

    - #### scripting

          ScriptingProvider scripting()

      Keycloak scripting support.

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