SecuritySchemeBuilder

Builder class for creating SecurityScheme instances.

This builder provides a fluent API for creating various types of security schemes supported by the A2A protocol, including the new mTLS and OAuth2 with metadata URL features introduced in version 0.3.0.

Example usage:

val oauth2Scheme = SecurityScheme.oauth2 {
metadataUrl = "https://auth.example.com/.well-known/oauth2"
flows {
authorizationCode {
authorizationUrl = "https://auth.example.com/oauth2/authorize"
tokenUrl = "https://auth.example.com/oauth2/token"
scopes = mapOf("read" to "Read access", "write" to "Write access")
}
}
}

Functions

Link copied to clipboard

Creates an API Key security scheme.

Link copied to clipboard
fun http(scheme: String, bearerFormat: String? = null): HttpSecurityScheme

Creates an HTTP security scheme.

Link copied to clipboard
fun mutualTLS(description: String? = null): MutualTLSSecurityScheme

Creates a Mutual TLS security scheme.

Link copied to clipboard
fun oauth2(metadataUrl: String? = null, flows: OAuth2Flows): OAuth2SecurityScheme

Creates an OAuth2 security scheme with optional metadata URL.

Link copied to clipboard

Creates an OpenID Connect security scheme.