auth

package
v0.0.0-...-0ee8c1f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JWTSigningMethodHS256 = "HS256"
	JWTSigningMethodHS384 = "HS384"
	JWTSigningMethodHS512 = "HS512"
)
View Source
const CasbinRBACModel = `` /* 251-byte string literal not displayed */
View Source
const JWTClaimsKey = "JWT_CLAIMS"
View Source
const SaltLength = 8
View Source
const UserKey = "LOGIN_USER"

Variables

View Source
var (
	JWTTokenMalformed   = errors.New("jwt token malformed")
	JWTTokenExpired     = errors.New("jwt token expired")
	JWTTokenNotValidYet = errors.New("jwt token not valid yet")
	JWTTokenInvalid     = errors.New("jwt token invalid")
)
View Source
var Enforcer *casbin.Enforcer

Functions

func InitCasbin

func InitCasbin()

Types

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT() *JWT

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims JWTClaims) (string, error)

create jwt token

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*JWTClaims, error)

parse token

func (*JWT) RefreshToken

func (j *JWT) RefreshToken(tokenString string) (string, error)

update token

func (*JWT) RefreshTokenWithTime

func (j *JWT) RefreshTokenWithTime(tokenString string, t time.Duration) (string, error)

update token with time

type JWTClaims

type JWTClaims struct {
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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