Skip to content

Add Access Request ID to response for UserContext#15653

Merged
rudream merged 15 commits into
masterfrom
yassine/access-request-ux
Aug 30, 2022
Merged

Add Access Request ID to response for UserContext#15653
rudream merged 15 commits into
masterfrom
yassine/access-request-ux

Conversation

@rudream
Copy link
Copy Markdown
Contributor

@rudream rudream commented Aug 18, 2022

Purpose

This PR resolves #14432

In the UI, when a user assumes a role from an approved access request, they need to include a --request-id flag to the tsh login command in order to be able to connect to their desired resources via CLI. This was previously missing from the connection instructions shown in the UI, and led to confusion. This UX fix will automatically add the --request-id flag with the correct request ID to the connection instructions if the user is currently assuming a role from an access request.

Implementation

When a request to extend a web session is made (when the user clicks "assume roles" on an access request in the UI), the access request ID that comes with the request is added to the newly created session under the field assumedRoleRequestId.

When the request is made to fetch Databases and Kubes, the assumedRoleRequestId is pulled from the session and included in the response so that it can be used by the UI and displayed in the connection instructions dialog.

webapps counterpart PR: gravitational/webapps#1130

Comment thread api/types/access_request.go Outdated
Comment thread api/types/access_request.go Outdated
Comment thread api/types/types.proto Outdated
@rudream rudream force-pushed the yassine/access-request-ux branch from bc099e1 to 217c8a2 Compare August 19, 2022 16:12
Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

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

Approved with 2 minor suggestions.

Comment thread lib/web/servers.go Outdated
Comment thread lib/auth/auth.go Outdated
@rudream rudream force-pushed the yassine/access-request-ux branch 2 times, most recently from 33b9fb7 to b5ffca4 Compare August 22, 2022 16:22
Comment thread api/types/access_request.go Outdated
Comment thread lib/web/servers.go Outdated
@rudream rudream force-pushed the yassine/access-request-ux branch from b5ffca4 to 2cade00 Compare August 23, 2022 18:52
@rudream rudream requested review from kimlisa and zmb3 August 23, 2022 18:55
@rudream
Copy link
Copy Markdown
Contributor Author

rudream commented Aug 23, 2022

Changes:

The accessRequestId is now returned as part of the userContext sent to the UI, instead of with the response for fetching Kubes and Databases.

Copy link
Copy Markdown
Contributor

@kimlisa kimlisa left a comment

Choose a reason for hiding this comment

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

after fixing doc lgtm

Comment thread api/types/session.go Outdated
Comment thread api/types/session.go Outdated
Comment thread api/types/session.go Outdated
Comment thread api/types/session.go Outdated
@github-actions github-actions Bot removed the request for review from gzdunek August 23, 2022 20:22
@rudream rudream changed the title Add Access Request ID to response for Databases and Kubes Add Access Request ID to response for UserContext Aug 23, 2022
@rudream rudream requested a review from kimlisa August 23, 2022 23:52
Copy link
Copy Markdown
Contributor

@kimlisa kimlisa left a comment

Choose a reason for hiding this comment

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

after minor comments

Comment thread api/types/access_request.go Outdated
Comment thread lib/web/apiserver_test.go Outdated
Comment thread lib/web/apiserver_test.go Outdated
Comment thread lib/web/apiserver_test.go Outdated
Comment thread api/types/types.proto Outdated
@rudream rudream force-pushed the yassine/access-request-ux branch from 780b92f to 8f40df6 Compare August 25, 2022 19:18
@rudream rudream enabled auto-merge (squash) August 25, 2022 19:22
@rudream rudream merged commit 6d475e1 into master Aug 30, 2022
@zmb3 zmb3 deleted the yassine/access-request-ux branch September 9, 2022 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UX for CLI based Access Requests tsh login --request-id=

3 participants