handler

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package handler defines the gRPC endpoint handlers for the Authorization service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorization

type Authorization struct {
	*Config
	*micro.Service
	// contains filtered or unexported fields
}

Authorization defines the Authorization service.

func New

func New(conf *Config, service *micro.Service) (*Authorization, error)

New creates a new instance of the Authorization service handlers.

func (*Authorization) Create

func (a *Authorization) Create(ctx context.Context, in *authz.Claims, out *authz.Token) (err error)

Create generates a new JWT with the given Claims.

func (*Authorization) Invalidate

func (a *Authorization) Invalidate(ctx context.Context, in *authz.Claims, out *authz.Claims) error

Invalidate inserts a record of a token's ID and expiration date into the list of manually invalidated tokens.

func (*Authorization) Validate

func (a *Authorization) Validate(ctx context.Context, in *authz.Token, out *authz.Claims) error

Validate checks the given JWT for validity with these criteria:

* The signature is valid * The token has not expired * The token has not been manually invalidated

type Config

type Config struct {
	MongoURL string `json:"mongourl"`

	// PrivateKey is a PEM-encoded ES256 private key used to sign JWTs.
	PrivateKey string `json:"privatekey"`
}

Config contains the configuration for an instance of the Autorization service handlers.

Jump to

Keyboard shortcuts

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