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

Auth Manager API part 2: AuthManager #11809

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
HTTPAuthSession close()
  • Loading branch information
adutra committed Dec 19, 2024
commit e3c4b311de21194ac82e4c450cb72d9f393beba3
15 changes: 11 additions & 4 deletions core/src/main/java/org/apache/iceberg/rest/auth/AuthSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@
public interface AuthSession extends AutoCloseable {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming issue from the previous PR is still pending. @nastra and myself agreed recently on HTTPAuthSession@danielcweeks is that OK with you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked with @danielcweeks and we probably want to go with what you have here as we should eventually deprecate the AuthSession in OAuth2Util and so we shouldn't have an issue with conflicting names for too long


/** An empty session that does nothing. */
AuthSession EMPTY = request -> request;
AuthSession EMPTY =
new AuthSession() {
@Override
public HTTPRequest authenticate(HTTPRequest request) {
return request;
}

@Override
public void close() {}
};

/**
* Authenticates the given request and returns a new request with the necessary authentication.
Expand All @@ -44,7 +53,5 @@ public interface AuthSession extends AutoCloseable {
* the cache, or the cache itself is closed.
*/
@Override
default void close() {
// Do nothing
}
void close();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nastra per your previous comment, I thought you would prefer this method to be non-default as well.

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ default HTTPRequest authenticate(HTTPRequest request) {
: ImmutableHTTPRequest.builder().from(request).headers(headers).build();
}

@Override
default void close() {
// no resources to close
}

static DefaultAuthSession of(HTTPHeaders headers) {
return ImmutableDefaultAuthSession.builder().headers(headers).build();
}
Expand Down