com.google.api.client.extensions.jetty.auth.oauth2
Class LocalServerReceiver

java.lang.Object
  extended by com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver
All Implemented Interfaces:
VerificationCodeReceiver

public final class LocalServerReceiver
extends Object
implements VerificationCodeReceiver

OAuth 2.0 verification code receiver that runs a Jetty server on a free port, waiting for a redirect with the verification code.

Implementation is thread-safe.

Since:
1.11
Author:
Yaniv Inbar

Nested Class Summary
static class LocalServerReceiver.Builder
          Builder.
 
Constructor Summary
LocalServerReceiver()
          Constructor that starts the server on "localhost" selects an unused port.
 
Method Summary
 String getHost()
          Returns the host name to use.
 int getPort()
          Returns the port to use or -1 to select an unused port in getRedirectUri().
 String getRedirectUri()
           
 void stop()
           
 String waitForCode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalServerReceiver

public LocalServerReceiver()
Constructor that starts the server on "localhost" selects an unused port.

Use LocalServerReceiver.Builder if you need to specify any of the optional parameters.

Method Detail

getRedirectUri

public String getRedirectUri()
                      throws Exception
Specified by:
getRedirectUri in interface VerificationCodeReceiver
Throws:
Exception

waitForCode

public String waitForCode()
                   throws Exception
Specified by:
waitForCode in interface VerificationCodeReceiver
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface VerificationCodeReceiver
Throws:
Exception

getHost

public String getHost()
Returns the host name to use.


getPort

public int getPort()
Returns the port to use or -1 to select an unused port in getRedirectUri().



Copyright © 2011-2012 Google. All Rights Reserved.