Google APIs Client Library for C++
|
An adapter to use webserver with OAuth2AuthorizationFlows. More...
#include "client/auth/webserver_authorization_getter.h"
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. | |
AskCallback * | ask_callback () |
Gets the ask callback. | |
OAuth2AuthorizationFlow::AuthorizationCodeCallback * | MakeAuthorizationCodeCallback (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) |
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.
typedef ResultCallback1< util::Status, const StringPiece& > AskCallback |
Callback used to prompt for authorization.
Receiving authorization will happen through a web server handler.
WebServerAuthorizationCodeGetter | ( | AskCallback * | ask_callback | ) | [explicit] |
Standard constructor.
[in] | ask_callback | Must be a non-NULL repeatable callback. takes ownership. |
virtual ~WebServerAuthorizationCodeGetter | ( | ) | [virtual] |
Standard destructor.
virtual void AddReceiveAuthorizationCodeUrlPath | ( | const StringPiece & | path, |
AbstractWebServer * | httpd | ||
) | [virtual] |
[in] | path | The path that uri_redirects are expected on. |
[in] | httpd | The webserver to process the redirects wtih |
AskCallback* ask_callback | ( | ) | [inline] |
Gets the ask callback.
virtual util::Status AskForAuthorization | ( | const StringPiece & | url | ) | [protected, virtual] |
OAuth2AuthorizationFlow::AuthorizationCodeCallback* MakeAuthorizationCodeCallback | ( | OAuth2AuthorizationFlow * | flow | ) |
Returns a repeatable callback for flow to get an authorization code.
[in] | flow | A reference to the flow is used to generate urls. |
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.
[in] | ms | Time in milliseconds. |
int64 timeout_ms | ( | ) | const [inline] |
How long we'll wait for authorization.