first working version

This commit is contained in:
ston1th 2022-07-10 15:51:31 +02:00
commit c9dfecc519
21 changed files with 296 additions and 178 deletions

View file

@ -9,20 +9,21 @@ type route struct {
}
const (
root = "/"
login = root + "login"
totp = root + "totp"
profile = root + "profile"
consent = root + "consent"
users = root + "users"
logout = root + "logout"
uroot = root + "user/"
root = "/"
login = root + "login"
totp = root + "totp"
sessions = root + "sessions"
consent = root + "consent"
users = root + "users"
logout = root + "logout"
uroot = root + "user/"
userNew = uroot + "new"
userEdit = uroot + "edit/{user:[a-zA-Z0-9]+$}"
userDel = uroot + "del/{user:[a-zA-Z0-9]+$}"
userTotp = uroot + "totp/{user:[a-zA-Z0-9]+$}"
userUnlock = uroot + "unlock/{user:[a-zA-Z0-9]+$}"
userNew = uroot + "new"
userEdit = uroot + "edit/{user:[a-zA-Z0-9]+$}"
userDel = uroot + "del/{user:[a-zA-Z0-9]+$}"
userTotp = uroot + "totp/{user:[a-zA-Z0-9]+$}"
userSessions = uroot + "sessions/{user:[a-zA-Z0-9]+$}"
userUnlock = uroot + "unlock/{user:[a-zA-Z0-9]+$}"
)
var routes = []route{
@ -48,15 +49,15 @@ var routes = []route{
{
consent,
jwtHandler(
userAuthHandler(
authHandler(
consentHandler)),
[]string{"GET", "POST"},
},
{
profile,
sessions,
jwtHandler(
userAuthHandler(
profileHandler)),
authHandler(
sessionsHandler)),
[]string{"GET"},
},
{
@ -100,6 +101,13 @@ var routes = []route{
userTotpHandler)),
[]string{"GET", "POST"},
},
{
userSessions,
jwtHandler(
userAuthHandler(
userSessionsHandler)),
[]string{"GET", "POST"},
},
{
userUnlock,
jwtHandler(