-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Working on a toy project that might turn into something open source eventually, I've been using jose to deal with JWS and JWK. One thing I'm looking for is a way to enforce a header is only sent as protected (or unprotected) and/or that no headers were sent unprotected. Right now, for every header I want to look up that isn't a standard header I'm doing something along the lines of
match header.additional("header") {
Some(HeaderValue::Protected(serde_json::Value::String(v))) => Ok(v),
Some(HeaderValue::Protected(_)) => Err(HeaderError::InvalidHeaderTypeFor("header")),
Some(HeaderValue::Unprotected(_)) => Err(HeaderError::UnprotectedHeader("header")),
None => Err(HeaderError::MissingHeader("header")),
}With enough values this is cumbersome. The policies around JWKs is nice... if not entirely what I was looking for there, so I was wondering if a similar policy logic could be introduced for jose::header. I saw that jose::policy moved to jose::jwk::policy since 0.0.2.
xxx48154-source
Metadata
Metadata
Assignees
Labels
No labels