mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
refactor: remove unnecessary proxy config
This commit is contained in:
@@ -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
|
||||
@@ -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 +0,0 @@
|
||||
package state
|
||||
Reference in New Issue
Block a user