pub struct JwtSvid { /* private fields */ }
Expand description
This type represents a SPIFFE JWT-SVID.
The token field is zeroized on drop.
Implementations§
Source§impl JwtSvid
impl JwtSvid
Sourcepub fn parse_and_validate<T: AsRef<str> + ToString + Debug>(
token: &str,
bundle_source: &impl BundleRefSource<Item = JwtBundle>,
expected_audience: &[T],
) -> Result<Self, JwtSvidError>
pub fn parse_and_validate<T: AsRef<str> + ToString + Debug>( token: &str, bundle_source: &impl BundleRefSource<Item = JwtBundle>, expected_audience: &[T], ) -> Result<Self, JwtSvidError>
Parses the given token verifying the token signature using the provided [BundleSource
] as
a source of JwtBundle
, validating the audience in the token with the expected audience,
and validating the expiration datetime.
Returns a validated instance of JwtSvid
.
§Arguments
token
: JWT token to parse.bundle_source
: Struct that implements a [BundleSource
] for the typeJwtBundle
.expected_audience
: List of audience strings that should be present in the token ‘aud’ claim.
§Errors
If the function cannot parse or verify the signature of the token, a JwtSvidError
variant will be returned.
Sourcepub fn parse_insecure(token: &str) -> Result<Self, JwtSvidError>
pub fn parse_insecure(token: &str) -> Result<Self, JwtSvidError>
Creates a new JwtSvid
with the given token without signature verification.
IMPORTANT: For parsing and validating the signature of untrusted tokens, use parse_and_validate
method.
Trait Implementations§
Source§impl FromStr for JwtSvid
impl FromStr for JwtSvid
Source§fn from_str(token: &str) -> Result<Self, Self::Err>
fn from_str(token: &str) -> Result<Self, Self::Err>
Creates a new JwtSvid
with the given token without signature verification.
Any result from this function is untrusted.
IMPORTANT: For parsing and validating the signature of untrusted tokens, use parse_and_validate
method.
Source§type Err = JwtSvidError
type Err = JwtSvidError
impl StructuralPartialEq for JwtSvid
impl Svid for JwtSvid
Auto Trait Implementations§
impl Freeze for JwtSvid
impl RefUnwindSafe for JwtSvid
impl Send for JwtSvid
impl Sync for JwtSvid
impl Unpin for JwtSvid
impl UnwindSafe for JwtSvid
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request