*: more updates to prepend the correct API path
This commit is contained in:
parent
ede6300a84
commit
435cadfc19
4 changed files with 14 additions and 5 deletions
|
@ -16,6 +16,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -181,7 +182,7 @@ func NewClientHandler(c *oidc.Client, issuer string, cbURL url.URL) http.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
resendURL := *issuerURL
|
resendURL := *issuerURL
|
||||||
resendURL.Path = "/resend-verify-email"
|
resendURL.Path = path.Join(resendURL.Path, "/resend-verify-email")
|
||||||
|
|
||||||
mux.HandleFunc("/resend", handleResendFunc(c, *issuerURL, resendURL, cbURL))
|
mux.HandleFunc("/resend", handleResendFunc(c, *issuerURL, resendURL, cbURL))
|
||||||
return mux
|
return mux
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/coreos/dex/connector"
|
"github.com/coreos/dex/connector"
|
||||||
|
@ -336,7 +337,7 @@ func getConnectorForUserByEmail(ur user.UserRepo, email string) (string, error)
|
||||||
func newLoginURLFromSession(issuer url.URL, ses *session.Session, register bool, connectorFilter []string, msgCode string) *url.URL {
|
func newLoginURLFromSession(issuer url.URL, ses *session.Session, register bool, connectorFilter []string, msgCode string) *url.URL {
|
||||||
loginURL := issuer
|
loginURL := issuer
|
||||||
v := loginURL.Query()
|
v := loginURL.Query()
|
||||||
loginURL.Path = httpPathAuth
|
loginURL.Path = path.Join(loginURL.Path, httpPathAuth)
|
||||||
v.Set("redirect_uri", ses.RedirectURL.String())
|
v.Set("redirect_uri", ses.RedirectURL.String())
|
||||||
v.Set("state", ses.ClientState)
|
v.Set("state", ses.ClientState)
|
||||||
v.Set("client_id", ses.ClientID)
|
v.Set("client_id", ses.ClientID)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/go-oidc/jose"
|
"github.com/coreos/go-oidc/jose"
|
||||||
|
@ -215,7 +216,13 @@ func (s *Server) HTTPHandler() http.Handler {
|
||||||
clock := clockwork.NewRealClock()
|
clock := clockwork.NewRealClock()
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
handle := func(urlPath string, h http.Handler) {
|
handle := func(urlPath string, h http.Handler) {
|
||||||
mux.Handle(path.Join(s.IssuerURL.Path, urlPath), h)
|
p := path.Join(s.IssuerURL.Path, urlPath)
|
||||||
|
// path.Join always trims trailing slashes (https://play.golang.org/p/GRr0jDd9P7).
|
||||||
|
// If path being registered has a trailing slash, add it back on.
|
||||||
|
if strings.HasSuffix(urlPath, "/") {
|
||||||
|
p = p + "/"
|
||||||
|
}
|
||||||
|
mux.Handle(p, h)
|
||||||
}
|
}
|
||||||
handleFunc := func(urlPath string, hf http.HandlerFunc) {
|
handleFunc := func(urlPath string, hf http.HandlerFunc) {
|
||||||
handle(urlPath, hf)
|
handle(urlPath, hf)
|
||||||
|
@ -277,7 +284,7 @@ func (s *Server) HTTPHandler() http.Handler {
|
||||||
}
|
}
|
||||||
// NOTE(ericchiang): This path MUST end in a "/" in order to indicate a
|
// NOTE(ericchiang): This path MUST end in a "/" in order to indicate a
|
||||||
// path prefix rather than an absolute path.
|
// path prefix rather than an absolute path.
|
||||||
mux.Handle(path.Join(httpPathAuth, idpc.ID())+"/", idpc.Handler(*errorURL))
|
handle(path.Join(httpPathAuth, idpc.ID())+"/", idpc.Handler(*errorURL))
|
||||||
}
|
}
|
||||||
|
|
||||||
apiBasePath := path.Join(httpPathAPI, APIVersion)
|
apiBasePath := path.Join(httpPathAPI, APIVersion)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<h2 class="heading">Reset your password</h2>
|
<h2 class="heading">Reset your password</h2>
|
||||||
<form onsubmit="return validate();" id="resetPasswordForm" method="POST" action="/reset-password">
|
<form onsubmit="return validate();" id="resetPasswordForm" method="POST" action="{{ "/reset-password" | absPath }}">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="input-desc">
|
<div class="input-desc">
|
||||||
<label for="password">New Password</label>
|
<label for="password">New Password</label>
|
||||||
|
|
Reference in a new issue