Commit 192636d1 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

refactor: improve internal server endpoints URL structure

parent 7276abc1
......@@ -206,7 +206,7 @@ func (s *Server) StartSession(req interface{}) (*irma.Qr, string, error) {
}
return &irma.Qr{
Type: action,
URL: s.conf.URL + session.clientToken,
URL: s.conf.URL + "session/" + session.clientToken,
}, session.token, nil
}
......@@ -238,7 +238,7 @@ func (s *Server) CancelSession(token string) error {
}
func ParsePath(path string) (string, string, error) {
pattern := regexp.MustCompile("(\\w+)/?(|commitments|proofs|status|statusevents)$")
pattern := regexp.MustCompile("session/(\\w+)/?(|commitments|proofs|status|statusevents)$")
matches := pattern.FindStringSubmatch(path)
if len(matches) != 3 {
return "", "", server.LogWarning(errors.Errorf("Invalid URL: %s", path))
......
......@@ -410,7 +410,7 @@ func TestStaticQRSession(t *testing.T) {
// setup static QR and other variables
qr := &irma.Qr{
Type: irma.ActionRedirect,
URL: "http://localhost:48682/irma/-/static/staticsession",
URL: "http://localhost:48682/irma/session/staticsession",
}
bts, err := json.Marshal(qr)
require.NoError(t, err)
......
......@@ -47,7 +47,7 @@ irma session --server http://localhost:48680 --authmethod token --key mytoken --
if err != nil {
die("", err)
}
// Make sure we always run with latest configuration
irmaconfig.UpdateSchemes()
......@@ -231,7 +231,7 @@ func init() {
if err != nil {
logger.Warn("Could not determine local IP address: ", err.Error())
} else {
defaulturl = "http://" + defaulturl + ":port"
defaulturl = "http://" + defaulturl + ":port/session"
}
flags := sessionCmd.Flags()
......
......@@ -177,7 +177,7 @@ func (s *Server) attachClientEndpoints(router *chi.Mux) {
if s.conf.Verbose >= 2 {
r.Use(s.logHandler("staticsession", true, true, true))
}
r.Post("/irma/-/static/{name}", s.handleCreateStatic)
r.Post("/irma/session/{name}", s.handleCreateStatic)
})
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment