authentication

package module
v0.0.0-...-2cdd7fe Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

README

authentication

authentication library for both native and service based token verification

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoAuthorizationHeader   = errors.New("authorization header required")
	ErrorNotBearerSchemeRequest  = errors.New("authorization requires Bearer scheme")
	ErrorUnableToVerifySignature = errors.New("unable to verify signature")
	ErrorTokenVerificationKey    = errors.New("error retrieving token verification key")
	ErrorCertificatePemNull      = errors.New("error retrieving token verification key, certificate pem is null")
	ErrorParsingCertificate      = errors.New("error retrieving token verification key, error parsing certificate")
	ErrorInvalidTokenIssueTime   = errors.New("invalid issued time on token")
	ErrorTokenExpired            = errors.New("token has expired")
	ErrorInvalidTokenAudience    = errors.New("invalid token audience")
	ErrorUnableToVerifyToken     = errors.New("unable to verify token")
	ErrorUnsupportedAuthProvider = errors.New("unsupported auth provider")
)

Functions

func ExtractTokenFromRequest

func ExtractTokenFromRequest(req *http.Request) (string, error)

Types

type AuthProvider

type AuthProvider interface {
	AuthenticationHandler(next http.HandlerFunc) http.HandlerFunc
	ValidateToken(token string, jwtToken *jwt.JWT) (bool, error)
}

func NewAuthenticationProvider

func NewAuthenticationProvider(provider AuthProviderType, iss string, aud string) (AuthProvider, error)

type AuthProviderType

type AuthProviderType int
const (
	GOOGLE AuthProviderType = iota
)

type KeyProvider

type KeyProvider interface {
	IsExpired() bool
	GetKeyValueAsString(key string) string
}

Jump to

Keyboard shortcuts

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