basicauth

package
v0.0.0-...-d4303dc Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizeHeader

func AuthorizeHeader(ctx context.Context, username *string, password string) bool

AuthorizeHeader checks if the request has a Basic Auth header matching the specified username and password. Username is optional and will be ignored if nil.

func AuthorizeHeaderForAllowedTypes

func AuthorizeHeaderForAllowedTypes(ctx context.Context, allowedTypes []AuthTokenType) bool

AuthorizeHeaderForAllowedTypes checks whether the request has a Basic Auth header matching one of the known token types. If the request has a valid token, it returns true. Otherwise, it returns false.

func MakeHeader

func MakeHeader(username *string, password string) string

MakeHeader takes a password and an optional username and base64 encodes them in the format required for a basic auth header. The output can be used as the value for the "Authorization" header.

Types

type AuthTokenType

type AuthTokenType string
const (
	AuthTokenTypeRetool     AuthTokenType = "Retool"
	AuthTokenTypeMonitoring AuthTokenType = "Monitoring"
)

Jump to

Keyboard shortcuts

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