use of io.gravitee.am.gateway.handler.common.vertx.web.handler.impl.internal.AuthenticationFlowChainHandler in project gravitee-access-management by gravitee-io.
the class AuthenticationFlowHandlerTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
List<AuthenticationFlowStep> steps = new LinkedList<>();
steps.add(new MFAEnrollStep(RedirectHandler.create("/mfa/enroll"), ruleEngine, factorManager));
steps.add(new MFAChallengeStep(RedirectHandler.create("/mfa/challenge"), ruleEngine, factorManager));
AuthenticationFlowChainHandler authenticationFlowChainHandler = new AuthenticationFlowChainHandler(steps);
when(jwtService.encode(any(JWT.class), (CertificateProvider) eq(null))).thenReturn(Single.just("token"));
Factor factor = new Factor();
factor.setFactorType(FactorType.SMS);
when(factorManager.getFactor(anyString())).thenReturn(factor);
router.route("/login").order(Integer.MIN_VALUE).handler(new CookieSessionHandler(jwtService, certificateManager, userService, "am-cookie", 30 * 60 * 60));
router.route("/login").handler(authenticationFlowChainHandler).handler(rc -> rc.response().setStatusCode(200).end()).failureHandler(new ErrorHandler());
}
Aggregations