Passport/pkg/internal/server/ui/index.go

35 lines
807 B
Go
Raw Normal View History

2024-04-20 06:05:50 +00:00
package ui
import (
"fmt"
2024-04-21 09:47:22 +00:00
"github.com/gofiber/fiber/v2"
)
func DoAuthRedirect(c *fiber.Ctx) error {
uri := c.Request().URI().FullURI()
return c.Redirect(fmt.Sprintf("/sign-in?redirect_uri=%s", string(uri)))
}
2024-04-20 06:05:50 +00:00
2024-06-22 12:05:21 +00:00
func MapUserInterface(app *fiber.App) {
pages := app.Group("/").Name("Pages")
2024-04-20 14:50:09 +00:00
2024-04-21 09:47:22 +00:00
pages.Get("/", func(c *fiber.Ctx) error {
return c.Redirect("/users/me")
})
2024-04-20 14:50:09 +00:00
pages.Get("/sign-up", signupPage)
2024-04-20 06:05:50 +00:00
pages.Get("/sign-in", signinPage)
pages.Get("/mfa", mfaRequestPage)
pages.Get("/mfa/apply", mfaApplyPage)
pages.Get("/authorize", authorizePage)
2024-04-20 14:50:09 +00:00
pages.Post("/sign-up", signupAction)
pages.Post("/sign-in", signinAction)
pages.Post("/mfa", mfaRequestAction)
pages.Post("/mfa/apply", mfaApplyAction)
pages.Post("/authorize", authorizeAction)
pages.Get("/users/me", selfUserinfoPage)
2024-04-20 06:05:50 +00:00
}