Documentation
¶
Index ¶
- func GenerateTokensAndSetCookies(user *user.User, c echo.Context) error
- func GetJWTRefreshSecret() string
- func GetJWTSecret() string
- func GetUserMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func JWTErrorChecker(err error, c echo.Context) error
- func UserRoleMiddleware(role utils.Role) echo.MiddlewareFunc
- type ChangePassword
- type Claims
- type CustomContext
- type Service
- func (s *Service) ChangePassword(c *CustomContext, passwordDto ChangePassword) error
- func (s *Service) Login(c echo.Context, uDto user.User) (*ent.User, error)
- func (s *Service) Me(c echo.Context, accessToken string) (*ent.User, error)
- func (s *Service) Refresh(c echo.Context, refreshToken string) error
- func (s *Service) Register(c echo.Context, user user.User) (*ent.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTokensAndSetCookies ¶
GenerateTokensAndSetCookies generates jwt token and saves it to the http-only cookie.
func GetJWTRefreshSecret ¶
func GetJWTRefreshSecret() string
func GetJWTSecret ¶
func GetJWTSecret() string
func GetUserMiddleware ¶
func GetUserMiddleware(next echo.HandlerFunc) echo.HandlerFunc
func JWTErrorChecker ¶
JWTErrorChecker will be executed when user try to access a protected path.
func UserRoleMiddleware ¶
Types ¶
type ChangePassword ¶
type Claims ¶
type Claims struct { UserID uuid.UUID `json:"user_id"` Username string `json:"username"` Role utils.Role `json:"role"` jwt.RegisteredClaims }
func GetUserClaims ¶
func GetUserClaims(c echo.Context) *Claims
GetUserClaims - returns user's claims
type CustomContext ¶
type CustomContext struct { echo.Context UserClaims *Claims }
type Service ¶
func NewService ¶
func (*Service) ChangePassword ¶
func (s *Service) ChangePassword(c *CustomContext, passwordDto ChangePassword) error
Click to show internal directories.
Click to hide internal directories.