refactor: remove unnecessary proxy config

This commit is contained in:
Prad Nukala
2024-09-26 13:52:03 -04:00
parent 6aacee387f
commit a190e1eac6
37 changed files with 298 additions and 353 deletions
@@ -15,20 +15,35 @@ import (
"github.com/labstack/echo/v4"
promise "github.com/nlepage/go-js-promise"
"github.com/onsonr/sonr/nebula/pages"
"github.com/onsonr/sonr/x/vault/client/htmx/middleware"
"github.com/onsonr/sonr/x/vault/client/htmx/state"
"github.com/onsonr/sonr/x/vault/client/dwn/middleware"
"github.com/onsonr/sonr/x/vault/client/dwn/state"
)
func main() {
e := echo.New()
e.Use(middleware.UseSession)
registerViews(e)
registerState(e)
Serve(e)
}
func registerState(e *echo.Echo) {
g := e.Group("state")
g.POST("/login/:identifier", state.HandleCredentialAssertion)
// g.GET("/discovery", state.GetDiscovery)
g.GET("/jwks", state.GetJWKS)
g.GET("/token", state.GetToken)
g.POST("/:origin/grant/:subject", state.GrantAuthorization)
g.POST("/register/:subject", state.HandleCredentialCreation)
g.POST("/register/:subject/check", state.CheckSubjectIsValid)
}
func registerViews(e *echo.Echo) {
e.GET("/home", pages.Home)
e.GET("/login", pages.Login)
e.GET("/register", pages.Register)
e.GET("/profile", pages.Profile)
e.GET("/authorize", pages.Authorize)
state.RegisterHandlers(e)
Serve(e)
}
// Serve serves HTTP requests using handler or http.DefaultServeMux if handler is nil.
@@ -8,16 +8,16 @@ import (
"github.com/labstack/echo/v4"
)
func checkSubjectIsValid(e echo.Context) error {
func CheckSubjectIsValid(e echo.Context) error {
credentialID := e.FormValue("credentialID")
return e.JSON(200, credentialID)
}
func handleCredentialAssertion(e echo.Context) error {
func HandleCredentialAssertion(e echo.Context) error {
return e.JSON(200, "HandleCredentialAssertion")
}
func handleCredentialCreation(e echo.Context) error {
func HandleCredentialCreation(e echo.Context) error {
// Get the serialized credential data from the form
credentialDataJSON := e.FormValue("credentialData")
@@ -4,19 +4,19 @@ import (
"github.com/labstack/echo/v4"
)
func grantAuthorization(e echo.Context) error {
func GrantAuthorization(e echo.Context) error {
// Implement authorization endpoint using passkey authentication
// Store session data in cache
return nil
}
func getJWKS(e echo.Context) error {
func GetJWKS(e echo.Context) error {
// Implement token endpoint
// Use cached session data for validation
return nil
}
func getToken(e echo.Context) error {
func GetToken(e echo.Context) error {
// Implement token endpoint
// Use cached session data for validation
return nil
-16
View File
@@ -1,16 +0,0 @@
package state
import (
"github.com/labstack/echo/v4"
)
func RegisterHandlers(e *echo.Echo) {
g := e.Group("state")
g.POST("/login/:identifier", handleCredentialAssertion)
// g.GET("/discovery", state.GetDiscovery)
g.GET("/jwks", getJWKS)
g.GET("/token", getToken)
g.POST("/:origin/grant/:subject", grantAuthorization)
g.POST("/register/:subject", handleCredentialCreation)
g.POST("/register/:subject/check", checkSubjectIsValid)
}
-1
View File
@@ -1 +0,0 @@
package state