pub struct JwtAuthority<P>{ /* private fields */ }Expand description
Authority bundle that owns an ES384 signing codec and a JWKS provider.
Construct this type once at startup with JwtAuthority::from_es384_pem
and share it across handlers with Arc<JwtAuthority<P>>.
The kid embedded in every signed JWT header is guaranteed to match the kid
in the published JWKS document.
Implementations§
Source§impl<P> JwtAuthority<P>
impl<P> JwtAuthority<P>
Sourcepub fn from_es384_pem(
private_key_pem: &[u8],
public_key_pem: &[u8],
) -> Result<Self>
pub fn from_es384_pem( private_key_pem: &[u8], public_key_pem: &[u8], ) -> Result<Self>
Build an authority bundle from PEM-encoded ES384 private and public keys.
The kid is derived deterministically from the public key bytes so it is
stable across restarts as long as the key pair does not change.
§Errors
Returns an error if either key cannot be parsed or the JWKS provider cannot be constructed from the public key.
Sourcepub fn codec(&self) -> Arc<JsonWebToken<P>> ⓘ
pub fn codec(&self) -> Arc<JsonWebToken<P>> ⓘ
Returns the signing codec.
Use this to encode JWTs in login handlers.
Sourcepub fn jwks_provider(&self) -> &JwksProvider
pub fn jwks_provider(&self) -> &JwksProvider
Returns the JWKS provider.
Pass this to the JWKS publication route handler.
Trait Implementations§
Source§impl<P> Clone for JwtAuthority<P>
impl<P> Clone for JwtAuthority<P>
Source§fn clone(&self) -> JwtAuthority<P>
fn clone(&self) -> JwtAuthority<P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more