Back to godoc.org

Package user

v1.0.1
Latest Go to latest

The latest major version is .

Published: Mar 15, 2020 | License: Apache-2.0 | Module: github.com/LinuxGit/tidb-dashboard

Index

Variables

var (
	ErrNS                        = errorx.NewNamespace("error.api.user")
	ErrNSSignIn                  = ErrNS.NewSubNamespace("signin")
	ErrSignInUnsupportedAuthType = ErrNSSignIn.NewType("unsupported_auth_type")
	ErrSignInOther               = ErrNSSignIn.NewType("other")
)

type AuthService

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

func NewAuthService

func NewAuthService(tidbForwarder *tidb.Forwarder) *AuthService

func (*AuthService) MWAuthRequired

func (s *AuthService) MWAuthRequired() gin.HandlerFunc

MWAuthRequired creates a middleware that verifies the authentication token (JWT) in the request. If the token is valid, identity information will be attached in the context. If there is no authentication token, or the token is invalid, subsequent handlers will be skipped and errors will be generated.

func (*AuthService) Register

func (s *AuthService) Register(r *gin.RouterGroup)

type TokenResponse

type TokenResponse struct {
	Token  string    `json:"token"`
	Expire time.Time `json:"expire"`
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier