Documentation
¶
Index ¶
- type AuthHandler
- func (authHandler *AuthHandler) GetAuthUser(rw http.ResponseWriter, r *http.Request)
- func (authHandler *AuthHandler) GetFacebookLoginCallback(rw http.ResponseWriter, r *http.Request)
- func (authHandler *AuthHandler) GetGoogleLoginCallback(rw http.ResponseWriter, r *http.Request)
- func (authHandler *AuthHandler) Login(rw http.ResponseWriter, r *http.Request)
- func (authHandler *AuthHandler) Logout(rw http.ResponseWriter, r *http.Request)
- func (authHandler *AuthHandler) MiddlewareCheckOTP(next http.Handler) http.Handler
- func (authHandler *AuthHandler) MiddlewareParseCredentialsRequest(next http.Handler) http.Handler
- func (authHandler *AuthHandler) MiddlewareValidateAuth(next http.Handler) http.Handler
- func (authHandler *AuthHandler) OTPLogin(rw http.ResponseWriter, r *http.Request)
- func (authHandler *AuthHandler) OTPRegister(rw http.ResponseWriter, r *http.Request)
- func (authHandler *AuthHandler) Register(rw http.ResponseWriter, r *http.Request)
- func (authHandler *AuthHandler) RegisterFinal(rw http.ResponseWriter, r *http.Request)
- type GenericError
- type KeyCredentials
- type KeyO2Auth
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