openid_client/types/
client_registration_options.rs

1use crate::{jwks::Jwks, types::ClientOptions};
2
3/// # Client Registration Options
4#[derive(Default)]
5pub struct ClientRegistrationOptions {
6    /// Private JWKS of the client
7    pub jwks: Option<Jwks>,
8    /// Initial Access Token for the client to register with
9    pub initial_access_token: Option<String>,
10    /// Other options
11    pub client_options: ClientOptions,
12}
13
14impl ClientRegistrationOptions {
15    /// Set Jwks
16    pub fn set_jwks(mut self, jwks: Jwks) -> Self {
17        self.jwks = Some(jwks);
18        self
19    }
20
21    /// Set Initial Access Token
22    pub fn set_iniatial_access_token(mut self, iat: impl Into<String>) -> Self {
23        self.initial_access_token = Some(iat.into());
24        self
25    }
26
27    /// Add Authorized Party
28    pub fn add_authorized_parties(mut self, pty: impl Into<String>) -> Self {
29        match self.client_options.additional_authorized_parties.as_mut() {
30            Some(aap) => aap.push(pty.into()),
31            None => {
32                self.client_options = ClientOptions {
33                    additional_authorized_parties: Some(vec![pty.into()]),
34                };
35            }
36        };
37        self
38    }
39}