jwtprovider

package
v0.0.0-...-2d572df Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config contains the internal configuration for the jwtprovider

func New

func New(key []byte) *Config

New builds a new Config struct

func TestConfig

func TestConfig(key []byte, now time.Time) *Config

TestConfig builds a new test Config

func (*Config) Authenticate

func (c *Config) Authenticate(r *http.Request) (*auth.Claims, bool)

Authenticate authenticates a requests via a JWT Bearer token, returning the associated Claims if if authentication succeed

func (*Config) SignedToken

func (c *Config) SignedToken(u *auth.User) (string, error)

SignedToken returns a new signed JWT token string for the given User

func (*Config) Valid

func (c *Config) Valid(r *http.Request) bool

Valid checks whether the request is a valid attempt at JWT auth

Jump to

Keyboard shortcuts

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