diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/config/model/SequenceConfig.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/config/model/SequenceConfig.java index ef79baaa92ee..c6c02e29fde4 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/config/model/SequenceConfig.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/config/model/SequenceConfig.java @@ -139,4 +139,27 @@ public void setAuthenticatedReqPathAuthenticator( AuthenticatorConfig authenticatedReqPathAuthenticator) { this.authenticatedReqPathAuthenticator = authenticatedReqPathAuthenticator; } + + /** + * This method will clone current class objects + * This method is to solve the issue - multiple requests for same user/SP + * + * @return SequenceConfig object + */ + public SequenceConfig cloneObject() { + SequenceConfig sequenceConfig = new SequenceConfig(); + sequenceConfig.setName(this.getName()); + sequenceConfig.setForceAuthn(this.isForceAuthn()); + sequenceConfig.setCheckAuthn(this.isCheckAuthn()); + sequenceConfig.setApplicationId(this.getApplicationId()); + sequenceConfig.setStepMap(this.getStepMap()); + sequenceConfig.setReqPathAuthenticators(this.getReqPathAuthenticators()); + sequenceConfig.setApplicationConfig(this.getApplicationConfig()); + sequenceConfig.setCompleted(this.isCompleted()); + sequenceConfig.setAuthenticatedUser(this.getAuthenticatedUser()); + sequenceConfig.setAuthenticatedIdPs(this.getAuthenticatedIdPs()); + sequenceConfig.setAuthenticatedReqPathAuthenticator(this.getAuthenticatedReqPathAuthenticator()); + return sequenceConfig; + } + } diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/handler/request/impl/DefaultRequestCoordinator.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/handler/request/impl/DefaultRequestCoordinator.java index 57b0539216c7..82326ffebb7e 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/handler/request/impl/DefaultRequestCoordinator.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/handler/request/impl/DefaultRequestCoordinator.java @@ -339,7 +339,7 @@ protected void findPreviousAuthenticatedSession(HttpServletRequest request, } context.setPreviousSessionFound(true); - sequenceConfig = previousAuthenticatedSeq; + sequenceConfig = previousAuthenticatedSeq.cloneObject(); AuthenticatedUser authenticatedUser = sequenceConfig.getAuthenticatedUser(); String authenticatedUserTenantDomain = sequenceConfig.getAuthenticatedUser().getTenantDomain();