jwt

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	JwtController
	web.Controller
}

JwtController is the base web controller that enabled JWT

func (*Controller) GetJwtProperties

func (c *Controller) GetJwtProperties() (propMap map[string]interface{})

GetJwtProperty is an util that parsing JWT token and return all properties from jwt.MapClaims

func (*Controller) GetJwtPropertiesString

func (c *Controller) GetJwtPropertiesString() (propMap map[string]string)

GetJwtProperty is an util that parsing JWT token and return all properties in string from jwt.MapClaims

func (*Controller) GetJwtProperty

func (c *Controller) GetJwtProperty(propName string) (propVal string)

GetJwtProperty is an util that parsing JWT token and return single property from jwt.MapClaims

func (*Controller) GetJwtToken

func (c *Controller) GetJwtToken() *jwt.Token

ParseToken is an util that parsing JWT token from jwt.MapClaims

func (*Controller) ParseToken

func (c *Controller) ParseToken(claims jwt.MapClaims, prop string) string

ParseToken is an util that parsing JWT token from jwt.MapClaims

type JwtController

type JwtController interface {
}

type JwtMiddleware

type JwtMiddleware struct {
	mwjwt.Middleware
}

JwtMiddleware derrived from github.com/iris-contrib/middleware/jwt/Middleware

func NewJwtMiddleware

func NewJwtMiddleware(cfg ...mwjwt.Config) *JwtMiddleware

NewJwtMiddleware New constructs a new Secure instance with supplied options.

func (*JwtMiddleware) CheckJWT

func (m *JwtMiddleware) CheckJWT(ctx context.Context) error

CheckJWT the main functionality, checks for token

func (*JwtMiddleware) Serve

func (m *JwtMiddleware) Serve(ctx context.Context)

Serve the middleware's action

type Map

type Map map[string]interface{}

JwtMap is the JWT map

type Properties

type Properties struct {
	PrivateKeyPath string `json:"private_key_path" default:"config/ssl/app.rsa"`
	PublicKeyPath  string `json:"public_key_path" default:"config/ssl/app.rsa.pub"`
}

type Token

type Token interface {
	Generate(payload Map, expired int64, unit time.Duration) (string, error)
	VerifyKey() *rsa.PublicKey
}

func NewJwtToken

func NewJwtToken(p *Properties) Token

Jump to

Keyboard shortcuts

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