Skip to content

Commit

Permalink
cipher suites for the jwk client restricted
Browse files Browse the repository at this point in the history
  • Loading branch information
kpacha committed Jul 30, 2018
1 parent b06c232 commit 1e7c616
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[[constraint]]
branch = "master"
branch = "custom_http_client"
name = "github.com/auth0-community/go-auth0"
source = "github.com/kpacha/go-auth0"

[[constraint]]
name = "github.com/devopsfaith/krakend"
Expand Down
31 changes: 30 additions & 1 deletion jwk.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package jose

import (
"crypto/tls"
"net"
"net/http"
"sync"
"time"

Expand All @@ -15,7 +18,33 @@ func secretProvider(URI string, cacheEnabled bool, tokenExtractor auth0.RequestT
}
mu.RUnlock()

opts := auth0.JWKClientOptions{URI: URI}
opts := auth0.JWKClientOptions{
URI: URI,
Client: &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 10,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
TLSClientConfig: &tls.Config{
CipherSuites: []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
},
},
},
},
}
if !cacheEnabled {
return auth0.NewJWKClient(opts, tokenExtractor)
}
Expand Down

0 comments on commit 1e7c616

Please sign in to comment.