pub struct OpenIDConfig {
pub issuer: String,
pub authorization_endpoint: String,
pub token_endpoint: String,
pub userinfo_endpoint: Option<String>,
pub jwks_uri: String,
pub scopes_supported: Option<Vec<String>>,
pub response_types_supported: Vec<String>,
pub subject_types_supported: Vec<String>,
pub id_token_signing_alg_values_supported: Vec<String>,
pub token_endpoint_auth_methods_supported: Option<Vec<String>>,
pub claims_supported: Option<Vec<String>>,
pub code_challenge_methods_supported: Option<Vec<String>>,
}
Expand description
OpenID discovery information, typically distributed on http://provider/.well-known/openid-configuration
Fields§
§issuer: String
URL using the https scheme with no query or fragment component that the OP asserts as its Issuer Identifier. If Issuer discovery is supported (see Section 2), this value MUST be identical to the issuer value returned by WebFinger. This also MUST be identical to the iss Claim value in ID Tokens issued from this Issuer
REQUIRED. URL of the OP’s OAuth 2.0 Authorization Endpoint OpenID.Core
token_endpoint: String
URL of the OP’s OAuth 2.0 Token Endpoint OpenID.Core
. This is REQUIRED unless only the Implicit Flow is used.
userinfo_endpoint: Option<String>
RECOMMENDED. URL of the OP’s UserInfo Endpoint [
OpenID.Core]
. This URL MUST use the https scheme and MAY contain port, path, and query parameter components
jwks_uri: String
REQUIRED. URL of the OP’s JSON Web Key Set [
JWK]
document. This contains the signing key(s) the RP uses to validate signatures from the OP. The JWK Set MAY also contain the Server’s encryption key(s), which are used by RPs to encrypt requests to the Server. When both signing and encryption keys are made available, a use (Key Use) parameter value is REQUIRED for all keys in the referenced JWK Set to indicate each key’s intended usage. Although some algorithms allow the same key to be used for both signatures and encryption, doing so is NOT RECOMMENDED, as it is less secure. The JWK x5c parameter MAY be used to provide X.509 representations of keys provided. When used, the bare key values MUST still be present and MUST match those in the certificate.
scopes_supported: Option<Vec<String>>
RECOMMENDED. JSON array containing a list of the OAuth 2.0 [
RFC6749]
scope values that this server supports. The server MUST support the openid scope value. Servers MAY choose not to advertise some supported scope values even when this parameter is used, although those defined in [
OpenID.Core]
SHOULD be listed, if supported.
response_types_supported: Vec<String>
REQUIRED. JSON array containing a list of the OAuth 2.0 response_type values that this OP supports. Dynamic OpenID Providers MUST support the code, id_token, and the token id_token Response Type values.
subject_types_supported: Vec<String>
REQUIRED. JSON array containing a list of the Subject Identifier types that this OP supports. Valid types include pairwise and public.
id_token_signing_alg_values_supported: Vec<String>
REQUIRED. JSON array containing a list of the JWS signing algorithms (alg values) supported by the OP for the ID Token to encode the Claims in a JWT [
JWT`. The algorithm RS256 MUST be included. The value none MAY be supported, but MUST NOT be used unless the Response Type used returns no ID Token from the Authorization Endpoint (such as when using the Authorization Code Flow).
token_endpoint_auth_methods_supported: Option<Vec<String>>
OPTIONAL. JSON array containing a list of Client Authentication methods supported by this Token Endpoint. The options are client_secret_post, client_secret_basic, client_secret_jwt, and private_key_jwt
claims_supported: Option<Vec<String>>
RECOMMENDED. JSON array containing a list of the Claim Names of the Claims that the OpenID Provider MAY be able to supply values for. Note that for privacy or other reasons, this might not be an exhaustive list.
code_challenge_methods_supported: Option<Vec<String>>
OPTIONAL JSON array containing a list of Proof Key for Code Exchange (PKCE)
Implementations§
Source§impl OpenIDConfig
impl OpenIDConfig
Sourcepub async fn load_from_url(url: &str) -> Result<Self, Box<dyn Error>>
pub async fn load_from_url(url: &str) -> Result<Self, Box<dyn Error>>
Load OpenID configuration from a given .well-known/openid-configuration URL
Get the authorization URL where a user should be redirect to perform authentication
Sourcepub async fn request_token(
&self,
client_id: &str,
client_secret: &str,
code: &str,
redirect_uri: &str,
) -> Result<(OpenIDTokenResponse, String), Box<dyn Error>>
pub async fn request_token( &self, client_id: &str, client_secret: &str, code: &str, redirect_uri: &str, ) -> Result<(OpenIDTokenResponse, String), Box<dyn Error>>
Query the token endpoint
This endpoint returns both the parsed and the raw response, to allow handling of bonus fields
Sourcepub async fn request_user_info(
&self,
token: &OpenIDTokenResponse,
) -> Result<(OpenIDUserInfo, String), Box<dyn Error>>
pub async fn request_user_info( &self, token: &OpenIDTokenResponse, ) -> Result<(OpenIDUserInfo, String), Box<dyn Error>>
Query the UserInfo endpoint.
This endpoint should be use after having successfully retrieved the token
This endpoint returns both the parsed value and the raw response, in case of presence of additional fields
Trait Implementations§
Source§impl Clone for OpenIDConfig
impl Clone for OpenIDConfig
Source§fn clone(&self) -> OpenIDConfig
fn clone(&self) -> OpenIDConfig
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more