pub struct SecurityRequirement {
pub schemes: BTreeMap<Arc<str>, StringList>,
}Expand description
A single security requirement — one rule an operation must satisfy.
The wire form is the proto’s: a schemes map
from scheme name to a StringList of
required scopes. An entry with an empty schemes
map explicitly says “this operation requires no
authentication” (OpenAPI 3.x semantics).
Fields§
§schemes: BTreeMap<Arc<str>, StringList>The schemes this requirement demands, keyed by
the scheme name (the same name as the key in
AgentCard::security_schemes).
The list of scopes is per-scheme; for schemes
that don’t take scopes (API key, HTTP, mTLS)
the list is empty.
Implementations§
Source§impl SecurityRequirement
impl SecurityRequirement
Sourcepub fn new() -> Self
pub fn new() -> Self
Starts a new empty requirement — equivalent to
OpenAPI 3.x’s securityRequirement: [{}],
“no authentication required”.
Sourcepub fn with_scheme(
self,
name: impl Into<Arc<str>>,
scopes: impl IntoIterator<Item = impl Into<Arc<str>>>,
) -> Self
pub fn with_scheme( self, name: impl Into<Arc<str>>, scopes: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> Self
Adds a scheme the requirement demands. The
scopes list is the scopes the operation
requires; for non-OAuth schemes the list
should be empty.