Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Auth Manager API part 3: OAuth2 Manager #11844
Auth Manager API part 3: OAuth2 Manager #11844
Changes from 2 commits
b88d99d
6bceebf
33017a0
42161ec
31acb12
d345ad0
2ac23cc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also define something like
AUTH_IMPL = "rest.auth.type";
that could be used here for any custom auth manager/provider we want to bring in?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's precisely the intent here; if you have a custom manager, you would activate it with
rest.auth.type=my.custom.AuthManager
. Is that OK for you?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that works! I wasn't sure whether you were planning on having authType for as a name of the type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be aliases for built-in managers, e.g. you can activate the built-in oauth2 manager with either:
But for custom ones, you must provide the FQDN of your implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we should also make this package private. The other issue is that we shouldn't be using the common pool by default. This should probably be provided by the
OAuth2Manager
or if we expect there to be only one per manager, then just create a named pool for handling refreshes. We definitely don't want to rely on or possibly tie up the common pool.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielcweeks we are already using the common pool. The session cache currently is created as follows:
iceberg/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
Lines 1144 to 1154 in a2b8008
As you can see, we are not providing an executor explicitly, so evictions are being done on the common pool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: turning this constructor package-private: this won't fly, as SigV4 will also need to create caches, so this constructor needs to be public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielcweeks I searched for all
Caffeine
caches in Iceberg's repo and found 25 occurrences. Only one occurrence sets the executor, the one inCachingCatalog
:iceberg/core/src/main/java/org/apache/iceberg/CachingCatalog.java
Line 112 in f7d40f0
Consequently, all the others are using the common pool for asynchronous tasks such as eviction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielcweeks do you maintain that you want me to use a different pool here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we previously had refresh in a dedicated threadpool, so I don't think the other caffeine examples are what we should point to.
Also, we don't want to rely on the common pool for something important like token refresh. If something ties up the thread pool, we may miss the window to refresh. Also, we don't want to tie up the thread pool with refresh threads if something goes wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not about token refresh, this is about auth session eviction.
But fair enough. I'll do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we would need to expose this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not really, I can turn this constructor into package-private. It's meant only for tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1