jwtutil

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2017 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package jwt holds JWT related funcs

Index

Constants

View Source
const (
	// Bearer is a prefix of JWT header value
	Bearer = "Bearer"
)

Variables

This section is empty.

Functions

func Config

func Config(c *Flags) func(a *App) error

Config sets config struct

Types

type App

type App struct {
	Log    *logger.Log
	Config *Flags
}

App - Класс сервера API

func New

func New(log *logger.Log, options ...func(a *App) error) (a *App, err error)

New - Конструктор сервера API

func (*App) Create

func (a *App) Create(producer string, s *json.RawMessage) (*json.RawMessage, error)

Create - creates JWT

func (*App) Parse

func (a *App) Parse(s string) (*Session, error)

Parse - parses JWT

type CustomClaims

type CustomClaims struct {
	Data *json.RawMessage `json:"data"`
	jwt.StandardClaims
}

type CustomRes

type CustomRes struct {
	Token string `json:"token"`
}

type Flags

type Flags struct {
	Key        string `long:"jwt_key" description:"Key to sign JWT results"`
	Age        int    `long:"jwt_age" default:"96" description:"JWT age to expire token (hours)"`
	Producer   string `long:"jwt_producer" default:"dbrpc" description:"JWT producer name"`
	AuthHeader string `long:"auth_token_header" default:"X-SSO-Token" description:"Header field to store auth token"`
}

Flags is a package flags sample in form ready for use with github.com/jessevdk/go-flags

type Session

type Session map[string]interface{}

type SessionSlice

type SessionSlice struct {
	Data []Session `json:"data"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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