mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
proxy: add routes HTML page (#5443)
* proxy: add route portal json * fix 405 issue * proxy: add routes HTML page
This commit is contained in:
parent
e9786f9719
commit
97ba21b95a
11 changed files with 269 additions and 44 deletions
|
@ -30,6 +30,7 @@ func (p *Proxy) registerDashboardHandlers(r *mux.Router, opts *config.Options) *
|
|||
if opts.IsRuntimeFlagSet(config.RuntimeFlagPomeriumJWTEndpoint) {
|
||||
h.Path("/jwt").Handler(httputil.HandlerFunc(p.jwtAssertion)).Methods(http.MethodGet)
|
||||
}
|
||||
h.Path("/routes").Handler(httputil.HandlerFunc(p.routesPortalHTML)).Methods(http.MethodGet)
|
||||
h.Path("/sign_out").Handler(httputil.HandlerFunc(p.SignOut)).Methods(http.MethodGet, http.MethodPost)
|
||||
h.Path("/user").Handler(httputil.HandlerFunc(p.jsonUserInfo)).Methods(http.MethodGet)
|
||||
h.Path("/webauthn").Handler(p.webauthn)
|
||||
|
|
|
@ -8,8 +8,17 @@ import (
|
|||
"github.com/pomerium/pomerium/internal/handlers"
|
||||
"github.com/pomerium/pomerium/internal/httputil"
|
||||
"github.com/pomerium/pomerium/proxy/portal"
|
||||
"github.com/pomerium/pomerium/ui"
|
||||
)
|
||||
|
||||
func (p *Proxy) routesPortalHTML(w http.ResponseWriter, r *http.Request) error {
|
||||
u := p.getUserInfoData(r)
|
||||
rs := p.getPortalRoutes(u)
|
||||
m := u.ToJSON()
|
||||
m["routes"] = rs
|
||||
return ui.ServePage(w, r, "Routes", "Routes Portal", m)
|
||||
}
|
||||
|
||||
func (p *Proxy) routesPortalJSON(w http.ResponseWriter, r *http.Request) error {
|
||||
u := p.getUserInfoData(r)
|
||||
rs := p.getPortalRoutes(u)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue