jwtoken

package
v0.0.0-...-f70f7d2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaimsFromContext

func ClaimsFromContext(r *http.Request) (*jwt.StandardClaims, error)

ClaimsFromContext gets claims from the request context

func ClaimsToContext

func ClaimsToContext(r *http.Request, c *jwt.StandardClaims)

ClaimsToContext puts claims to the request context

Types

type Config

type Config struct {
	Exp    int
	Secret string
}

Config represents the jwt settings

func NewConfig

func NewConfig(e int, s string) Config

NewConfig creates an instance for JwtConfig

type Token

type Token struct {
	// AuthService   auth.DefaultService
	SigningMethod jwt.SigningMethod
	Config        Config
}

Token represents a jwt token service It uses an AuthService for the authentication logic It generates a jwt token from UserDetails data

func New

func New(m jwt.SigningMethod, c Config) Token

New creates a new instance of TokenService

func (Token) GenerateToken

func (s Token) GenerateToken(claims jwt.Claims) (t token.Token, err error)

GenerateToken generates a token with UserDetails data

Jump to

Keyboard shortcuts

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