jwt

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTClaims

type JWTClaims struct {
	ID                 string `json:"id,omitempty" bson:"_id,omitempty"`
	Username           string `json:"username,omitempty" bson:",omitempty"`
	AccessControl      string `json:"accessControl,omitempty" bson:",omitempty"`
	jwt.StandardClaims        // 표준 토큰 Claims
}

type Jwt

type Jwt struct {
	Secret   []byte
	Duration time.Duration
}

func Init

func Init(config JwtConfig) (jwt *Jwt, err error)

func (*Jwt) ForgeToken

func (j *Jwt) ForgeToken(id string, username string, accessControl string) (string, time.Time, error)

func (*Jwt) OpenToken

func (j *Jwt) OpenToken(tokenStr string) (*JWTClaims, error)

type JwtConfig added in v0.1.7

type JwtConfig struct {
	Secret   []byte
	Duration time.Duration
}

Jump to

Keyboard shortcuts

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