Class Flows
java.lang.Object
org.apache.juneau.rest.auth.oauth.flow.Flows
Helpers shared across all flow types.
Centralizes the Nimbus TokenRequest-to-OAuthToken round-trip plus the standard error mapping.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic OAuthTokensend(com.nimbusds.oauth2.sdk.TokenRequest req, Duration timeout, Consumer<com.nimbusds.oauth2.sdk.http.HTTPRequest> httpConfigurator) Sends the suppliedTokenRequestvia Nimbus's HTTP client and maps the response toOAuthToken.
-
Method Details
-
send
public static OAuthToken send(com.nimbusds.oauth2.sdk.TokenRequest req, Duration timeout, Consumer<com.nimbusds.oauth2.sdk.http.HTTPRequest> httpConfigurator) Sends the suppliedTokenRequestvia Nimbus's HTTP client and maps the response toOAuthToken.A finite connect/read timeout is applied BEFORE the caller's
httpConfiguratorruns, so an unresponsive IdP can never wedge the call indefinitely while still letting callers override the value.- Parameters:
req- The NimbusTokenRequest. Nevernull.timeout- The connect/read timeout.nullselectsDEFAULT_HTTP_TIMEOUT.httpConfigurator- Optional pre-send hook on theHTTPRequest.- Returns:
- The acquired token.
- Throws:
OAuthFlowException- If the IdP returns an error or the HTTP round-trip fails.
-