examples/app: infer callback path from redirect URL

This commit is contained in:
Eric Chiang 2016-04-19 15:55:07 -07:00
parent c2c7f03f47
commit 9d7cebce7c

View file

@ -20,10 +20,6 @@ import (
"github.com/coreos/go-oidc/oidc" "github.com/coreos/go-oidc/oidc"
) )
var (
pathCallback = "/callback"
)
func main() { func main() {
fs := flag.NewFlagSet("oidc-app", flag.ExitOnError) fs := flag.NewFlagSet("oidc-app", flag.ExitOnError)
listen := fs.String("listen", "http://127.0.0.1:5555", "") listen := fs.String("listen", "http://127.0.0.1:5555", "")
@ -142,7 +138,7 @@ func NewClientHandler(c *oidc.Client, issuer string, cbURL url.URL) http.Handler
mux.HandleFunc("/", handleIndex) mux.HandleFunc("/", handleIndex)
mux.HandleFunc("/login", handleLoginFunc(c)) mux.HandleFunc("/login", handleLoginFunc(c))
mux.HandleFunc("/register", handleRegisterFunc(c)) mux.HandleFunc("/register", handleRegisterFunc(c))
mux.HandleFunc(pathCallback, handleCallbackFunc(c)) mux.HandleFunc(cbURL.Path, handleCallbackFunc(c))
resendURL := *issuerURL resendURL := *issuerURL
resendURL.Path = "/resend-verify-email" resendURL.Path = "/resend-verify-email"