OpenFGA Rust Client SDK
OpenFGA Rust Client is a type-safe gRPC client for OpenFGA with optional Authorization Model management and Authentication (Bearer or Client Credentials).
Features
- Type-safe client for OpenFGA (gRPC) build on
tonic - (JSON) Serialization and deserialization for Authorization Models in addition to protobuf Messages
- Uses
vendored-protocfor well-known types - Rust files are pre-generated. - Optional Authorization Model management with Migration hooks. Ideal for stateless deployments. State is managed exclusively in OpenFGA. This enables fully automated model management by your Application without re-writing of Authorization Models on startup.
- Optional Authentication (Bearer or Client Credentials) via the Middle Crate. (Feature:
auth-middle) - Optional TLS support for secure HTTPS connections (Features:
tls-rustls,tls-native-roots,tls-webpki-roots) - Convenience functions like
read_all_tuples(handles pagination),get_store_by_nameand more.
TLS Support
To connect to OpenFGA servers over HTTPS, enable the TLS feature flags:
[]
= { = "0.4", = ["tls-rustls", "tls-native-roots"] }
Available TLS features:
tls-rustls: Enables TLS support using rustlstls-native-roots: Uses the platform's native certificate storetls-webpki-roots: Uses Mozilla's root certificates (bundled)all: Enablestls-rustls,tls-native-roots, andauth-middle(does not includetls-webpki-roots)
When TLS is enabled, HTTPS endpoints are automatically configured with TLS.
Usage
Basic Usage
use OpenFgaServiceClient;
use Channel;
async
Bearer Token Authentication (API-Key)
use ;
Client Credential Authentication
use BasicOpenFgaServiceClient;
use Url;
async
License
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
See DEVELOPMENT.md for some tips.