human

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package human verifies a Hydra ID token. The broker does not issue it.

Verifies with coreos/go-oidc, same check as workload. The subject is the human, not a bound agent. golang.org/x/oauth2 exchanges the code. PKCE, public client.

Index

Constants

View Source
const (
	// Deployed Hydra audience; renaming is a prod migration, not a string sweep.
	DefaultAudience = "veil"
	DefaultRedirect = "http://127.0.0.1:4460/oidc/callback"
)

Variables

This section is empty.

Functions

func AMR

func AMR(raw string) ([]string, bool)

AMR reads the Hydra id_token amr claim. ok is false when the token is not a JWT.

func PKCE

func PKCE() (verifier, state string, err error)

func RequireTOTP

func RequireTOTP(raw string) error

RequireTOTP rejects an id token whose amr skipped TOTP. Opaque test tokens are not JWTs and are left alone.

Types

type Config

type Config struct {
	Issuer      string
	Audience    string
	RedirectURL string
}

type HTTPLogin

type HTTPLogin struct {
	KratosPublic string
	Email        string
	Password     string
	TOTPSeed     string
}

HTTPLogin is Kratos frontend HTTP. Not Ory Elements. Not CDP.

type Verifier

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

func New

func New(cfg Config) (*Verifier, error)

func (*Verifier) Audience

func (v *Verifier) Audience() string

func (*Verifier) AuthCodeURL

func (v *Verifier) AuthCodeURL(ctx context.Context, state, verifier string) (string, error)

AuthCodeURL is the Hydra authorize URL. PKCE S256. prompt=login so Hydra cannot skip on a remembered session (Kratos would then accept aal1).

func (*Verifier) Exchange

func (v *Verifier) Exchange(ctx context.Context, code, verifier string) (string, error)

Exchange trades an authorization code for an ID token. Access and refresh stay here; the caller only gets the ID token to verify.

func (*Verifier) Human

func (v *Verifier) Human(ctx context.Context, rawToken string) (protocol.Principal, error)

Human verifies rawToken against the configured Hydra issuer. Subject is the human id; org is NOT stamped here — the vault humans row is org of record, resolved by the caller after the subject authenticates.

func (*Verifier) Issuer

func (v *Verifier) Issuer() string

func (*Verifier) LoginHTTP

func (v *Verifier) LoginHTTP(ctx context.Context, in HTTPLogin) (string, error)

LoginHTTP mints an ID token with password then TOTP. prompt=login is already on AuthCodeURL. The id token is rejected unless amr includes totp.

func (*Verifier) Redirect

func (v *Verifier) Redirect() string

func (*Verifier) Subject

func (v *Verifier) Subject(ctx context.Context, rawToken string) (string, error)

Jump to

Keyboard shortcuts

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