jwt

package
v0.0.0-...-6dbb2d7 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Overview

Copyright 2018. box.la authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     error  = errors.New("Token is expired")
	TokenNotValidYet error  = errors.New("Token not active yet")
	TokenMalformed   error  = errors.New("That's not even a token")
	TokenInvalid     error  = errors.New("Couldn't handle this token:")
	SignKey          string = "box.la"
)

Functions

func GetSignKey

func GetSignKey() string

func JWTAuth

func JWTAuth() gin.HandlerFunc

func SetSignKey

func SetSignKey(key string) string

Types

type CustomClaims

type CustomClaims struct {
	AppID   string `json:"appid"`
	Account string `json:"account"`
	jwt.StandardClaims
}

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT() *JWT

func (*JWT) CreateToken

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

func (*JWT) ParseToken

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

func (*JWT) RefreshToken

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

Jump to

Keyboard shortcuts

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