auth

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package auth implements JWT auth.

Index

Constants

View Source
const Issuer = "token-exchange"

Issuer is the entity that issued the JWTs.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutojoinClaims added in v0.3.0

type AutojoinClaims struct {
	jwt.Claims
	Organization string `json:"org"`
}

AutojoinClaims is a JWT claims set for autojoin tokens.

type ClientIntegrationClaims added in v0.3.0

type ClientIntegrationClaims struct {
	jwt.Claims
	IntegrationID string `json:"int_id"`
	KeyID         string `json:"key_id"`
	Tier          int    `json:"tier"`
}

ClientIntegrationClaims is a JWT claims set for client-integration tokens.

type JWTSigner

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

JWTSigner is a JWT signer that can be used to sign JWTs.

func NewJWTSigner

func NewJWTSigner(keyPath string) (*JWTSigner, error)

NewJWTSigner loads a private key from a JWK file and prepares a signer.

func (*JWTSigner) GenerateAutojoinToken added in v0.3.0

func (s *JWTSigner) GenerateAutojoinToken(org string, expiry time.Duration, audience ...string) (string, error)

GenerateAutojoinToken generates a JWT token for autojoin with organization ID.

This method is thread safe.

func (*JWTSigner) GenerateClientIntegrationToken added in v0.3.0

func (s *JWTSigner) GenerateClientIntegrationToken(integrationID, keyID string, tier int, expiry time.Duration, audience ...string) (string, error)

GenerateClientIntegrationToken generates a JWT token for client-integration with integration ID, key ID, and service tier.

This method is thread safe.

func (*JWTSigner) GetPublicJWK

func (s *JWTSigner) GetPublicJWK() jose.JSONWebKey

GetPublicJWK returns the public key in jose.JSONWebKey format.

This method is thread safe as long as the returned key is not modified.

Jump to

Keyboard shortcuts

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