org.apereo.cas.web.flow.DelegatedAuthenticationClientRetryAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cas-server-support-pac4j-webflow Show documentation
Show all versions of cas-server-support-pac4j-webflow Show documentation
cas-server-support-pac4j-webflow
package org.apereo.cas.web.flow;
import org.apereo.cas.web.flow.actions.BaseCasWebflowAction;
import org.apereo.cas.web.support.WebUtils;
import lombok.RequiredArgsConstructor;
import lombok.val;
import org.apache.http.client.utils.URIBuilder;
import org.pac4j.core.client.Clients;
import org.pac4j.core.client.IndirectClient;
import org.pac4j.core.redirect.RedirectionActionBuilder;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;
/**
* This is {@link DelegatedAuthenticationClientRetryAction}.
*
* @author Misagh Moayyed
* @since 6.4.0
*/
@RequiredArgsConstructor
public class DelegatedAuthenticationClientRetryAction extends BaseCasWebflowAction {
private final Clients clients;
private final DelegatedClientIdentityProviderConfigurationProducer providerConfigurationProducer;
@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(requestContext);
val clientName = WebUtils.getDelegatedAuthenticationClientName(requestContext);
val client = clients.findClient(clientName).map(IndirectClient.class::cast).get();
val config = providerConfigurationProducer.produce(requestContext, client).get();
val urlBuilder = new URIBuilder(config.getRedirectUrl());
urlBuilder.addParameter(RedirectionActionBuilder.ATTRIBUTE_FORCE_AUTHN, Boolean.TRUE.toString());
response.sendRedirect(urlBuilder.toString());
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy