ory

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

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(ctx context.Context, tokenString string, jwksURL string) (jwt.MapClaims, error)

ValidateJWT validates a JWT signed by Ory Kratos.

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
}

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