Reexport claims struct to avoid downstream deps on biscuit
This commit is contained in:
parent
b684baa89f
commit
6861617e1a
|
@ -18,7 +18,7 @@
|
||||||
//!
|
//!
|
||||||
//! // ... send your user to auth_url, get an auth_code back at your redirect_url handler
|
//! // ... send your user to auth_url, get an auth_code back at your redirect_url handler
|
||||||
//!
|
//!
|
||||||
//! let token = client.authenticate(auth_code, Default::default())?;
|
//! let token = client.authenticate(auth_code, None, None)?;
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! That example leaves you with a decoded `Token` that has been validated. Your user is
|
//! That example leaves you with a decoded `Token` that has been validated. Your user is
|
||||||
|
@ -420,6 +420,9 @@ impl Client {
|
||||||
/// Derives Default, so remember to ..Default::default() after you specify what you want.
|
/// Derives Default, so remember to ..Default::default() after you specify what you want.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
|
/// MUST contain openid. By default this is ONLY openid. Official optional scopes are
|
||||||
|
/// email, profile, address, phone, offline_access. Check the Discovery config
|
||||||
|
/// `scopes_supported` to see what is available at your provider!
|
||||||
pub scope: Option<String>,
|
pub scope: Option<String>,
|
||||||
pub state: Option<String>,
|
pub state: Option<String>,
|
||||||
pub nonce: Option<String>,
|
pub nonce: Option<String>,
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
use base64;
|
use base64;
|
||||||
use biscuit::{CompactJson, Empty, SingleOrMultiple};
|
use biscuit::{CompactJson, Empty, SingleOrMultiple};
|
||||||
use biscuit::jws::Compact;
|
|
||||||
use inth_oauth2::client::response::{FromResponse, ParseError};
|
use inth_oauth2::client::response::{FromResponse, ParseError};
|
||||||
use inth_oauth2::token::{self, Bearer, Expiring};
|
use inth_oauth2::token::{self, Bearer, Expiring};
|
||||||
use reqwest::Url;
|
use reqwest::Url;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use url_serde;
|
use url_serde;
|
||||||
|
|
||||||
type IdToken = Compact<Claims, Empty>;
|
pub use biscuit::jws::Compact as Jws;
|
||||||
|
|
||||||
|
type IdToken = Jws<Claims, Empty>;
|
||||||
|
|
||||||
|
/// ID Token contents. [See spec.](https://openid.net/specs/openid-connect-basic-1_0.html#IDToken)
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct Claims {
|
pub struct Claims {
|
||||||
#[serde(with = "url_serde")] pub iss: Url,
|
#[serde(with = "url_serde")] pub iss: Url,
|
||||||
|
@ -70,7 +72,7 @@ impl Token {
|
||||||
let token = obj.get("id_token").and_then(Value::as_str).ok_or(
|
let token = obj.get("id_token").and_then(Value::as_str).ok_or(
|
||||||
ParseError::ExpectedFieldType("id_token", "string"),
|
ParseError::ExpectedFieldType("id_token", "string"),
|
||||||
)?;
|
)?;
|
||||||
Ok(Compact::new_encoded(token))
|
Ok(Jws::new_encoded(token))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue