security

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sha512

func Sha512(s string) string

Sha512 hashes a provided string using SHA512 and returns the resulting hash as a string Deprecated: Use bcrypt instead

Types

type BasicConfig

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

	// PasswordSha512Hash is the SHA512 hash of the password which will need to be used for a successful authentication
	// XXX: Remove this on v4.0.0
	// Deprecated: Use PasswordBcryptHashBase64Encoded instead
	PasswordSha512Hash string `yaml:"password-sha512"`

	// 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 added in v3.5.0

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 added in v3.5.0

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 added in v3.5.0

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

RegisterHandlers registers all handlers required based on the security configuration

type OIDCConfig added in v3.5.0

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