Skip to content

Commit

Permalink
MID-8993: not show error for not received response from idp server
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Sep 8, 2023
1 parent 385e902 commit 8d3ee0d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import com.evolveum.midpoint.gui.api.GuiConstants;
import com.evolveum.midpoint.model.api.authentication.*;

import com.evolveum.midpoint.web.security.saml.NotShowedAuthenticationServiceException;

import org.apache.commons.lang3.StringUtils;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
Expand Down Expand Up @@ -62,7 +64,9 @@ public void onAuthenticationFailure(HttpServletRequest request, HttpServletRespo
moduleAuthentication.setState(StateOfModule.FAILURE);
}

saveException(request, exception);
if (!(exception instanceof NotShowedAuthenticationServiceException)) {
saveException(request, exception);
}

SavedRequest savedRequest = getRequestCache().getRequest(request, response);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
boolean requiresAuthentication = requiresAuthentication((HttpServletRequest) req, (HttpServletResponse) res);

if (!requiresAuthentication && sentRequest) {
AuthenticationServiceException exception = new AuthenticationServiceException("web.security.flexAuth.saml.not.response");
NotShowedAuthenticationServiceException exception =
new NotShowedAuthenticationServiceException(
"Midpoint saml module doesn't receive response from Identity Provider server.");
unsuccessfulAuthentication((HttpServletRequest) req, (HttpServletResponse) res, exception);
} else {
if (moduleAuthentication != null && requiresAuthentication && sentRequest) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2023 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.web.security.saml;

import org.springframework.security.authentication.AuthenticationServiceException;

public class NotShowedAuthenticationServiceException extends AuthenticationServiceException {
public NotShowedAuthenticationServiceException(String msg) {
super(msg);
}
}

0 comments on commit 8d3ee0d

Please sign in to comment.