auth

package
v0.0.0-...-16d05a1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package auth holds user login related stuff

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleJWTTokenValidator

type GoogleJWTTokenValidator struct{}

func NewGoogleJWTTokenValidator

func NewGoogleJWTTokenValidator() *GoogleJWTTokenValidator

func (*GoogleJWTTokenValidator) Validate

func (g *GoogleJWTTokenValidator) Validate(token string) error

type HandlerAuthenticator

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

HandlerAuthenticator is responsible for authenticating handlers

func NewHandlerAuthenticator

func NewHandlerAuthenticator(sessionManager *helpers.SessionHelper[models.Session]) *HandlerAuthenticator

NewHandlerAuthenticator returns a new HandlerAuthenticator instance

func (*HandlerAuthenticator) AuthenticateHandler

func (h *HandlerAuthenticator) AuthenticateHandler(handler HandlerFunc) http.HandlerFunc

AuthenticateHandler executes the given handler function is authentication is done correctly :)

func (*HandlerAuthenticator) AuthenticateHandlers

func (h *HandlerAuthenticator) AuthenticateHandlers(handlers map[string]HandlerFunc) map[string]http.HandlerFunc

AuthenticateHandlers returns authenticated handler functions map of the given map

type HandlerFunc

type HandlerFunc func(ctx context.HandlerContext)

HandlerFunc is a handler function with an extra parameter(session)

type JWTTokenValidator

type JWTTokenValidator interface {
	Validate(token string) error
}

type MicrosoftJWTValidator

type MicrosoftJWTValidator struct{}

func NewMicrosoftJWTValidator

func NewMicrosoftJWTValidator() *MicrosoftJWTValidator

func (*MicrosoftJWTValidator) Validate

func (m *MicrosoftJWTValidator) Validate(token string) error

type OAuthLoginAPI

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

OAuthLoginAPI holds google login handlers

func NewOAuthLoginAPI

func NewOAuthLoginAPI(userManager *helpers.UserHelper, tokenValidator JWTTokenValidator, apiEndPoint string) *OAuthLoginAPI

NewOAuthLoginAPI returns a new OAuthLoginAPI instance

func (*OAuthLoginAPI) ServeHTTP

func (l *OAuthLoginAPI) ServeHTTP(res http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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