auth

package
v0.0.0-...-449f33c Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Handler

type Handler struct {
	Service *Service
}

func (Handler) Authenticate

func (h Handler) Authenticate(ctx echo.Context) error

Authenticate @Description Authenticate @Accept json @Produce json @Param username query string true "Username of the user" @Param password query string true "Password of the user" @Success 200 {object} common.AuthenticationResponse "ok" @Failure 400 {object} string "Error reading body." @Router /auth [post]

func (Handler) Refresh

func (h Handler) Refresh(ctx echo.Context) error

Refresh @Description Refresh @Accept json @Produce json @Security Bearer @Success 200 {object} common.AuthenticationResponse "ok" @Failure 400 {object} string "Error reading body." @Router /auth/refresh [get]

func (Handler) Start

func (h Handler) Start(app *echo.Echo)

type Provider

type Provider interface {
	Authenticate(ctx echo.Context) error
}

type Service

type Service struct {
	Config         *config.Config
	Duoc           *duoc.Client
	Database       *database.Database
	AuthMiddleware echo.MiddlewareFunc
	IDGenerator    func() string
}

func New

func New(cfg *config.Config, db *database.Database, duoc *duoc.Client) *Service

func (Service) Authenticate

func (s Service) Authenticate(credentials Credentials) (*common.User, error)

Jump to

Keyboard shortcuts

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