Validate provider config against a [`JwksPolicy`]. Fail-closed: empty `issuer` is rejected; `jwks_url` must pass the policy.
(
&self,
policy: &crate::control::security::jwks::url::JwksPolicy,
)
| 198 | /// Validate provider config against a [`JwksPolicy`]. Fail-closed: |
| 199 | /// empty `issuer` is rejected; `jwks_url` must pass the policy. |
| 200 | pub fn validate( |
| 201 | &self, |
| 202 | policy: &crate::control::security::jwks::url::JwksPolicy, |
| 203 | ) -> crate::Result<()> { |
| 204 | if self.name.trim().is_empty() { |
| 205 | return Err(crate::Error::Config { |
| 206 | detail: "auth.jwt provider must have a non-empty name".into(), |
| 207 | }); |
| 208 | } |
| 209 | if self.issuer.trim().is_empty() { |
| 210 | return Err(crate::Error::Config { |
| 211 | detail: format!( |
| 212 | "auth.jwt provider '{}' must set a non-empty `issuer`; \ |
| 213 | empty issuer would disable issuer validation and allow \ |
| 214 | cross-tenant token acceptance", |
| 215 | self.name |
| 216 | ), |
| 217 | }); |
| 218 | } |
| 219 | policy |
| 220 | .check_url(&self.jwks_url) |
| 221 | .map_err(|e| crate::Error::Config { |
| 222 | detail: format!("auth.jwt provider '{}' has unsafe jwks_url: {e}", self.name), |
| 223 | })?; |
| 224 | Ok(()) |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | impl JwtAuthConfig { |
nothing calls this directly
no test coverage detected