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

Support email domain based organization discovery during self-registration. #7083

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Yasasr1
Copy link
Contributor

@Yasasr1 Yasasr1 commented Nov 5, 2024

Purpose

With this pr, the recovery portal will be improved to handle email domain based orgnization discovery for self-registration. Changes are made to the login.jsp, org_discovery.jsp and self-registration-username-request.jsp pages to handle new parameters

Related issue

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 32.02%. Comparing base (d2c7e01) to head (f77acad).
Report is 36 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7083   +/-   ##
=======================================
  Coverage   32.02%   32.02%           
=======================================
  Files          41       41           
  Lines         893      893           
  Branches      216      220    +4     
=======================================
  Hits          286      286           
  Misses        557      557           
  Partials       50       50           
Flag Coverage Δ
@wso2is/core 32.02% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

} else if (isErrorFallbackLocale) {
errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle,"error.retry");
}
} else if (isSelfRegistration && errorMessage.equalsIgnoreCase("Organization is not associated with this application.")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

use a key instead of this string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the error message currently returned from the organization SSO authenticator. Since this is the existing behaviour will track this improvement as a separate effort.


<% if (Boolean.parseBoolean(request.getParameter("isSelfRegistration"))) { %>
$(".ui.segment").hide();
window.location = "<%=getRegistrationUrl(accountRegistrationEndpointContextURL, srURLEncodedURL, (String) request.getAttribute(JAVAX_SERVLET_FORWARD_QUERY_STRING))%>";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

check if similar logic as below works here
request.getRequestDispatcher("error.jsp").forward(request, response);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

check if similar logic as below works here request.getRequestDispatcher("error.jsp").forward(request, response);

This is not possible since the registration page resides in a seperate web app (recovery portal)

Copy link
Member

Choose a reason for hiding this comment

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

Have your tried using response.sendRedirect from Java context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have your tried using response.sendRedirect from Java context?

Yes, since the login page url is generated and added to the auth response as a 302 location header, using sendRedirect in this flow will introduce some inconsistencies and unwanted complexity.

invalid.organization.discovery.type=Given organization discovery type is invalid or not enabled.
discovery.input.cannot.be.empty=Email cannot be empty.
organization.name.cannot.be.empty=Organization name cannot be empty.
provide.organization.name=Provide organization name
provide.email.address=Provide email address
self.registration.application.not.shared=The application is not shared with the organization associated with the provided email domain.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to show this error message to an end user? an average user will not have an idea about what sharing an application means

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can remove and show the general message. updated

} else {
isSSOLoginAuthenticatorConfigured = true;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to break the for loop once the sso authenticator is found?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, updated

@wso2-jenkins-bot
Copy link
Contributor

🦋 Changeset detected

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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