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

Improve Organization SSO user ID resolving logic to add to the carbon context #277

Conversation

sadilchamishka
Copy link
Contributor

@sadilchamishka sadilchamishka commented Jun 24, 2024

Proposed changes in this pull request

Improve the organization SSO user-id & username resolving logics which is used to set the values in the carbon context.
Reverted back to the old logic which was there previously 4bdc3b6#diff-604290ac058e0ac40d2bd89a168f3e62a58fcbd753e58ddadf8066bfaed56701R101-R129 and added only the required logics.

Related Issues

The organization SSO user resolving and set the correct ID & name will impact for sub-organization MyAccount related operations(view sessions, configure MFA etc things) and sub-organization console login and its operations flows (ex-org creation). Those flows are tested.

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/9638599474

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/9638599474
Status: success

Copy link

@jenkins-is-staging jenkins-is-staging left a comment

Choose a reason for hiding this comment

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

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/9638599474

LOG.error("Authenticated user's username could not be resolved.", e);
}
return StringUtils.EMPTY;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handle from the invocation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the previous implementation, when username didn't get resolved, it simply skip setting the username in the context. In that cases, username might have been set with user-id which is wrong.

Here if fails to resolve the username, it set the username as empty, so that if any downstream task requires to fetch the username, it will not relay on the username in the context as it is set to empty, hence might rely on the user-id if it is properly set in the context.

As setting username, user-id in the context are not directly related to post authentication, but added for any usecase where the request initiator is required (ex; resource creation, auditing etc.), only added an error log instead of throwing an exception.

@sadilchamishka sadilchamishka merged commit fcee0de into wso2-extensions:master Jul 1, 2024
3 checks passed
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.

3 participants