Package no.unit.nva.auth
Class AuthorizedBackendClient
java.lang.Object
no.unit.nva.auth.AuthorizedBackendClient
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAuthorizedBackendClient(HttpClient httpClient, String bearerToken, CognitoCredentials cognitoCredentials) -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringstatic AuthorizedBackendClientprepareWithBearerToken(String bearerToken) static AuthorizedBackendClientprepareWithBearerToken(HttpClient httpClient, String bearerToken) static AuthorizedBackendClientprepareWithBearerTokenAndCredentials(HttpClient httpClient, String bearerToken, CognitoCredentials cognitoCredentials) static AuthorizedBackendClientprepareWithCognitoCredentials(HttpClient httpClient, CognitoCredentials cognitoApiClientCredentials) static AuthorizedBackendClientprepareWithCognitoCredentials(CognitoCredentials cognitoCredentials) <T> HttpResponse<T>send(HttpRequest.Builder request, HttpResponse.BodyHandler<T> responseBodyHandler) <T> CompletableFuture<HttpResponse<T>>sendAsync(HttpRequest.Builder request, HttpResponse.BodyHandler<T> responseBodyHandler)
-
Field Details
-
APPLICATION_X_WWW_FORM_URLENCODED
- See Also:
-
AUTHORIZATION_HEADER
- See Also:
-
-
Constructor Details
-
AuthorizedBackendClient
protected AuthorizedBackendClient(HttpClient httpClient, String bearerToken, CognitoCredentials cognitoCredentials)
-
-
Method Details
-
prepareWithCognitoCredentials
public static AuthorizedBackendClient prepareWithCognitoCredentials(CognitoCredentials cognitoCredentials) -
prepareWithCognitoCredentials
public static AuthorizedBackendClient prepareWithCognitoCredentials(HttpClient httpClient, CognitoCredentials cognitoApiClientCredentials) -
prepareWithBearerToken
-
prepareWithBearerToken
public static AuthorizedBackendClient prepareWithBearerToken(HttpClient httpClient, String bearerToken) -
prepareWithBearerTokenAndCredentials
public static AuthorizedBackendClient prepareWithBearerTokenAndCredentials(HttpClient httpClient, String bearerToken, CognitoCredentials cognitoCredentials) -
send
public <T> HttpResponse<T> send(HttpRequest.Builder request, HttpResponse.BodyHandler<T> responseBodyHandler) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
sendAsync
public <T> CompletableFuture<HttpResponse<T>> sendAsync(HttpRequest.Builder request, HttpResponse.BodyHandler<T> responseBodyHandler) -
getBearerToken
-