handlers

package
v0.0.0-...-88dbfc4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	PgConn *db.PostgresDriver
	Log    *logrus.Logger
	// contains filtered or unexported fields
}

Interface for Authentication handlers

func NewAuth

func NewAuth(pg *db.PostgresDriver, log *logrus.Logger, oConf *oauth2.Config, redirectUrl string, gitCollabSecret string) *Auth

NewAuth returns initialized Auth handler struct

func (*Auth) GithubRedirectHandler

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

GithubRedirectHandler get the redirect url for github, when login button is clicked, this will be returned to the frontend.

func (*Auth) LoginHandler

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

LoginHandler handler for login, occurs when user returns from github redirect. Will first attempt to get code from request body, if valid retrieve a github access token. If this token is good, go ahead and create a JWT for frontend.

func (*Auth) LogoutHandler

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

LogoutHandler adds jwt to the blacklist, these will be picked up by the blacklist middleware and refuse access if found.

Jump to

Keyboard shortcuts

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