Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BucketImpl is not public #41

Closed
jmferland opened this issue Aug 30, 2018 · 8 comments
Closed

BucketImpl is not public #41

jmferland opened this issue Aug 30, 2018 · 8 comments
Labels
closed:stale Issue or PR has not seen activity recently enhancement An enhancement or improvement to the SDK that could not be otherwise categorized as a new feature

Comments

@jmferland
Copy link

BucketImpl is not public so I cannot use rate limiting without using JwkProviderBuilder. (Also I cannot set a connect and read timeout with JwkProviderBuilder, otherwise I would have just used it).

e.g. this is impossible:

JwkProvider url = new UrlJwkProvider("https://samples.auth0.com/");
Bucket bucket = new Bucket(10, 1, TimeUnit.MINUTES);
JwkProvider provider = new RateLimitJwkProvider(url, bucket);

@lbalmaceda
Copy link
Contributor

That's right. You need to use the builder class. To achieve the snippet that you posted above you would do this:

JwkProvider provider = new JwkProviderBuilder("https://samples.auth0.com/")
   .rateLimited(10, 1, TimeUnit.MINUTES)
   .build();

But if you want to specify a connect/read timeout (I think you forgot to demonstrate that on the snippet) you can't do it today. I'd add a method to the builder rather than changing the visibility of the bucket implementation. I'll leave this open to track it.

@lbalmaceda lbalmaceda added the enhancement An enhancement or improvement to the SDK that could not be otherwise categorized as a new feature label Aug 30, 2018
@jmferland
Copy link
Author

Even better. Sounds great, thank you!

@onelapahead
Copy link

So I wrote a simple JwkProvider for fetching our JWKS since the our OIDC provider's JWKS endpoint is not /.well-known/jwks.json. Since the builder does not have a constructor which takes in a JwkProvider, I was going to add the RateLimitJwkProvider and GuavaCachedJwkProvider manually like the README demonstrates.

Since that is not possible, I'll try to extend the JwkProviderBuilder class and override the build method to get around this but this is very annoying! Can the BucketImpl either be exposed, or should I request in a separate issue a new constructor be added to the builder?

@apgv
Copy link

apgv commented Nov 14, 2018

@brix4dayz: You can do to this with UrlJwkProvider. Code copied from README:

JwkProvider provider = new UrlJwkProvider(new URL("https://samples.auth0.com/"));

@onelapahead
Copy link

Unfortunately not, the UrlJwkProvider only looks for JWKS at /.well-known/jwks.json (which I think should customizable as well). We're not using Auth0 as our OIDC provider but we thought your lib's were the nicest to use.

As a result, it was easier to write a custom JwkProvider that used our Feign client to retrieve the JWKS. I opened this PR to get the conversation around adding custom provider support to the builder started: #47

@apgv
Copy link

apgv commented Nov 14, 2018

That's not completely correct. Notice the new URL() passed as parameter to UrlJwkProvider. I have used this for the same reason as you with Keycloak as a provider which has a different URL to the jwks. As the README states : "Also it can load jwks.json file from any given Url (even to a local file in your filesystem)."

@onelapahead
Copy link

Perfect! Thanks, that makes a lot more sense.

@stale
Copy link

stale bot commented Oct 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

@stale stale bot added the closed:stale Issue or PR has not seen activity recently label Oct 26, 2019
@stale stale bot closed this as completed Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:stale Issue or PR has not seen activity recently enhancement An enhancement or improvement to the SDK that could not be otherwise categorized as a new feature
Projects
None yet
Development

No branches or pull requests

4 participants