Documentation ¶
Overview ¶
Package controller contains all the controllers of the application
Index ¶
- func Activate2FA(c *gin.Context)
- func CreateBackup2FA(c *gin.Context)
- func CreateUserAuth(c *gin.Context)
- func CreateVerificationEmail(c *gin.Context)
- func Deactivate2FA(c *gin.Context)
- func GetUnverifiedEmail(c *gin.Context)
- func Login(c *gin.Context)
- func Logout(c *gin.Context)
- func PasswordForgot(c *gin.Context)
- func PasswordRecover(c *gin.Context)
- func PasswordUpdate(c *gin.Context)
- func Refresh(c *gin.Context)
- func ResendVerificationCodeToModifyActiveEmail(c *gin.Context)
- func Setup2FA(c *gin.Context)
- func UpdateEmail(c *gin.Context)
- func Validate2FA(c *gin.Context)
- func ValidateBackup2FA(c *gin.Context)
- func VerifyEmail(c *gin.Context)
- func VerifyUpdatedEmail(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Activate2FA ¶
Activate2FA - activate 2FA upon validation
- possible for accounts without 2FA-ON
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"otp":"..."}`
func CreateBackup2FA ¶
CreateBackup2FA - get new set of 2FA backup codes
- 2FA must already be enabled for the user account
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"password":"..."}`
func CreateUserAuth ¶
CreateUserAuth - register a new user account
[POST]: /register
dependency: relational database
Accepted JSON payload:
`{"email":"...", "password":"..."}`
func CreateVerificationEmail ¶
CreateVerificationEmail issues new verification code upon request
dependency: email service, email verification service, Redis
Accepted JSON payload:
`{"email":"...", "password":"..."}`
func Deactivate2FA ¶
Deactivate2FA - disable 2FA for user account
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"password":"..."}`
func GetUnverifiedEmail ¶
GetUnverifiedEmail - if any email is yet to be verified, return it to the logged-in user
When this email is verified, it will replace the existing active email of the user.
dependency: email verification service, relational database, JWT
func Login ¶
Login - issue new JWTs after user:pass verification
[POST]: /login
dependency: relational database, JWT
Accepted JSON payload:
`{"email":"...", "password":"..."}`
func Logout ¶
Logout -
- if 'AUTH_COOKIE_ACTIVATE=yes', delete tokens from client browser.
- if Redis is enabled, save invalid tokens in Redis up until the expiry time.
dependency: JWT
func PasswordForgot ¶
PasswordForgot sends secret code for resetting a forgotten password
dependency: relational database, Redis, email service, password recovery service
Accepted JSON payload:
`{"email":"..."}`
func PasswordRecover ¶
PasswordRecover resets a forgotten password
dependency: relational database, Redis
Accepted JSON payload:
`{"secretCode":"...", "passNew":"...", "passRepeat":"...", "recoveryKey":"..."}`
- `recoveryKey` is required if 2FA is enabled for the user account
func PasswordUpdate ¶
PasswordUpdate - change password in logged-in state
dependency: relational database, JWT
Accepted JSON payload:
`{"password":"...", "passNew":"...", "passRepeat":"..."}`
func ResendVerificationCodeToModifyActiveEmail ¶
ResendVerificationCodeToModifyActiveEmail issues new verification code upon request
dependency: email service, email verification service, Redis, relational database, JWT
func Setup2FA ¶
Setup2FA - get secret to activate 2FA
- possible for accounts without 2FA-ON
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"password":"..."}`
func UpdateEmail ¶
UpdateEmail - update existing user email
dependency: relational database, JWT
Accepted JSON payload:
`{"emailNew":"...", "password":"..."}`
func Validate2FA ¶
Validate2FA - issue new JWTs upon 2FA validation
- required for accounts with 2FA-ON
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"otp":"..."}`
func ValidateBackup2FA ¶
ValidateBackup2FA - issue new JWTs upon 2FA validation with backup code
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"otp":"..."}`
func VerifyEmail ¶
VerifyEmail - verify email address of a newly registered user account
dependency: email verification service, Redis
Accepted JSON payload:
`{"verificationCode":"..."}`
func VerifyUpdatedEmail ¶
VerifyUpdatedEmail - verify request to modify user's email address
dependency: email verification service, relational database, redis
Accepted JSON payload:
`{"verificationCode":"..."}`
Types ¶
This section is empty.