From af0b8bfe43f200fa81795d556254ccb52b15561a Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Mon, 21 Dec 2015 22:21:53 -0500 Subject: [PATCH] Add Provider trait --- src/lib.rs | 1 + src/provider.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/provider.rs diff --git a/src/lib.rs b/src/lib.rs index dd63bef..2d7e474 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,3 +4,4 @@ extern crate rustc_serialize; extern crate url; pub mod token; +pub mod provider; diff --git a/src/provider.rs b/src/provider.rs new file mode 100644 index 0000000..d54bd81 --- /dev/null +++ b/src/provider.rs @@ -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; + + /// 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; +}