2 releases
| 0.4.12 | Jan 24, 2026 |
|---|---|
| 0.4.4 | Jan 9, 2026 |
#1114 in Authentication
14KB
82 lines
Federated Auth Realm Rust SDK
A comprehensive Rust SDK for Federated Auth Realm, providing authentication, token management, and basic API calls.
Features
- Authenticate with username/password
- Token management (access/refresh)
- Async API calls with reqwest
- Extensible for SRWP discovery
Project layout
├── Cargo.toml # Package manifest
├── src
│ ├── lib.rs # Library entry point
│ └── client.rs # Auth client implementation
├── tests
│ └── client_tests.rs # Unit tests
├── example
│ └── main.rs # Usage example
Getting started
- Build the library
cargo build
- Run tests
cargo test
- Format and lint
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
Usage
use federated_auth_realm_sdk::AuthClient;
#[tokio::main]
async fn main() {
let client = AuthClient::new("https://api.example.com");
match client.login("user", "pass").await {
Ok(token) => println!("Access token: {}", token.access_token),
Err(e) => eprintln!("Login failed: {}", e),
}
}
## Publishing to crates.io
To publish the package, ensure you have a valid `.env` file with your `CARGO_REGISTRY_TOKEN`.
Run:
Contributing
If you want to publish with a dirty working directory (not recommended), use:
./scripts/deploy.sh --allow-dirty
This will pass the --allow-dirty flag to cargo publish.
- Format:
cargo fmt --all - Lint:
cargo clippy --all-targets --all-features -- -D warnings - Tests:
cargo test
License
MIT
Dependencies
~6–22MB
~263K SLoC