diff --git a/src/provider.rs b/src/provider.rs index d54bd81..b115e65 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -1,6 +1,6 @@ //! Providers. -use token::{Token, Lifetime}; +use token::{Token, Lifetime, Bearer, Expiring}; /// OAuth 2.0 providers. pub trait Provider { @@ -20,3 +20,15 @@ pub trait Provider { /// See [RFC 6749, section 3.2](http://tools.ietf.org/html/rfc6749#section-3.2). fn token_uri() -> &'static str; } + +/// Google OAuth 2.0 provider. +/// +/// See [Using OAuth 2.0 to Access Google +/// APIs](https://developers.google.com/identity/protocols/OAuth2). +pub struct Google; +impl Provider for Google { + type Lifetime = Expiring; + type Token = Bearer; + fn auth_uri() -> &'static str { "https://accounts.google.com/o/oauth2/v2/auth" } + fn token_uri() -> &'static str { "https://www.googleapis.com/oauth2/v4/token" } +}