pub struct ClientMetadata {Show 18 fields
pub redirect_uris: Vec<String>,
pub application_type: Option<String>,
pub token_endpoint_auth_method: Option<String>,
pub grant_types: Vec<String>,
pub response_types: Vec<String>,
pub client_name: Option<String>,
pub client_uri: Option<String>,
pub logo_uri: Option<String>,
pub scope: Option<String>,
pub contacts: Vec<String>,
pub tos_uri: Option<String>,
pub policy_uri: Option<String>,
pub jwks_uri: Option<String>,
pub jwks: Option<Value>,
pub software_id: Option<String>,
pub software_version: Option<String>,
pub software_statement: Option<String>,
pub additional_fields: HashMap<String, Value>,
}Expand description
Client metadata submitted for registration per RFC 7591 Section 2
ClientMetadata::new prefills the OAuth 2.1 client profile
(authorization_code grant, code response type); extension and
OIDC-specific fields - including localized variants such as
client_name#ja-JP - are preserved in
additional_fields.
Fields§
§redirect_uris: Vec<String>Redirection URIs for redirect-based flows; REQUIRED for clients
using the authorization_code or implicit grants
application_type: Option<String>Kind of application the client is: web (the default when absent)
or native
Defined by OpenID Connect Dynamic Client Registration Section 2 and widely
honored by OAuth 2.0 registration endpoints: a native client is
what allows the loopback redirect URIs (http://127.0.0.1:{port}/...)
desktop and CLI applications rely on - servers reject those for
web clients.
token_endpoint_auth_method: Option<String>Requested token endpoint authentication method
(e.g. client_secret_basic, client_secret_post, none)
grant_types: Vec<String>Grant types the client will use
response_types: Vec<String>Response types the client will use
client_name: Option<String>Human-readable client name shown to end users
client_uri: Option<String>URL of the client’s home page
logo_uri: Option<String>URL of the client’s logo
scope: Option<String>Space-separated scope values the client will request
contacts: Vec<String>Contact addresses for people responsible for the client
tos_uri: Option<String>URL of the client’s terms of service
policy_uri: Option<String>URL of the client’s privacy policy
jwks_uri: Option<String>URL of the client’s JWK Set document; mutually exclusive with
jwks
jwks: Option<Value>The client’s JWK Set document by value; mutually exclusive with
jwks_uri
software_id: Option<String>Identifier for the client software, stable across instances
software_version: Option<String>Version of the client software
software_statement: Option<String>Software statement JWT asserting client metadata values (Section 2.3); issued by a third party and passed through as-is, not validated
additional_fields: HashMap<String, Value>Extension and OIDC-specific fields not modeled above, including
localized (field#language-tag) variants
Implementations§
Source§impl ClientMetadata
impl ClientMetadata
Sourcepub fn new() -> ClientMetadata
pub fn new() -> ClientMetadata
Creates client metadata prefilled with the OAuth 2.1 profile:
the authorization_code grant and the code response type
Sourcepub fn with_redirect_uris<I, S>(self, uris: I) -> ClientMetadata
pub fn with_redirect_uris<I, S>(self, uris: I) -> ClientMetadata
Sets the redirection URIs
Sourcepub fn with_application_type(
self,
application_type: impl Into<String>,
) -> ClientMetadata
pub fn with_application_type( self, application_type: impl Into<String>, ) -> ClientMetadata
Sets the application type - web (the server-side default) or
native for a desktop/CLI client with a loopback redirect URI
Sourcepub fn with_token_endpoint_auth_method(
self,
method: impl Into<String>,
) -> ClientMetadata
pub fn with_token_endpoint_auth_method( self, method: impl Into<String>, ) -> ClientMetadata
Sets the requested token endpoint authentication method
Sourcepub fn with_grant_types<I, S>(self, grant_types: I) -> ClientMetadata
pub fn with_grant_types<I, S>(self, grant_types: I) -> ClientMetadata
Sets the grant types the client will use
Response types only accompany redirect-based grants; when none of
the given grants is redirect-based (authorization_code or
implicit), the response types are cleared so the profile default
code does not leak into e.g. a client_credentials registration
(RFC 7591 Section 2 requires the two fields to be consistent). Set
response types after grant types when an extension grant needs them.
Sourcepub fn with_response_types<I, S>(self, response_types: I) -> ClientMetadata
pub fn with_response_types<I, S>(self, response_types: I) -> ClientMetadata
Sets the response types the client will use
Sourcepub fn with_client_name(self, name: impl Into<String>) -> ClientMetadata
pub fn with_client_name(self, name: impl Into<String>) -> ClientMetadata
Sets the human-readable client name
Sourcepub fn with_client_uri(self, uri: impl Into<String>) -> ClientMetadata
pub fn with_client_uri(self, uri: impl Into<String>) -> ClientMetadata
Sets the URL of the client’s home page
Sourcepub fn with_logo_uri(self, uri: impl Into<String>) -> ClientMetadata
pub fn with_logo_uri(self, uri: impl Into<String>) -> ClientMetadata
Sets the URL of the client’s logo
Sourcepub fn with_scopes<I, S>(self, scopes: I) -> ClientMetadata
pub fn with_scopes<I, S>(self, scopes: I) -> ClientMetadata
Sets the requested scopes, joined into the space-separated scope
field
Sourcepub fn with_contacts<I, S>(self, contacts: I) -> ClientMetadata
pub fn with_contacts<I, S>(self, contacts: I) -> ClientMetadata
Sets the contact addresses
Sourcepub fn with_tos_uri(self, uri: impl Into<String>) -> ClientMetadata
pub fn with_tos_uri(self, uri: impl Into<String>) -> ClientMetadata
Sets the URL of the client’s terms of service
Sourcepub fn with_policy_uri(self, uri: impl Into<String>) -> ClientMetadata
pub fn with_policy_uri(self, uri: impl Into<String>) -> ClientMetadata
Sets the URL of the client’s privacy policy
Sourcepub fn with_jwks_uri(self, uri: impl Into<String>) -> ClientMetadata
pub fn with_jwks_uri(self, uri: impl Into<String>) -> ClientMetadata
Sets the URL of the client’s JWK Set document
Sourcepub fn with_jwks(self, jwks: impl Into<Value>) -> ClientMetadata
pub fn with_jwks(self, jwks: impl Into<Value>) -> ClientMetadata
Sets the client’s JWK Set document by value
Sourcepub fn with_software_id(self, id: impl Into<String>) -> ClientMetadata
pub fn with_software_id(self, id: impl Into<String>) -> ClientMetadata
Sets the software identifier
Sourcepub fn with_software_version(self, version: impl Into<String>) -> ClientMetadata
pub fn with_software_version(self, version: impl Into<String>) -> ClientMetadata
Sets the software version
Sourcepub fn with_software_statement(self, jwt: impl Into<String>) -> ClientMetadata
pub fn with_software_statement(self, jwt: impl Into<String>) -> ClientMetadata
Sets the software statement JWT (Section 2.3)
Sourcepub fn with_additional_field(
self,
name: impl Into<String>,
value: impl Into<Value>,
) -> ClientMetadata
pub fn with_additional_field( self, name: impl Into<String>, value: impl Into<Value>, ) -> ClientMetadata
Adds an extension or OIDC-specific field not modeled by the typed fields
Trait Implementations§
Source§impl Clone for ClientMetadata
impl Clone for ClientMetadata
Source§fn clone(&self) -> ClientMetadata
fn clone(&self) -> ClientMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more