-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add authentication to the Preview Web UI #23230
base: master
Are you sure you want to change the base?
Conversation
67f054b
to
03ae4a8
Compare
3895cf2
to
92310b1
Compare
ef2ee0e
to
f5f4331
Compare
6c48bf4
to
8e3d739
Compare
8e3d739
to
ce604df
Compare
75666ed
to
e2eb9cd
Compare
a18540f
to
d9489a3
Compare
core/trino-web-ui/src/main/resources/webapp-preview/eslint.config.js
Outdated
Show resolved
Hide resolved
da79342
to
d805fac
Compare
@koszti I've pushed a commit to your PR that tries to simplify the bindings to reduce the scope of changes. Ideally we don't want to change existing classes at all to reduce the chance of introducing security-related bugs. |
0297479
to
46154d2
Compare
thanks for doing that. I was struggling with that part so it was a great help. I made a few other modifications and everything is now working. I've also addressed nearly all your comments and rebased everything into a single commit. |
46154d2
to
946bca0
Compare
946bca0
to
b7c86d5
Compare
@koszti I've pushed a bunch of changes - can you test them? I'm ok with the change as it is right now so I'm willing to merge it. |
@wendigo I'm fixing conflicts and testing your commits. I can see you've moved
I've checked other resources and seems like it's always annotated at the endpoint methods and not at the class level. One annotation for each.. Should I modify related classes accordingly so it'd look like this below? Doing that there is no exception:
|
@koszti according to the code it should work on the class-level as well |
|
@koszti there is an invalid check in the
|
@wendigo yes, it does work after your changes, thanks! I'm going to continue the rest and will come back soon |
a3f0d91
to
2ccf6ec
Compare
dd3d28b
to
2ccf6ec
Compare
@wendigo this is now ready. |
2ccf6ec
to
4d750ff
Compare
@koszti there were unrelated changes in 3 files which I removed and extracted one change to a separate commit. |
@@ -49,15 +49,13 @@ public AccessType getAccessType(ResourceInfo resourceInfo) | |||
// check if the resource class has an access type declared for all methods | |||
accessType = resourceAccessTypeLoader.getAccessType(resourceInfo.getResourceClass()); | |||
if (accessType.isPresent()) { | |||
verifyNotTrinoResource(resourceInfo); |
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.
@dain this prohibited @ResourceSecurity at the class level for io.trino Jax-RS resources. Was it on purpose?
Description
Authentication methods for the preview UI. Partially addressing #22697
Technical details
Introducing three new API endpoints designed for enhanced Single Page App compatibility:
GET: /ui/preview/auth/info
: Provides a lightweight JSON response containing the essential details for authentication type, user information, and login form rendering (if needed). Unlike the current approach, it eliminates the need for server-side HTML rendering and string manipulation.. Example:POST: /ui/preview/auth/login
: Functionally equivalent toPOST: /ui/login
, but it exchanges data via JSON instead of HTTP forms and HTML responses.GET: /ui/preview/auth/logout
: Functionally equivalent toGET: /ui/logout
but it exchanges data via JSON instead of HTTP redirects and HTML responseSupported Authentication Types
INSECURE
FORM
(via HTTP)FORM
(via HTTPS)FIXED
OAUTH2
(tested with Okta)JWT
: - (tested by ingesting jwt tokens into HTTP header as auth bearer token using mitmproxy)KERBEROS
CERTIFICATE
Screenshots
1.
INSECURE
auth type for development. No password.2.
FORM
auth type via HTTPS3.
FIXED
4.
OAUTH2
Okta as IdPNOTE: In
oauth2
, the IdP login form is displayed (such as okta login page), whereas forfixed
and protocol-based authenticators (jwt
,certifacte
andkerberos
), users are redirected to the main page upon successful authentication without being shown a login form.5. Periodically fetching
/ui/api/stats
endpoint after a successful login