Skip to content

Commit 95cf0ab

Browse files
authored
Parse OIDC Issuer URL (#16)
1 parent 5010ea9 commit 95cf0ab

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

pkg/proxy/config.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import (
55
"crypto/x509"
66
"encoding/json"
77
"encoding/pem"
8-
"fmt"
98
"io/ioutil"
109
"log"
1110
"net/http"
11+
"net/url"
12+
"path"
1213
"time"
1314
)
1415

@@ -82,8 +83,15 @@ func getKeys(u string, ca *x509.Certificate, i bool) (*JWKS, error) {
8283
// Accepts a trusted CA certificate as well as a bool to skip tls verification
8384
func getWellKnown(u string, ca *x509.Certificate, i bool) (*openIDConfiguration, error) {
8485

85-
wellKnownURL := fmt.Sprintf("%s/%s", u, "/.well-known/openid-configuration")
86-
req, err := http.NewRequest("GET", wellKnownURL, nil)
86+
ul, err := url.Parse(u)
87+
if err != nil {
88+
return nil, err
89+
}
90+
91+
ul.Path = path.Join(ul.Path, ".well-known/openid-configuration")
92+
93+
//wellKnownURL := fmt.Sprintf("%s/%s", u, "/.well-known/openid-configuration")
94+
req, err := http.NewRequest("GET", ul.String(), nil)
8795
if err != nil {
8896
return nil, err
8997
}

0 commit comments

Comments
 (0)