Package org.keycloak.services
Class DefaultKeycloakContext
java.lang.Object
org.keycloak.services.DefaultKeycloakContext
- All Implemented Interfaces:
KeycloakContext
- Author:
- Stian Thorgersen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ClientConnectionprotected abstract HttpRequestprotected abstract HttpResponseGet current AuthenticationSessionModel, can be null out of the AuthenticationSession context.Returns aTokenrepresenting the bearer token used to authenticate and authorize the current request.getRealm()jakarta.ws.rs.core.HttpHeadersDeprecated.protected KeycloakSessiongetUri()Returns the URI assuming it is a frontend request.Returns the URI.getUser()Returns theUserModelbound to this context.resolveLocale(UserModel user) resolveLocale(UserModel user, Theme.Type themeType) voidsetAuthenticationSession(AuthenticationSessionModel authenticationSession) voidsetBearerToken(Token token) voidsetClient(ClientModel client) voidsetConnection(ClientConnection clientConnection) voidsetHttpRequest(HttpRequest httpRequest) voidsetHttpResponse(HttpResponse httpResponse) voidsetOrganization(OrganizationModel organization) voidsetRealm(RealmModel realm) voidsetUserSession(UserSessionModel userSession) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.models.KeycloakContext
getContextObject
-
Field Details
-
session
-
-
Constructor Details
-
DefaultKeycloakContext
-
-
Method Details
-
getAuthServerUrl
- Specified by:
getAuthServerUrlin interfaceKeycloakContext
-
getContextPath
- Specified by:
getContextPathin interfaceKeycloakContext
-
getUri
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 interfaceKeycloakContext- Parameters:
type- the type of the request- Returns:
-
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 interfaceKeycloakContext- Returns:
-
getRequestHeaders
Deprecated.UsegetHttpRequest()to obtain the request headers.- Specified by:
getRequestHeadersin interfaceKeycloakContext- Returns:
-
getRealm
- Specified by:
getRealmin interfaceKeycloakContext
-
setRealm
- Specified by:
setRealmin interfaceKeycloakContext
-
getClient
- Specified by:
getClientin interfaceKeycloakContext
-
setClient
- Specified by:
setClientin interfaceKeycloakContext
-
getOrganization
- Specified by:
getOrganizationin interfaceKeycloakContext
-
setOrganization
- Specified by:
setOrganizationin interfaceKeycloakContext
-
getConnection
- Specified by:
getConnectionin interfaceKeycloakContext
-
resolveLocale
- Specified by:
resolveLocalein interfaceKeycloakContext
-
resolveLocale
- Specified by:
resolveLocalein interfaceKeycloakContext
-
getAuthenticationSession
Description copied from interface:KeycloakContextGet current AuthenticationSessionModel, can be null out of the AuthenticationSession context.- Specified by:
getAuthenticationSessionin interfaceKeycloakContext- Returns:
- current AuthenticationSessionModel or null
-
setAuthenticationSession
- Specified by:
setAuthenticationSessionin interfaceKeycloakContext
-
getHttpRequest
- Specified by:
getHttpRequestin interfaceKeycloakContext
-
getHttpResponse
- Specified by:
getHttpResponsein interfaceKeycloakContext
-
createClientConnection
-
createHttpRequest
-
createHttpResponse
-
getSession
-
setConnection
- Specified by:
setConnectionin interfaceKeycloakContext
-
setHttpRequest
- Specified by:
setHttpRequestin interfaceKeycloakContext
-
setHttpResponse
- Specified by:
setHttpResponsein interfaceKeycloakContext
-
getUserSession
- Specified by:
getUserSessionin interfaceKeycloakContext
-
setUserSession
- Specified by:
setUserSessionin interfaceKeycloakContext
-
setBearerToken
- Specified by:
setBearerTokenin interfaceKeycloakContext
-
getBearerToken
Description copied from interface:KeycloakContextReturns aTokenrepresenting the bearer token used to authenticate and authorize the current request.- Specified by:
getBearerTokenin interfaceKeycloakContext- Returns:
- the bearer token
-
getUser
Description copied from interface:KeycloakContextReturns theUserModelbound to this context. The user is first resolved from theKeycloakContext.getBearerToken()set to this context, if any. Otherwise, it will be resolved from theKeycloakContext.getUserSession()set to this context, if any.- Specified by:
getUserin interfaceKeycloakContext- Returns:
- the
UserModelbound to this context.
-
getHttpRequest()to obtain the request headers.