service

package
v0.0.0-...-0967350 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2018 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const Issuer = "Go-GraphQL-Group"
View Source
const SecretKey = "StarWars"
View Source
const TokenName = "sw_token"

Variables

This section is empty.

Functions

func ApiHandler

func ApiHandler(w http.ResponseWriter, r *http.Request)

func LoginHandler

func LoginHandler(w http.ResponseWriter, r *http.Request)

func LogoutHandler

func LogoutHandler(w http.ResponseWriter, r *http.Request)

func ParseToken

func ParseToken(tokenStr string, secretKey []byte) (claims jwt.Claims, err error)

func TokenMiddleware

func TokenMiddleware(next http.Handler) http.Handler

Types

type RespData

type RespData struct {
	Status bool   `json:"status"`
	Msg    string `json:"msg"`
	Token
}

type Token

type Token struct {
	SW_TOKEN string `json:"sw_token"`
}

func CreateToken

func CreateToken(secretKey []byte, issuer string, isAdmin bool) (token Token, err error)

Jump to

Keyboard shortcuts

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