public class KeycloakRestTemplate
extends org.springframework.web.client.RestTemplate
implements org.springframework.web.client.RestOperations
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.
RestOperations
,
RestTemplate
Constructor and Description |
---|
KeycloakRestTemplate(KeycloakClientRequestFactory factory)
Create a new instance based on the given
KeycloakClientRequestFactory . |
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, setUriTemplateHandler
getInterceptors, getRequestFactory, setInterceptors, setRequestFactory
createRequest, getClientHttpRequestInitializers, setClientHttpRequestInitializers
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
public KeycloakRestTemplate(KeycloakClientRequestFactory factory)
KeycloakClientRequestFactory
.factory
- the KeycloakClientRequestFactory
to use when creating new requestsCopyright © 2021 JBoss by Red Hat. All rights reserved.