authentication

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 9 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

This section is empty.

Variables

View Source
var Gateway func(isAdmin bool) Authentication // 网关,所有的认证方式都通过这里

Functions

This section is empty.

Types

type Authentication

type Authentication interface {
	Generate(uid string, duration ...time.Duration) (string, error) // 生成身份认证的 token
	Parse(token string) (string, error)                             // 解析 token,并且返回 uuid
	Remove(token string) error                                      // 移除某个 token
}

type Jwt

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

func NewJwt

func NewJwt(isAdmin bool) Jwt

func (Jwt) Generate

func (c Jwt) Generate(uid string, duration ...time.Duration) (string, error)

func (Jwt) Parse

func (c Jwt) Parse(tokenString string) (string, error)

func (Jwt) Remove

func (c Jwt) Remove(_ string) error

type Session

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

func NewSession

func NewSession(isAdmin bool) Session

func (Session) Generate

func (c Session) Generate(uid string, durations ...time.Duration) (string, error)

func (Session) Parse

func (c Session) Parse(tokenString string) (string, error)

func (Session) Remove

func (c Session) Remove(tokenString string) error

Jump to

Keyboard shortcuts

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