jwtservice

package
v1.21.12 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	Id                int    `json:"id"`
	Role              int    `json:"role"`
	GihubId           int64  `json:"github_id"`
	Username          string `json:"username"`
	AccessToken       string `json:"-"`
	AccessTokenCipher string `json:"access_token_cipher,omitempty"`
	jwt.RegisteredClaims
}

func (*Claims) DecryptAccessToken

func (claims *Claims) DecryptAccessToken(secret string) error

func (*Claims) EncryptAccessToken

func (claims *Claims) EncryptAccessToken(secret string) error

type JwtService

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

func NewJwtService

func NewJwtService(jwtSecretFunc func() string) *JwtService

func (*JwtService) ParseToken

func (js *JwtService) ParseToken(token string) (*Claims, *jwt.Token, error)

func (*JwtService) SignToken

func (js *JwtService) SignToken(claims *Claims) (string, error)

Jump to

Keyboard shortcuts

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