diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml index 85e7115..1d25ae1 100644 --- a/cas-client-core/pom.xml +++ b/cas-client-core/pom.xml @@ -123,6 +123,21 @@ + + + xml-security + xmlsec + 1.3.0 + runtime + + + + opensaml + opensaml + 1.1b + jar + compile + false diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AbstractCasFilter.java index 9db575e..3c743e1 100644 --- a/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AbstractCasFilter.java +++ b/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AbstractCasFilter.java @@ -61,12 +61,12 @@ public abstract class AbstractCasFilter implements Filter { * The name of the server in the following format: : where * port is optional if its a standard port. */ - private final String serverName; + private final String service; /** * The exact service url to match to. */ - private final String serviceUrl; + private final boolean isServerName; /** * Whether to store the entry in session or not. Defaults to true. @@ -74,20 +74,18 @@ public abstract class AbstractCasFilter implements Filter { private final boolean useSession; - protected AbstractCasFilter(final String serverName, final String serviceUrl) { - this(serverName, serviceUrl, true); + protected AbstractCasFilter(final String service, final boolean isServerName) { + this(service, isServerName, true); } - protected AbstractCasFilter(final String serverName, final String serviceUrl, final boolean useSession) { - CommonUtils.assertTrue(CommonUtils.isNotBlank(serverName) - || CommonUtils.isNotBlank(serviceUrl), - "either serverName or serviceUrl must be set"); + protected AbstractCasFilter(final String service, final boolean isServerName, final boolean useSession) { + CommonUtils.assertNotNull(service, "service must be set"); - this.serverName = serverName; - this.serviceUrl = serviceUrl; + this.service = service; + this.isServerName = isServerName; this.useSession = useSession; - log.info("Service Name set to: " + this.serverName + "; Service Url set to: " + this.serviceUrl + "Use Session set to: " + this.useSession); + log.info("Service set to: " + this.service + "; Is Server Name? set to: " + this.isServerName + "Use Session set to: " + this.useSession); } public final void destroy() { @@ -120,15 +118,15 @@ public abstract class AbstractCasFilter implements Filter { */ protected final String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response) { - if (CommonUtils.isNotBlank(this.serviceUrl)) { - return response.encodeURL(this.serviceUrl); + if (!isServerName) { + return response.encodeURL(this.service); } final StringBuffer buffer = new StringBuffer(); synchronized (buffer) { buffer.append(request.isSecure() ? "https://" : "http://"); - buffer.append(this.serverName); + buffer.append(this.service); buffer.append(request.getRequestURI()); if (CommonUtils.isNotBlank(request.getQueryString())) { diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AuthenticationFilter.java index e5d7a13..f403238 100644 --- a/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AuthenticationFilter.java +++ b/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AuthenticationFilter.java @@ -41,16 +41,16 @@ public final class AuthenticationFilter extends AbstractCasFilter { */ private final boolean gateway; - public AuthenticationFilter(final String serverName, final String serviceUrl, final String casServerLoginUrl) { - this(serverName, serviceUrl, true, casServerLoginUrl, false, false); + public AuthenticationFilter(final String serverName, final boolean isServerName, final String casServerLoginUrl) { + this(serverName, isServerName, true, casServerLoginUrl, false, false); } - public AuthenticationFilter(final String serverName, final String serviceUrl, final String casServerLoginUrl, boolean renew, boolean gateway) { - this(serverName, serviceUrl, true, casServerLoginUrl, renew, gateway); + public AuthenticationFilter(final String serverName, final boolean isServerName, final String casServerLoginUrl, boolean renew, boolean gateway) { + this(serverName, isServerName, true, casServerLoginUrl, renew, gateway); } - public AuthenticationFilter(String serverName, String serviceUrl, boolean useSession, String casServerLoginUrl, boolean renew, boolean gateway) { - super(serverName, serviceUrl, useSession); + public AuthenticationFilter(final String serverName, final boolean isServerName, final boolean useSession, String casServerLoginUrl, final boolean renew, final boolean gateway) { + super(serverName, isServerName, useSession); CommonUtils.assertNotNull(casServerLoginUrl, "the CAS Server Login URL cannot be null."); this.casServerLoginUrl = casServerLoginUrl; diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/TicketValidationFilter.java index 0a2be53..723b39b 100644 --- a/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/TicketValidationFilter.java +++ b/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/TicketValidationFilter.java @@ -51,39 +51,39 @@ public final class TicketValidationFilter extends AbstractCasFilter { /** * Constructor that takes the severName (or serviceUrl) and the TicketValidator. Either serveName or serviceUrl is required (but not both). * - * @param serverName the name of the server in : combination, if using a non-standard port. - * @param serviceUrl the url to always redirect to. + * @param service the name of the server in : combination, if using a non-standard port or the fully qualified url. + * @param isServerName whether the service is the host name or the fully qualified url. * @param ticketValidator the validator to validate the tickets. */ - public TicketValidationFilter(final String serverName, final String serviceUrl, final TicketValidator ticketValidator) { - this(serverName, serviceUrl, true, ticketValidator, false); + public TicketValidationFilter(final String service, final boolean isServerName, final TicketValidator ticketValidator) { + this(service, isServerName, true, ticketValidator, false); } /** * Constructor that takes the severName (or serviceUrl), TicketValidator, useSession and redirectAfterValidation. Either serveName or serviceUrl is required (but not both). * - * @param serverName the name of the server in : combination, if using a non-standard port. - * @param serviceUrl the url to always redirect to. + * @param service the name of the server in : combination, if using a non-standard port or the fully qualified url. + * @param isServerName whether the service is the host name or the fully qualified url. * @param useSession flag to set whether to store stuff in the session. * @param ticketValidator the validator to validate the tickets. * @param redirectAfterValidation whether to redirect to remove the ticket. */ - public TicketValidationFilter(final String serverName, final String serviceUrl, final boolean useSession, final TicketValidator ticketValidator, final boolean redirectAfterValidation) { - this(serverName, serviceUrl, useSession, ticketValidator, redirectAfterValidation, true); + public TicketValidationFilter(final String service, final boolean isServerName, final boolean useSession, final TicketValidator ticketValidator, final boolean redirectAfterValidation) { + this(service, isServerName, useSession, ticketValidator, redirectAfterValidation, true); } /** * Constructor that takes the severName (or serviceUrl), TicketValidator, useSession and redirectAfterValidation. Either serveName or serviceUrl is required (but not both). * - * @param serverName the name of the server in : combination, if using a non-standard port. - * @param serviceUrl the url to always redirect to. + * @param service the name of the server in : combination, if using a non-standard port or the fully qualified url. + * @param isServerName whether the service is the host name or the fully qualified url. * @param useSession flag to set whether to store stuff in the session. * @param ticketValidator the validator to validate the tickets. * @param redirectAfterValidation whether to redirect to remove the ticket. * @param exceptionOnValidationFailure whether to throw an exception if there is a validation failure or not. */ - public TicketValidationFilter(final String serverName, final String serviceUrl, final boolean useSession, final TicketValidator ticketValidator, final boolean redirectAfterValidation, final boolean exceptionOnValidationFailure) { - super(serverName, serviceUrl, useSession); + public TicketValidationFilter(final String service, final boolean isServerName, final boolean useSession, final TicketValidator ticketValidator, final boolean redirectAfterValidation, final boolean exceptionOnValidationFailure) { + super(service, isServerName, useSession); CommonUtils.assertNotNull(ticketValidator, "ticketValidator cannot be null."); this.ticketValidator = ticketValidator; diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/web/filter/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/web/filter/AuthenticationFilterTests.java index 7e83d73..134f4c8 100644 --- a/cas-client-core/src/test/java/org/jasig/cas/client/web/filter/AuthenticationFilterTests.java +++ b/cas-client-core/src/test/java/org/jasig/cas/client/web/filter/AuthenticationFilterTests.java @@ -36,7 +36,7 @@ public final class AuthenticationFilterTests extends TestCase { private AuthenticationFilter filter; protected void setUp() throws Exception { - this.filter = new AuthenticationFilter(null, CAS_SERVICE_URL, CAS_LOGIN_URL, false, false); + this.filter = new AuthenticationFilter(CAS_SERVICE_URL, false, CAS_LOGIN_URL, false, false); this.filter.init(new MockFilterConfig()); } @@ -80,7 +80,7 @@ public final class AuthenticationFilterTests extends TestCase { }; request.setSession(session); - this.filter = new AuthenticationFilter("localhost:8443", null, CAS_LOGIN_URL, false, false); + this.filter = new AuthenticationFilter("localhost:8443", true, CAS_LOGIN_URL, false, false); this.filter.doFilter(request, response, filterChain); assertEquals(CAS_LOGIN_URL @@ -122,7 +122,7 @@ public final class AuthenticationFilterTests extends TestCase { } }; - this.filter = new AuthenticationFilter("localhost:8443", null, CAS_LOGIN_URL, true, false); + this.filter = new AuthenticationFilter("localhost:8443", true, CAS_LOGIN_URL, true, false); request.setSession(session); this.filter.doFilter(request, response, filterChain); @@ -143,7 +143,7 @@ public final class AuthenticationFilterTests extends TestCase { }; request.setSession(session); - this.filter = new AuthenticationFilter("localhost:8443", null, CAS_LOGIN_URL, true, true); + this.filter = new AuthenticationFilter("localhost:8443", true, CAS_LOGIN_URL, true, true); this.filter.doFilter(request, response, filterChain); assertNotNull(session.getAttribute(AbstractCasFilter.CONST_GATEWAY)); assertNotNull(response.getRedirectedUrl()); diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/web/filter/ValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/web/filter/ValidationFilterTests.java index 6622b52..f9681a3 100644 --- a/cas-client-core/src/test/java/org/jasig/cas/client/web/filter/ValidationFilterTests.java +++ b/cas-client-core/src/test/java/org/jasig/cas/client/web/filter/ValidationFilterTests.java @@ -34,7 +34,7 @@ public final class ValidationFilterTests extends TestCase { private TicketValidationFilter filter; protected void setUp() throws Exception { - this.filter = new TicketValidationFilter("localhost:8443", null, new TicketValidator() { + this.filter = new TicketValidationFilter("localhost:8443", true, new TicketValidator() { public Assertion validate(final String ticketId, final Service service) throws ValidationException { diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilter.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilter.java index 9e6d037..c57ea8b 100644 --- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilter.java +++ b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilter.java @@ -30,12 +30,12 @@ import java.io.IOException; public final class ThreadLocalAwareCasServiceFilter extends AbstractCasFilter { - public ThreadLocalAwareCasServiceFilter(final String serverName, final String serviceUrl) { - super(serverName, serviceUrl); + public ThreadLocalAwareCasServiceFilter(final String service, final boolean isServerName) { + super(service, isServerName); } - public ThreadLocalAwareCasServiceFilter(final String serverName, final String serviceUrl, final boolean useSession) { - super(serverName, serviceUrl, useSession); + public ThreadLocalAwareCasServiceFilter(final String service, final boolean isServerName, final boolean useSession) { + super(service, isServerName, useSession); } protected void doFilterInternal(final HttpServletRequest request, diff --git a/cas-client-uportal/src/test/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilterTests.java b/cas-client-uportal/src/test/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilterTests.java index 2a2f2b2..e05dae4 100644 --- a/cas-client-uportal/src/test/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilterTests.java +++ b/cas-client-uportal/src/test/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilterTests.java @@ -22,7 +22,7 @@ public final class ThreadLocalAwareCasServiceFilterTests extends TestCase { protected void setUp() throws Exception { - this.filter = new ThreadLocalAwareCasServiceFilter(null, "http://localhost"); + this.filter = new ThreadLocalAwareCasServiceFilter("http://localhost", false); } public void testServiceSetter() throws IOException, ServletException { diff --git a/pom.xml b/pom.xml index 7104f86..e5f5b05 100644 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ scm:cvs:pserver:anonymous:@developer.ja-sig.org:2401/home/cvs/jasig:cas-clients/java-client - scm:cvs:pserver:${username}@developer.ja-sig.org:/home/cvs/jasig:cas-clients/java-client + scm:cvs:pserver:${username}@developer.ja-sig.org:2401/home/cvs/jasig:cas-clients/java-client http://developer.ja-sig.org/source/browse/jasig/cas-clients/java-client @@ -115,7 +115,7 @@ cas cas-server - 3.0.5 + 3.1-SNAPSHOT compile