v1

package
v1.4.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	APIKeyHeader = "X-Api-Key"
)

Functions

func Authorizator

func Authorizator(data interface{}, c *gin.Context) bool

func GenerateAPIKey

func GenerateAPIKey(n int) (string, error)

func HashSHA512

func HashSHA512(str string) string

func IdentityHandler

func IdentityHandler(c *gin.Context) interface{}

func PayloadFunc

func PayloadFunc(data interface{}) jwt.MapClaims

func Unauthorized

func Unauthorized(c *gin.Context, code int, message string)

Types

type APIKey

type APIKey struct {
	HeaderName string
	DbClient   *database.Client
	TlsAuth    *TLSAuth
}

func NewAPIKey

func NewAPIKey(dbClient *database.Client) *APIKey

func (*APIKey) MiddlewareFunc

func (a *APIKey) MiddlewareFunc() gin.HandlerFunc

type JWT

type JWT struct {
	Middleware *jwt.GinJWTMiddleware
	DbClient   *database.Client
	TlsAuth    *TLSAuth
}

func NewJWT

func NewJWT(dbClient *database.Client) (*JWT, error)

func (*JWT) Authenticator

func (j *JWT) Authenticator(c *gin.Context) (interface{}, error)

type Middlewares

type Middlewares struct {
	APIKey *APIKey
	JWT    *JWT
}

func NewMiddlewares

func NewMiddlewares(dbClient *database.Client) (*Middlewares, error)

type TLSAuth added in v1.4.0

type TLSAuth struct {
	AllowedOUs []string
	CrlPath    string
	// contains filtered or unexported fields
}

func NewTLSAuth added in v1.4.0

func NewTLSAuth(allowedOus []string, crlPath string, cacheExpiration time.Duration, logger *log.Entry) (*TLSAuth, error)

func (*TLSAuth) SetAllowedOu added in v1.4.0

func (ta *TLSAuth) SetAllowedOu(allowedOus []string) error

func (*TLSAuth) ValidateCert added in v1.4.0

func (ta *TLSAuth) ValidateCert(c *gin.Context) (bool, string, error)

Jump to

Keyboard shortcuts

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