org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
cas-client
4.0.0
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 75cdc0c..c69cf2a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -46,6 +46,7 @@ import java.util.Map;
* casServerLoginUrl - the url to log into CAS, i.e. https://cas.rutgers.edu/login
* renew - true/false on whether to use renew or not.
* gateway - true/false on whether to use gateway or not.
+ * method - the method used by the CAS server to send the user back to the application (redirect or post).
*
*
* Please see AbstractCasFilter for additional properties.
@@ -70,6 +71,11 @@ public class AuthenticationFilter extends AbstractCasFilter {
*/
private boolean gateway = false;
+ /**
+ * The method used by the CAS server to send the user back to the application.
+ */
+ private String method;
+
private GatewayResolver gatewayStorage = new DefaultGatewayResolverImpl();
private AuthenticationRedirectStrategy authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
@@ -107,6 +113,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
setRenew(getBoolean(ConfigurationKeys.RENEW));
setGateway(getBoolean(ConfigurationKeys.GATEWAY));
+ setMethod(getString(ConfigurationKeys.METHOD));
final String ignorePattern = getString(ConfigurationKeys.IGNORE_PATTERN);
final String ignoreUrlPatternType = getString(ConfigurationKeys.IGNORE_URL_PATTERN_TYPE);
@@ -195,7 +202,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
logger.debug("Constructed service url: {}", modifiedServiceUrl);
final String urlToRedirectTo = CommonUtils.constructRedirectUrl(this.casServerLoginUrl,
- getProtocol().getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway);
+ getProtocol().getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway, this.method);
logger.debug("redirecting to \"{}\"", urlToRedirectTo);
this.authenticationRedirectStrategy.redirect(request, response, urlToRedirectTo);
@@ -209,6 +216,10 @@ public class AuthenticationFilter extends AbstractCasFilter {
this.gateway = gateway;
}
+ public void setMethod(final String method) {
+ this.method = method;
+ }
+
public final void setCasServerUrlPrefix(final String casServerUrlPrefix) {
setCasServerLoginUrl(CommonUtils.addTrailingSlash(casServerUrlPrefix) + "login");
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
index d9b6ea6..e89efed 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
@@ -49,6 +49,7 @@ public interface ConfigurationKeys {
ConfigurationKey IGNORE_CASE = new ConfigurationKey("ignoreCase", Boolean.FALSE);
ConfigurationKey CAS_SERVER_LOGIN_URL = new ConfigurationKey("casServerLoginUrl", null);
ConfigurationKey GATEWAY = new ConfigurationKey("gateway", Boolean.FALSE);
+ ConfigurationKey METHOD = new ConfigurationKey("method", null);
ConfigurationKey> AUTHENTICATION_REDIRECT_STRATEGY_CLASS = new ConfigurationKey>("authenticationRedirectStrategyClass", null);
ConfigurationKey> GATEWAY_STORAGE_CLASS = new ConfigurationKey>("gatewayStorageClass", DefaultGatewayResolverImpl.class);
ConfigurationKey CAS_SERVER_URL_PREFIX = new ConfigurationKey("casServerUrlPrefix", null);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index d227271..77fef14 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -25,6 +25,7 @@ import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
/**
* Abstract filter that contains code that is common to all CAS filters.
@@ -140,6 +141,7 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
* @return the ticket if its found, null otherwise.
*/
protected String retrieveTicketFromRequest(final HttpServletRequest request) {
- return CommonUtils.safeGetParameter(request, this.protocol.getArtifactParameterName());
+ return CommonUtils.safeGetParameter(request, this.protocol.getArtifactParameterName(),
+ Arrays.asList(this.protocol.getArtifactParameterName()));
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index cabb34b..fe13922 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -179,12 +179,14 @@ public final class CommonUtils {
* @param serviceUrl the actual service's url.
* @param renew whether we should send renew or not.
* @param gateway where we should send gateway or not.
+ * @param method the method used by the CAS server to send the user back to the application.
* @return the fully constructed redirect url.
*/
public static String constructRedirectUrl(final String casServerLoginUrl, final String serviceParameterName,
- final String serviceUrl, final boolean renew, final boolean gateway) {
+ final String serviceUrl, final boolean renew, final boolean gateway, final String method) {
return casServerLoginUrl + (casServerLoginUrl.contains("?") ? "&" : "?") + serviceParameterName + "="
- + urlEncode(serviceUrl) + (renew ? "&renew=true" : "") + (gateway ? "&gateway=true" : "");
+ + urlEncode(serviceUrl) + (renew ? "&renew=true" : "") + (gateway ? "&gateway=true" : "")
+ + (method != null ? "&method=" + method : "");
}
/**
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index e060662..e44a882 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -41,7 +41,9 @@ public final class CommonUtilsTests extends TestCase {
public void testRedirectUrlWithParam() {
final String loginUrl = "http://localhost:8080/login?myName=foo";
- final String fullyConstructedUrl = CommonUtils.constructRedirectUrl(loginUrl, "foo", "foo", false, false);
+ final String fullyConstructedUrl = CommonUtils.constructRedirectUrl(loginUrl, "foo", "foo", false, false, null);
+
+ assertEquals("http://localhost:8080/login?myName=foo&foo=foo", fullyConstructedUrl);
int count = 0;
final char[] chars = fullyConstructedUrl.toCharArray();
@@ -55,6 +57,13 @@ public final class CommonUtilsTests extends TestCase {
assertEquals(1, count);
}
+ public void testRedirectUrlWithMethod() {
+ final String loginUrl = "http://localhost:8080/login";
+ final String redirectUrl = CommonUtils.constructRedirectUrl(loginUrl, "foo", "foo", true, true, "post");
+
+ assertEquals("http://localhost:8080/login?foo=foo&renew=true&gateway=true&method=post", redirectUrl);
+ }
+
public void testAssertNotNull() {
final String CONST_MESSAGE = "test";
CommonUtils.assertNotNull(new Object(), CONST_MESSAGE);
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 5fb7760..0501f2c 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
cas-client
4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 05194ca..8c1deaf 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
cas-client
4.0.0
diff --git a/cas-client-integration-jetty/pom.xml b/cas-client-integration-jetty/pom.xml
index 968cf95..c28c41d 100644
--- a/cas-client-integration-jetty/pom.xml
+++ b/cas-client-integration-jetty/pom.xml
@@ -3,7 +3,7 @@
cas-client
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
4.0.0
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
index 81477ae..43e68cf 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -237,7 +237,7 @@ public class CasAuthenticator extends AbstractLifeCycle implements Authenticator
final HttpServletRequest request, final HttpServletResponse response) throws ServerAuthException {
try {
final String redirectUrl = CommonUtils.constructRedirectUrl(
- casServerLoginUrl, protocol.getServiceParameterName(), serviceUrl(request, response), renew, false);
+ casServerLoginUrl, protocol.getServiceParameterName(), serviceUrl(request, response), renew, false, null);
logger.debug("Redirecting to {}", redirectUrl);
response.sendRedirect(redirectUrl);
} catch (IOException e) {
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 5375c78..fcfdd28 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-client
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
4.0.0
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
index 9fae1a6..a47c74d 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
@@ -89,7 +89,7 @@ public final class AuthenticatorDelegate {
this.serviceParameterName, this.artifactParameterName, true);
if (CommonUtils.isBlank(token)) {
final String redirectUrl = CommonUtils.constructRedirectUrl(this.casServerLoginUrl,
- this.serviceParameterName, service, false, false);
+ this.serviceParameterName, service, false, false, null);
logger.debug("Redirecting to {}", redirectUrl);
CommonUtils.sendRedirect(response, redirectUrl);
return null;
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index f502ab0..2f6a1ba 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-client
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 37dc8ce..37fa1ae 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-client
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
4.0.0
diff --git a/cas-client-integration-tomcat-v8/pom.xml b/cas-client-integration-tomcat-v8/pom.xml
index 71facef..1c0ca16 100644
--- a/cas-client-integration-tomcat-v8/pom.xml
+++ b/cas-client-integration-tomcat-v8/pom.xml
@@ -3,7 +3,7 @@
cas-client
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
4.0.0
diff --git a/cas-client-integration-tomcat-v85/pom.xml b/cas-client-integration-tomcat-v85/pom.xml
index 764e8e6..94919cc 100644
--- a/cas-client-integration-tomcat-v85/pom.xml
+++ b/cas-client-integration-tomcat-v85/pom.xml
@@ -3,7 +3,7 @@
cas-client
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 9bf5033..2aada53 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-client
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
4.0.0
Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 8004766..6c02ab7 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-client
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
4.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index de8fb4d..5c026c0 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
cas-client
4.0.0
diff --git a/pom.xml b/pom.xml
index 7009c27..4aeb42c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0
org.jasig.cas.client
- 3.5.2-SNAPSHOT
+ 3.6.0-SNAPSHOT
cas-client
pom