Struct openid_client::Issuer
source · pub struct Issuer {Show 14 fields
pub issuer: String,
pub authorization_endpoint: Option<String>,
pub token_endpoint: Option<String>,
pub jwks_uri: Option<String>,
pub userinfo_endpoint: Option<String>,
pub revocation_endpoint: Option<String>,
pub claims_parameter_supported: bool,
pub grant_types_supported: Vec<String>,
pub request_parameter_supported: bool,
pub request_uri_parameter_supported: bool,
pub require_request_uri_registration: bool,
pub response_modes_supported: Vec<String>,
pub claim_types_supported: Vec<String>,
pub token_endpoint_auth_methods_supported: Vec<String>,
/* private fields */
}Expand description
Holds all the discovered values from the OIDC Issuer
Fields§
§issuer: StringDiscovered issuer uri.
OpenID Connect Authorization Endpoint.
token_endpoint: Option<String>OpenID Connect Token Endpoint.
jwks_uri: Option<String>URL of the authorization server’s JWK Set. See.
userinfo_endpoint: Option<String>OpenID Connect Userinfo Endpoint.
revocation_endpoint: Option<String>Endpoint for revoking refresh tokes and access tokens. Authorization Server Metadata.
claims_parameter_supported: boolClaims supported by the Authorization Server
grant_types_supported: Vec<String>OAuth 2.0 Grant Types supported by the Authorization Server. RFC 7591.
request_parameter_supported: boolIndicates whether request object is supported by Authorization Server. OIDC Request Object.
request_uri_parameter_supported: boolIndicates whether request object by reference is supported by Authorization Server. OIDC Request Object by Reference.
require_request_uri_registration: boolWhether a request uri has to be pre registered with Authorization Server.
response_modes_supported: Vec<String>OAuth 2.0 Response Mode values that Authorization Server supports. Authorization Server Metadata.
claim_types_supported: Vec<String>Claim Types supported. OIDC Claim types.
token_endpoint_auth_methods_supported: Vec<String>Client Authentication methods supported by Token Endpoint. Client Authentication
Implementations§
source§impl Issuer
impl Issuer
OIDC Issuer Discovery
sourcepub fn discover(issuer: &str) -> Result<Issuer, OidcClientError>
pub fn discover(issuer: &str) -> Result<Issuer, OidcClientError>
Discover OIDC Issuer
This is a blocking method. Checkout Issuer::discover_async for async version.
Discover an OIDC Issuer using the issuer url method.
fn main(){
let issuer = Issuer::discover("https://auth.example.com").unwrap();
}Only an absolute urls are accepted, passing in auth.example.com will result in an error.
Urls with .well-known/openid-configuration can also be used to discover issuer.
fn main(){
let issuer = Issuer::discover("https://auth.example.com/.well-known/openid-configurtaion").unwrap();
}sourcepub fn discover_with_interceptor(
issuer: &str,
interceptor: Box<dyn FnMut(&Request) -> RequestOptions>
) -> Result<Issuer, OidcClientError>
pub fn discover_with_interceptor( issuer: &str, interceptor: Box<dyn FnMut(&Request) -> RequestOptions> ) -> Result<Issuer, OidcClientError>
Discover OIDC Issuer with a request interceptor
This is a blocking method.Checkout Issuer::discover_with_interceptor_async for async version.
Allows you to pass in a closure that will be called for every request. First parameter is the actual request that is being processed. See Request. The expected return type is of type RequestOptions with custom headers and the timeout.
fn main(){
let interceptor = |_request: &Request| {
let mut headers = HeaderMap::new();
headers.append("testHeader", HeaderValue::from_static("testHeaderValue"));
RequestOptions {
headers,
timeout: Duration::from_millis(3500),
}
};
let issuer = Issuer::discover_with_interceptor("https://auth.example.com", Box::new(request_options)).unwrap();
}Headers that are returned with request options are appended to the headers of the request.
If there are duplicate headers, all values are appended to the header like so:
header: value1, value2, value3 ....
sourcepub async fn discover_async(issuer: &str) -> Result<Issuer, OidcClientError>
pub async fn discover_async(issuer: &str) -> Result<Issuer, OidcClientError>
Discover OIDC Issuer
This is an async method. Checkout Issuer::discover for blocking version.
Discover an OIDC Issuer using the issuer url method.
#[tokio::main]
async fn main(){
let issuer = Issuer::discover_async("https://auth.example.com").await.unwrap();
}Only an absolute urls are accepted, passing in auth.example.com will result in an error.
Urls with .well-known/openid-configuration can also be used to discover issuer.
#[tokio::main]
async fn main(){
let issuer = Issuer::discover_async("https://auth.example.com/.well-known/openid-configurtaion").await.unwrap();
}sourcepub async fn discover_with_interceptor_async(
issuer: &str,
request_interceptor: Box<dyn FnMut(&Request) -> RequestOptions>
) -> Result<Issuer, OidcClientError>
pub async fn discover_with_interceptor_async( issuer: &str, request_interceptor: Box<dyn FnMut(&Request) -> RequestOptions> ) -> Result<Issuer, OidcClientError>
Discover OIDC Issuer with a request interceptor
This is an async method.Checkout Issuer::discover_with_interceptor for blocking version.
Allows you to pass in a closure that will be called for every request. First parameter is the actual request that is being processed. See Request. The expected return type is of type RequestOptions with custom headers and the timeout.
#[tokio::main]
fn main(){
let interceptor = |_request: &Request| {
let mut headers = HeaderMap::new();
headers.append("testHeader", HeaderValue::from_static("testHeaderValue"));
RequestOptions {
headers,
timeout: Duration::from_millis(3500),
}
};
let issuer = Issuer::discover_with_interceptor_async("https://auth.example.com", Box::new(request_options)).unwrap();
}Headers that are returned with request options are appended to the headers of the request.
If there are duplicate headers, all values are appended to the header like so:
header: value1, value2, value3 ....
source§impl Issuer
impl Issuer
sourcepub fn webfinger(input: &str) -> Result<Issuer, OidcClientError>
pub fn webfinger(input: &str) -> Result<Issuer, OidcClientError>
Webfinger OIDC Issuer Discovery
This is a blocking method. Checkout Issuer::webfinger_async for async version.
Discover an OIDC Issuer using the user email, url, url with port syntax or acct syntax.
fn main(){
let issuer_email = Issuer::webfinger("joe@auth.example.com").unwrap();
let issuer_url = Issuer::webfinger("https://auth.example.com/joe").unwrap();
let issuer_url_port = Issuer::webfinger("auth.example.com:3000/joe").unwrap();
let issuer_acct_email = Issuer::webfinger("acct:joe@auth.example.com").unwrap();
let issuer_acct_host = Issuer::webfinger("acct:auth.example.com").unwrap();
}sourcepub fn webfinger_with_interceptor(
input: &str,
request_options: Box<dyn FnMut(&Request) -> RequestOptions>
) -> Result<Issuer, OidcClientError>
pub fn webfinger_with_interceptor( input: &str, request_options: Box<dyn FnMut(&Request) -> RequestOptions> ) -> Result<Issuer, OidcClientError>
Webfinger OIDC Issuer Discovery with request interceptor
This is a blocking method. Checkout Issuer::webfinger_with_interceptor_async for async version.
Discover an OIDC Issuer using the user email, url, url with port syntax or acct syntax.
Allows you to pass in a closure as a second argument that will be called for every request. First parameter is the actual request that is being processed. See Request. The expected return type is of type RequestOptions with custom headers and the timeout.
fn main(){
let interceptor = |_request: &Request| {
let mut headers = HeaderMap::new();
headers.append("testHeader", HeaderValue::from_static("testHeaderValue"));
RequestOptions {
headers,
timeout: Duration::from_millis(3500),
}
};
let issuer = Issuer::webfinger_with_interceptor("joe@auth.example.com", Box::new(interceptor)).unwrap();
}sourcepub async fn webfinger_async(input: &str) -> Result<Issuer, OidcClientError>
pub async fn webfinger_async(input: &str) -> Result<Issuer, OidcClientError>
Webfinger OIDC Issuer Discovery
This is an async method. Checkout Issuer::webfinger for blocking version.
Discover an OIDC Issuer using the user email, url, url with port syntax or acct syntax.
use openid_client::Issuer;
#[tokio::main]
async fn main(){
let issuer_email = Issuer::webfinger_async("joe@auth.example.com").await.unwrap();
let issuer_url = Issuer::webfinger_async("https://auth.example.com/joe").await.unwrap();
let issuer_url_port = Issuer::webfinger_async("auth.example.com:3000/joe").await.unwrap();
let issuer_acct_email = Issuer::webfinger_async("acct:joe@auth.example.com").await.unwrap();
let issuer_acct_host = Issuer::webfinger_async("acct:auth.example.com").await.unwrap();
}sourcepub async fn webfinger_with_interceptor_async(
input: &str,
request_options: Box<dyn FnMut(&Request) -> RequestOptions>
) -> Result<Issuer, OidcClientError>
pub async fn webfinger_with_interceptor_async( input: &str, request_options: Box<dyn FnMut(&Request) -> RequestOptions> ) -> Result<Issuer, OidcClientError>
Webfinger OIDC Issuer Discovery with request interceptor
This is an async method. Checkout Issuer::webfinger_with_interceptor for blocking version.
Discover an OIDC Issuer using the user email, url, url with port syntax or acct syntax.
Allows you to pass in a closure as a second argument that will be called for every request. First parameter is the actual request that is being processed. See Request. The expected return type is of type RequestOptions with custom headers and the timeout.
use openid_client::{Issuer, Request, HeaderMap, HeaderValue, RequestOptions};
use std::time::Duration;
#[tokio::main]
async fn main(){
let interceptor = |_request: &Request| {
let mut headers = HeaderMap::new();
headers.append("testHeader", HeaderValue::from_static("testHeaderValue"));
RequestOptions {
headers,
timeout: Duration::from_millis(3500),
}
};
let issuer = Issuer::webfinger_with_interceptor_async("joe@auth.example.com", Box::new(interceptor)).await.unwrap();
}