apitoken

package
v0.92.6 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Audience = "api-token-auth.chainloop"

Variables

View Source
var SigningMethod = jwt.SigningMethodHS256

Functions

This section is empty.

Types

type Builder

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

func NewBuilder

func NewBuilder(opts ...NewOpt) (*Builder, error)

NewBuilder creates a new APIToken JWT builder It supports expiration and revocation Currently we use a simple hmac encryption method meant to be continuously rotated TODO: additional/alternative encryption method, i.e DSE asymmetric, see CAS robot account for reference

func (*Builder) GenerateJWT

func (ra *Builder) GenerateJWT(orgID, keyID string, expiresAt *time.Time) (string, error)

it can both expire and being revoked, revocation is performed by checking the keyID against our revocation list

type CustomClaims

type CustomClaims struct {
	OrgID string `json:"org_id"`
	jwt.RegisteredClaims
}

type NewOpt

type NewOpt func(b *Builder)

func WithIssuer

func WithIssuer(issuer string) NewOpt

func WithKeySecret

func WithKeySecret(hmacSecret string) NewOpt

Jump to

Keyboard shortcuts

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