|
34 | 34 | import javax.servlet.http.HttpServletResponse; |
35 | 35 | import javax.servlet.http.HttpSession; |
36 | 36 |
|
| 37 | +import com.cloud.api.auth.DefaultForgotPasswordAPIAuthenticatorCmd; |
37 | 38 | import org.apache.cloudstack.api.ApiConstants; |
38 | 39 | import org.apache.cloudstack.api.ApiErrorCode; |
39 | 40 | import org.apache.cloudstack.api.ApiServerService; |
@@ -225,7 +226,6 @@ void processRequestInContext(final HttpServletRequest req, final HttpServletResp |
225 | 226 | } |
226 | 227 |
|
227 | 228 | if (command != null && !command.equals(ValidateUserTwoFactorAuthenticationCodeCmd.APINAME)) { |
228 | | - |
229 | 229 | APIAuthenticator apiAuthenticator = authManager.getAPIAuthenticator(command); |
230 | 230 | if (apiAuthenticator != null) { |
231 | 231 | auditTrailSb.append("command="); |
@@ -261,7 +261,9 @@ void processRequestInContext(final HttpServletRequest req, final HttpServletResp |
261 | 261 | } catch (ServerApiException e) { |
262 | 262 | httpResponseCode = e.getErrorCode().getHttpCode(); |
263 | 263 | responseString = e.getMessage(); |
264 | | - LOGGER.debug("Authentication failure: " + e.getMessage()); |
| 264 | + if (!DefaultForgotPasswordAPIAuthenticatorCmd.APINAME.equalsIgnoreCase(command) || StringUtils.isNotBlank(username)) { |
| 265 | + LOGGER.debug("Authentication failure: {}", e.getMessage()); |
| 266 | + } |
265 | 267 | } |
266 | 268 |
|
267 | 269 | if (apiAuthenticator.getAPIType() == APIAuthenticationType.LOGOUT_API) { |
@@ -329,7 +331,7 @@ void processRequestInContext(final HttpServletRequest req, final HttpServletResp |
329 | 331 | } |
330 | 332 | } |
331 | 333 |
|
332 | | - if (! requestChecksoutAsSane(resp, auditTrailSb, responseType, params, session, command, userId, account, accountObj)) |
| 334 | + if (!requestChecksoutAsSane(resp, auditTrailSb, responseType, params, session, command, userId, account, accountObj)) |
333 | 335 | return; |
334 | 336 | } else { |
335 | 337 | CallContext.register(accountMgr.getSystemUser(), accountMgr.getSystemAccount()); |
@@ -359,7 +361,6 @@ void processRequestInContext(final HttpServletRequest req, final HttpServletResp |
359 | 361 | apiServer.getSerializedApiError(HttpServletResponse.SC_UNAUTHORIZED, "unable to verify user credentials and/or request signature", params, |
360 | 362 | responseType); |
361 | 363 | HttpUtils.writeHttpResponse(resp, serializedResponse, HttpServletResponse.SC_UNAUTHORIZED, responseType, ApiServer.JSONcontentType.value()); |
362 | | - |
363 | 364 | } |
364 | 365 | } catch (final ServerApiException se) { |
365 | 366 | final String serializedResponseText = apiServer.getSerializedApiError(se, params, responseType); |
|
0 commit comments