ONES OIDC Rust Authentication Library
Package to authenticate with ONES using OpenID Connect (OIDC) and Client Initiated Backchannel Authentication (CIBA).
Usage
1.0 Device Authentication
use ;
use ;
let device_config = load_device_config.expect;
let private_key = read_private_key.expect;
let client_id = device_config.client_id.clone;
let issuer_url = device_config.get_issuer_url.expect;
let provider_metadata = discover_async
.await
.expect;
// Create client with default configuration
let openid_client = new;
// Or create client with custom configuration
let config = default;
let openid_client = with_config;
1.1 Get Device Access Token
// Reuse the `openid_client` from the previous example
let device_access_token = openid_client.device_access_token.await
.expect;
// Or use the non-cached version
let device_access_token = openid_client.request_device_access_token.await
.expect;
2.0 CIBA
Authenticate with user username (OnesID).
2.1 Make CIBA Request
use ;
// Reuse the `openid_client` from the previous example
let login_hint = LoginHint ;
let result = openid_client.make_ciba_request.await;
match result
2.2 Check CIBA Status
use OidcError;
// Reuse the `openid_client` from the previous example
// Use the auth_req_id from the previous CIBA request
let auth_request_id = "your-auth-request-id";
match openid_client.check_ciba_status.await
3.0 Token Validation
// Reuse the `openid_client` from the previous example
let token = "your-jwt-or-opaque-token";
match openid_client.validate_token.await
CLI Tool
The library includes a CLI tool for common operations:
Installation
Build the CLI tool:
Usage
Get Device Access Token
Show Device Configuration
Query Well-Known Application
Custom Configuration Paths
Help