auth

package
v0.0.0-...-cbad50d Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package auth provides authentication and authorization support.

Index

Constants

This section is empty.

Variables

View Source
var ErrForbidden = errors.New("action is not allowed")

ErrForbidden is returned for auth issues.

Functions

This section is empty.

Types

type Auth

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

Auth is used to authenticate clients.

type Claims

type Claims struct {
	jwt.RegisteredClaims
	Roles []string `json:"roles"`
}

Claims reprents authorization via JWT.

func (Claims) HasRole

func (c Claims) HasRole(r string) bool

HasRole checks if the specified role exists.

type Config

type Config struct {
	Log       *logger.Logger
	KeyLookup KeyLookup
	Issuer    string
}

Config is information we need to initialize auth.

type KeyLookup

type KeyLookup interface {
	PrivateKey(kid string) (key string, err error)
	PublicKey(kid string) (key string, err error)
}

KeyLookup declares a method set of behaviour for looking keys for JWT use.

Jump to

Keyboard shortcuts

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