handler

package
v0.0.0-...-2fddd97 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	ServiceAuth     *sAuth.ServiceAuth
	ServiceEmployee *sEmployee.ServiceEmployee
	Mux             *http.ServeMux
}

Handler is used to handles endpoint

func (*Handler) HandleAuthLogout

func (h *Handler) HandleAuthLogout(w http.ResponseWriter, r *http.Request)

HandleAuthLogout is used to log out the user. It might be used if the app using a cache (ex: redis), it will delete the record in the cache.

func (*Handler) HandleAuthMe

func (h *Handler) HandleAuthMe(w http.ResponseWriter, r *http.Request)

HandleAuthMe is used to get user information from token. It should use only to verify and extract token data. This endpoint can be also done in the frontend, but the data will not be verified. It is in the frontend anyway.

func (*Handler) HandleAuthProviderCallback

func (h *Handler) HandleAuthProviderCallback(w http.ResponseWriter, r *http.Request)

HandleAuthProviderCallback is used in login proses. This endpoint specifically used for the provider to give state and code. This endpoint will use the state to validate from CSRF attack and the code is used for getting the token from provider through the exchange process.

func (*Handler) HandleAuthProviderLogin

func (h *Handler) HandleAuthProviderLogin(w http.ResponseWriter, r *http.Request)

HandleAuthProviderLogin is used for user to login using identity provider such as google, facebook, twitter, etc. This API will redirect user to provider's login page.

func (*Handler) HandleEmployeeCreate

func (h *Handler) HandleEmployeeCreate(w http.ResponseWriter, r *http.Request)

HandleEmployeeCreate is used to create a new employee in the same company

func (*Handler) HandleEmployeeList

func (h *Handler) HandleEmployeeList(w http.ResponseWriter, r *http.Request)

HandleEmployeeList is used to list all employee in the same company

func (*Handler) HandleEmployeeUpdate

func (h *Handler) HandleEmployeeUpdate(w http.ResponseWriter, r *http.Request)

HandleEmployeeUpdate is used to update an existing employee in the same company

func (*Handler) HandlePing

func (h *Handler) HandlePing(w http.ResponseWriter, r *http.Request)

HandlePing is used for pinging, mainly for test whether the server alive or not

func (*Handler) RegisterAuth

func (h *Handler) RegisterAuth()

RegisterAuth is used to register auth related handlers

func (*Handler) RegisterEmployee

func (h *Handler) RegisterEmployee()

RegisterEmployee is used to register employee related handlers

func (*Handler) StaticFrontEnd

func (h *Handler) StaticFrontEnd()

Jump to

Keyboard shortcuts

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