org.keycloak.adapters

## Class RefreshableKeycloakSecurityContext

- java.lang.Object
- - org.keycloak.KeycloakSecurityContext
  - - org.keycloak.adapters.RefreshableKeycloakSecurityContext

- All Implemented Interfaces:
    Serializable

      public class RefreshableKeycloakSecurityContext
      extends KeycloakSecurityContext

  Version:
    $Revision: 1 $
  Author:
    Bill Burke
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected KeycloakDeployment` | `deployment`
    `protected static org.jboss.logging.Logger` | `log`
    `protected String` | `refreshToken`
    `protected AdapterTokenStore` | `tokenStore`

    - ### Fields inherited from class org.keycloak.KeycloakSecurityContext

      `idToken, idTokenString, token, tokenString`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RefreshableKeycloakSecurityContext()`
    `RefreshableKeycloakSecurityContext(KeycloakDeployment deployment, AdapterTokenStore tokenStore, String tokenString, AccessToken token, String idTokenString, IDToken idToken, String refreshToken)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `KeycloakDeployment` | `getDeployment()`
    `String` | `getRefreshToken()`
    `AccessToken` | `getToken()`
    `String` | `getTokenString()`
    `boolean` | `isActive()`
    `void` | `logout(KeycloakDeployment deployment)`
    `boolean` | `refreshExpiredToken(boolean checkActive)`
    `void` | `setCurrentRequestInfo(KeycloakDeployment deployment, AdapterTokenStore tokenStore)`

    - ### Methods inherited from class org.keycloak.KeycloakSecurityContext

      `getIdToken, getIdTokenString, getRealm`

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

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

- - ### Field Detail

    - #### log

          protected static org.jboss.logging.Logger log

    - #### deployment

          protected transient KeycloakDeployment deployment

    - #### tokenStore

          protected transient AdapterTokenStore tokenStore

    - #### refreshToken

          protected String refreshToken

  - ### Constructor Detail

    - #### RefreshableKeycloakSecurityContext

          public RefreshableKeycloakSecurityContext()

    - #### RefreshableKeycloakSecurityContext

          public RefreshableKeycloakSecurityContext(KeycloakDeployment deployment,
                                            AdapterTokenStore tokenStore,
                                            String tokenString,
                                            AccessToken token,
                                            String idTokenString,
                                            IDToken idToken,
                                            String refreshToken)

  - ### Method Detail

    - #### getToken

          public AccessToken getToken()

      Overrides:
        `getToken` in class `KeycloakSecurityContext`

    - #### getTokenString

          public String getTokenString()

      Overrides:
        `getTokenString` in class `KeycloakSecurityContext`

    - #### getRefreshToken

          public String getRefreshToken()

    - #### logout

          public void logout(KeycloakDeployment deployment)

    - #### isActive

          public boolean isActive()

    - #### getDeployment

          public KeycloakDeployment getDeployment()

    - #### setCurrentRequestInfo

          public void setCurrentRequestInfo(KeycloakDeployment deployment,
                                   AdapterTokenStore tokenStore)

    - #### refreshExpiredToken

          public boolean refreshExpiredToken(boolean checkActive)

      Parameters:
        `checkActive` - if true, then we won't send refresh request if current accessToken is still active.
      Returns:
        true if accessToken is active or was successfully refreshed

Copyright © 2014. All Rights Reserved.