hiboot: hidevops.io/hiboot/pkg/starter/jwt Index | Files

package jwt

import "hidevops.io/hiboot/pkg/starter/jwt"

Package jwt provides the hiboot starter for injectable jwt dependency

Index

Package Files

autoconfigure.go controller.go jwtmiddleware.go postProcessor.go properties.go token.go

Constants

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

type Controller Uses

type Controller struct {
    at.JwtRestController
}

Controller is the base controller for jwt.RestController

type Map Uses

type Map map[string]interface{}

Map is the JWT map

type Middleware Uses

type Middleware struct {
    mwjwt.Middleware
}

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

func NewJwtMiddleware Uses

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

NewJwtMiddleware New constructs a new Secure instance with supplied options.

func (*Middleware) CheckJWT Uses

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

CheckJWT the main functionality, checks for token

func (*Middleware) Serve Uses

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

Serve the middleware's action

type Properties Uses

type Properties struct {
    at.ConfigurationProperties `value:"jwt"`

    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 Uses

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

Token is the token interface

func NewJwtToken Uses

func NewJwtToken(p *Properties) (token Token)

NewJwtToken create new jwt token

type TokenProperties Uses

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

TokenProperties is the struct for parse jwt token properties

func (*TokenProperties) Get Uses

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 Uses

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 Uses

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 Uses

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

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

Package jwt imports 14 packages (graph). Updated 2019-10-15. Refresh now. Tools for package owners.