auth

package
v0.0.0-...-cffe6dc Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2018 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultTokenProvider

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

DefaultTokenProvider is the defaul implementation of the TokenProvider interface.

func NewDefaultTokenProvider

func NewDefaultTokenProvider(maximumTokenDuration time.Duration, key []byte, debug bool) *DefaultTokenProvider

NewDefaultTokenProvider creates a new instance of the default TokenProvider interface implementation.

func (*DefaultTokenProvider) GenerateToken

func (d *DefaultTokenProvider) GenerateToken(handler string, timestamp time.Time) (string, error)

GenerateToken token based on provided input string and timestamp.

func (*DefaultTokenProvider) ValidateToken

func (d *DefaultTokenProvider) ValidateToken(token, handler string, timestamp time.Time) (bool, error)

ValidateToken decodes toekn and returns true if the token is (still) valid.

type TokenProvider

type TokenProvider interface {
	GenerateToken(handler string, timestamp time.Time) (string, error)
	ValidateToken(token, handler string, timestamp time.Time) (bool, error)
}

TokenProvider is anything that can create and validate token based on handler (usually URI) and timestamp.

Jump to

Keyboard shortcuts

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