Authenticated Proxy

Issue #197 new
Mark Dixon created an issue

There doesn’t seem to be much support for customising the Http requester that gets the JWKS keys, in my case I need to go through a HTTP proxy which requires authentication and the only way I seem to be ablse to make it work is by setting the default authenticator:

Authenticator.setDefault( new Authenticator() {
  // do whateveer
}  );

This is unfortunately a bit global, and will set those credentials by default everywhere. It would be nice to have a way to do it on the connection itself. I see that I can override the instance of Get / SimpleGet used, but it doesn’t seem to support configuration in this way.

Comments (1)

  1. Brian Campbell

    Honestly I’ve never really understood all the various options and apis in java for working with forward proxies. But there are a number of ways in jose4j to customize the outbound request to the JWKS endpoint. The non customized usage is shown https://bitbucket.org/b_c/jose4j/wiki/JWT Examples#markdown-header-using-an-https-jwks-endpoint

    But can be augmented with some of the below. Including your own SimpleGet implementation or subclass of Get or customized Get.

    setSimpleHttpGet(...) on HttpsJwks “Sets the SimpleGet instance to use when making the HTTP GET request to the JWKS location. By default a new instance of Get is used. This method should be used right after construction, if a different implementation of SimpleGet or non-default configured instance of Get is needed.”

    https://javadoc.io/doc/org.bitbucket.b_c/jose4j/latest/org/jose4j/jwk/HttpsJwks.html#setSimpleHttpGet-org.jose4j.http.SimpleGet-

    And Get has a setHttpProxy(Proxy proxy)

    https://javadoc.io/static/org.bitbucket.b_c/jose4j/0.7.12/org/jose4j/http/Get.html#setHttpProxy-java.net.Proxy-

  2. Log in to comment