security

package
v4.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 13 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(api *mux.Router) error

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

func (*Config) IsAuthenticated

func (c *Config) IsAuthenticated(r *http.Request) 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 *mux.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