Skip to main content

nominal_api_conjure/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. The org rid from the expiring session should be provided.
4/// It is required for guest users and multi-org users to determine what org the Nominal token should be minted for.
5#[derive(
6    Debug,
7    Clone,
8    conjure_object::serde::Serialize,
9    conjure_object::serde::Deserialize,
10    PartialEq,
11    Eq,
12    PartialOrd,
13    Ord,
14    Hash
15)]
16#[serde(crate = "conjure_object::serde")]
17#[conjure_object::private::staged_builder::staged_builder]
18#[builder(crate = conjure_object::private::staged_builder, update, inline)]
19pub struct RefreshAccessTokenRequest {
20    #[builder(into)]
21    #[serde(rename = "accessToken")]
22    access_token: String,
23    #[builder(default, into)]
24    #[serde(rename = "orgRid", skip_serializing_if = "Option::is_none", default)]
25    org_rid: Option<super::super::authentication::api::OrgRid>,
26}
27impl RefreshAccessTokenRequest {
28    /// Constructs a new instance of the type.
29    #[inline]
30    pub fn new(access_token: impl Into<String>) -> Self {
31        Self::builder().access_token(access_token).build()
32    }
33    #[inline]
34    pub fn access_token(&self) -> &str {
35        &*self.access_token
36    }
37    #[inline]
38    pub fn org_rid(&self) -> Option<&super::super::authentication::api::OrgRid> {
39        self.org_rid.as_ref().map(|o| &*o)
40    }
41}