Git Product home page Git Product logo

Comments (6)

voidmain avatar voidmain commented on May 27, 2024

Hi @alienintheheights - I'm not finding that class anywhere quickly. Can you provide more information about the code you are referencing here? Where does it exist and how are you seeing the hardcoded values?

from fusionauth-jwt.

alienintheheights avatar alienintheheights commented on May 27, 2024

I found it by looking at public static List<JSONWebKey> retrieveKeysFromJWKS(String endpoint) which calls io.fusionauth.http.AbstractHttpHelper

https://github.com/FusionAuth/fusionauth-jwt/blob/f2f987502dc682f644a9c5293357b6259e48e0f2/src/main/java/io/fusionauth/http/AbstractHttpHelper.java

protected static HttpURLConnection buildURLConnection(String endpoint) {
    try {
      HttpURLConnection urlConnection = (HttpURLConnection) new URL(endpoint).openConnection();
      urlConnection.setDoOutput(true);
      urlConnection.setConnectTimeout(3_000);
      urlConnection.setReadTimeout(2_000);
      urlConnection.addRequestProperty("User-Agent", "fusionauth-jwt (https://github.com/FusionAuth/fusionauth-jwt)");
      return urlConnection;
    } catch (IOException e) {
      throw new JSONWebKeySetHelper.JSONWebKeySetException("Failed to build connection to [" + endpoint + "].", e);
    }
  }

My current workaround is to construct my own HttpURLConnection which I pass to this method instead:

public static List<JSONWebKey> retrieveKeysFromJWKS(HttpURLConnection httpURLConnection) {

But I was hoping to avoid getting that low-level in the client code.

from fusionauth-jwt.

robotdan avatar robotdan commented on May 27, 2024

Seems reasonable.

from fusionauth-jwt.

robotdan avatar robotdan commented on May 27, 2024

Can you already do this?

For example

JSONWebKeySetHelper.retrieveKeysFromJWKS(HttpURLConnection httpURLConnection);

Maybe not ideal, you'd have to build the connection object, but if you do this, you can specify any time out you like.

Maybe we can add another method that takes a consumer so that you can modify it inline.

from fusionauth-jwt.

robotdan avatar robotdan commented on May 27, 2024

Added some additional methods under this comment. baa3457

Will this work for you?

Example usage:

retrieveKeysFromJWKS("https://acme.com/jwks", connection -> connection.setConnectTimeout(5_000));

from fusionauth-jwt.

robotdan avatar robotdan commented on May 27, 2024

4.2.0 is released.

from fusionauth-jwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.