jwt

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenIssuer

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

AccessTokenIssuer issues access tokens according to the Token Authentication Specification and Token Authentication Implementation.

func NewAccessTokenIssuer

func NewAccessTokenIssuer(issuer string, signingKey libtrust.PrivateKey, expiration time.Duration, opts ...AccessTokenIssuerOption) AccessTokenIssuer

NewAccessTokenIssuer returns a new AccessTokenIssuer.

func (AccessTokenIssuer) IssueAccessToken

func (i AccessTokenIssuer) IssueAccessToken(_ context.Context, service string, subject auth.Subject, grantedScopes []auth.Scope) (auth.AccessToken, error)

type AccessTokenIssuerOption

type AccessTokenIssuerOption interface {
	// contains filtered or unexported methods
}

AccessTokenIssuerOption configures a AccessTokenIssuer.

func WithIDGenerator

func WithIDGenerator(idGenerator IDGenerator) AccessTokenIssuerOption

WIthIDGenerator configures a token issuer to use an IDGenerator.

type Clock

type Clock interface {
	Now() time.Time
}

Clock provides an interface to accessing current time.

type IDGenerator

type IDGenerator interface {
	GenerateID() (string, error)
}

IDGenerator generates a random ID.

type Option

Option configures a token issuer.

func WithClock

func WithClock(clock Clock) Option

WithClock configures a token issuer to use a Clock.

type RefreshTokenIssuer

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

RefreshTokenIssuer issues a refresh token.

func NewRefreshTokenIssuer

func NewRefreshTokenIssuer(issuer string, signingKey libtrust.PrivateKey, opts ...RefreshTokenIssuerOption) RefreshTokenIssuer

NewRefreshTokenIssuer returns a new RefreshTokenIssuer.

func (RefreshTokenIssuer) IssueRefreshToken

func (i RefreshTokenIssuer) IssueRefreshToken(_ context.Context, service string, subject auth.Subject) (string, error)

IssueRefreshToken implements auth.RefreshTokenIssuer.

func (RefreshTokenIssuer) VerifyRefreshToken

func (i RefreshTokenIssuer) VerifyRefreshToken(_ context.Context, service string, refreshToken string) (auth.SubjectID, error)

VerifyRefreshToken implements authn.RefreshTokenVerifier.

type RefreshTokenIssuerOption

type RefreshTokenIssuerOption interface {
	// contains filtered or unexported methods
}

RefreshTokenIssuerOption configures a RefreshTokenIssuer.

Jump to

Keyboard shortcuts

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