Documentation
¶
Index ¶
- func CheckRefreshToken(jwtToken string) (*jwt.StandardClaims, error)
- func GenerateAccessToken(refreshToken string) (string, error)
- func GenerateRefreshToken(userID string) (*string, error)
- func Login(usernameOrEmail string, password string) (*string, *routes.APIError)
- func Register(params RegisterData) *routes.APIError
- func RegisterNamespace()
- func SendRegistrationEmail(user db.User) *error
- type ForgotPassword
- type LoginData
- type RegisterData
- type ResetPasswordData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRefreshToken ¶
func CheckRefreshToken(jwtToken string) (*jwt.StandardClaims, error)
CheckRefreshToken checks if a refresh token is valid. In case of invalidity a theft is assumed and the users sessions are nuked
func GenerateAccessToken ¶
GenerateAccessToken issues a new access token based on a refresh token
func GenerateRefreshToken ¶
GenerateRefreshToken generates a new refresh-token and saves it in the database
func RegisterNamespace ¶
func RegisterNamespace()
RegisterNamespace registers all functions for users
func SendRegistrationEmail ¶
SendRegistrationEmail sends a registration email, with confirmation link
Types ¶
type ForgotPassword ¶
type ForgotPassword struct {
Email string `json:"email"`
}
ForgotPassword is the required information required to request a reset password email
type LoginData ¶
type LoginData struct { UsernameOrEmail string `json:"id" binding:"required"` Password string `json:"password" binding:"required"` RememberMe bool `json:"rememberMe" binding:"required"` }
LoginData is the required information for logging in
type RegisterData ¶
type RegisterData struct { Username string `json:"username" validate:"required,min=3,max=16"` Password string `json:"password" validate:"required,min=3"` Email string `json:"email" validate:"required,email"` Language string `json:"language" validate:"required"` FirstName string `json:"firstName" validate:"required"` LastName string `json:"lastName" validate:"required"` }
RegisterData is the required information for registering
type ResetPasswordData ¶
type ResetPasswordData struct { Token string `json:"token"` NewPassword string `json:"newPassword"` }
ResetPasswordData is the required information to reset the password