Add Google provider
This commit is contained in:
parent
af0b8bfe43
commit
c3e4d78ad3
|
@ -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" }
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue