OpenAgentID documentation
Source referencesRust module referenceopenagent-oidc

openagent-oidc · config

Declared module signatures, types, configuration, and source documentation.

Source: openagent-sdk/bridges/oidc/rust/src/config.rs. SHA-256: 2965e6823b8dd3c0503f4826dcedefa6b7d85304ad090dc45f2e6e8be5a5268e.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

config::ProviderConfig

Configuration for a single OIDC provider (Okta, Auth0, Azure AD, etc.).

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProviderConfig {
/// Human-readable provider name (e.g. `"okta"`, `"azure"`).

pub name: String,
/// OIDC issuer URL (must match the `iss` claim in JWTs from this provider).

pub issuer: String,
/// Expected `aud` claim. Omit to skip audience validation (not recommended).

pub audience: Option<String>,
/// Override for the JWKS URI. If `None`, auto-discovered from

/// `{issuer}/.well-known/openid-configuration`.

pub jwks_url: Option<String>,
/// Which JWT claim maps to the human identity (default: `"sub"`).

#[serde(default = "default_hmr_claim")]
pub hmr_claim: String,
/// Mapping from OIDC scopes / roles to Arsenal-style scopes.

///

/// Example: `{ "admin": ["*:*:*"], "agent-user": ["openai:chat:*"] }`.

#[serde(default)]
pub scope_mapping: HashMap<String, Vec<String>>
}

Source line: 16.

config::ProviderConfig::new

Create a minimal provider config with just issuer and audience.

pub fn new(name: impl Into<String>, issuer: impl Into<String>) -> Self;

Source line: 42.

config::ProviderConfig::with_audience

Set the expected audience.

pub fn with_audience(mut self, audience: impl Into<String>) -> Self;

Source line: 54.

config::ProviderConfig::with_jwks_url

Set a custom JWKS URL (skip discovery).

pub fn with_jwks_url(mut self, url: impl Into<String>) -> Self;

Source line: 60.

config::ProviderConfig::with_hmr_claim

Set the JWT claim that identifies the human root.

pub fn with_hmr_claim(mut self, claim: impl Into<String>) -> Self;

Source line: 66.

config::ProviderConfig::with_scope_mapping

Add a scope mapping entry.

pub fn with_scope_mapping(mut self, role: impl Into<String>, scopes: Vec<String>) -> Self;

Source line: 72.

config::ProviderConfig::validate

Validate that the configuration is usable.

pub fn validate(&self) -> Result<()>;

Source line: 78.

config::OidcConfig

Top-level OIDC bridge configuration.

Supports either a single provider (for simple setups) or multiple providers (for enterprises with several IdPs). The bridge routes JWTs to the correct provider based on the iss claim.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OidcConfig {
/// List of OIDC providers. At least one is required.

pub providers: Vec<ProviderConfig>,
/// OAS namespace for minted DIDs (default: `"openagent"`).

#[serde(default = "default_namespace")]
pub namespace: String,
/// Default TTL in seconds for emitted JWTs (Flow 2). Default: 3600.

#[serde(default = "default_jwt_ttl")]
pub jwt_ttl_seconds: i64,
/// HTTP client timeout in milliseconds for discovery / JWKS fetches.

#[serde(default = "default_http_timeout_ms")]
pub http_timeout_ms: u64
}

Source line: 99.

config::OidcConfig::single

Create a config with a single OIDC provider.

pub fn single(provider: ProviderConfig) -> Self;

Source line: 127.

config::OidcConfig::multi

Create a config with multiple providers.

pub fn multi(providers: Vec<ProviderConfig>) -> Self;

Source line: 137.

config::OidcConfig::with_namespace

Override the OAS namespace.

pub fn with_namespace(mut self, ns: impl Into<String>) -> Self;

Source line: 147.

config::OidcConfig::with_jwt_ttl

Override the JWT TTL for Flow 2 (ACT -> JWT).

pub fn with_jwt_ttl(mut self, seconds: i64) -> Self;

Source line: 153.

config::OidcConfig::validate

Validate the entire configuration.

pub fn validate(&self) -> Result<()>;

Source line: 159.

config::OidcConfig::find_provider

Find the provider whose issuer matches the given string.

pub fn find_provider(&self, issuer: &str) -> Option<&ProviderConfig>;

Source line: 188.

On this page