本文整理汇总了Java中org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig.setCompleted方法的典型用法代码示例。如果您正苦于以下问题:Java StepConfig.setCompleted方法的具体用法?Java StepConfig.setCompleted怎么用?Java StepConfig.setCompleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig
的用法示例。
在下文中一共展示了StepConfig.setCompleted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testHandleLastStep
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入方法依赖的package包/类
@Test(dataProvider = "stepData")
public void testHandleLastStep(boolean isRequestAuthenticated,
boolean isOverallAuthenticationSucceeded) throws Exception {
StepHandler stepHandler = getMockedStepHandlerForSuccessfulRequestAuthentication();
mockStatic(FrameworkUtils.class);
when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);
StepConfig firstStep = new StepConfig();
firstStep.setOrder(1);
// Second step is completed.
StepConfig lastStep = new StepConfig();
lastStep.setOrder(2);
lastStep.setCompleted(true);
SequenceConfig sequenceConfig = new SequenceConfig();
sequenceConfig.getStepMap().put(1, firstStep);
sequenceConfig.getStepMap().put(2, lastStep);
doNothing().when(stepBasedSequenceHandler).handlePostAuthentication(any(HttpServletRequest.class), any
(HttpServletResponse.class), any(AuthenticationContext.class));
// currently we have completed second step
context.setCurrentStep(2);
context.setSequenceConfig(sequenceConfig);
context.setRequestAuthenticated(isRequestAuthenticated);
stepBasedSequenceHandler.handle(request, response, context);
assertResetContext(context);
assertEquals(context.isRequestAuthenticated(), isOverallAuthenticationSucceeded);
assertTrue(context.getSequenceConfig().isCompleted());
}
示例2: testHandlePassiveAuthenticateWhenMultiOptionStep
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入方法依赖的package包/类
@Test
public void testHandlePassiveAuthenticateWhenMultiOptionStep() throws Exception {
StepHandler stepHandler = getMockedStepHandlerForSuccessfulRequestAuthentication();
mockStatic(FrameworkUtils.class);
when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);
StepConfig firstStep = new StepConfig();
firstStep.setOrder(1);
// Second step is completed.
StepConfig lastStep = new StepConfig();
lastStep.setMultiOption(true);
lastStep.setOrder(2);
lastStep.setCompleted(true);
SequenceConfig sequenceConfig = new SequenceConfig();
sequenceConfig.getStepMap().put(1, firstStep);
sequenceConfig.getStepMap().put(2, lastStep);
doNothing().when(stepBasedSequenceHandler).handlePostAuthentication(any(HttpServletRequest.class), any
(HttpServletResponse.class), any(AuthenticationContext.class));
// currently we have completed second step
context.setCurrentStep(2);
context.setSequenceConfig(sequenceConfig);
context.setPassiveAuthenticate(true);
context.setRequestAuthenticated(false);
stepBasedSequenceHandler.handle(request, response, context);
assertResetContext(context);
assertTrue(context.getSequenceConfig().isCompleted());
assertFalse(context.getSequenceConfig().getStepMap().get(context.getCurrentStep()).isRetrying());
}
示例3: testHandleMultiOptionStep
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入方法依赖的package包/类
@Test
public void testHandleMultiOptionStep() throws Exception {
StepHandler stepHandler = getMockedStepHandlerForIncompleteStep(true);
mockStatic(FrameworkUtils.class);
when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);
StepConfig firstStep = new StepConfig();
firstStep.setOrder(1);
// Second step is completed.
StepConfig lastStep = new StepConfig();
lastStep.setMultiOption(true);
lastStep.setOrder(2);
lastStep.setCompleted(true);
SequenceConfig sequenceConfig = new SequenceConfig();
sequenceConfig.getStepMap().put(1, firstStep);
sequenceConfig.getStepMap().put(2, lastStep);
doNothing().when(stepBasedSequenceHandler).handlePostAuthentication(any(HttpServletRequest.class), any
(HttpServletResponse.class), any(AuthenticationContext.class));
// currently we have completed second step
context.setCurrentStep(2);
context.setSequenceConfig(sequenceConfig);
context.setRequestAuthenticated(false);
stepBasedSequenceHandler.handle(request, response, context);
assertResetContext(context);
// Assert whether the sequence is retrying the step
assertTrue(context.getSequenceConfig().getStepMap().get(context.getCurrentStep()).isRetrying());
// Assert whether before retrying the context request authentication status was set to true.
assertTrue(context.isRequestAuthenticated());
// step handler completes the step successfully
stepHandler = getMockedStepHandlerForSuccessfulRequestAuthentication();
when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);
stepBasedSequenceHandler.handle(request, response, context);
assertTrue(context.getSequenceConfig().isCompleted());
assertTrue(context.isRequestAuthenticated());
}