token

package
v1.0.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSignToken = errors.New("fail when sign token")
)

Functions

func ClaimsFactory

func ClaimsFactory() jwt.Claims

Types

type Claims

type Claims struct {
	jwt.StandardClaims
	SubjectID uuid.UUID `json:"subId,omitempty"`
}

type Creator

type Creator interface {
	MakeToken(acc domain.Account) (string, error)
}

Creator is interface for creating token.

type JWTStrategyConfig

type JWTStrategyConfig struct {
	// Key for token signing.
	Key []byte

	// Token time life.
	Ttl time.Duration

	// Token audience.
	Audience string

	// Token Issuer.
	Issuer string
}

JWTStrategyConfig is config for jwt service.

type ServiceJwt

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

ServiceJwt is jwt implementation.

func NewJwtService

func NewJwtService(cfg JWTStrategyConfig, clock clock.Clock) *ServiceJwt

NewJwtService creates jst service.

func (*ServiceJwt) MakeToken

func (s *ServiceJwt) MakeToken(acc domain.Account) (string, error)

MakeToken creates token.

Jump to

Keyboard shortcuts

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