// Path: spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/client/validation/ProxyCallbackUrlAwareTicketValidator.java
// public interface ProxyCallbackUrlAwareTicketValidator {
//     void setProxyCallbackUrl(String proxyCallbackUrl);
// }
// 
// Path: spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/web/authentication/ProxyCallbackAndServiceAuthenticationDetails.java
// public interface ProxyCallbackAndServiceAuthenticationDetails extends ServiceAuthenticationDetails {
//     String getProxyCallbackUrl();
// 
//     void setContext(HttpServletRequest context);
// }


import com.kakawait.spring.security.cas.client.validation.ProxyCallbackUrlAwareTicketValidator;
import com.kakawait.spring.security.cas.web.authentication.ProxyCallbackAndServiceAuthenticationDetails;
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
import org.springframework.security.cas.authentication.CasAuthenticationProvider;
import org.springframework.security.core.Authentication;
package com.kakawait.spring.security.cas.authentication;


/**
 * @author Thibaud Leprêtre
 */
public class DynamicProxyCallbackUrlCasAuthenticationProvider extends CasAuthenticationProvider {
    @Override
    public Authentication authenticate(Authentication authentication) {
        if (authentication.getDetails() instanceof ProxyCallbackAndServiceAuthenticationDetails) {
            if (getTicketValidator() instanceof Cas20ServiceTicketValidator) {
                String proxyCallbackUrl =
                        ((ProxyCallbackAndServiceAuthenticationDetails) authentication.getDetails()).getProxyCallbackUrl();
                ((Cas20ServiceTicketValidator) getTicketValidator()).setProxyCallbackUrl(proxyCallbackUrl);
// Path: spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/client/validation/ProxyCallbackUrlAwareTicketValidator.java
// public interface ProxyCallbackUrlAwareTicketValidator {
//     void setProxyCallbackUrl(String proxyCallbackUrl);
// }
// 
// Path: spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/web/authentication/ProxyCallbackAndServiceAuthenticationDetails.java
// public interface ProxyCallbackAndServiceAuthenticationDetails extends ServiceAuthenticationDetails {
//     String getProxyCallbackUrl();
// 
//     void setContext(HttpServletRequest context);
// }


// Path: spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/authentication/DynamicProxyCallbackUrlCasAuthenticationProvider.java
import com.kakawait.spring.security.cas.client.validation.ProxyCallbackUrlAwareTicketValidator;
import com.kakawait.spring.security.cas.web.authentication.ProxyCallbackAndServiceAuthenticationDetails;
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
import org.springframework.security.cas.authentication.CasAuthenticationProvider;
import org.springframework.security.core.Authentication;

package com.kakawait.spring.security.cas.authentication;


/**
 * @author Thibaud Leprêtre
 */
public class DynamicProxyCallbackUrlCasAuthenticationProvider extends CasAuthenticationProvider {
    @Override
    public Authentication authenticate(Authentication authentication) {
        if (authentication.getDetails() instanceof ProxyCallbackAndServiceAuthenticationDetails) {
            if (getTicketValidator() instanceof Cas20ServiceTicketValidator) {
                String proxyCallbackUrl =
                        ((ProxyCallbackAndServiceAuthenticationDetails) authentication.getDetails()).getProxyCallbackUrl();
                ((Cas20ServiceTicketValidator) getTicketValidator()).setProxyCallbackUrl(proxyCallbackUrl);
            } else if (getTicketValidator() instanceof ProxyCallbackUrlAwareTicketValidator) {