auth

module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0

README

auth

github.com/wyolet/relay/auth holds general-purpose authentication and authorization primitives. Kinds, verbs and owner kinds are opaque strings that the product passes in, so the module carries no relay vocabulary. Relay builds its users, teams, projects, RBAC, SSO, SCIM and inference tokens on it.

go get github.com/wyolet/relay/auth@latest
Package Contents
authn an ordered chain of authenticators and HTTP middleware that puts the authenticated principal in the request context
principal the authenticated caller: who it is, which credential proved it, and what that credential is limited to
rbac, authz a default-deny role-based authorization engine with scopes, bindings and product rules; the shared resource and refusal types
directory users, external identities, groups, teams, projects, service accounts, roles and role bindings, with grant checks on writes (memstore for tests, storetest for conformance)
store/postgres the Postgres implementation of the directory stores, with embedded migrations
manifest YAML documents (auth.wyolet.dev/v1alpha1) for directory rows: parse, plan, apply, prune, JSON Schema
oidc an OpenID Connect relying party for browser login, with PKCE
scim a SCIM 2.0 service provider over the directory
session cookie sessions over alexedwards/scs/v2, with token rotation on login
token Ed25519-signed JWTs with kid key rotation and a JWK Set
apikey opaque bearer keys and the sha256 hash a server stores in place of them
password bcrypt hashing and verification, and detection of published placeholder passwords

The module is v0: its API may change between minor versions. Releases are tagged auth/vX.Y.Z. It was built for relay, and it imports nothing from the relay server module.

API reference: pkg.go.dev. License: Apache-2.0.

Directories

Path Synopsis
Package apikey generates opaque bearer keys and the hash a server stores in place of them.
Package apikey generates opaque bearer keys and the hash a server stores in place of them.
Package authn turns a request into a principal: an ordered chain of authenticators, the product hooks that run once one succeeds, and the HTTP middleware that puts the result in the request context.
Package authn turns a request into a principal: an ordered chain of authenticators, the product hooks that run once one succeeds, and the HTTP middleware that puts the result in the request context.
Package authz holds what every authorization decision shares: the resource a check names and the two refusals.
Package authz holds what every authorization decision shares: the resource a check names and the two refusals.
Package directory is the identity and tenancy data an auth deployment keeps: users and the external identities they sign in with, groups and their members, teams, projects (each in one team), service accounts (each in one project), roles, and the role bindings that grant them to users, groups, service accounts or every authenticated principal.
Package directory is the identity and tenancy data an auth deployment keeps: users and the external identities they sign in with, groups and their members, teams, projects (each in one team), service accounts (each in one project), roles, and the role bindings that grant them to users, groups, service accounts or every authenticated principal.
memstore
Package memstore is an in-memory directory.Stores.
Package memstore is an in-memory directory.Stores.
storetest
Package storetest is the behaviour every directory.Stores implementation must share: lookups, unique names, resource versions, references and delete cascades.
Package storetest is the behaviour every directory.Stores implementation must share: lookups, unique names, resource versions, references and delete cascades.
Package manifest reads and writes the directory's rows as YAML documents of apiVersion auth.wyolet.dev/v1alpha1: Team, Project, ServiceAccount, Role, User, Group and RoleBinding.
Package manifest reads and writes the directory's rows as YAML documents of apiVersion auth.wyolet.dev/v1alpha1: Team, Project, ServiceAccount, Role, User, Group and RoleBinding.
Package oidc is an OpenID Connect relying party for browser login: Start redirects to the provider's hosted login, Callback exchanges the authorization code and hands the caller's claims to the product.
Package oidc is an OpenID Connect relying party for browser login: Start redirects to the provider's hosted login, Callback exchanges the authorization code and hands the caller's claims to the product.
Package password hashes and verifies login passwords with bcrypt, keeps a constant-time fallback for stored values that are not bcrypt hashes, and recognises published placeholder passwords.
Package password hashes and verifies login passwords with bcrypt, keeps a constant-time fallback for stored values that are not bcrypt hashes, and recognises published placeholder passwords.
Package principal is the caller a request authenticated as: who it is, which credential proved it, and what that credential is limited to.
Package principal is the caller a request authenticated as: who it is, which credential proved it, and what that credential is limited to.
Package rbac is a default-deny role-based authorization engine.
Package rbac is a default-deny role-based authorization engine.
Package scim is a SCIM 2.0 service provider (RFC 7643, RFC 7644) over a directory.Directory: a plain http.Handler serving /Users, /Groups, /ServiceProviderConfig, /ResourceTypes and /Schemas, so an identity provider such as Microsoft Entra ID or Okta can create, update, deactivate and delete the accounts and groups it manages.
Package scim is a SCIM 2.0 service provider (RFC 7643, RFC 7644) over a directory.Directory: a plain http.Handler serving /Users, /Groups, /ServiceProviderConfig, /ResourceTypes and /Schemas, so an identity provider such as Microsoft Entra ID or Okta can create, update, deactivate and delete the accounts and groups it manages.
Package session is a cookie session manager over alexedwards/scs/v2: middleware that loads and saves the session, login with token rotation, logout, ending every session of one user, and an authn.Authenticator that reads the caller from the loaded session.
Package session is a cookie session manager over alexedwards/scs/v2: middleware that loads and saves the session, login with token rotation, logout, ending every session of one user, and an authn.Authenticator that reads the caller from the loaded session.
store
postgres
Package postgres is the ready-made Postgres implementation of directory.Stores: the tables, the queries, and the embedded migrations a product runs with Migrate under a version table of the module's own.
Package postgres is the ready-made Postgres implementation of directory.Stores: the tables, the queries, and the embedded migrations a product runs with Migrate under a version table of the module's own.
Package token signs and verifies Ed25519 compact JWTs whose header may name the verification key by `kid`.
Package token signs and verifies Ed25519 compact JWTs whose header may name the verification key by `kid`.

Jump to

Keyboard shortcuts

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