rafaelweingartner commented on a change in pull request #2185: CLOUDSTACK-9976:
Redirect saml2 failed login message to a configurable URL
URL: https://github.com/apache/cloudstack/pull/2185#discussion_r221677314
##########
File path:
plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
##########
@@ -329,6 +333,24 @@ public String authenticate(final String command, final
Map<String, Object[]> par
params, responseType));
}
+ /**
+ * If it fails to authenticate the user, the method gets the value from
configuration
+ * Saml2FailedLoginRedirectUrl; if the user configured an error URL then
it redirects to that
+ * URL, otherwise it throws the ServerApiException
+ */
+ protected void whenFailToAuthenticateThrowExceptionOrRedirectToUrl(final
Map<String, Object[]> params, final String responseType, final
HttpServletResponse resp, Issuer issuer,
+ UserAccount userAccount) throws IOException {
+ if (userAccount == null || userAccount.getExternalEntity() == null ||
!_samlAuthManager.isUserAuthorized(userAccount.getId(), issuer.getValue())) {
+ String saml2FailedLoginRedirectUrl =
(String)getConfigKeys()[0].value();
Review comment:
What about using `Saml2FailedLoginRedirectUrl.value()` instead of
`getConfigKeys()[0].value()`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services