Package org.keycloak.models
Interface KeycloakContext
- All Known Implementing Classes:
DefaultKeycloakContext
public interface KeycloakContext
- Author:
- Stian Thorgersen
-
Method Summary
Modifier and TypeMethodDescriptionGet current AuthenticationSessionModel, can be null out of the AuthenticationSession context.default <T> T
getContextObject
(Class<T> clazz) Deprecated, for removal: This API element is subject to removal in a future version.getRealm()
jakarta.ws.rs.core.HttpHeaders
getUri()
Returns the URI assuming it is a frontend request.Returns the URI.resolveLocale
(UserModel user) default Locale
resolveLocale
(UserModel user, Theme.Type themeType) void
setAuthenticationSession
(AuthenticationSessionModel authenticationSession) void
setClient
(ClientModel client) void
setConnection
(ClientConnection clientConnection) void
setHttpRequest
(HttpRequest httpRequest) void
setHttpResponse
(HttpResponse httpResponse) void
setOrganization
(OrganizationModel organization) void
setRealm
(RealmModel realm)
-
Method Details
-
getAuthServerUrl
URI getAuthServerUrl() -
getContextPath
String getContextPath() -
getUri
KeycloakUriInfo getUri()Returns the URI assuming it is a frontend request. To resolve URI for a backend request usegetUri(UrlType)
- Returns:
-
getUri
Returns 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.- Parameters:
type
- the type of the request- Returns:
-
getRequestHeaders
jakarta.ws.rs.core.HttpHeaders getRequestHeaders() -
getContextObject
Deprecated, for removal: This API element is subject to removal in a future version.Will always return null. You should not need access to a general context object. -
getRealm
RealmModel getRealm() -
setRealm
-
getClient
ClientModel getClient() -
setClient
-
getOrganization
OrganizationModel getOrganization() -
setOrganization
-
getConnection
ClientConnection getConnection() -
resolveLocale
-
resolveLocale
-
getAuthenticationSession
AuthenticationSessionModel getAuthenticationSession()Get current AuthenticationSessionModel, can be null out of the AuthenticationSession context.- Returns:
- current AuthenticationSessionModel or null
-
setAuthenticationSession
-
getHttpRequest
HttpRequest getHttpRequest() -
getHttpResponse
HttpResponse getHttpResponse() -
setConnection
-
setHttpRequest
-
setHttpResponse
-