Skip to main content

Gate

Struct Gate 

Source
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

Source

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.

Source

pub fn builder() -> GateBuilder

Return a GateBuilder for fine-grained configuration.

Source

pub fn identities(&self) -> IdentitiesClient

Return an IdentitiesClient for CRUD operations on identities.

Source

pub fn tokens(&self) -> TokensClient

Return a TokensClient for issuing and introspecting access tokens.

Source

pub fn settings(&self) -> SettingsClient

Return a SettingsClient for reading and updating tenant settings.

Source

pub async fn authorize( &self, params: AuthorizeParams, ) -> Result<AuthorizationDecision, Error>

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);
Source

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"]
Source

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.

Trait Implementations§

Source§

impl Debug for Gate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Gate

§

impl !UnwindSafe for Gate

§

impl Freeze for Gate

§

impl Send for Gate

§

impl Sync for Gate

§

impl Unpin for Gate

§

impl UnsafeUnpin for Gate

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more