pub struct JwtBundle { /* private fields */ }
Expand description
This type contains a collection of trusted JWT authorities (Public keys) for a TrustDomain
.
Implementations§
Source§impl JwtBundle
impl JwtBundle
Sourcepub fn new(trust_domain: TrustDomain) -> Self
pub fn new(trust_domain: TrustDomain) -> Self
Creates an empty JwtBundle
for the given TrustDomain
.
Parses a JwtBundle
from bytes representing a set of JWT authorities. The data must be
a standard RFC 7517 JWTK document.
§Arguments
trust_domain
- ATrustDomain
to associate to the bundle.jwt_authorities
- A slice of bytes representing a set of JWT authorities in a standard RFC 7517 JWKS document.
§Errors
If the function cannot parse the bytes into a JSON WebKey Set, a JwtBundleError
variant will be returned.
§Examples
use spiffe::{JwtBundle, TrustDomain};
let jwt_authorities = r#"{
"keys": [
{
"kty": "EC",
"kid": "C6vs25welZOx6WksNYfbMfiw9l96pMnD",
"crv": "P-256",
"x": "ngLYQnlfF6GsojUwqtcEE3WgTNG2RUlsGhK73RNEl5k",
"y": "tKbiDSUSsQ3F1P7wteeHNXIcU-cx6CgSbroeQrQHTLM"
}
]
}"#
.as_bytes();
let trust_domain = TrustDomain::new("example.org").unwrap();
let jwt_bundle = JwtBundle::from_jwt_authorities(trust_domain, jwt_authorities).unwrap();
assert!(jwt_bundle
.find_jwt_authority("C6vs25welZOx6WksNYfbMfiw9l96pMnD")
.is_some());
Returns the [JwtAuthority
] with the given key ID.
Adds a [JwtAuthority
] to the bundle.
Sourcepub fn trust_domain(&self) -> &TrustDomain
pub fn trust_domain(&self) -> &TrustDomain
Returns the TrustDomain
associated to the bundle.
Trait Implementations§
impl Bundle for JwtBundle
impl Eq for JwtBundle
impl StructuralPartialEq for JwtBundle
Auto Trait Implementations§
impl Freeze for JwtBundle
impl RefUnwindSafe for JwtBundle
impl Send for JwtBundle
impl Sync for JwtBundle
impl Unpin for JwtBundle
impl UnwindSafe for JwtBundle
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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>
Wrap the input message
T
in a tonic::Request