Skip to main content

AssertionKeys

Enum AssertionKeys 

Source
pub enum AssertionKeys {
    ClientSecret {
        secret: ClientSecretKey,
    },
    PublicKeys {
        keys: Vec<PublicJwk>,
    },
}
Available on crate feature client-assertion only.
Expand description

What a registration expects a client assertion to be signed with.

The variants are the two RFC 7523 methods, and the choice between them is the choice of algorithm: there is deliberately no way to spell “this client uses private_key_jwt and also HS256”. See verify_assertion.

Variants§

§

ClientSecret

client_secret_jwt (RFC 7523 section 2.2 with a MAC): HMAC-SHA-256 under the registered client secret.

Weaker than AssertionKeys::PublicKeys and supported because deployments have it: the server still holds a secret that could authenticate as the client, so a dump of the client table is still a set of working credentials. What it does buy over client_secret_basic is that the secret never crosses the network, so it cannot be captured in transit or logged by an intermediary.

Fields

§secret: ClientSecretKey

The shared secret. Held in the clear because HMAC verification needs the key itself; a one-way crate::client::SecretHash cannot be used here, and pretending otherwise would be the kind of storage that looks safe and is not.

A ClientSecretKey rather than a String so that the entropy floor cannot be walked past by writing the variant out by hand.

§

PublicKeys

private_key_jwt (RFC 7523 section 2.2 with a digital signature): ECDSA P-256 under a key only the client holds. This is the variant to reach for.

Fields

§keys: Vec<PublicJwk>

The registered public keys. Several are allowed so a client can rotate: it publishes the new key alongside the old, signs with either during the overlap, and retires the old one when it is done. A server that accepted only one key would make rotation an outage.

Implementations§

Source§

impl AssertionKeys

Source

pub fn token_endpoint_auth_method(&self) -> &'static str

The RFC 8414 method name this registration authenticates with.

Source

pub fn signing_alg(&self) -> &'static str

The ONE alg this registration’s assertions may carry.

Singular on purpose. A registration that accepted a SET of algorithms would be one where an attacker gets to pick from that set, and the interesting attacks are all about picking the element the deployment did not think about.

Trait Implementations§

Source§

impl Clone for AssertionKeys

Source§

fn clone(&self) -> AssertionKeys

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AssertionKeys

Hand-written for the same reason as crate::client::ClientAuth’s: ClientAuth derives nothing that would print a secret, and this type sits inside it. The PUBLIC keys stay visible, because they are public and because “which keys does this registration actually hold” is the first question anyone debugging a private_key_jwt failure asks.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AssertionKeys

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for AssertionKeys

Source§

impl PartialEq for AssertionKeys

Source§

fn eq(&self, other: &AssertionKeys) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AssertionKeys

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AssertionKeys

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.