@Override
    public Optional<RedirectionAction> getRedirectionAction(final CallContext ctx) {
        val webContext = ctx.webContext();

        var computeLoginUrl = configuration.computeFinalLoginUrl(webContext);
        val computedCallbackUrl = client.computeFinalCallbackUrl(webContext);

        val renew = configuration.isRenew()
            || webContext.getRequestAttribute(RedirectionActionBuilder.ATTRIBUTE_FORCE_AUTHN).isPresent();
        val gateway = configuration.isGateway()
            || webContext.getRequestAttribute(RedirectionActionBuilder.ATTRIBUTE_PASSIVE).isPresent();
        val redirectionUrl = constructRedirectUrl(computeLoginUrl, getServiceParameter(),
                computedCallbackUrl, renew, gateway, configuration.getMethod());
        LOGGER.debug("redirectionUrl: {}", redirectionUrl);
        return Optional.of(HttpActionHelper.buildRedirectUrlAction(webContext, redirectionUrl));
    }
@Test
    public void testRedirectForSAMLProtocol() {
        val config = new CasConfiguration();
        config.setProtocol(CasProtocol.SAML);
        val builder = newBuilder(config);
        val action = builder.getRedirectionAction(new CallContext(MockWebContext.create(), new MockSessionStore())).get();
        assertTrue(action instanceof FoundAction);
        assertEquals(LOGIN_URL + "?TARGET=http%3A%2F%2Fwww.pac4j.org%2Ftest.html%3Fclient_name%3DCasClient",
            ((FoundAction) action).getLocation());
    }