controller

package
v0.0.0-...-a69ed84 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSubject   = errors.New("subject not found")
	ErrInvalidType = errors.New("invalid type")
)

Errors.

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue is returned when a value is not defined or has wrong value.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

Auth controller.

func NewAuth

func NewAuth(users store.Users, jwtauth *jwtauth.JWTAuth, logger *zap.Logger, opts ...AuthOption) *Auth

NewAuth creates new auth controller.

func (*Auth) Login

func (c *Auth) Login(w http.ResponseWriter, r *http.Request)

Login handles /auth/login endpoint.

func (*Auth) Logout

func (c *Auth) Logout(w http.ResponseWriter, r *http.Request)

Logout handles /auth/logout endpoint.

func (*Auth) User

func (c *Auth) User(w http.ResponseWriter, r *http.Request)

User handles /auth/user endpoint.

type AuthOption

type AuthOption func(*Auth)

AuthOption ...

func AuthTokenExpiration

func AuthTokenExpiration(e time.Duration) AuthOption

AuthTokenExpiration ...

func RefreshTokenExpiration

func RefreshTokenExpiration(e time.Duration) AuthOption

RefreshTokenExpiration ...

type Mail

type Mail struct {
	// contains filtered or unexported fields
}

Mail controller.

func NewMail

func NewMail(sender mail.Sender, recipient string, logger *zap.Logger) *Mail

NewMail creates new mail controller.

func (*Mail) Send

func (c *Mail) Send(w http.ResponseWriter, r *http.Request)

Send sends e-mail from contact form.

Jump to

Keyboard shortcuts

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