Add Provider trait

This commit is contained in:
Curtis McEnroe 2015-12-21 22:21:53 -05:00
parent 76dcc305f3
commit af0b8bfe43
2 changed files with 23 additions and 0 deletions

View File

@ -4,3 +4,4 @@ extern crate rustc_serialize;
extern crate url;
pub mod token;
pub mod provider;

22
src/provider.rs Normal file
View File

@ -0,0 +1,22 @@
//! Providers.
use token::{Token, Lifetime};
/// OAuth 2.0 providers.
pub trait Provider {
/// The lifetime of tokens issued by the provider.
type Lifetime: Lifetime;
/// The type of token issued by the provider.
type Token: Token<Self::Lifetime>;
/// The authorization endpoint URI.
///
/// See [RFC 6749, section 3.1](http://tools.ietf.org/html/rfc6749#section-3.1).
fn auth_uri() -> &'static str;
/// The token endpoint URI.
///
/// See [RFC 6749, section 3.2](http://tools.ietf.org/html/rfc6749#section-3.2).
fn token_uri() -> &'static str;
}