Documentation ¶
Index ¶
- Constants
- func AuthorizeUserByRolesMiddleware(roles []string) echo.MiddlewareFunc
- func JWTAuthenticationMiddleware(s *mgo.Session, dbName string) echo.MiddlewareFunc
- type UserController
- func (uc UserController) ChangeUserPassword(c echo.Context) error
- func (ac UserController) RefreshAccessToken(c echo.Context) error
- func (uc UserController) SignIn(c echo.Context) error
- func (uc UserController) SignUpNewUser(c echo.Context) error
- func (uc UserController) UpdateUserProfile(c echo.Context) error
Constants ¶
View Source
const ( USER_COLLECTION_NAME = "users" ACCESS_TOKEN_COLLECTION_NAME = "accessTokens" JWT_SIGNING_KEY_PHRASE = "sectet_keys_to_hash_jwt_token" BEARER_AUTHENTICATION_TYPE = "Bearer" ROLES_KEY = "roles" USER_ID_KEY = "user_id" TOKEN_ID_KEY = "token_id" TRUSTED_APP_ID_KEY = "trusted_app_id" )
Variables ¶
This section is empty.
Functions ¶
func AuthorizeUserByRolesMiddleware ¶
func AuthorizeUserByRolesMiddleware(roles []string) echo.MiddlewareFunc
echo middleware to check is this user have role
func JWTAuthenticationMiddleware ¶
func JWTAuthenticationMiddleware(s *mgo.Session, dbName string) echo.MiddlewareFunc
echo middleware for checking JWT token is valid and authorize request
Types ¶
type UserController ¶
type UserController struct { Session *mgo.Session DBName string }
func NewUserController ¶
func NewUserController(s *mgo.Session, dbName string) *UserController
func (UserController) ChangeUserPassword ¶
func (uc UserController) ChangeUserPassword(c echo.Context) error
change password with authorized user NOT reset password TODO : should implement reset password flow like send reset password link to user by email
func (UserController) RefreshAccessToken ¶
func (ac UserController) RefreshAccessToken(c echo.Context) error
refresh the user access token
func (UserController) SignIn ¶
func (uc UserController) SignIn(c echo.Context) error
authenticate the user with credential information email/username with password and generate access token
func (UserController) SignUpNewUser ¶
func (uc UserController) SignUpNewUser(c echo.Context) error
func (UserController) UpdateUserProfile ¶
func (uc UserController) UpdateUserProfile(c echo.Context) error
update user model such as email , first, last, display name TODO : should implement user change image profile, get uploaded image resize it and save it as user image profile
Click to show internal directories.
Click to hide internal directories.