auth

package
v0.0.1-041123-998b0c9 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const GRPCMetadataTokenKey = "x-standup-token"

Variables

This section is empty.

Functions

func IssueToken

func IssueToken(subjectID string, notBefore, expiresAt time.Time, privateKey any) (string, error)

func LoadPrivateKey

func LoadPrivateKey(path string) (*ecdsa.PrivateKey, error)

func LoadPublicKey

func LoadPublicKey(path string) (*ecdsa.PublicKey, error)

func ValidateToken

func ValidateToken(raw string, publicKey any) (subjectID string, err error)

Types

type Authenticator

type Authenticator interface {
	Enabled() bool
	Authenticate(raw string) (subjectID string, err error)
}

func NewDisabledAuthenticator

func NewDisabledAuthenticator() Authenticator

func NewStaticAuthenticator

func NewStaticAuthenticator(key *ecdsa.PublicKey) Authenticator

type Issuer

type Issuer interface {
	IssueToken(subjectID string, notBefore, expiresAt time.Time) (string, error)
}

func NewStaticIssuer

func NewStaticIssuer(pk any) Issuer

Jump to

Keyboard shortcuts

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