webauth

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingCredentials = errors.New("missing credentials")
	ErrInvalidCredentials = errors.New("invalid credentials")
)
View Source
var GetAuth = httpauth.GetAuth
View Source
var LoginBoxStyle = ui.MustParseStyle(`
	display: flex;
	flex-direction: column;
	justify-content: center;
	height: 100%;
	padding: 0 var(--size-5);
	font-size: var(--font-size-2);

	h2 {
		font-size: var(--font-size-5);
    font-weight: var(--font-weight-4);
	}

	@media (min-width: 1024px) {
		& {
			padding: 0 var(--size-9);
		}
	}
	@media (min-width: 1920px) {
		& {
			padding: 0 var(--size-13);
		}
	}

	& .buttons {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
	}

	& .error {
		margin: var(--size-3) 0;
	}
`)
View Source
var LoginInputStyle = ui.MustParseStyle(`
  margin: var(--size-7) 0;
`)

Functions

func WebAuthFlagSet

func WebAuthFlagSet(defaultIssuer string) (*flag.FlagSet, func() WebAuthConfig)

Types

type Auth

type Auth = httpauth.Auth

type AuthenticatedPath added in v0.0.3

type AuthenticatedPath func(auth httpauth.Auth) string

func ConstantPath added in v0.0.3

func ConstantPath(path string) AuthenticatedPath

type WebAuth

type WebAuth struct {
	// contains filtered or unexported fields
}

func NewWebAuth

func NewWebAuth(
	factory *ldap.Factory,
	config WebAuthConfig,
	options WebAuthOptions,
	logger *slog.Logger,
) (*WebAuth, error)

func (*WebAuth) Login

func (wa *WebAuth) Login(w http.ResponseWriter, r *http.Request) (ui.Component, error)

func (*WebAuth) Logout

func (wa *WebAuth) Logout(w http.ResponseWriter, r *http.Request) (ui.Component, error)

func (*WebAuth) Metrics added in v0.0.3

func (wa *WebAuth) Metrics() []prometheus.Collector

Metrics implements observability.Metrics.

func (*WebAuth) Middleware

func (wa *WebAuth) Middleware(next http.Handler) http.Handler

type WebAuthConfig

type WebAuthConfig struct {
	JWTAuth          httpauth.JWTAuthConfig
	ResetPasswordURL string
}

type WebAuthOptions

type WebAuthOptions struct {
	LoginPath  string
	LogoutPath string
	ReturnPath AuthenticatedPath
	App        string
}

Jump to

Keyboard shortcuts

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