serviceauth

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package serviceauth signs and verifies request-bound service credentials. It owns the JWT protocol shared by callers and fact providers.

Index

Constants

View Source
const Audience = "epithet-policy"

Audience is the aud claim on every service token.

View Source
const DirectoryAudience = "epithet-directory"
View Source
const InventoryAudience = "epithet-inventory"
View Source
const TokenTTL = 60 * time.Second

TokenTTL bounds how long a minted request token is accepted.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

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

Signer mints request-bound JWTs signed with a service SSH private key.

func NewSigner

func NewSigner(privateKey sshcert.RawPrivateKey) (*Signer, error)

NewSigner creates a Signer from an SSH private key.

func NewSignerFor added in v0.30.0

func NewSignerFor(privateKey sshcert.RawPrivateKey, audience string) (*Signer, error)

func (*Signer) Authorize

func (s *Signer) Authorize(req *http.Request, body []byte) error

Authorize mints a request-bound JWT and sets the Authorization header. body may be nil (GET); the bh claim is then over the empty string.

func (*Signer) AuthorizeActor added in v0.38.0

func (s *Signer) AuthorizeActor(req *http.Request, body []byte, actor string) error

AuthorizeActor binds an authenticated human actor to this backend request. An empty actor is used for service operations such as enrollment.

type Verifier

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

Verifier checks request-bound JWTs against the CA's SSH public key.

func NewVerifier

func NewVerifier(publicKey sshcert.RawPublicKey) (*Verifier, error)

NewVerifier creates a Verifier from an SSH public key.

func NewVerifierFor added in v0.30.0

func NewVerifierFor(publicKey sshcert.RawPublicKey, audience string) (*Verifier, error)

func (*Verifier) Verify

func (v *Verifier) Verify(req *http.Request, body []byte) error

Verify checks the request's Authorization header JWT: signature, aud, exp/iat freshness, that htm/htu match the request actually received, and that bh matches sha256(body). It takes the request (rather than just the header) because method/target binding needs req.Method, req.Host, and req.URL.RequestURI().

func (*Verifier) VerifyActor added in v0.38.0

func (v *Verifier) VerifyActor(req *http.Request, body []byte) (string, error)

VerifyActor returns only the subject covered by a valid request signature.

Jump to

Keyboard shortcuts

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