bearertoken

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: MIT Imports: 13 Imported by: 0

README

bearertoken

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCustomClaims2Ctx added in v0.1.0

func AddCustomClaims2Ctx(ctx context.Context, env *env.Env, clms *CustomClaims) (context.Context, error)

AddCustomClaims2Ctx adds the calling serverToken to the context

func Handler

func Handler(env *env.Env, realm string) (mw func(http.Handler) http.Handler)

Handler middleware performs Bearertoken authorization The client must send their Server token as the username portion of HTTP Basic Authenication. This middleware will parse the token and determine if the token is valid for the request path and method

Types

type BearerToken

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

BearerToken is the tokenized representation of a user

func NewBearerToken

func NewBearerToken(client *client.Client, usr *usr.User) (*BearerToken, error)

NewBearerToken takes an External user ID and provides a token

type CustomClaims

type CustomClaims struct {
	jwt.StandardClaims
}

CustomClaims struct has the jwt claims that will be added to the UserToken

func ClaimsFromBearerToken

func ClaimsFromBearerToken(log zerolog.Logger, userToken string) (*CustomClaims, error)

ClaimsFromBearerToken validates a Bearer Token and passes back the claims held within

Jump to

Keyboard shortcuts

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