Struct openid_client::client::Client
source · pub struct Client {Show 43 fields
pub client_id: String,
pub client_secret: Option<String>,
pub registration_access_token: Option<String>,
pub registration_client_uri: Option<String>,
pub client_id_issued_at: Option<i64>,
pub client_secret_expires_at: Option<i64>,
pub token_endpoint_auth_method: String,
pub token_endpoint_auth_signing_alg: Option<String>,
pub introspection_endpoint_auth_method: Option<String>,
pub introspection_endpoint_auth_signing_alg: Option<String>,
pub revocation_endpoint_auth_method: Option<String>,
pub revocation_endpoint_auth_signing_alg: Option<String>,
pub redirect_uri: Option<String>,
pub redirect_uris: Option<Vec<String>>,
pub response_type: Option<String>,
pub response_types: Vec<String>,
pub grant_types: Vec<String>,
pub application_type: Option<String>,
pub contacts: Option<Vec<String>>,
pub client_name: Option<String>,
pub logo_uri: Option<String>,
pub client_uri: Option<String>,
pub policy_uri: Option<String>,
pub tos_uri: Option<String>,
pub jwks_uri: Option<String>,
pub jwks: Option<Jwks>,
pub sector_identifier_uri: Option<String>,
pub subject_type: Option<String>,
pub id_token_signed_response_alg: String,
pub id_token_encrypted_response_alg: Option<String>,
pub id_token_encrypted_response_enc: Option<String>,
pub userinfo_signed_response_alg: Option<String>,
pub userinfo_encrypted_response_alg: Option<String>,
pub userinfo_encrypted_response_enc: Option<String>,
pub request_object_signing_alg: Option<String>,
pub request_object_encryption_alg: Option<String>,
pub request_object_encryption_enc: Option<String>,
pub default_max_age: Option<i64>,
pub require_auth_time: Option<bool>,
pub default_acr_values: Option<Vec<String>>,
pub initiate_login_uri: Option<String>,
pub request_uris: Option<String>,
pub other_fields: HashMap<String, Value>,
/* private fields */
}Expand description
Fields§
§client_id: StringClient Id
client_secret: Option<String>Client secret
registration_access_token: Option<String>§registration_client_uri: Option<String>§client_id_issued_at: Option<i64>§client_secret_expires_at: Option<i64>Secret Expiry Epoch Seconds
token_endpoint_auth_method: StringAuthentication method used by the client for authenticating with the OP
token_endpoint_auth_signing_alg: Option<String>Algorithm used for signing the JWT used to authenticate the client at the token endpoint.
introspection_endpoint_auth_method: Option<String>Authentication method used by the client for introspection endpoint
introspection_endpoint_auth_signing_alg: Option<String>Algorithm used for signing the JWT used to authenticate the client at the introspection endpoint.
revocation_endpoint_auth_method: Option<String>Authentication method used by the client for revocation endpoint
revocation_endpoint_auth_signing_alg: Option<String>Algorithm used for signing the JWT used to authenticate the client at the revocation endpoint.
redirect_uri: Option<String>The redirect uri where response will be sent
redirect_uris: Option<Vec<String>>A list of acceptable redirect uris
response_type: Option<String>Response type supported by the client.
response_types: Vec<String>List of Response type supported by the client
grant_types: Vec<String>§application_type: Option<String>§contacts: Option<Vec<String>>§client_name: Option<String>§logo_uri: Option<String>§client_uri: Option<String>§policy_uri: Option<String>§tos_uri: Option<String>§jwks_uri: Option<String>§jwks: Option<Jwks>§sector_identifier_uri: Option<String>§subject_type: Option<String>§id_token_signed_response_alg: String§id_token_encrypted_response_alg: Option<String>§id_token_encrypted_response_enc: Option<String>§userinfo_signed_response_alg: Option<String>§userinfo_encrypted_response_alg: Option<String>§userinfo_encrypted_response_enc: Option<String>§request_object_signing_alg: Option<String>§request_object_encryption_alg: Option<String>§request_object_encryption_enc: Option<String>§default_max_age: Option<i64>§require_auth_time: Option<bool>§default_acr_values: Option<Vec<String>>§initiate_login_uri: Option<String>§request_uris: Option<String>§other_fields: HashMap<String, Value>Extra key values
Implementations§
source§impl Client
impl Client
Implementation for Client Read Methods
sourcepub fn from_uri(
registration_client_uri: &str,
registration_access_token: Option<String>,
jwks: Option<Jwks>,
client_options: Option<ClientOptions>,
issuer: Option<&Issuer>,
interceptor: Option<RequestInterceptor>
) -> Result<Self, OidcClientError>
pub fn from_uri( registration_client_uri: &str, registration_access_token: Option<String>, jwks: Option<Jwks>, client_options: Option<ClientOptions>, issuer: Option<&Issuer>, interceptor: Option<RequestInterceptor> ) -> Result<Self, OidcClientError>
Creates a client from the Client Read Endpoint
This is a blocking method. Checkout Client::from_uri_async() for async version
Creates a Client from the Client Read Endpoint.
registration_client_uri- The client read endpointregistration_access_token- The access token to be sent with the requestjwks- Private Jwks of the clientclient_options- The ClientOptionsissuer- Issuerinterceptor- RequestInterceptor
Example:
let _client = Client::from_uri(
"https://auth.example.com/client/id",
None,
None,
None,
None,
None,
)
.unwrap();Example: with all params
let jwk = Jwk::generate_rsa_key(2048).unwrap();
let jwks = Jwks::from(vec![jwk]);
let client_options = ClientOptions {
additional_authorized_parties: Some(vec!["authParty".to_string()]),
};
let interceptor = |request: &Request| {
let mut headers = HeaderMap::new();
if request.url.contains("userinfor") || request.url.contains("token") {
headers.append("foo", HeaderValue::from_static("bar"));
}
RequestOptions {
headers,
timeout: Duration::from_millis(10000),
}
};
let issuer = Issuer::discover("https://auth.example.com", Some(Box::new(interceptor))).unwrap();
let _client = Client::from_uri(
"https://auth.example.com/client/id",
Some("token".to_string()),
Some(jwks),
Some(client_options),
Some(&issuer),
Some(Box::new(interceptor)),
)
.unwrap();sourcepub async fn from_uri_async(
registration_client_uri: &str,
registration_access_token: Option<String>,
jwks: Option<Jwks>,
client_options: Option<ClientOptions>,
issuer: Option<&Issuer>,
interceptor: Option<RequestInterceptor>
) -> Result<Self, OidcClientError>
pub async fn from_uri_async( registration_client_uri: &str, registration_access_token: Option<String>, jwks: Option<Jwks>, client_options: Option<ClientOptions>, issuer: Option<&Issuer>, interceptor: Option<RequestInterceptor> ) -> Result<Self, OidcClientError>
Creates a client from the Client Read Endpoint
This is an async method. Checkout Client::from_uri() for the blocking version.
Creates a Client from the Client read endpoint.
registration_client_uri- The client read endpointregistration_access_token- The access token to be sent with the requestjwks- Private Jwks of the clientclient_options- The ClientOptionsissuer- Issuerinterceptor- RequestInterceptor
Example:
let _client = Client::from_uri_async(
"https://auth.example.com/client/id",
None,
None,
None,
None,
None,
)
.await
.unwrap();Example: with all params
let jwk = Jwk::generate_rsa_key(2048).unwrap();
let jwks = Jwks::from(vec![jwk]);
let client_options = ClientOptions {
additional_authorized_parties: Some(vec!["authParty".to_string()]),
};
let interceptor = |request: &Request| {
let mut headers = HeaderMap::new();
if request.url.contains("userinfor") || request.url.contains("token") {
headers.append("foo", HeaderValue::from_static("bar"));
}
RequestOptions {
headers,
timeout: Duration::from_millis(10000),
}
};
let issuer = Issuer::discover_async("https://auth.example.com", Some(Box::new(interceptor)))
.await
.unwrap();
let _client = Client::from_uri_async(
"https://auth.example.com/client/id",
Some("token".to_string()),
Some(jwks),
Some(client_options),
Some(&issuer),
Some(Box::new(interceptor)),
)
.await
.unwrap();source§impl Client
impl Client
Implementations for Dynamic Client Registration
sourcepub fn register(
issuer: &Issuer,
client_metadata: ClientMetadata,
register_options: Option<ClientRegistrationOptions>,
interceptor: Option<RequestInterceptor>
) -> Result<Self, OidcClientError>
pub fn register( issuer: &Issuer, client_metadata: ClientMetadata, register_options: Option<ClientRegistrationOptions>, interceptor: Option<RequestInterceptor> ) -> Result<Self, OidcClientError>
Dynamic Client Registration
This is a blocking method. Checkout Client::register_async() for async version.
Attempts a Dynamic Client Registration using the Issuer’s registration_endpoint
issuer- The Issuer client should be registered to.client_metadata- The ClientMetadata to be sent using the registration request.register_options- ClientRegistrationOptionsinterceptor- RequestInterceptor
Example:
let issuer = Issuer::discover("https://auth.example.com", None).unwrap();
let metadata = ClientMetadata {
client_id: Some("identifier".to_string()),
..ClientMetadata::default()
};
let _client = Client::register(&issuer, metadata, None, None).unwrap();Example: with all params
let interceptor = |request: &Request| {
let mut headers = HeaderMap::new();
if request.url.contains("token") {
headers.append("foo", HeaderValue::from_static("bar"));
}
RequestOptions {
headers,
timeout: Duration::from_millis(10000),
}
};
let issuer = Issuer::discover("https://auth.example.com", Some(Box::new(interceptor))).unwrap();
let metadata = ClientMetadata {
client_id: Some("identifier".to_string()),
..ClientMetadata::default()
};
let jwk = Jwk::generate_rsa_key(2048).unwrap();
let registration_options = ClientRegistrationOptions {
initial_access_token: Some("initial_access_token".to_string()),
jwks: Some(Jwks::from(vec![jwk])),
client_options: Default::default(),
};
let _client = Client::register(
&issuer,
metadata,
Some(registration_options),
Some(Box::new(interceptor)),
)
.unwrap();sourcepub async fn register_async(
issuer: &Issuer,
client_metadata: ClientMetadata,
register_options: Option<ClientRegistrationOptions>,
interceptor: Option<RequestInterceptor>
) -> Result<Self, OidcClientError>
pub async fn register_async( issuer: &Issuer, client_metadata: ClientMetadata, register_options: Option<ClientRegistrationOptions>, interceptor: Option<RequestInterceptor> ) -> Result<Self, OidcClientError>
Dynamic Client Registration
This is an async method. Checkout Client::register() for the blocking version.
Attempts a Dynamic Client Registration using the Issuer’s registration_endpoint
issuer- The Issuer client should be registered to.client_metadata- The ClientMetadata to be sent using the registration request.register_options- ClientRegistrationOptionsinterceptor- RequestInterceptor
Example:
let issuer = Issuer::discover_async("https://auth.example.com", None)
.await
.unwrap();
let metadata = ClientMetadata {
client_id: Some("identifier".to_string()),
..ClientMetadata::default()
};
let _client = Client::register_async(&issuer, metadata, None, None)
.await
.unwrap();Example: with all params
let interceptor = |request: &Request| {
let mut headers = HeaderMap::new();
if request.url.contains("token") {
headers.append("foo", HeaderValue::from_static("bar"));
}
RequestOptions {
headers,
timeout: Duration::from_millis(10000),
}
};
let issuer = Issuer::discover_async("https://auth.example.com", Some(Box::new(interceptor)))
.await
.unwrap();
let metadata = ClientMetadata {
client_id: Some("identifier".to_string()),
..ClientMetadata::default()
};
let jwk = Jwk::generate_rsa_key(2048).unwrap();
let registration_options = ClientRegistrationOptions {
initial_access_token: Some("initial_access_token".to_string()),
jwks: Some(Jwks::from(vec![jwk])),
client_options: Default::default(),
};
let _client = Client::register_async(
&issuer,
metadata,
Some(registration_options),
Some(Box::new(interceptor)),
)
.await
.unwrap();source§impl Client
impl Client
Getter & Setter method implementations for Client
sourcepub fn get_client_id(&self) -> String
pub fn get_client_id(&self) -> String
Get client id
sourcepub fn get_client_secret(&self) -> Option<String>
pub fn get_client_secret(&self) -> Option<String>
Get client secret
sourcepub fn get_grant_types(&self) -> Vec<String>
pub fn get_grant_types(&self) -> Vec<String>
Get grant types
sourcepub fn get_registration_access_token(&self) -> Option<String>
pub fn get_registration_access_token(&self) -> Option<String>
Get registration access token
sourcepub fn get_registration_client_uri(&self) -> Option<String>
pub fn get_registration_client_uri(&self) -> Option<String>
Get registration client uri
sourcepub fn get_client_id_issued_at(&self) -> Option<i64>
pub fn get_client_id_issued_at(&self) -> Option<i64>
Get client id issued at. Epoch(seconds)
sourcepub fn get_client_secret_expires_at(&self) -> Option<i64>
pub fn get_client_secret_expires_at(&self) -> Option<i64>
Get client secret exprires at. Epoch(seconds)
sourcepub fn get_id_token_signed_response_alg(&self) -> String
pub fn get_id_token_signed_response_alg(&self) -> String
Get id token signed response algorithm
sourcepub fn get_response_types(&self) -> Vec<String>
pub fn get_response_types(&self) -> Vec<String>
Get response types. See ClientMetadata.
sourcepub fn get_token_endpoint_auth_method(&self) -> String
pub fn get_token_endpoint_auth_method(&self) -> String
Get token endpoint authentication method. See ClientMetadata.
sourcepub fn get_token_endpoint_auth_signing_alg(&self) -> Option<String>
pub fn get_token_endpoint_auth_signing_alg(&self) -> Option<String>
Get token endpoint authentication signing alg. See ClientMetadata.
sourcepub fn get_introspection_endpoint_auth_method(&self) -> Option<String>
pub fn get_introspection_endpoint_auth_method(&self) -> Option<String>
Get introspection endpoint authentication method. See ClientMetadata.
sourcepub fn get_introspection_endpoint_auth_signing_alg(&self) -> Option<String>
pub fn get_introspection_endpoint_auth_signing_alg(&self) -> Option<String>
Get introspection endpoint authentication signing alg. See ClientMetadata.
sourcepub fn get_revocation_endpoint_auth_method(&self) -> Option<String>
pub fn get_revocation_endpoint_auth_method(&self) -> Option<String>
Get revocation endpoint authentication method. See ClientMetadata.
sourcepub fn get_revocation_endpoint_auth_signing_alg(&self) -> Option<String>
pub fn get_revocation_endpoint_auth_signing_alg(&self) -> Option<String>
Get revocation endpoint authentication signing alg. See ClientMetadata.
sourcepub fn get_redirect_uri(&self) -> Option<String>
pub fn get_redirect_uri(&self) -> Option<String>
Get redirect uri. See ClientMetadata.
sourcepub fn get_redirect_uris(&self) -> Option<Vec<String>>
pub fn get_redirect_uris(&self) -> Option<Vec<String>>
Get redirect uris. See ClientMetadata.
sourcepub fn get_response_type(&self) -> Option<String>
pub fn get_response_type(&self) -> Option<String>
Get response type
sourcepub fn get_application_type(&self) -> Option<String>
pub fn get_application_type(&self) -> Option<String>
Get application type
sourcepub fn get_contacts(&self) -> Option<Vec<String>>
pub fn get_contacts(&self) -> Option<Vec<String>>
Get contacts
sourcepub fn get_client_name(&self) -> Option<String>
pub fn get_client_name(&self) -> Option<String>
Get client name
sourcepub fn get_logo_uri(&self) -> Option<String>
pub fn get_logo_uri(&self) -> Option<String>
Get logo uri
sourcepub fn get_client_uri(&self) -> Option<String>
pub fn get_client_uri(&self) -> Option<String>
Get client uri
sourcepub fn get_policy_uri(&self) -> Option<String>
pub fn get_policy_uri(&self) -> Option<String>
Get policy uri
sourcepub fn get_tos_uri(&self) -> Option<String>
pub fn get_tos_uri(&self) -> Option<String>
Get tos uri
sourcepub fn get_jwks_uri(&self) -> Option<String>
pub fn get_jwks_uri(&self) -> Option<String>
Get jwks uri
sourcepub fn get_sector_identifier_uri(&self) -> Option<String>
pub fn get_sector_identifier_uri(&self) -> Option<String>
Get sector identifier uri
sourcepub fn get_subject_type(&self) -> Option<String>
pub fn get_subject_type(&self) -> Option<String>
Get subject type
sourcepub fn get_id_token_encrypted_response_alg(&self) -> Option<String>
pub fn get_id_token_encrypted_response_alg(&self) -> Option<String>
Get id token encrypted response algorithm
sourcepub fn get_id_token_encrypted_response_enc(&self) -> Option<String>
pub fn get_id_token_encrypted_response_enc(&self) -> Option<String>
Get id token encrypted response algorithm
sourcepub fn get_userinfo_signed_response_alg(&self) -> Option<String>
pub fn get_userinfo_signed_response_alg(&self) -> Option<String>
Get userinfo signed response algorithm
sourcepub fn get_userinfo_encrypted_response_alg(&self) -> Option<String>
pub fn get_userinfo_encrypted_response_alg(&self) -> Option<String>
Get userinfo encrypted response algorithm
sourcepub fn get_userinfo_encrypted_response_enc(&self) -> Option<String>
pub fn get_userinfo_encrypted_response_enc(&self) -> Option<String>
Get userinfo encrypted response algorithm
sourcepub fn get_request_object_signing_alg(&self) -> Option<String>
pub fn get_request_object_signing_alg(&self) -> Option<String>
Get request object signing algorithm
sourcepub fn get_request_object_encryption_alg(&self) -> Option<String>
pub fn get_request_object_encryption_alg(&self) -> Option<String>
Get request object encryption algorithm
sourcepub fn get_request_object_encryption_enc(&self) -> Option<String>
pub fn get_request_object_encryption_enc(&self) -> Option<String>
Get request object encryption algorithm
sourcepub fn get_default_max_age(&self) -> Option<i64>
pub fn get_default_max_age(&self) -> Option<i64>
Get default max age
sourcepub fn get_require_auth_time(&self) -> Option<bool>
pub fn get_require_auth_time(&self) -> Option<bool>
Get require auth time
sourcepub fn get_default_acr_values(&self) -> Option<Vec<String>>
pub fn get_default_acr_values(&self) -> Option<Vec<String>>
Get default acr values
sourcepub fn get_initiate_login_uri(&self) -> Option<String>
pub fn get_initiate_login_uri(&self) -> Option<String>
Get initiate login uri
sourcepub fn get_request_uris(&self) -> Option<String>
pub fn get_request_uris(&self) -> Option<String>
Get request uris
sourcepub fn get_issuer(&self) -> Option<&Issuer>
pub fn get_issuer(&self) -> Option<&Issuer>
Gets the issuer that the client was created with.
sourcepub fn get_private_jwks(&self) -> Option<Jwks>
pub fn get_private_jwks(&self) -> Option<Jwks>
Gets the private jwks
sourcepub fn get_client_options(&self) -> Option<ClientOptions>
pub fn get_client_options(&self) -> Option<ClientOptions>
Gets the client options the client was created with