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

Control JIT provisioning users associating to local users through associating_to_existing_user configuration. #5468

Merged
merged 7 commits into from
Feb 12, 2024

Conversation

RushanNanayakkara
Copy link
Contributor

@RushanNanayakkara RushanNanayakkara commented Feb 2, 2024

Purpose

Adding the associating_to_existing_user configuration.

This configuration allows the configuration of whether to allow JIT provisioning users to be associated to an already existing local account or not. The default value of this configuration is false.
The existing validations for username existence are removed since these validations were causing the federated authentication flow to break upon failure. The validation is now done inside the DefaultProvisioningHandler and an error is thrown unless local user association is not enabled through the above configuration.

@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/7794722752
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/7794722752

@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/7813318849
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/7813318849

@RushanNanayakkara RushanNanayakkara changed the title Adding allow_email_username_when_email_as_username_not_enabled configuration Control JIT provisioning users associating to local users through associating_to_existing_user configuration. Feb 8, 2024
@@ -413,9 +408,6 @@ private PostAuthnHandlerFlowStatus handleRequestFlow(HttpServletRequest request,
localClaimValues.get(EMAIL_ADDRESS_CLAIM))) {
username = UserCoreUtil.addTenantDomainToEntry(username, context.getTenantDomain());
}
if (StringUtils.isEmpty(associatedLocalUser)) {
isUsernameExists(context, username);
Copy link
Contributor

Choose a reason for hiding this comment

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

What will happen if a customer uses custom jsp file? won't it cause an issue as we are skipping a isUsernameExists function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To identify if the user is existing, same as the defualt implementation, the user will have to first performa a username validation using the api/identity/user/v1.0/validate-username endpoint. This will throw an error if the username is already existing.
If the custom jsp skips this check, the federation flow will continue without the user being provisioned. However the user will not be aware of the provisioning failure unless username is validated initially and the existence of the username is handled appropriately.


if (StringUtils.isBlank(associatedUserName)) {
// If a local user is using the same username, association is not allowed unless enabled through config.
if (isAssociationToExistingUserAllowed()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Dont' we need to handle migration for this configuration?

Copy link
Contributor Author

@RushanNanayakkara RushanNanayakkara Feb 9, 2024

Choose a reason for hiding this comment

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

For any cloud deployments, if it does not associate JIT provisioning users to local accounts, rather creates new accounts. Therefore the default behaviour of this change will not affect asgardeo deployment.

For other customers whose behaviour is to associate to local users, they will have to activate this through the configuration.

@RushanNanayakkara
Copy link
Contributor Author

RushanNanayakkara commented Feb 9, 2024

Silent provisioning flow with configuration disabled (default)

silent_provisioning.mov

@RushanNanayakkara
Copy link
Contributor Author

Silent provisioning flow with config enabled

silent_provisioning_with_config_enabled.mov

@RushanNanayakkara
Copy link
Contributor Author

Password consent prompt flow

password_consent_prompt.mov

@RushanNanayakkara
Copy link
Contributor Author

Username password consent prompt flow

username_password_consent_prompt.mov

Thumimku
Thumimku previously approved these changes Feb 9, 2024
Copy link
Contributor

@Thumimku Thumimku left a comment

Choose a reason for hiding this comment

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

LGTM

@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/7868274814
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/7868274814

Copy link
Contributor

@Thumimku Thumimku left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants