auth

package
v0.0.0-...-a929f2b Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthCallbackError  = errors.New("auth callback returned error")
	ErrAuthRedirectToAuth = errors.New("redirecting to auth endpoint")
	CookieNameToken       = "auth-token"
)

Functions

func CheckAuth

func CheckAuth(a *AuthProvider, w http.ResponseWriter, r *http.Request, logger *logr.Logger) (string, error, bool)

CheckAuth checks if the user is authenticated and returns the token if so. If the user is not authenticated, it will redirect to the auth endpoint. If the user is authenticated but the token is invalid, it will return an error.

Returns:

  • token: The token if the user is authenticated
  • error: An error if the user is not authenticated or the token is invalid
  • bool: if a redirect to the auth endpoint was performed

Types

type AuthProvider

type AuthProvider struct {
	Provider *oidc.Provider
	Config   oauth2.Config
}

Jump to

Keyboard shortcuts

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