class OAuth20RedirectionActionBuilder implements RedirectionActionBuilder {

    protected OAuth20Configuration configuration;

    protected IndirectClient client;

    /**
     * <p>Constructor for OAuth20RedirectionActionBuilder.</p>
     *
     * @param configuration a {@link OAuth20Configuration} object
     * @param client a {@link IndirectClient} object
     */
    public OAuth20RedirectionActionBuilder(final OAuth20Configuration configuration, final IndirectClient client) {
        CommonHelper.assertNotNull("client", client);
        CommonHelper.assertNotNull("configuration", configuration);
        this.configuration = configuration;
        this.client = client;
    }

    /** {@inheritDoc} */
    @Override
    public Optional<RedirectionAction> getRedirectionAction(final CallContext ctx) {<FILL_FUNCTION_BODY>}
}

        val webContext = ctx.webContext();

        try {

            final String state;
            if (configuration.isWithState()) {
                state = this.configuration.getStateGenerator().generateValue(ctx);
                LOGGER.debug("save sessionState: {}", state);
                ctx.sessionStore().set(webContext, client.getStateSessionAttributeName(), state);
            } else {
                state = null;
            }
            val service = (OAuth20Service) this.configuration.buildService(webContext, client);
            val authorizationUrl = new AuthorizationUrlBuilder(service)
                .state(state).additionalParams(this.configuration.getCustomParams()).build();
            LOGGER.debug("authorizationUrl: {}", authorizationUrl);
            return Optional.of(HttpActionHelper.buildRedirectUrlAction(webContext, authorizationUrl));

        } catch (final OAuthException e) {
            throw new TechnicalException(e);
        }
    
<no_super_class>