Skip to main content

nominal_api/conjure/objects/authorization/
refresh_access_token_request.rs

1/// We accept an OIDC access token issued by a trusted identity provider to refresh a Nominal access token.
2/// The access token is validated and exchanged for a Nominal access token. To be used in this endpoint,
3/// the OIDC access token must contain an email claim.
4/// The org rid from the expiring session should be provided to deconflict if the user is a member of
5/// multiple orgs.
6#[derive(
7    Debug,
8    Clone,
9    conjure_object::serde::Serialize,
10    conjure_object::serde::Deserialize,
11    PartialEq,
12    Eq,
13    PartialOrd,
14    Ord,
15    Hash
16)]
17#[serde(crate = "conjure_object::serde")]
18#[conjure_object::private::staged_builder::staged_builder]
19#[builder(crate = conjure_object::private::staged_builder, update, inline)]
20pub struct RefreshAccessTokenRequest {
21    #[builder(into)]
22    #[serde(rename = "accessToken")]
23    access_token: String,
24    #[builder(default, into)]
25    #[serde(rename = "orgRid", skip_serializing_if = "Option::is_none", default)]
26    org_rid: Option<super::super::authentication::api::OrgRid>,
27}
28impl RefreshAccessTokenRequest {
29    /// Constructs a new instance of the type.
30    #[inline]
31    pub fn new(access_token: impl Into<String>) -> Self {
32        Self::builder().access_token(access_token).build()
33    }
34    #[inline]
35    pub fn access_token(&self) -> &str {
36        &*self.access_token
37    }
38    #[inline]
39    pub fn org_rid(&self) -> Option<&super::super::authentication::api::OrgRid> {
40        self.org_rid.as_ref().map(|o| &*o)
41    }
42}