auth_http

package
v0.0.0-...-704a905 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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]

type AuthResponse

type AuthResponse struct {
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
	Result string `json:"result,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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