Class KerberosRestTemplate
java.lang.Object
org.springframework.http.client.support.HttpAccessor
org.springframework.http.client.support.InterceptingHttpAccessor
org.springframework.web.client.RestTemplate
org.springframework.security.kerberos.client.KerberosRestTemplate
- All Implemented Interfaces:
org.springframework.web.client.RestOperations
public class KerberosRestTemplate
extends org.springframework.web.client.RestTemplate
RestTemplate that is able to make kerberos SPNEGO authenticated REST requests.
Under a hood this KerberosRestTemplate is using HttpClient to support
Kerberos.
Generally this template can be configured in few different ways.
- Leave keyTabLocation and userPrincipal empty if you want to use cached ticket
- Use keyTabLocation and userPrincipal if you want to use keytab file
- Use userPrincipal and password if you want to use user/password
- Use loginOptions if you want to customise Krb5LoginModule options
- Use a customised httpClient
-
Field Summary
Fields inherited from class org.springframework.http.client.support.HttpAccessor
logger -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new kerberos rest template.KerberosRestTemplate(@Nullable String keyTabLocation, @Nullable String userPrincipal) Instantiates a new kerberos rest template.KerberosRestTemplate(@Nullable String keyTabLocation, @Nullable String userPrincipal, @Nullable String password, @Nullable Map<String, Object> loginOptions) Instantiates a new kerberos rest template.KerberosRestTemplate(@Nullable String keyTabLocation, @Nullable String userPrincipal, @Nullable Map<String, Object> loginOptions) Instantiates a new kerberos rest template.KerberosRestTemplate(@Nullable String keyTabLocation, @Nullable String userPrincipal, org.apache.hc.client5.http.classic.HttpClient httpClient) Instantiates a new kerberos rest template.KerberosRestTemplate(@Nullable Map<String, Object> loginOptions) Instantiates a new kerberos rest template.KerberosRestTemplate(@Nullable Map<String, Object> loginOptions, org.apache.hc.client5.http.classic.HttpClient httpClient) Instantiates a new kerberos rest template.KerberosRestTemplate(org.apache.hc.client5.http.classic.HttpClient httpClient) Instantiates a new kerberos rest template. -
Method Summary
Modifier and TypeMethodDescriptionprotected final <T> TdoExecute(URI url, @Nullable String uriTemplate, @Nullable org.springframework.http.HttpMethod method, @Nullable org.springframework.web.client.RequestCallback requestCallback, @Nullable org.springframework.web.client.ResponseExtractor<T> responseExtractor) Methods inherited from class org.springframework.web.client.RestTemplate
acceptHeaderRequestCallback, delete, delete, delete, exchange, exchange, exchange, exchange, exchange, exchange, exchange, exchange, execute, execute, execute, getErrorHandler, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, getMessageConverters, getObservationConvention, getObservationRegistry, 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, setObservationConvention, setObservationRegistry, setUriTemplateHandlerMethods inherited from class org.springframework.http.client.support.InterceptingHttpAccessor
getInterceptors, getRequestFactory, setInterceptors, setRequestFactoryMethods inherited from class org.springframework.http.client.support.HttpAccessor
createRequest, getBufferingPredicate, getClientHttpRequestInitializers, setBufferingPredicate, setClientHttpRequestInitializers
-
Constructor Details
-
KerberosRestTemplate
public KerberosRestTemplate()Instantiates a new kerberos rest template. -
KerberosRestTemplate
public KerberosRestTemplate(org.apache.hc.client5.http.classic.HttpClient httpClient) Instantiates a new kerberos rest template.- Parameters:
httpClient- the http client
-
KerberosRestTemplate
-
KerberosRestTemplate
public KerberosRestTemplate(@Nullable String keyTabLocation, @Nullable String userPrincipal, org.apache.hc.client5.http.classic.HttpClient httpClient) Instantiates a new kerberos rest template.- Parameters:
keyTabLocation- the key tab locationuserPrincipal- the user principalhttpClient- the http client
-
KerberosRestTemplate
-
KerberosRestTemplate
-
KerberosRestTemplate
-
KerberosRestTemplate
public KerberosRestTemplate(@Nullable String keyTabLocation, @Nullable String userPrincipal, @Nullable String password, @Nullable Map<String, Object> loginOptions) Instantiates a new kerberos rest template.- Parameters:
keyTabLocation- the key tab locationuserPrincipal- the user principalpassword- the passwordloginOptions- the login options
-
-
Method Details
-
doExecute
protected final <T> T doExecute(URI url, @Nullable String uriTemplate, @Nullable org.springframework.http.HttpMethod method, @Nullable org.springframework.web.client.RequestCallback requestCallback, @Nullable org.springframework.web.client.ResponseExtractor<T> responseExtractor) throws org.springframework.web.client.RestClientException - Overrides:
doExecutein classorg.springframework.web.client.RestTemplate- Throws:
org.springframework.web.client.RestClientException
-