auth

package
v0.0.0-...-718b68f Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidParameters = iota
	ErrInvalidCredentials
	ErrMissingToken
	ErrInvalidToken
	ErrDecryptionToken
	ErrInsufficientRights
)

Variables

View Source
var (
	JwtSecret       = []byte("upersecretpass")
	TokenExpiration = 60 * time.Minute
)

Functions

func NewToken

func NewToken(entity entities.TokenClaimer) (string, error)

NewToken return new token for given employee.

func ParseToken

func ParseToken(authenticate string) (entities.TokenClaims, error)

ParseToken parses given token and returns token claims with embedded JWT claims if token is valid.

func ValidPassword

func ValidPassword(hashedPwd string, plainPwd string) bool

ValidPassword verifies given password with hashed one.

Types

type AuthError

type AuthError struct {
	Reason AuthErrorReason
	Err    error
}

func (AuthError) Error

func (err AuthError) Error() string

type AuthErrorReason

type AuthErrorReason int

Directories

Path Synopsis
delivery

Jump to

Keyboard shortcuts

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