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

[Native] The "Extra Credentials" API is not available to Prestissimo/Velox connectors #22849

Open
ashkrisk opened this issue May 28, 2024 · 11 comments
Assignees
Labels
feature request prestissimo Presto Native Execution

Comments

@ashkrisk
Copy link
Contributor

As per the Presto Client REST API, clients can add a header called X-Presto-Extra-Credential to their requests. These extra credentials are not used by core Presto, but are made available to the connectors through the ConnectorSession object.

session.getIdentity().getExtraCredentials()

In Prestissimo, the closest equivalent to the ConnectorSession is the ConnectorQueryCtx class, which does not have any interface to read the extra credentials provided by the client.

As such there is no way for Prestissimo connectors to read the extra credentials supplied by the client.

Expected Behavior or Use Case

Connectors written for Prestissimo should have access to the extra credentials provided by the client.

Presto Component, Service, or Connector

Prestissimo connector infrastructure.

Context

Normally, access credentials are specified as catalog properties. This does not always work well in multi-user contexts, where many different users with varying levels of access credentials are all interacting with the same presto cluster. The "Extra Credentials" interface is a way for integrations to provide different levels of access to different users, but these are currently unavailable to Prestissimo connectors. We ran into this issue while developing an Arrow Flight connector for Prestissimo.

@ashkrisk
Copy link
Contributor Author

FYI @tdcmeehan

@tdcmeehan tdcmeehan added the prestissimo Presto Native Execution label May 28, 2024
@aditi-pandit
Copy link
Contributor

@majetideepak

@majetideepak majetideepak self-assigned this May 29, 2024
@majetideepak
Copy link
Collaborator

@ashkrisk Velox does not have some of the Presto Java abstractions such as Session, Identity. An easy workaround is to combine the extraCredentials and other session properties along with the ConnectorQueryCtx.sessionProperties map.
I added this implementation below. Will that work for you?
#22859

@ashkrisk
Copy link
Contributor Author

ashkrisk commented May 29, 2024

@majetideepak yes, we can work with this, thanks 👍
Should the credentials added to the session be prefixed like ec.<name> or extraCreds.<name> before adding them to the list of session properties to avoid conflicts?

@tdcmeehan
Copy link
Contributor

Wondering if this use case, providing per-session authentication credentials, is common enough that it should have its own abstraction in Velox?

@majetideepak
Copy link
Collaborator

majetideepak commented May 29, 2024

Wondering if this use case, providing per-session authentication credentials, is common enough that it should have its own abstraction in Velox?

Yes, we should add an identity/credentials abstraction in Velox. The complexity is to make this engine agnostic.
Is it going to simply be another map?

@majetideepak
Copy link
Collaborator

Should the credentials added to the session be prefixed

We can add a prefix. I assume the extraCredentials keys are fixed per connector.

@tdcmeehan
Copy link
Contributor

Wondering if this use case, providing per-session authentication credentials, is common enough that it should have its own abstraction in Velox?

Yes, we should add an identity/credentials abstraction in Velox. The complexity is to make this engine agnostic. Is it going to simply be another map?

That's how it is in Presto. Connectors will either expect a specific key in that map, or it may be configurable as a property.

@majetideepak
Copy link
Collaborator

I added a simple Identity API in Velox. Let me know your feedback.
facebookincubator/velox#9982

@majetideepak
Copy link
Collaborator

majetideepak commented Jun 10, 2024

@ashkrisk can you update the RFC to explain how and where the Extra Credentials will be used?

@ashkrisk
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request prestissimo Presto Native Execution
Projects
Status: Backlog
Development

No branches or pull requests

4 participants