handlers

package
v0.0.0-...-c43a9c1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

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

AuthHandler is a handler struct for authentication

func NewAuthHandler

func NewAuthHandler(newLogger hclog.Logger, newCredentials *data.Credentials, newStore *mysqlstore.MySQLStore, newFacebookOauthConfig *oauth2.Config) *AuthHandler

NewAuthHandler returns a new Auth handler with the given logger

func (*AuthHandler) GetAuthUser

func (authHandler *AuthHandler) GetAuthUser(rw http.ResponseWriter, r *http.Request)

GetAuthUser is a method to fetch the authorized user info

func (*AuthHandler) GetFacebookLoginCallback

func (authHandler *AuthHandler) GetFacebookLoginCallback(rw http.ResponseWriter, r *http.Request)

GetFacebookLoginCallback is a method to respond to the facebook oauth2 callback

func (*AuthHandler) GetGoogleLoginCallback

func (authHandler *AuthHandler) GetGoogleLoginCallback(rw http.ResponseWriter, r *http.Request)

GetGoogleLoginCallback is a method to respond to the google oauth2 callback

func (*AuthHandler) Login

func (authHandler *AuthHandler) Login(rw http.ResponseWriter, r *http.Request)

Login to generate an authentication token to be used between client and server

func (*AuthHandler) Logout

func (authHandler *AuthHandler) Logout(rw http.ResponseWriter, r *http.Request)

Logout is a method to log the authorized user out

func (*AuthHandler) MiddlewareCheckOTP

func (authHandler *AuthHandler) MiddlewareCheckOTP(next http.Handler) http.Handler

MiddlewareCheckOTP checks if the OTP code match

func (*AuthHandler) MiddlewareParseCredentialsRequest

func (authHandler *AuthHandler) MiddlewareParseCredentialsRequest(next http.Handler) http.Handler

MiddlewareParseCredentialsRequest parses the credentials payload in the request body from json

func (*AuthHandler) MiddlewareValidateAuth

func (authHandler *AuthHandler) MiddlewareValidateAuth(next http.Handler) http.Handler

MiddlewareValidateAuth validates the request and calls next if ok

func (*AuthHandler) OTPLogin

func (authHandler *AuthHandler) OTPLogin(rw http.ResponseWriter, r *http.Request)

OTPLogin is a method to validate the login otp

func (*AuthHandler) OTPRegister

func (authHandler *AuthHandler) OTPRegister(rw http.ResponseWriter, r *http.Request)

OTPRegister is a method to validate the register otp

func (*AuthHandler) Register

func (authHandler *AuthHandler) Register(rw http.ResponseWriter, r *http.Request)

TODO: fix bug username yang sama masih bisa masuk database Register to create a new user and register it to a database endpoint

func (*AuthHandler) RegisterFinal

func (authHandler *AuthHandler) RegisterFinal(rw http.ResponseWriter, r *http.Request)

RegisterFinal is the final point of the registration function

type GenericError

type GenericError struct {
	Message string `json:"message"`
}

GenericError is a generic error message returned by a server

type KeyCredentials

type KeyCredentials struct{}

KeyCredentials is a key used for the Credentials object in the context

type KeyO2Auth

type KeyO2Auth struct{}

KeyO2Auth is a key used for the O2Auth object in the context

Jump to

Keyboard shortcuts

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