pub enum Audience {
Single(String),
Multi(Vec<String>),
}Expand description
The aud claim per RFC 7519 §4.1.3: “a StringOrURI value or an
array of StringOrURI”. Mainstream IdPs (Okta, Auth0, Azure AD,
Cognito) emit the array form for multi-audience apps
("aud": ["agentvisor", "some-other-svc"]). Accepting only the
string form silently locks the operator out at go-live with an
invalid type: sequence, expected string error deep inside
jsonwebtoken::decode, before our validator’s aud check runs.
Round-12 F10 defense-in-depth: reject "aud": [] at deserialize
time. Without this guard Multi(vec![]) would still be caught by
jsonwebtoken’s set_audience intersection check, but a future
refactor that removed the library gate would leave the empty-list
shape silently accepting any token. Refusing at the concrete
deserialize step means the audience gate remains sound at both
layers.
Variants§
Single(String)
Single-string form ("aud": "agentvisor").
Multi(Vec<String>)
Array form ("aud": ["agentvisor", "other"]).
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Audience
impl<'de> Deserialize<'de> for Audience
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for Audience
impl StructuralPartialEq for Audience
Auto Trait Implementations§
impl Freeze for Audience
impl RefUnwindSafe for Audience
impl Send for Audience
impl Sync for Audience
impl Unpin for Audience
impl UnsafeUnpin for Audience
impl UnwindSafe for Audience
Blanket Implementations§
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.