public final class LocalServerReceiver implements VerificationCodeReceiver
OAuth 2.0 verification code receiver that runs an HTTP server on a free port, waiting for a redirect with the verification code.
Implementation is thread-safe.
Implements
VerificationCodeReceiverConstructors
LocalServerReceiver()
public LocalServerReceiver()
Constructor that starts the server on #LOCALHOST and an unused port.
Use Builder if you need to specify any of the optional parameters.
Methods
getCallbackPath()
public String getCallbackPath()
Returns callback path used in redirect_uri.
Type | Description |
String |
getHost()
public String getHost()
Returns the host name to use.
Type | Description |
String |
getPort()
public int getPort()
Returns the port to use or -1
to select an unused port in #getRedirectUri().
Type | Description |
int |
getRedirectUri()
public String getRedirectUri()
Returns the redirect URI.
Type | Description |
String |
Type | Description |
IOException |
stop()
public void stop()
Releases any resources and stops any processes started.
Type | Description |
IOException |
waitForCode()
public String waitForCode()
Blocks until the server receives a login result, or the server is stopped by #stop(), to return an authorization code.
Type | Description |
String | authorization code if login succeeds; may return |
Type | Description |
IOException | if the server receives an error code (through an HTTP request parameter
|