feat: initialized auth controller
This commit is contained in:
63
backend/internal/controllers/auth.go
Normal file
63
backend/internal/controllers/auth.go
Normal file
@@ -0,0 +1,63 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Summary Register an account
|
||||
// @Tags Auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Router /auth/registrationBegin [post]
|
||||
func RegistrationBegin(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// @Summary Confirm with code, finish creating the account
|
||||
// @Tags Auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Router /auth/registrationComplete [post]
|
||||
func RegistrationComplete(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// TODO: Document instructions on 2FA
|
||||
// @Summary Acquire tokens via login credentials or by providing 2FA code
|
||||
// @Tags Auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Router /auth/login [post]
|
||||
func Login(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// @Summary Receive new tokens via refresh token
|
||||
// @Tags Auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Router /auth/refresh [post]
|
||||
func Refresh(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// @Summary Request password reset email
|
||||
// @Tags Auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Router /auth/passwordResetBegin [post]
|
||||
func PasswordResetBegin(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// TODO: Document instructions on 2FA
|
||||
// @Summary Complete password reset with email code and provide 2FA code or backup code if needed
|
||||
// @Tags Auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Router /auth/passwordResetComplete [post]
|
||||
func PasswordResetComplete(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
@@ -13,6 +13,16 @@ func SetupRoutes(r *gin.Engine) *gin.Engine {
|
||||
{
|
||||
serviceGroup.GET("/health", controllers.HealthCheck)
|
||||
}
|
||||
|
||||
authGroup := apiGroup.Group("/auth")
|
||||
{
|
||||
authGroup.POST("/registrationBegin", controllers.RegistrationBegin)
|
||||
authGroup.POST("/registrationComplete", controllers.RegistrationComplete)
|
||||
authGroup.POST("/login", controllers.Login)
|
||||
authGroup.POST("/refresh", controllers.Refresh)
|
||||
authGroup.POST("/passwordResetBegin", controllers.PasswordResetBegin)
|
||||
authGroup.POST("/passwordResetComplete", controllers.PasswordResetComplete)
|
||||
}
|
||||
}
|
||||
|
||||
return r
|
||||
|
||||
Reference in New Issue
Block a user