From cd66c77a941a7d5d3fc401eb87b79220c4515659 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Mon, 21 Dec 2015 22:28:48 -0500 Subject: [PATCH] Add GitHub provider --- src/provider.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/provider.rs b/src/provider.rs index b115e65..2e6a129 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -1,6 +1,6 @@ //! Providers. -use token::{Token, Lifetime, Bearer, Expiring}; +use token::{Token, Lifetime, Bearer, Static, Expiring}; /// OAuth 2.0 providers. pub trait Provider { @@ -32,3 +32,14 @@ impl Provider for Google { 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" } } + +/// GitHub OAuth 2.0 provider. +/// +/// See [OAuth, GitHub Developer Guide](https://developer.github.com/v3/oauth/). +pub struct GitHub; +impl Provider for GitHub { + type Lifetime = Static; + type Token = Bearer; + fn auth_uri() -> &'static str { "https://github.com/login/oauth/authorize" } + fn token_uri() -> &'static str { "https://github.com/login/oauth/access_token" } +}