auth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package auth contains methods for working with authorization tokens, their generation and parsing.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValidateAlg = errors.New("unexpected signing method")
)

Errors.

Functions

func New

func New(jwtKey string, options ...Option) app.Auth

New creates and returns new app.Auth.

Types

type Auth

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

Auth is an implements app.Auth. Responsible for working with authorization tokens, be it cookies or jwt.

func (*Auth) Parse

func (t *Auth) Parse(authToken app.AuthToken) (app.TokenID, error)

Parse need for implements app.Auth.

func (*Auth) Token

func (t *Auth) Token(expired time.Duration) (app.AuthToken, app.TokenID, error)

Token need for implements app.Auth.

type Option

type Option func(*Auth)

Option for building auth struct.

func SetIDGenerator

func SetIDGenerator(generatorID func() (string, error)) Option

SetIDGenerator sets func for create tokenID.

Jump to

Keyboard shortcuts

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