Package org.keycloak.services
Class DefaultKeycloakContext
- java.lang.Object
- 
- org.keycloak.services.DefaultKeycloakContext
 
- 
- All Implemented Interfaces:
- KeycloakContext
 
 public class DefaultKeycloakContext extends Object implements KeycloakContext - Author:
- Stian Thorgersen
 
- 
- 
Constructor SummaryConstructors Constructor Description DefaultKeycloakContext(KeycloakSession session)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected HttpRequestcreateHttpRequest()protected HttpResponsecreateHttpResponse()AuthenticationSessionModelgetAuthenticationSession()Get current AuthenticationSessionModel, can be null out of the AuthenticationSession context.URIgetAuthServerUrl()ClientModelgetClient()ClientConnectiongetConnection()<T> TgetContextObject(Class<T> clazz)StringgetContextPath()HttpRequestgetHttpRequest()HttpResponsegetHttpResponse()RealmModelgetRealm()javax.ws.rs.core.HttpHeadersgetRequestHeaders()Deprecated.UsegetHttpRequest()to obtain the request headers.KeycloakUriInfogetUri()Returns the URI assuming it is a frontend request.KeycloakUriInfogetUri(UrlType type)Returns the URI.LocaleresolveLocale(UserModel user)voidsetAuthenticationSession(AuthenticationSessionModel authenticationSession)voidsetClient(ClientModel client)voidsetRealm(RealmModel realm)
 
- 
- 
- 
Constructor Detail- 
DefaultKeycloakContextpublic DefaultKeycloakContext(KeycloakSession session) 
 
- 
 - 
Method Detail- 
getAuthServerUrlpublic URI getAuthServerUrl() - Specified by:
- getAuthServerUrlin interface- KeycloakContext
 
 - 
getContextPathpublic String getContextPath() - Specified by:
- getContextPathin interface- KeycloakContext
 
 - 
getUripublic KeycloakUriInfo getUri(UrlType type) Description copied from interface:KeycloakContextReturns the URI. If a frontend request (from user-agent) @frontendRequest should be set to true. If a backend request (request from a client) should be set to false. Depending on the configure hostname provider it may return a hard-coded base URL for frontend request (for example https://auth.mycompany.com) and use the request URL for backend requests. Frontend URI should also be used for realm issuer fields in tokens.- Specified by:
- getUriin interface- KeycloakContext
- Parameters:
- type- the type of the request
- Returns:
 
 - 
getUripublic KeycloakUriInfo getUri() Description copied from interface:KeycloakContextReturns the URI assuming it is a frontend request. To resolve URI for a backend request useKeycloakContext.getUri(UrlType)- Specified by:
- getUriin interface- KeycloakContext
- Returns:
 
 - 
getRequestHeaders@Deprecated public javax.ws.rs.core.HttpHeaders getRequestHeaders() Deprecated.UsegetHttpRequest()to obtain the request headers.- Specified by:
- getRequestHeadersin interface- KeycloakContext
- Returns:
 
 - 
getContextObjectpublic <T> T getContextObject(Class<T> clazz) - Specified by:
- getContextObjectin interface- KeycloakContext
 
 - 
getRealmpublic RealmModel getRealm() - Specified by:
- getRealmin interface- KeycloakContext
 
 - 
setRealmpublic void setRealm(RealmModel realm) - Specified by:
- setRealmin interface- KeycloakContext
 
 - 
getClientpublic ClientModel getClient() - Specified by:
- getClientin interface- KeycloakContext
 
 - 
setClientpublic void setClient(ClientModel client) - Specified by:
- setClientin interface- KeycloakContext
 
 - 
getConnectionpublic ClientConnection getConnection() - Specified by:
- getConnectionin interface- KeycloakContext
 
 - 
resolveLocalepublic Locale resolveLocale(UserModel user) - Specified by:
- resolveLocalein interface- KeycloakContext
 
 - 
getAuthenticationSessionpublic AuthenticationSessionModel getAuthenticationSession() Description copied from interface:KeycloakContextGet current AuthenticationSessionModel, can be null out of the AuthenticationSession context.- Specified by:
- getAuthenticationSessionin interface- KeycloakContext
- Returns:
- current AuthenticationSessionModel or null
 
 - 
setAuthenticationSessionpublic void setAuthenticationSession(AuthenticationSessionModel authenticationSession) - Specified by:
- setAuthenticationSessionin interface- KeycloakContext
 
 - 
getHttpRequestpublic HttpRequest getHttpRequest() - Specified by:
- getHttpRequestin interface- KeycloakContext
 
 - 
getHttpResponsepublic HttpResponse getHttpResponse() - Specified by:
- getHttpResponsein interface- KeycloakContext
 
 - 
createHttpRequestprotected HttpRequest createHttpRequest() 
 - 
createHttpResponseprotected HttpResponse createHttpResponse() 
 
- 
 
-