Documentation ¶
Index ¶
- type Handler
- func (h *Handler) HandleAuthLogout(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleAuthMe(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleAuthProviderCallback(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleAuthProviderLogin(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleEmployeeCreate(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleEmployeeList(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleEmployeeUpdate(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandlePing(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RegisterAuth()
- func (h *Handler) RegisterEmployee()
- func (h *Handler) StaticFrontEnd()
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()