auth

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticate

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

func New

func New(opt ...Option) (*Authenticate, error)

func (*Authenticate) Generate

func (a *Authenticate) Generate(opts ...TokenOption) (*Token, error)

func (*Authenticate) Inspect

func (a *Authenticate) Inspect(signedToken []byte) (*Token, error)

func (*Authenticate) InspectWithJwk

func (a *Authenticate) InspectWithJwk(signedToken []byte) (*Token, error)

func (*Authenticate) Jwks

func (a *Authenticate) Jwks() ([]byte, error)

func (*Authenticate) Parse

func (a *Authenticate) Parse(signedToken []byte) (*Token, error)

func (*Authenticate) PrivateKeyBytes

func (a *Authenticate) PrivateKeyBytes() []byte

func (*Authenticate) PublicKeyBytes

func (a *Authenticate) PublicKeyBytes() []byte

type JwkType

type JwkType int
const (
	JwkTypeJson JwkType = iota + 1
	JwkTypePem
)

type Option

type Option func(*Options)

func WithDefaultRsaKeyPair

func WithDefaultRsaKeyPair(b bool) Option

func WithJwk

func WithJwk(data []byte, jwkType JwkType) Option

func WithRsaPrivateKey

func WithRsaPrivateKey(key *rsa.PrivateKey) Option

func WithRsaPrivateKeyBytes

func WithRsaPrivateKeyBytes(privateKeyBytes []byte) Option

func WithRsaPublic

func WithRsaPublic(key *rsa.PublicKey) Option

func WithRsaPublicKeyBytes

func WithRsaPublicKeyBytes(publicKeyBytes []byte) Option

type Options

type Options struct {
	RsaPublicKeyBytes []byte
	// contains filtered or unexported fields
}

Options .

type Token

type Token struct {
	AccessToken string                 `json:"access_token"`
	Exp         time.Time              `json:"exp,omitempty"`
	Iat         time.Time              `json:"iat,omitempty"`
	Iss         string                 `json:"iss,omitempty"`
	Subject     string                 `json:"subject"`
	Claims      map[string]interface{} `json:"claims"`
}

type TokenOption

type TokenOption func(options *TokenOptions)

func WithClaims

func WithClaims(claims map[string]any) TokenOption

func WithExpiration

func WithExpiration(expiration time.Duration) TokenOption

func WithIssuer

func WithIssuer(issuer string) TokenOption

func WithSubject

func WithSubject(sub string) TokenOption

type TokenOptions

type TokenOptions struct {
	Claims map[string]any
	// contains filtered or unexported fields
}

TokenOptions .

func NewGenerateTokenOptions

func NewGenerateTokenOptions(opts ...TokenOption) TokenOptions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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