jwt

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jwt provides the hiboot starter for injectable jwt dependency

Index

Constants

View Source
const (
	// Profile is the profile of jwt, it should be as same as the package name
	Profile = "jwt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	at.JwtRestController
}

Controller is the base controller for jwt.RestController

type Map

type Map map[string]interface{}

Map is the JWT map

type Middleware added in v0.9.3

type Middleware struct {
	mwjwt.Middleware
}

Middleware derived from github.com/iris-contrib/middleware/jwt/Middleware

func NewJwtMiddleware

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

NewJwtMiddleware New constructs a new Secure instance with supplied options.

func (*Middleware) CheckJWT added in v0.9.3

func (m *Middleware) CheckJWT(ctx ictx.Context) error

CheckJWT the main functionality, checks for token

func (*Middleware) Serve added in v0.9.3

func (m *Middleware) Serve(ctx ictx.Context)

Serve the middleware's action

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"`
}

Properties the jwt properties

type Token

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

Token is the token interface

func NewJwtToken

func NewJwtToken(p *Properties) (token Token)

NewJwtToken create new jwt token

type TokenProperties added in v0.11.0

type TokenProperties struct {
	at.ContextAware
	// contains filtered or unexported fields
}

TokenProperties is the struct for parse jwt token properties

func (*TokenProperties) Get added in v0.11.0

func (p *TokenProperties) Get(propName string) (propVal string)

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

func (*TokenProperties) GetAll added in v0.11.0

func (p *TokenProperties) GetAll() (propMap map[string]interface{}, ok bool)

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

func (*TokenProperties) Items added in v0.11.0

func (p *TokenProperties) Items() (propMap map[string]string, ok bool)

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

func (*TokenProperties) Parse added in v0.11.0

func (p *TokenProperties) Parse(claims jwt.MapClaims, prop string) (retVal string)

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

Jump to

Keyboard shortcuts

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