Documentation ¶
Index ¶
Constants ¶
const ( SessionIdKey = "session_id" CsrfTokenKey = echo.HeaderXCSRFToken )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHandler ¶
type AuthHandler struct {
AuthUseCase auth_domain.AuthUseCase
}
func MakeHandler ¶
func MakeHandler(authUseCase auth_domain.AuthUseCase) AuthHandler
func (*AuthHandler) GetCSRF ¶
func (a *AuthHandler) GetCSRF(c echo.Context) error
GetCSRF godoc @Summary Getting csrf @Description Exposes a csrf token and creates an unauthorized session @Tags auth @Accept application/json @Produce application/json @Success 200 {object} webUtils.Success @Failure 500 {object} webUtils.Error "Internal server error" @Router /api/v1/get_csrf [get]
func (*AuthHandler) Login ¶
func (a *AuthHandler) Login(c echo.Context) error
Login godoc @Summary Login @Description login user @Tags auth @Accept application/json @Produce application/json @Param User body domain.User true "username/email and password" @Param X-CSRF-TOKEN header string true "csrf-token" @Param Cookie header string true "the same csrf-token by key X-CSRF-TOKEN" @Success 200 {object} webUtils.Success @Failure 422 {object} webUtils.Error "invalid json" @Failure 400 {object} webUtils.Error "invalid login or password" @Router /api/v1/login [post]
func (*AuthHandler) Logout ¶
func (a *AuthHandler) Logout(c echo.Context) error
Logout godoc @Summary Logout @Description logout user @Tags auth @Accept application/json @Produce application/json @Param X-CSRF-TOKEN header string true "csrf-token" @Param Cookie header string true "the same csrf-token by key X-CSRF-TOKEN" @Success 200 {object} webUtils.Success @Router /api/v1/logout [post]
func (*AuthHandler) SignUp ¶
func (a *AuthHandler) SignUp(c echo.Context) error
SignUp godoc @Summary Signup @Description Sign up user @Tags auth @Accept application/json @Produce application/json @Param User body domain.User true "Username, Email, Password required" @Param X-CSRF-TOKEN header string true "csrf-token" @Param Cookie header string true "the same csrf-token by key X-CSRF-TOKEN" @Success 200 {object} webUtils.Success @Failure 422 {object} webUtils.Error "invalid json" @Failure 400 {object} webUtils.Error "invalid sign up" @Router /api/v1/signup [post]