Skip to content

Commit

Permalink
Validate the auth fail massege with the resourceBundle
Browse files Browse the repository at this point in the history
  • Loading branch information
thisaltennakoon committed Dec 17, 2024
1 parent 0f7c494 commit 9abdf6a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,4 @@ error.user.not.found.smsotp=User not found in the directory. Cannot proceed furt
authenticate.button=Authenticate
please.enter.code=Please enter the code!
enter.phone.number=Enter Your Mobile Phone Number
federated.login=Federated Login
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,4 @@ error.user.not.found.smsotp=Utilisateur introuvable dans l'annuaire. Impossible
authenticate.button=S'uthentifier
please.enter.code=Veuillez entrer le code !
enter.phone.number=Entrez votre numéro de téléphone portable
federated.login=Connexion fédérée
14 changes: 11 additions & 3 deletions apps/authentication-portal/src/main/webapp/domain.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@

<%
String domainUnknown = AuthenticationEndpointUtil.i18n(resourceBundle, "domain.unknown");
String errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle, "authentication.failed");
String errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle, "authentication.failed.please.retry");
boolean loginFailed = false;
if (Boolean.parseBoolean(request.getParameter("authFailure"))) {
loginFailed = true;
if (request.getParameter("authFailureMsg") != null) {
errorMessage = request.getParameter("authFailureMsg");
String error = Encode.forJava(request.getParameter("authFailureMsg"));
/*
* Only allowing error messages defined in the resourceBundle.
* AuthenticationEndpointUtil.i18n() will return the value of the provided key if the key is found
* in the resourceBundle. If the key is not found, it will return the key itself.
*/
if (!error.equalsIgnoreCase(AuthenticationEndpointUtil.i18n(resourceBundle, error))) {
errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle, error);
}
if (domainUnknown.equalsIgnoreCase(errorMessage)) {
if (domainUnknown.equalsIgnoreCase(error)) {
errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle, "domain.cannot.be.identified");
}
}
Expand Down

0 comments on commit 9abdf6a

Please sign in to comment.