-
Notifications
You must be signed in to change notification settings - Fork 667
OCPBUGS-56892: Console can only show user name instead of full name as the display name #15522
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
OCPBUGS-56892: Console can only show user name instead of full name as the display name #15522
Conversation
…hook in telemetry and masthead components
… data retrieval and dispatch behavior
|
@Leo6Leo: This pull request references Jira Issue OCPBUGS-56892, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@Leo6Leo: This pull request references Jira Issue OCPBUGS-56892, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
…th fallbacks and add corresponding unit tests
|
@Leo6Leo: This pull request references Jira Issue OCPBUGS-56892, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
| const userToggle = ( | ||
| <span className="co-username" data-test="username"> | ||
| {authEnabledFlag ? username : t('public~Auth disabled')} | ||
| {authEnabledFlag ? displayName || username || 'User' : t('public~Auth disabled')} |
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.
displayName will always return a value so i am not sure if we need the fallback values here
| return currentUsername.trim(); | ||
| } | ||
| // Final fallback for edge cases | ||
| return 'Unknown User'; |
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.
should either add i18n or return null (to allow for fallback values to fallback)
frontend/packages/console-dynamic-plugin-sdk/src/app/redux-types.ts
Outdated
Show resolved
Hide resolved
frontend/packages/console-dynamic-plugin-sdk/src/app/core/reducers/coreSelectors.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: logonoff <git@logonoff.co>
|
/retest-required |
|
/retest |
|
/retest-required |
|
/retest |
|
/retest-required |
|
@Leo6Leo there is conflict for the pr code, cluster-bot could not launch cluster with the pr, could you please rebase the code? |
…ail-shown-insteadof-name
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Leo6Leo, logonoff The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@yanpzhan The PR has been successfully rebased, please let me know if any further action is needed, thanks! |
|
Checked on cluster launched against the pr, the full name is shown as expected. |
|
@yanpzhan: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@Leo6Leo: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@Leo6Leo: Jira Issue OCPBUGS-56892 is in an unrecognized state (ON_QA) and will not be moved to the MODIFIED state. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/cherry-pick release-4.20 |
|
@Leo6Leo: #15522 failed to apply on top of branch "release-4.20": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
…s the display name (openshift#15522) * fix: Update CoreState type to include userResource for k8s API integration * feat: Add userResource management to core actions and reducer * feat: Introduce useUser hook for centralized user data management * refactor: Replace direct user data fetching with centralized useUser hook in telemetry and masthead components * test: auto generated the unit tests for useUser hook to validate user data retrieval and dispatch behavior * feat: Enhance useUser hook to provide robust display name handling with fallbacks and add corresponding unit tests * fix: apply the review feedback * Apply suggestions from code review Co-authored-by: logonoff <git@logonoff.co> * feat: run i18n * feat: Add UserKind type import * Apply suggestions from code review Co-authored-by: logonoff <git@logonoff.co> * Update frontend/public/locales/en/public.json Co-authored-by: logonoff <git@logonoff.co> * Update frontend/packages/console-dynamic-plugin-sdk/src/app/core/actions/core.ts Co-authored-by: logonoff <git@logonoff.co> * feat: Import UserKind type in core actions * refactor: Update GetUserResource type to use UserKind for improved type safety * test: Update useUser.spec.ts to mock setUserResource and correct displayName expectation * test: fixing the failing CI issue --------- Co-authored-by: logonoff <git@logonoff.co>
…s the display name (openshift#15522) Cherry-picked from efd72db with conflict resolution adapted for 4.19 branch.

Closes #13744
Description
After logging in with Google OAuth OIDC, the Console can only show username instead of full name as the display name on the top right corner in the console.
Step to test out the changes
Have a cluster that configure the Google OIDC login. If you don't have one, you can follow the instructions I wrote in the Appendix which locates at the bottom of this PR description.
Choose
Google-OpenID-Connectas your login option and login with your google accountSpecial Note
Thanks to @logonoff for the discussion on what would be the better way to resolve this issue.
Appendix: How to configure Google OAuth on your cluster for testing purpose
Prerequisites
Before you begin, you'll need:
Step 1: Create the Google Client Secret in OpenShift
First, create a k8s secret in the openshift-config namespace to securely store your Google OAuth client secret. This prevents storing sensitive values directly in the main cluster configuration.
Replace
<your-google-client-secret>with the actual client secret from your Google Cloud project.Step 2: Configure the Cluster OAuth Identity Provider
Next, edit the cluster-wide OAuth configuration to add Google as an identity provider.
Replace with the Client ID from your Google Cloud project.
Save and close the editor. Then wait until the authentication operator finish reconciling.
Step 3: Get the redirect_uri and Update Google Cloud
This is a crucial step. OpenShift generates a unique callback URL that Google needs to know about for security.
Open your OpenShift cluster's web console in a browser. You should now see the "Google" login option.
Click the Google login button. You will likely be redirected to a Google error page saying something like "Error 400: redirect_uri_mismatch". This is expected!
Copy the entire URL from your browser's address bar. Find the redirect_uri parameter within that URL. It will look something like this:
https://oauth-openshift.apps../oauth2callback/Google
Go to your project in the Google Cloud Console.
Navigate to your OAuth 2.0 Client ID.
Under the "Authorized redirect URIs" section, click "ADD URI" and paste the full redirect_uri you copied.
Click Save.
Login with your google account again and you will see it works!