security

package
v5.11.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicConfig

type BasicConfig struct {
	// Username is the name which will need to be used for a successful authentication
	Username string `yaml:"username"`

	// PasswordBcryptHashBase64Encoded is the base64 encoded string of the Bcrypt hash of the password to use to
	// authenticate using basic auth.
	PasswordBcryptHashBase64Encoded string `yaml:"password-bcrypt-base64"`
}

BasicConfig is the configuration for Basic authentication

type Config

type Config struct {
	Basic *BasicConfig `yaml:"basic,omitempty"`
	OIDC  *OIDCConfig  `yaml:"oidc,omitempty"`
	// contains filtered or unexported fields
}

Config is the security configuration for Gatus

func (*Config) ApplySecurityMiddleware

func (c *Config) ApplySecurityMiddleware(router fiber.Router) error

ApplySecurityMiddleware applies an authentication middleware to the router passed. The router passed should be a sub-router in charge of handlers that require authentication.

func (*Config) IsAuthenticated

func (c *Config) IsAuthenticated(ctx *fiber.Ctx) bool

IsAuthenticated checks whether the user is authenticated If the Config does not warrant authentication, it will always return true.

func (*Config) IsValid

func (c *Config) IsValid() bool

IsValid returns whether the security configuration is valid or not

func (*Config) RegisterHandlers

func (c *Config) RegisterHandlers(router fiber.Router) error

RegisterHandlers registers all handlers required based on the security configuration

type OIDCConfig

type OIDCConfig struct {
	IssuerURL       string   `yaml:"issuer-url"`   // e.g. https://dev-12345678.okta.com
	RedirectURL     string   `yaml:"redirect-url"` // e.g. http://localhost:8080/authorization-code/callback
	ClientID        string   `yaml:"client-id"`
	ClientSecret    string   `yaml:"client-secret"`
	Scopes          []string `yaml:"scopes"`           // e.g. ["openid"]
	AllowedSubjects []string `yaml:"allowed-subjects"` // e.g. ["user1@example.com"]. If empty, all subjects are allowed
	// contains filtered or unexported fields
}

OIDCConfig is the configuration for OIDC authentication

Jump to

Keyboard shortcuts

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