Class OAuthReceiverCallback
java.lang.Object
com.amilesend.onedrive.connection.auth.oauth.OAuthReceiverCallback
- All Implemented Interfaces:
HttpHandler
HttpServer handler that takes the verifier token passed over from the OAuth provider and
stashes it where
OAuthReceiver.waitForCode() will find it.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionOAuthReceiverCallback(@NonNull String callbackPath, String successLandingPageUrl, String failureLandingPageUrl) Builds a newOAuthReceiverCallback -
Method Summary
Modifier and TypeMethodDescriptionbuilder()getCode()The authorization code.getError()The error code.voidhandle(HttpExchange httpExchange) Handles the given request and sets the corresponding redirect status.voidReleases the lock.Blocks until the server receives a login result, or the server is stopped byOAuthReceiver.stop(), to return an authorization code.
-
Constructor Details
-
OAuthReceiverCallback
public OAuthReceiverCallback(@NonNull String callbackPath, String successLandingPageUrl, String failureLandingPageUrl) Builds a newOAuthReceiverCallback- Parameters:
callbackPath- the path to listen for the redirectsuccessLandingPageUrl- optional URL for a custom successful landing pagefailureLandingPageUrl- optional URL for a custom failure landing page
-
-
Method Details
-
handle
Handles the given request and sets the corresponding redirect status.- Specified by:
handlein interfaceHttpHandler- Parameters:
httpExchange- the exchange containing the request from the client- Throws:
IOException- if unable to retrieve request information from the exchange
-
waitForCode
Blocks until the server receives a login result, or the server is stopped byOAuthReceiver.stop(), to return an authorization code.- Returns:
- authorization code if login succeeds; may return
nullif the server is stopped byOAuthReceiver.stop() - Throws:
OAuthReceiverException- if the server receives an error code (through an HTTP request parametererror)
-
releaseLock
public void releaseLock()Releases the lock. -
builder
-
getCode
The authorization code. -
getError
The error code.
-