pub struct AccessToken {
kind: AccessTokenKind,
api_key_id: Uuid,
client_secret: SensitiveString,
key: AccessTokenKey,
}Expand description
A parsed access token. The derived key only reaches a key store through
Self::open_payload.
Fields§
§kind: AccessTokenKind§api_key_id: Uuid§client_secret: SensitiveString§key: AccessTokenKeyImplementations§
Source§impl AccessToken
impl AccessToken
Sourcepub fn parse(
token: &str,
expected: AccessTokenKind,
) -> Result<Self, AccessTokenInvalidError>
pub fn parse( token: &str, expected: AccessTokenKind, ) -> Result<Self, AccessTokenInvalidError>
Parses a token in the shape expected requires, including its client-kind segment.
Sourcepub fn api_key_id(&self) -> Uuid
pub fn api_key_id(&self) -> Uuid
The API key identifier. See Self::client_id for the full OAuth client_id.
Sourcepub fn client_secret(&self) -> &SensitiveString
pub fn client_secret(&self) -> &SensitiveString
The OAuth client secret.
Sourcepub fn kind(&self) -> AccessTokenKind
pub fn kind(&self) -> AccessTokenKind
Which AccessTokenKind this token authenticates.
Sourcepub fn client_id(&self) -> String
pub fn client_id(&self) -> String
The OAuth client_id: <kind>.<api_key_id>, or the bare <api_key_id> for Secrets
Manager.
Sourcepub fn open_payload<Ids: KeySlotIds>(
&self,
ctx: &mut KeyStoreContext<'_, Ids>,
encrypted_payload: &str,
organization_key: Ids::Symmetric,
) -> Result<(), AccessTokenError>
pub fn open_payload<Ids: KeySlotIds>( &self, ctx: &mut KeyStoreContext<'_, Ids>, encrypted_payload: &str, organization_key: Ids::Symmetric, ) -> Result<(), AccessTokenError>
Decrypts encrypted_payload and installs the organization key it carries at
organization_key in ctx. Errors carry no payload content.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AccessToken
impl RefUnwindSafe for AccessToken
impl Send for AccessToken
impl Sync for AccessToken
impl Unpin for AccessToken
impl UnsafeUnpin for AccessToken
impl UnwindSafe for AccessToken
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Consume a handle, getting back the initial
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more