Class RestTemplateUrlAccessTokenProvider
java.lang.Object
org.entur.jwt.client.AbstractUrlAccessTokenProvider<org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>>
org.entur.jwt.client.spring.classic.RestTemplateUrlAccessTokenProvider
- All Implemented Interfaces:
Closeable,AutoCloseable,AccessTokenHealthProvider,AccessTokenProvider
public class RestTemplateUrlAccessTokenProvider
extends AbstractUrlAccessTokenProvider<org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>>
RestTemplate access-token provider. Using UrlAccessTokenProvider
would strictly be sufficient, but using RestTemplate is more convenient for
mocking.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.springframework.web.client.RestTemplateFields inherited from class org.entur.jwt.client.AbstractUrlAccessTokenProvider
CONTENT_TYPE, issueBody, issueHeaders, issueUrl, KEY_GRANT_TYPE, logger, reader -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected InputStreamgetResponseContent(org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> response) protected intgetResponseStatusCode(org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> response) protected StringBuilderprintHeadersIfPresent(org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> c, String... headerNames) protected static StringBuilderprintResponseEntityHeadersIfPresent(org.springframework.http.ResponseEntity<?> c, String... headerNames) protected org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>booleanMethods inherited from class org.entur.jwt.client.AbstractUrlAccessTokenProvider
checkArgument, close, createBody, encode, getAccessToken, getToken, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.entur.jwt.client.AccessTokenHealthProvider
getHealth
-
Field Details
-
restTemplate
protected final org.springframework.web.client.RestTemplate restTemplate
-
-
Constructor Details
-
RestTemplateUrlAccessTokenProvider
-
-
Method Details
-
printResponseEntityHeadersIfPresent
protected static StringBuilder printResponseEntityHeadersIfPresent(org.springframework.http.ResponseEntity<?> c, String... headerNames) -
request
protected org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> request(URL url, byte[] body, Map<String, Object> map) throws IOException- Specified by:
requestin classAbstractUrlAccessTokenProvider<org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>>- Throws:
IOException
-
getResponseStatusCode
protected int getResponseStatusCode(org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> response) throws IOException - Specified by:
getResponseStatusCodein classAbstractUrlAccessTokenProvider<org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>>- Throws:
IOException
-
getResponseContent
protected InputStream getResponseContent(org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> response) throws IOException - Specified by:
getResponseContentin classAbstractUrlAccessTokenProvider<org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>>- Throws:
IOException
-
printHeadersIfPresent
protected StringBuilder printHeadersIfPresent(org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> c, String... headerNames) - Specified by:
printHeadersIfPresentin classAbstractUrlAccessTokenProvider<org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>>
-
supportsHealth
public boolean supportsHealth()
-