auth

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthHostNotFound     = errors.New("environment variable AUTH_HOST is not defined")
	ErrClientIDNotFound     = errors.New("environment variable AUTH_CLIENT_ID is not defined")
	ErrClientSecretNotFound = errors.New("environment variable AUTH_CLIENT_SECRET is not defined")
)

Functions

func Authorize

func Authorize(ctx context.Context, c *clientcredentials.Config) (*http.Client, error)

func GetPublicKey

func GetPublicKey(ctx context.Context, host string) (*rsa.PublicKey, error)

func HasRole

func HasRole(roles ...role.Role) func(http.Handler) http.Handler

Parse a JWT token from request. And check if token has role from provided list. If list of roles is empty, just check if token is valid.

func ParseToken added in v0.2.3

func ParseToken() func(http.Handler) http.Handler

Parse a JWT token from request. Not throw error if token is not provided!

func TestServer added in v0.4.5

func TestServer(t *testing.T) (string, func())

Types

type Token

type Token struct {
	AccessToken  string
	TokenType    string
	RefreshToken string
	ExpireIn     int
	Scope        []role.Role
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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