Check if auth request is a returning request
@@ -37,13 +37,13 @@ import org.wso2.carbon.identity.application.common.model.Property;
import org.wso2.carbon.identity.application.common.model.User;
import org.wso2.carbon.user.core.util.UserCoreUtil;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import static org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants.REDIRECT_TO_MULTI_OPTION_PAGE_ON_FAILURE;
@@ -63,7 +63,9 @@ public abstract class AbstractApplicationAuthenticator implements ApplicationAut
// if an authentication flow
if (!context.isLogoutRequest()) {
- if (!canHandle(request)
+ // If it is not a returning request then we can think that
+ // it is an auth initiating request.
+ if (!context.isReturning() || !canHandle(request)
|| Boolean.TRUE.equals(request.getAttribute(FrameworkConstants.REQ_ATTR_HANDLED))) {
if (getName().equals(context.getProperty(FrameworkConstants.LAST_FAILED_AUTHENTICATOR))) {
context.setRetrying(true);
