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: String

Discovered issuer uri.

§authorization_endpoint: Option<String>

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: bool

Claims 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: bool

Indicates whether request object is supported by Authorization Server. OIDC Request Object.

§request_uri_parameter_supported: bool

Indicates whether request object by reference is supported by Authorization Server. OIDC Request Object by Reference.

§require_request_uri_registration: bool

Whether 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

source

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();
}
source

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 ....

source

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();
}
source

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

source

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();
}
source

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();
}
source

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();
}
source

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();
}

Trait Implementations§

source§

impl Debug for Issuer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Issuer

§

impl !Send for Issuer

§

impl !Sync for Issuer

§

impl Unpin for Issuer

§

impl !UnwindSafe for Issuer

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more