pub struct Gate { /* private fields */ }Expand description
Gate service client — Auth-as-a-Service.
Provides identity management, short-lived access token issuance, and policy-based authorization checks.
Obtain a Gate instance either as part of the unified Verne client or
standalone:
// Standalone
use nautilus_rs::Gate;
let gate = Gate::new("vrn_gate_live_sk_…");
// Via unified client
use nautilus_rs::Verne;
let verne = Verne::builder().gate("vrn_gate_live_sk_…").build()?;
let gate = verne.gate()?;Implementations§
Source§impl Gate
impl Gate
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Create a Gate client with default settings.
Panics if the API key is empty or the HTTP client cannot be initialized.
Use Gate::builder for fallible construction.
Sourcepub fn builder() -> GateBuilder
pub fn builder() -> GateBuilder
Return a GateBuilder for fine-grained configuration.
Sourcepub fn identities(&self) -> IdentitiesClient
pub fn identities(&self) -> IdentitiesClient
Return an IdentitiesClient for CRUD operations on identities.
Sourcepub fn tokens(&self) -> TokensClient
pub fn tokens(&self) -> TokensClient
Return a TokensClient for issuing and introspecting access tokens.
Sourcepub fn settings(&self) -> SettingsClient
pub fn settings(&self) -> SettingsClient
Return a SettingsClient for reading and updating tenant settings.
Check whether a subject is allowed to perform an action on a resource.
Maps to POST /v1/gate/authorize.
§Example
use nautilus_rs::{Gate, AuthorizeParams};
let gate = Gate::new("vrn_gate_live_sk_…");
let decision = gate.authorize(AuthorizeParams {
subject: "idn_alice".into(),
action: "read".into(),
resource: "report:rpt_456".into(),
context: None,
}).await?;
assert!(decision.allowed);Sourcepub async fn get_enabled_providers(
&self,
tenant_id: &str,
) -> Result<Vec<String>, Error>
pub async fn get_enabled_providers( &self, tenant_id: &str, ) -> Result<Vec<String>, Error>
List the social login providers currently enabled for a tenant.
This is a public, unauthenticated endpoint — call it from your
login / registration page to decide which social buttons to render.
Maps to GET /public/gate/providers/{tenant_id}.
§Example
use nautilus_rs::Gate;
let gate = Gate::new("vrn_gate_live_sk_…");
let providers = gate.get_enabled_providers("ten_001").await?;
// → ["github", "google"]Sourcepub async fn create_login_flow(&self) -> Result<Value, Error>
pub async fn create_login_flow(&self) -> Result<Value, Error>
Initialize a Kratos login flow using your Gate API key.
Call this from your server and pass the returned flow JSON to your
browser-side code to render social login buttons. The flow already
contains only the providers your tenant has enabled. Maps to
GET /v1/gate/auth/login.
The response mirrors the raw Ory Kratos flow JSON, so it is returned as
an untyped serde_json::Value.