Package org.faceless.publisher.type
Class OAuth2StandaloneCallbackHandler
java.lang.Object
org.faceless.publisher.type.OAuth2StandaloneCallbackHandler
- All Implemented Interfaces:
CallbackHandler
An implementation of
CallbackHandler
that can support OAuth2Callback
It uses the com.sun.net.httpserver
package to create a local webserver
and then directs the user to that URL to begin the authentication process.-
Constructor Summary
ConstructorDescriptionCreate an OAuth2StandaloneCallbackHandler on the default portOAuth2StandaloneCallbackHandler
(int port) Create an OAuth2StandaloneCallbackHandler on the specified portOAuth2StandaloneCallbackHandler
(String scheme, String host, int port, String prefix) Create an OAuth2StandaloneCallbackHandler on the specified port -
Method Summary
Modifier and TypeMethodDescriptionlong
Get the timeout as set bysetTimeout(long)
void
void
handle
(OAuth2Callback callback) void
setTimeout
(long timeout) Set the timeout to wait for a response
-
Constructor Details
-
OAuth2StandaloneCallbackHandler
public OAuth2StandaloneCallbackHandler()Create an OAuth2StandaloneCallbackHandler on the default port -
OAuth2StandaloneCallbackHandler
public OAuth2StandaloneCallbackHandler(int port) Create an OAuth2StandaloneCallbackHandler on the specified port- Parameters:
port
- the port to start the webserver on, eg 8080
-
OAuth2StandaloneCallbackHandler
Create an OAuth2StandaloneCallbackHandler on the specified port- Parameters:
scheme
- either "http" or "https"host
- the host, typically "localhost"port
- the port to start the webserver on, eg 8080prefix
- the prefix for requests to this webserver, typically "/"
-
-
Method Details
-
setTimeout
public void setTimeout(long timeout) Set the timeout to wait for a response- Parameters:
timeout
- the timeout in milliseconds
-
getTimeout
public long getTimeout()Get the timeout as set bysetTimeout(long)
- Returns:
- the timeout in milliseconds
-
handle
- Specified by:
handle
in interfaceCallbackHandler
- Throws:
IOException
UnsupportedCallbackException
-
handle
- Throws:
IOException
-