auth

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(clustersClient clusters.Client) func(next http.Handler) http.Handler

Handler creates a new Auth handler with the options defined via the above flags.

func UserHandler

func UserHandler(w http.ResponseWriter, r *http.Request)

UserHandler returns the information of the authenticated user.

Types

type Auth

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

Auth is the struct for handling authorization for resources.

func New

func New(enabled bool, headerUser, headerTeams, sessionToken string, sessionInterval time.Duration, clustersClient clusters.Client) *Auth

New returns a new authentication and authorization object.

func (*Auth) Handler

func (a *Auth) Handler(next http.Handler) http.Handler

Handler is the handler for the auth middleware. In the middleware we check if authentication is enabled. If this is the case we check if the request contains a valid jwt cookie in the "kobs-auth" token. If we do not found a valid token we try to create a new one and set it as cookie, before we return an unauthorized error. If the authorization succeeds we also inject the user in the request context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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