auth_constants

package
v0.0.0-...-0064678 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ViperJWTTTLKey    = "service.jwt_ttl"
	ViperJWTSecretKey = "service.jwt_secret"
)
View Source
const (
	Nothing = ""
)

Variables

View Source
var (
	// Unathorized
	ErrMissingAuthToken  = &CodedError{errors.New("missing authorization token"), http.StatusUnauthorized}
	ErrMissingAuthCookie = &CodedError{errors.New("missing authorization cookie"), http.StatusUnauthorized}

	ErrPasswordMismatch = &CodedError{errors.New("password mismatch"), http.StatusUnauthorized}

	ErrAuthTokenInvalid        = &CodedError{errors.New("authorization token is invalid"), http.StatusUnauthorized}
	ErrUnexpectedSigningMethod = &CodedError{errors.New("unexpected signing method"), http.StatusUnauthorized}

	// Forbidden
	ErrAuthTokenExpired = &CodedError{errors.New("authorization token is expired"), http.StatusForbidden}
	ErrAuthorIDMismatch = &CodedError{errors.New("author id mismatch"), http.StatusForbidden}

	// Bad Request
	ErrValidateRequest = &CodedError{errors.New("failed to validate request"), http.StatusBadRequest}
	ErrDBNotFound      = &CodedError{errors.New("not found in the database"), http.StatusBadRequest}
	ErrPassword        = &CodedError{errors.New("error generating hash"), http.StatusBadRequest}
	ErrPasswordSalt    = &CodedError{errors.New("error generating salt"), http.StatusBadRequest}

	// Internal
	ErrSignToken      = &CodedError{errors.New("failed to sign token"), http.StatusInternalServerError}
	ErrGenerateUUID   = &CodedError{errors.New("failed to generate UUID"), http.StatusInternalServerError}
	ErrParseAuthToken = &CodedError{errors.New("failed to parse authorization token"), http.StatusInternalServerError}

	// Conflict
	ErrEmailAlreadyTaken = &CodedError{errors.New("email is taken already by other user"), http.StatusConflict}
)

Functions

This section is empty.

Types

type CodedError

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

CodedError is an error wrapper which wraps errors with http status codes.

func (*CodedError) Code

func (ce *CodedError) Code() int

func (*CodedError) Error

func (ce *CodedError) Error() string

Jump to

Keyboard shortcuts

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