Documentation ¶
Overview ¶
Package auth is a service for authenticating http requets
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidCredentials = echo.NewHTTPError(http.StatusUnauthorized, "Username or password is not authorized")
)
Custom errors
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth represents auth application service
func Initialize ¶
Initialize initializes auth application service
func New ¶
func New(db *gorm.DB, udb UserDBClientInterface, j TokenGenerator, sec Securer, rbac RBAC) *Auth
New creates new iam service
func (*Auth) Authenticate ¶
Authenticate tries to authenticate the user provided by username and password
type Service ¶
type Service interface { Authenticate(echo.Context, string, string) (*models.AuthToken, error) Refresh(echo.Context, string) (*models.RefreshToken, error) Me(echo.Context) (*models.User, error) }
Service represents auth service interface
type TokenGenerator ¶
TokenGenerator represents token generator (jwt) interface
type UserDBClientInterface ¶
type UserDBClientInterface interface { View(*gorm.DB, uint) (*models.User, error) FindByUsername(*gorm.DB, string) (*models.User, error) FindByToken(*gorm.DB, string) (*models.User, error) Update(*gorm.DB, *models.User) error }
UserDBClientInterface represents user repository interface
Click to show internal directories.
Click to hide internal directories.