auth

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func User

func User(r *http.Request) string

User extracts username from request's headers. Requires Auth.RequireUser middleware (otherwise users can spoof the header).

Types

type Auth

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

Auth provides authentication via OAuth.

func New

func New(clientID, clientSecret, jwtSecret string, jwtTTL time.Duration, hostname string, mux *http.ServeMux) *Auth

New instantiates an Auth object and registers it against provided http.ServeMux.

func (*Auth) RequireUser

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

RequireUser is a middleware function that ensures that the user is authenticated. Use User to get the username.

func (*Auth) ServeHTTP

func (a *Auth) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves OAuth callback page.

Jump to

Keyboard shortcuts

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