ory

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package ory provides Ory Kratos authentication and Keto authorization client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps Ory Kratos (auth) and Keto (authorization).

func NewClient

func NewClient(cfg Config) *Client

NewClient creates an Ory client (Kratos + Keto).

func (*Client) KetoCheck

func (c *Client) KetoCheck(ctx context.Context, req KetoCheckRequest) (bool, error)

KetoCheck performs an authorization check against Ory Keto.

func (*Client) ValidateJWT

func (c *Client) ValidateJWT(_ context.Context, tokenString string, _ string) (jwt.MapClaims, error)

ValidateJWT validates a JWT signed by Ory Kratos using JWKS.

func (*Client) ValidateSession

func (c *Client) ValidateSession(ctx context.Context, token string) (*Session, error)

ValidateSession validates a session cookie or token against Ory Kratos.

func (*Client) WriteKetoTuple

func (c *Client) WriteKetoTuple(ctx context.Context, namespace, object, relation, subjectID string) error

WriteKetoTuple writes a relation tuple to Ory Keto.

type Config

type Config struct {
	KratosPublicURL string
	KetoURL         string
	TTL             time.Duration
}

Config holds Ory connection settings.

type KetoCheckRequest

type KetoCheckRequest struct {
	Namespace string
	Object    string
	Relation  string
	SubjectID string
}

KetoCheckRequest defines an authorization check against Ory Keto.

type Session

type Session struct {
	Identity struct {
		ID     string         `json:"id"`
		Traits map[string]any `json:"traits"`
	} `json:"identity"`
}

Session holds the validated user session from Kratos.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL