adk-auth
Access control and authentication for Rust Agent Development Kit (ADK-Rust).
Overview
adk-auth provides enterprise-grade access control for AI agents:
- Role-Based Access - Define roles with tool/agent permissions
- Permission Scopes - Fine-grained allow/deny rules (deny precedence)
- Audit Logging - Log all access attempts to JSONL files
- SSO/OAuth - JWT validation with Google, Azure AD, Okta, Auth0 providers
Features
| Feature | Description |
|---|---|
default |
Core RBAC + audit logging |
sso |
JWT/OIDC providers (Google, Azure AD, Okta, Auth0) |
Quick Start
use ;
// Define roles
let admin = new.allow;
let user = new
.allow
.deny;
// Build access control
let ac = builder
.role
.role
.assign
.assign
.build?;
// Protect tools
let middleware = new;
let protected_tools = middleware.protect_all;
SSO Integration
Enable with features = ["sso"]:
use ;
// Create provider
let provider = new;
// Map IdP groups to roles
let mapper = builder
.map_group
.default_role
.user_id_from_email
.build;
// Combined SSO + RBAC
let sso = builder
.validator
.mapper
.access_control
.build?;
// Validate token and check permission
let claims = sso.check_token.await?;
println!;
Providers
| Provider | Usage |
|---|---|
GoogleProvider::new(client_id) |
|
| Azure AD | AzureADProvider::new(tenant_id, client_id) |
| Okta | OktaProvider::new(domain, client_id) |
| Auth0 | Auth0Provider::new(domain, audience) |
| Generic OIDC | OidcProvider::from_discovery(issuer, client_id).await |
Audit Logging
use FileAuditSink;
let audit = new?;
let middleware = with_audit;
Output:
Examples
License
Apache-2.0
Part of ADK-Rust
This crate is part of the ADK-Rust framework for building AI agents in Rust.