Class KeycloakRestTemplate
java.lang.Object
org.springframework.http.client.support.HttpAccessor
org.springframework.http.client.support.InterceptingHttpAccessor
org.springframework.web.client.RestTemplate
org.keycloak.adapters.springsecurity.client.KeycloakRestTemplate
- All Implemented Interfaces:
org.springframework.web.client.RestOperations
public class KeycloakRestTemplate
extends org.springframework.web.client.RestTemplate
implements org.springframework.web.client.RestOperations
Extends Spring's central class for client-side HTTP access,
RestTemplate, adding
automatic authentication for service to service calls using the currently authenticated Keycloak principal.
This class is designed to work with other services secured by Keycloak.
The main advantage to using this class over Spring's RestTemplate is that authentication
is handled automatically when both the service making the API call and the service being called are
protected by Keycloak authentication.
- Version:
- $Revision: 1 $
- Author:
- Scott Rossillo
- See Also:
-
RestOperationsRestTemplate
-
Field Summary
Fields inherited from class org.springframework.http.client.support.HttpAccessor
logger -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.springframework.web.client.RestTemplate
acceptHeaderRequestCallback, delete, delete, delete, doExecute, exchange, exchange, exchange, exchange, exchange, exchange, exchange, exchange, execute, execute, execute, getErrorHandler, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, getMessageConverters, getUriTemplateHandler, handleResponse, headersExtractor, headForHeaders, headForHeaders, headForHeaders, httpEntityCallback, httpEntityCallback, optionsForAllow, optionsForAllow, optionsForAllow, patchForObject, patchForObject, patchForObject, postForEntity, postForEntity, postForEntity, postForLocation, postForLocation, postForLocation, postForObject, postForObject, postForObject, put, put, put, responseEntityExtractor, setDefaultUriVariables, setErrorHandler, setMessageConverters, setUriTemplateHandlerMethods inherited from class org.springframework.http.client.support.InterceptingHttpAccessor
getInterceptors, getRequestFactory, setInterceptors, setRequestFactoryMethods inherited from class org.springframework.http.client.support.HttpAccessor
createRequest, getClientHttpRequestInitializers, setClientHttpRequestInitializersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.client.RestOperations
delete, delete, delete, exchange, exchange, exchange, exchange, exchange, exchange, exchange, exchange, execute, execute, execute, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, headForHeaders, headForHeaders, headForHeaders, optionsForAllow, optionsForAllow, optionsForAllow, patchForObject, patchForObject, patchForObject, postForEntity, postForEntity, postForEntity, postForLocation, postForLocation, postForLocation, postForObject, postForObject, postForObject, put, put, put
-
Constructor Details
-
KeycloakRestTemplate
Create a new instance based on the givenKeycloakClientRequestFactory.- Parameters:
factory- theKeycloakClientRequestFactoryto use when creating new requests
-