Add Google provider

This commit is contained in:
Curtis McEnroe 2015-12-21 22:25:50 -05:00
parent af0b8bfe43
commit c3e4d78ad3
1 changed files with 13 additions and 1 deletions

View File

@ -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<Expiring>;
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" }
}