Java Code Examples for org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext#setCurrentStep()

The following examples show how to use org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext#setCurrentStep() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultRequestCoordinator.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
private void handleIdentifierRequestInPreviousSteps(AuthenticationContext context) {

        boolean isIDFAuthenticatorFound = false;
        int currentStep = context.getCurrentStep();

        if (log.isDebugEnabled()) {
            log.debug("Started to handle the IDF request as previous steps since the current steps cannot handle the" +
                    " IDF request");
        }
        while (currentStep > 1 && !isIDFAuthenticatorFound) {
            currentStep = currentStep - 1;
            isIDFAuthenticatorFound = isIDFAuthenticatorFoundInStep(context.getSequenceConfig().getStepMap().get(currentStep));
        }

        if (isIDFAuthenticatorFound) {
            context.setCurrentStep(currentStep);
            context.setProperty(BACK_TO_PREVIOUS_STEP, true);
            //IDF should be the first step.
            context.getCurrentAuthenticatedIdPs().clear();
        } else {
            if (log.isDebugEnabled()) {
                log.debug("IDF requests cannot handle in any of the previous steps.");
            }
        }
    }
 
Example 2
Source File: GraphBasedSequenceHandler.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
private boolean handleInitialize(HttpServletRequest request, HttpServletResponse response,
                                 AuthenticationContext context, SequenceConfig sequenceConfig,
                                 AuthenticationGraph graph)
        throws FrameworkException {

    AuthGraphNode startNode = graph.getStartNode();
    if (startNode == null) {
        throw new FrameworkException("Start node is not set for authentication graph:" + graph.getName());
    }
    context.setCurrentStep(0);
    return handleNode(request, response, context, sequenceConfig, startNode);
}
 
Example 3
Source File: AbstractFrameworkTest.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
protected AuthenticationContext getAuthenticationContext(ServiceProvider serviceProvider) {
    AuthenticationContext authenticationContext = new AuthenticationContext();
    authenticationContext.setServiceProviderName(serviceProvider.getApplicationName());
    authenticationContext.setTenantDomain("test_domain");
    authenticationContext.setCurrentStep(1);
    authenticationContext.setContextIdentifier(UUID.randomUUID().toString());
    return authenticationContext;
}