diff --git a/cas-security-dynamic-service-resolver/pom.xml b/cas-security-dynamic-service-resolver/pom.xml deleted file mode 100644 index c6d9a69..0000000 --- a/cas-security-dynamic-service-resolver/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - 4.0.0 - - cas-security-dynamic-service-resolver - 0.4.0 - jar - - - com.kakawait - cas-security-spring-boot-parent - 1.0.0-SNAPSHOT - - - Cas security dynamic service resolver - Spring security and Apereo override implementation to support dynamic service resolution - - - true - - 3.1.0 - - - - - spring-security-cas-extension - 0.4.4 - - - - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.security - spring-security-cas - - - javax.servlet - javax.servlet-api - ${javax.servlet-api.version} - - - - diff --git a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/DefaultProxyCallbackAndServiceAuthenticationDetails.java b/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/DefaultProxyCallbackAndServiceAuthenticationDetails.java deleted file mode 100644 index 60c165c..0000000 --- a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/DefaultProxyCallbackAndServiceAuthenticationDetails.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.kakawait.security.cas; - -import org.springframework.security.web.util.UrlUtils; - -import javax.servlet.http.HttpServletRequest; - -/** - * @author Thibaud Leprêtre - * @deprecated Please use new artifact id {@code spring-security-cas-extension} - */ -@Deprecated -public class DefaultProxyCallbackAndServiceAuthenticationDetails - implements ProxyCallbackAndServiceAuthenticationDetails { - - private final HttpServletRequest context; - - private final String proxyCallbackPath; - - public DefaultProxyCallbackAndServiceAuthenticationDetails(HttpServletRequest context, String proxyCallbackPath) { - this.context = context; - this.proxyCallbackPath = proxyCallbackPath; - } - - @Override - public String getProxyCallbackUrl() { - if (proxyCallbackPath == null) { - return null; - } - String path = context.getContextPath() + proxyCallbackPath; - return UrlUtils.buildFullRequestUrl(context.getScheme(), context.getServerName(), - context.getServerPort(), path, null); - } - - @Override - public String getServiceUrl() { - return UrlUtils.buildFullRequestUrl(context.getScheme(), context.getServerName(), - context.getServerPort(), context.getRequestURI(), null); - } -} diff --git a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/DynamicProxyCallbackUrlCasAuthenticationProvider.java b/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/DynamicProxyCallbackUrlCasAuthenticationProvider.java deleted file mode 100644 index 42dc5ff..0000000 --- a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/DynamicProxyCallbackUrlCasAuthenticationProvider.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.kakawait.security.cas; - -import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; -import org.springframework.security.cas.authentication.CasAuthenticationProvider; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; - -/** - * @author Thibaud Leprêtre - * @deprecated Please use new artifact id {@code spring-security-cas-extension} - */ -@Deprecated -public class DynamicProxyCallbackUrlCasAuthenticationProvider extends CasAuthenticationProvider { - @Override - public Authentication authenticate(Authentication authentication) throws AuthenticationException { - if (authentication.getDetails() instanceof ProxyCallbackAndServiceAuthenticationDetails && - getTicketValidator() instanceof Cas20ServiceTicketValidator) { - String proxyCallbackUrl = ((ProxyCallbackAndServiceAuthenticationDetails) authentication.getDetails()) - .getProxyCallbackUrl(); - ((Cas20ServiceTicketValidator) getTicketValidator()).setProxyCallbackUrl(proxyCallbackUrl); - } - return super.authenticate(authentication); - } -} diff --git a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/LaxServiceProperties.java b/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/LaxServiceProperties.java deleted file mode 100644 index d93ecf2..0000000 --- a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/LaxServiceProperties.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.kakawait.security.cas; - -import org.springframework.security.cas.ServiceProperties; -import org.springframework.util.Assert; - -/** - * @author Thibaud Leprêtre - * @deprecated Please use new artifact id {@code spring-security-cas-extension} - */ -@Deprecated -public class LaxServiceProperties extends ServiceProperties { - - @Override - public void afterPropertiesSet() throws Exception { - Assert.hasLength(getArtifactParameter(), "artifactParameter cannot be empty."); - Assert.hasLength(getServiceParameter(), "serviceParameter cannot be empty."); - } -} diff --git a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/ProxyCallbackAndServiceAuthenticationDetails.java b/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/ProxyCallbackAndServiceAuthenticationDetails.java deleted file mode 100644 index 1620367..0000000 --- a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/ProxyCallbackAndServiceAuthenticationDetails.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.kakawait.security.cas; - -import org.springframework.security.cas.web.authentication.ServiceAuthenticationDetails; - -/** - * @author Thibaud Leprêtre - * @deprecated Please use new artifact id {@code spring-security-cas-extension} - */ -@Deprecated -public interface ProxyCallbackAndServiceAuthenticationDetails extends ServiceAuthenticationDetails { - String getProxyCallbackUrl(); -} diff --git a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/ProxyCallbackAndServiceAuthenticationDetailsSource.java b/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/ProxyCallbackAndServiceAuthenticationDetailsSource.java deleted file mode 100644 index fde25f9..0000000 --- a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/ProxyCallbackAndServiceAuthenticationDetailsSource.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.kakawait.security.cas; - -import org.springframework.security.cas.ServiceProperties; -import org.springframework.security.cas.web.authentication.ServiceAuthenticationDetails; -import org.springframework.security.cas.web.authentication.ServiceAuthenticationDetailsSource; - -import javax.servlet.http.HttpServletRequest; - -/** - * @author Thibaud Leprêtre - * @deprecated Please use new artifact id {@code spring-security-cas-extension} - */ -@Deprecated -public class ProxyCallbackAndServiceAuthenticationDetailsSource extends ServiceAuthenticationDetailsSource { - private final String proxyCallbackPath; - - public ProxyCallbackAndServiceAuthenticationDetailsSource(ServiceProperties serviceProperties, - String proxyCallbackPath) { - super(serviceProperties); - this.proxyCallbackPath = proxyCallbackPath; - } - - @Override - public ServiceAuthenticationDetails buildDetails(HttpServletRequest context) { - return new DefaultProxyCallbackAndServiceAuthenticationDetails(context, proxyCallbackPath); - } -} diff --git a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/RequestAwareCasAuthenticationEntryPoint.java b/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/RequestAwareCasAuthenticationEntryPoint.java deleted file mode 100644 index 5948b58..0000000 --- a/cas-security-dynamic-service-resolver/src/main/java/com/kakawait/security/cas/RequestAwareCasAuthenticationEntryPoint.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.kakawait.security.cas; - -import org.jasig.cas.client.util.CommonUtils; -import org.springframework.security.cas.web.CasAuthenticationEntryPoint; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Optional; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author Thibaud Leprêtre - * @deprecated Please use new artifact id {@code spring-security-cas-extension} - */ -@Deprecated -public class RequestAwareCasAuthenticationEntryPoint extends CasAuthenticationEntryPoint { - - private final String loginPath; - - public RequestAwareCasAuthenticationEntryPoint(String loginPath) { - this.loginPath = loginPath; - } - - @Override - public void afterPropertiesSet() throws Exception { - Assert.hasLength(getLoginUrl(), "loginUrl must be specified"); - Assert.notNull(getServiceProperties(), "serviceProperties must be specified"); - } - - @Override - protected String createServiceUrl(HttpServletRequest request, HttpServletResponse response) { - String serviceUrl = buildUrl(request, loginPath).orElse(loginPath); - return CommonUtils.constructServiceUrl(null, response, serviceUrl, null, - getServiceProperties().getServiceParameter(), getServiceProperties().getArtifactParameter(), true); - } - - private static Optional buildUrl(HttpServletRequest request, String path) { - Assert.notNull(request, "request is required; it must not be null"); - Assert.isTrue(!StringUtils.isEmpty(path), "path is required, it must not be null or empty"); - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - return Optional.of(getBaseUrl(request, true) + path); - } - } catch (URISyntaxException e) { - // Do nothing - } - return Optional.empty(); - } - - static String getBaseUrl(HttpServletRequest request, boolean withContextPath) { - String uri = request.getRequestURI(); - StringBuilder url = new StringBuilder(request.getRequestURL()); - String contextPath = request.getContextPath(); - return url.substring(0, url.length() - uri.length() + (withContextPath ? contextPath.length() : 0)); - } -} diff --git a/pom.xml b/pom.xml index 7edf17d..d2d2617 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,6 @@ spring-security-cas-extension cas-security-spring-boot-starter cas-security-spring-boot-autoconfigure - cas-security-dynamic-service-resolver