Adding Live 2fa capacity
* Some requests may be sensitive enough to require a secondary two-factor authorization on the spot * Examples: changing password, changing email address, viewing API tokens etc * This creates a core handler that can attach to any Auth-able method which will require a "twofactorcode" query param before processing
This commit is contained in:
2
main.go
2
main.go
@@ -15,6 +15,7 @@ import (
|
||||
func Migrate(g *gorm.DB) {
|
||||
g.AutoMigrate(&models.User{})
|
||||
g.AutoMigrate(&models.Admin{})
|
||||
g.AutoMigrate(&models.TotpUsage{})
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -36,6 +37,7 @@ func main() {
|
||||
v1Sec := v1.Group("/sec", core.UserAuth())
|
||||
|
||||
v1Sec.GET("/doot", core.Doot())
|
||||
v1Sec.GET("/2fa-doot", core.LiveTwoFactor(), core.Doot())
|
||||
|
||||
// Administrative login
|
||||
v1.POST("/admin", core.AdminLogin())
|
||||
|
||||
Reference in New Issue
Block a user