pub struct Assertion { /* private fields */ }Expand description
Generates tokens by signing its specifics with a private key.
Tokens produced by the generator include a serialized version of the grant followed by an HMAC signature. Since data is not encrypted, this token generator will ERROR if any private extension is present in the grant.
The actual generator is given by a TaggedAssertion from Assertion::tag which enables
signing the same grant for different uses, i.e. separating authorization from bearer grants and
refresh tokens.
Implementations§
Source§impl Assertion
impl Assertion
Sourcepub fn new(kind: AssertionKind, key: &[u8]) -> Self
pub fn new(kind: AssertionKind, key: &[u8]) -> Self
Construct an assertion from a custom secret.
If the key material mismatches the key length required by the selected hash algorithm then padding or shortening of the supplied key material may be applied in the form dictated by the signature type. See the respective standards.
If future suites are added where this is not possible, this function may panic when supplied with an incorrect key length.
Currently, the implementation lacks the ability to really make use of another hasing mechanism than hmac + sha256.
Sourcepub fn ephemeral() -> Self
pub fn ephemeral() -> Self
Construct an assertion instance whose tokens are only valid for the program execution.
Sourcepub fn tag<'a>(&'a self, tag: &'a str) -> TaggedAssertion<'a>
pub fn tag<'a>(&'a self, tag: &'a str) -> TaggedAssertion<'a>
Get a reference to generator for the given tag.