Package org.keycloak.urls
Interface HostnameProvider
-
- All Superinterfaces:
Provider
- All Known Implementing Classes:
DefaultHostnameProvider,FixedHostnameProvider,RequestHostnameProvider
public interface HostnameProvider extends Provider
The Hostname provider is used by Keycloak to decide URLs for frontend and backend requests. A provider can either base the URL on the request (Host header for example) or based on hard-coded URLs. Further, it is possible to have different URLs on frontend requests and backend requests. Note: Do NOT useKeycloakContext.getUri()within a Hostname provider. It will result in an infinite loop.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidclose()default StringgetContextPath(javax.ws.rs.core.UriInfo originalUriInfo)Returns the context-path for Keycloak This is useful when Keycloak is exposed on a different context-path on a reverse proxy.default StringgetContextPath(javax.ws.rs.core.UriInfo originalUriInfo, UrlType type)Returns the context-path for Keycloak.default StringgetHostname(javax.ws.rs.core.UriInfo originalUriInfo)Returns the host.default StringgetHostname(javax.ws.rs.core.UriInfo originalUriInfo, UrlType type)Returns the host.default intgetPort(javax.ws.rs.core.UriInfo originalUriInfo)Returns the port (or -1 for default port).default intgetPort(javax.ws.rs.core.UriInfo originalUriInfo, UrlType type)Returns the port (or -1 for default port).default StringgetScheme(javax.ws.rs.core.UriInfo originalUriInfo)Returns the URL scheme.default StringgetScheme(javax.ws.rs.core.UriInfo originalUriInfo, UrlType type)Returns the URL scheme.
-
-
-
Method Detail
-
getScheme
default String getScheme(javax.ws.rs.core.UriInfo originalUriInfo, UrlType type)
Returns the URL scheme. If not implemented will delegate togetScheme(UriInfo).- Parameters:
originalUriInfo- the original URItype- type of the request- Returns:
- the schema
-
getScheme
default String getScheme(javax.ws.rs.core.UriInfo originalUriInfo)
Returns the URL scheme. If not implemented will get the scheme from the request.- Parameters:
originalUriInfo- the original URI- Returns:
- the schema
-
getHostname
default String getHostname(javax.ws.rs.core.UriInfo originalUriInfo, UrlType type)
Returns the host. If not implemented will delegate togetHostname(UriInfo).- Parameters:
originalUriInfo- the original URItype- type of the request- Returns:
- the host
-
getHostname
default String getHostname(javax.ws.rs.core.UriInfo originalUriInfo)
Returns the host. If not implemented will get the host from the request.- Parameters:
originalUriInfo-- Returns:
- the host
-
getPort
default int getPort(javax.ws.rs.core.UriInfo originalUriInfo, UrlType type)Returns the port (or -1 for default port). If not implemented will delegate togetPort(UriInfo)- Parameters:
originalUriInfo- the original URItype- type of the request- Returns:
- the port
-
getPort
default int getPort(javax.ws.rs.core.UriInfo originalUriInfo)
Returns the port (or -1 for default port). If not implemented will get the port from the request.- Parameters:
originalUriInfo- the original URI- Returns:
- the port
-
getContextPath
default String getContextPath(javax.ws.rs.core.UriInfo originalUriInfo, UrlType type)
Returns the context-path for Keycloak. This is useful when Keycloak is exposed on a different context-path on a reverse proxy. If not implemented will delegate togetContextPath(UriInfo)- Parameters:
originalUriInfo- the original URItype- type of the request- Returns:
- the context-path
-
getContextPath
default String getContextPath(javax.ws.rs.core.UriInfo originalUriInfo)
Returns the context-path for Keycloak This is useful when Keycloak is exposed on a different context-path on a reverse proxy. If not implemented will use the context-path from the request, which by default is /auth- Parameters:
originalUriInfo- the original URI- Returns:
- the context-path
-
-