auth

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 9 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)

func WritePrivateKey

func WritePrivateKey(key *ecdsa.PrivateKey, w io.Writer) error

func WritePublicKey

func WritePublicKey(key *ecdsa.PublicKey, w io.Writer) 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