1
0
Fork 0

Add Google provider

Dieser Commit ist enthalten in:
Curtis McEnroe 2015-12-21 22:25:50 -05:00
Ursprung af0b8bfe43
Commit c3e4d78ad3
1 geänderte Dateien mit 13 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,6 @@
//! Providers. //! Providers.
use token::{Token, Lifetime}; use token::{Token, Lifetime, Bearer, Expiring};
/// OAuth 2.0 providers. /// OAuth 2.0 providers.
pub trait Provider { 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). /// See [RFC 6749, section 3.2](http://tools.ietf.org/html/rfc6749#section-3.2).
fn token_uri() -> &'static str; 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" }
}