Google APIs Client Library for C++
WebServerAuthorizationCodeGetter Class Reference

An adapter to use webserver with OAuth2AuthorizationFlows. More...

#include "client/auth/webserver_authorization_getter.h"

List of all members.

Public Types

typedef ResultCallback1
< util::Status, const
StringPiece & > 
AskCallback
 Callback used to prompt for authorization.

Public Member Functions

 WebServerAuthorizationCodeGetter (AskCallback *ask_callback)
 Standard constructor.
virtual ~WebServerAuthorizationCodeGetter ()
 Standard destructor.
int64 timeout_ms () const
 How long we'll wait for authorization.
void set_timeout_ms (int64 ms)
 Set how long we'll weait.
AskCallbackask_callback ()
 Gets the ask callback.
OAuth2AuthorizationFlow::AuthorizationCodeCallbackMakeAuthorizationCodeCallback (OAuth2AuthorizationFlow *flow)
 Returns a repeatable callback for flow to get an authorization code.
virtual void AddReceiveAuthorizationCodeUrlPath (const StringPiece &path, AbstractWebServer *httpd)
virtual util::Status PromptForAuthorizationCode (OAuth2AuthorizationFlow *flow, const OAuth2RequestOptions &options, string *authorization_code)

Static Public Member Functions

static util::Status PromptWithCommand (const string &program, const string &args, const StringPiece &url)
 A suitable function for an asker that execute a command (e.g.
static util::Status PromptWithOstream (std::ostream *ostream, const string &prompt, const StringPiece &url)
 A suitable function for an asker that prompts a console.

Protected Member Functions

virtual util::Status AskForAuthorization (const StringPiece &url)

Detailed Description

An adapter to use webserver with OAuth2AuthorizationFlows.

This class will likely change significantly or go away in a future release.

It is here to support samples, experimentation, and testing OAuth2 web flows.


Member Typedef Documentation

typedef ResultCallback1< util::Status, const StringPiece& > AskCallback

Callback used to prompt for authorization.

Receiving authorization will happen through a web server handler.


Constructor & Destructor Documentation

WebServerAuthorizationCodeGetter ( AskCallback ask_callback) [explicit]

Standard constructor.

Parameters:
[in]ask_callbackMust be a non-NULL repeatable callback. takes ownership.
virtual ~WebServerAuthorizationCodeGetter ( ) [virtual]

Standard destructor.


Member Function Documentation

virtual void AddReceiveAuthorizationCodeUrlPath ( const StringPiece &  path,
AbstractWebServer httpd 
) [virtual]
Parameters:
[in]pathThe path that uri_redirects are expected on.
[in]httpdThe webserver to process the redirects wtih
AskCallback* ask_callback ( ) [inline]

Gets the ask callback.

Returns:
reference. This instance retains ownership.
virtual util::Status AskForAuthorization ( const StringPiece &  url) [protected, virtual]

Returns a repeatable callback for flow to get an authorization code.

Parameters:
[in]flowA reference to the flow is used to generate urls.
Returns:
Ownershp is apssed back to the caller.
virtual util::Status PromptForAuthorizationCode ( OAuth2AuthorizationFlow flow,
const OAuth2RequestOptions options,
string *  authorization_code 
) [virtual]
static util::Status PromptWithCommand ( const string &  program,
const string &  args,
const StringPiece &  url 
) [static]

A suitable function for an asker that execute a command (e.g.

a browser).

static util::Status PromptWithOstream ( std::ostream *  ostream,
const string &  prompt,
const StringPiece &  url 
) [static]

A suitable function for an asker that prompts a console.

void set_timeout_ms ( int64  ms) [inline]

Set how long we'll weait.

Parameters:
[in]msTime in milliseconds.
int64 timeout_ms ( ) const [inline]

How long we'll wait for authorization.

Returns:
Time in milliseconds.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines