token

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

View Source
const (
	Prefix    = "Bearer"
	AuthField = "Authorization"
)

Variables

This section is empty.

Functions

func Generate

func Generate(userId string, isAdmin bool) (tokenString string, err error)

generate jwt token

func JoinPrefixToken

func JoinPrefixToken(token string) string

Types

type Claims

type Claims struct {
	Uid string `json:"uid"`
	jwt.StandardClaims
}

func Parse

func Parse(tokenString string, isAdmin bool) (claims Claims, err error)

parse jwt token

type ClaimsInternal

type ClaimsInternal struct {
	Uid string `json:"uid"` // base64 encode
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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