org.keycloak.models

## Interface KeycloakSession

- All Superinterfaces:
    Provider
  All Known Subinterfaces:
    CacheKeycloakSession
  All Known Implementing Classes:
    DefaultCacheKeycloakSession, JpaKeycloakSession, MongoKeycloakSession, NoCacheKeycloakSession

      public interface KeycloakSession
      extends Provider

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `UsernameLoginFailureModel` | `addUserLoginFailure(String username, RealmModel realm)`
    `void` | `close()`
    `RealmModel` | `createRealm(String name)`
    `RealmModel` | `createRealm(String id, String name)`
    `UserSessionModel` | `createUserSession(RealmModel realm, UserModel user, String ipAddress)`
    `int` | `getActiveUserSessions(RealmModel realm, ClientModel client)`
    `List<UsernameLoginFailureModel>` | `getAllUserLoginFailures(RealmModel realm)`
    `ApplicationModel` | `getApplicationById(String id, RealmModel realm)`
    `OAuthClientModel` | `getOAuthClientById(String id, RealmModel realm)`
    `RealmModel` | `getRealm(String id)`
    `RealmModel` | `getRealmByName(String name)`
    `List<RealmModel>` | `getRealms()`
    `RoleModel` | `getRoleById(String id, RealmModel realm)`
    `SocialLinkModel` | `getSocialLink(UserModel user, String socialProvider, RealmModel realm)`
    `Set<SocialLinkModel>` | `getSocialLinks(UserModel user, RealmModel realm)`
    `KeycloakTransaction` | `getTransaction()`
    `UserModel` | `getUserByEmail(String email, RealmModel realm)`
    `UserModel` | `getUserById(String id, RealmModel realm)`
    `UserModel` | `getUserBySocialLink(SocialLinkModel socialLink, RealmModel realm)`
    `UserModel` | `getUserByUsername(String username, RealmModel realm)`
    `UsernameLoginFailureModel` | `getUserLoginFailure(String username, RealmModel realm)`
    `List<UserModel>` | `getUsers(RealmModel realm)`
    `UserSessionModel` | `getUserSession(String id, RealmModel realm)`
    `Set<UserSessionModel>` | `getUserSessions(RealmModel realm, ClientModel client)`
    `List<UserSessionModel>` | `getUserSessions(UserModel user, RealmModel realm)`
    `void` | `removeAllData()`
    `void` | `removeExpiredUserSessions(RealmModel realm)`
    `boolean` | `removeRealm(String id)`
    `void` | `removeUserSession(UserSessionModel session)`
    `void` | `removeUserSessions(RealmModel realm)`
    `void` | `removeUserSessions(RealmModel realm, UserModel user)`
    `List<UserModel>` | `searchForUser(String search, RealmModel realm)`
    `List<UserModel>` | `searchForUserByAttributes(Map<String,String> attributes, RealmModel realm)`

- - ### Method Detail

    - #### getTransaction

          KeycloakTransaction getTransaction()

    - #### createRealm

          RealmModel createRealm(String name)

    - #### createRealm

          RealmModel createRealm(String id,
                               String name)

    - #### getRealm

          RealmModel getRealm(String id)

    - #### getRealmByName

          RealmModel getRealmByName(String name)

    - #### getUserById

          UserModel getUserById(String id,
                              RealmModel realm)

    - #### getUserByUsername

          UserModel getUserByUsername(String username,
                                    RealmModel realm)

    - #### getUserByEmail

          UserModel getUserByEmail(String email,
                                 RealmModel realm)

    - #### getUserBySocialLink

          UserModel getUserBySocialLink(SocialLinkModel socialLink,
                                      RealmModel realm)

    - #### getUsers

          List<UserModel> getUsers(RealmModel realm)

    - #### searchForUser

          List<UserModel> searchForUser(String search,
                                      RealmModel realm)

    - #### searchForUserByAttributes

          List<UserModel> searchForUserByAttributes(Map<String,String> attributes,
                                                  RealmModel realm)

    - #### getSocialLinks

          Set<SocialLinkModel> getSocialLinks(UserModel user,
                                            RealmModel realm)

    - #### getSocialLink

          SocialLinkModel getSocialLink(UserModel user,
                                      String socialProvider,
                                      RealmModel realm)

    - #### getRoleById

          RoleModel getRoleById(String id,
                              RealmModel realm)

    - #### getApplicationById

          ApplicationModel getApplicationById(String id,
                                            RealmModel realm)

    - #### getOAuthClientById

          OAuthClientModel getOAuthClientById(String id,
                                            RealmModel realm)

    - #### getRealms

          List<RealmModel> getRealms()

    - #### removeRealm

          boolean removeRealm(String id)

    - #### getUserLoginFailure

          UsernameLoginFailureModel getUserLoginFailure(String username,
                                                      RealmModel realm)

    - #### addUserLoginFailure

          UsernameLoginFailureModel addUserLoginFailure(String username,
                                                      RealmModel realm)

    - #### getAllUserLoginFailures

          List<UsernameLoginFailureModel> getAllUserLoginFailures(RealmModel realm)

    - #### createUserSession

          UserSessionModel createUserSession(RealmModel realm,
                                           UserModel user,
                                           String ipAddress)

    - #### getUserSession

          UserSessionModel getUserSession(String id,
                                        RealmModel realm)

    - #### getUserSessions

          List<UserSessionModel> getUserSessions(UserModel user,
                                               RealmModel realm)

    - #### getUserSessions

          Set<UserSessionModel> getUserSessions(RealmModel realm,
                                              ClientModel client)

    - #### getActiveUserSessions

          int getActiveUserSessions(RealmModel realm,
                                  ClientModel client)

    - #### removeUserSession

          void removeUserSession(UserSessionModel session)

    - #### removeUserSessions

          void removeUserSessions(RealmModel realm,
                                UserModel user)

    - #### removeExpiredUserSessions

          void removeExpiredUserSessions(RealmModel realm)

    - #### removeUserSessions

          void removeUserSessions(RealmModel realm)

    - #### removeAllData

          void removeAllData()

    - #### close

          void close()

      Specified by:
        `close` in interface `Provider`

Copyright © 2014. All Rights Reserved.