Merge branch 'master' into CASC-200-rebasefail

Conflicts:
	cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
This commit is contained in:
Scott 2014-12-07 12:11:42 -05:00
commit 4d8057462f
21 changed files with 92 additions and 38 deletions

10
NOTICE
View File

@ -16,21 +16,22 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
Apache Log4j under The Apache Software License, Version 2.0
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Apache XML Security under The Apache Software License, Version 2.0
Atlassian JIRA - Code - Core under Atlassian End User License
Atlassian Seraph under BSD License
atlassian-osuser under BSD License
Bouncy Castle Provider under Bouncy Castle Licence
catalina under Apache License, Version 2.0
Codec under The Apache Software License, Version 2.0
com.atlassian.confluence:confluence under Atlassian End User License
com.atlassian.event:atlassian-event under Atlassian End User License
com.atlassian.jira:jira-core under Atlassian End User License
com.atlassian.osuser:atlassian-osuser under Atlassian End User License
com.atlassian.seraph:atlassian-seraph under Atlassian End User License
Commons Codec under The Apache Software License, Version 2.0
commons-collections under Apache License, Version 2.0
Confluence Core under Atlassian End User License
Ehcache Core under The Apache Software License, Version 2.0
ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
Google Collections Library under The Apache Software License, Version 2.0
@ -49,7 +50,6 @@ This project includes:
JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
JavaMail API under Common Development and Distribution License (CDDL) v1.0
JBoss Application Server Tomcat under lgpl
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
Apache Log4j under The Apache Software License, Version 2.0
Apache Santuario under The Apache Software License, Version 2.0
@ -30,7 +31,6 @@ This project includes:
Java Servlet API under CDDL + GPLv2 with classpath exception
JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
JavaMail API under Common Development and Distribution License (CDDL) v1.0
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
<artifactId>cas-client</artifactId>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -55,6 +55,11 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
/** Url connection factory to use when communicating with the server **/
private final HttpURLConnectionFactory urlConnectionFactory;
@Deprecated
public Cas20ProxyRetriever(final String casServerUrl, final String encoding) {
this(casServerUrl, encoding, null);
}
/**
* Main Constructor.
*
@ -75,7 +80,13 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
CommonUtils.assertNotNull(targetService, "targetService cannot be null.");
final URL url = constructUrl(proxyGrantingTicketId, targetService);
final String response = CommonUtils.getResponseFromServer(url, this.urlConnectionFactory, this.encoding);
final String response;
if (this.urlConnectionFactory != null) {
response = CommonUtils.getResponseFromServer(url, this.urlConnectionFactory, this.encoding);
} else {
response = CommonUtils.getResponseFromServer(url, this.encoding);
}
final String error = XmlUtils.getTextForElement(response, "proxyFailure");
if (CommonUtils.isNotEmpty(error)) {

View File

@ -67,7 +67,7 @@ public final class SingleSignOutHandler {
private String relayStateParameterName = ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue();
/** The prefix url of the CAS server */
private String casServerUrlPrefix;
private String casServerUrlPrefix = "";
private boolean artifactParameterOverPost = false;
@ -75,6 +75,8 @@ public final class SingleSignOutHandler {
private List<String> safeParameters;
private LogoutStrategy logoutStrategy = isServlet30() ? new Servlet30LogoutStrategy() : new Servlet25LogoutStrategy();
public void setSessionMappingStorage(final SessionMappingStorage storage) {
this.sessionMappingStorage = storage;
}
@ -138,6 +140,10 @@ public final class SingleSignOutHandler {
CommonUtils.assertNotNull(this.relayStateParameterName, "relayStateParameterName cannot be null.");
CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
if (CommonUtils.isBlank(this.casServerUrlPrefix)) {
logger.warn("Front Channel single sign out redirects are disabled when the 'casServerUrlPrefix' value is not set.");
}
if (this.artifactParameterOverPost) {
this.safeParameters = Arrays.asList(this.logoutParameterName, this.artifactParameterName);
} else {
@ -173,14 +179,15 @@ public final class SingleSignOutHandler {
}
/**
* Determines whether the given request is a CAS front channel logout request.
* Determines whether the given request is a CAS front channel logout request. Front Channel log out requests are only supported
* when the 'casServerUrlPrefix' value is set.
*
* @param request HTTP request.
*
* @return True if request is logout request, false otherwise.
*/
private boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
return "GET".equals(request.getMethod())
return "GET".equals(request.getMethod()) && CommonUtils.isNotBlank(this.casServerUrlPrefix)
&& CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.frontLogoutParameterName));
}
@ -303,11 +310,7 @@ public final class SingleSignOutHandler {
} catch (final IllegalStateException e) {
logger.debug("Error invalidating session.", e);
}
try {
request.logout();
} catch (final ServletException e) {
logger.debug("Error performing request.logout.");
}
this.logoutStrategy.logout(request);
}
}
}
@ -342,4 +345,39 @@ public final class SingleSignOutHandler {
private boolean isMultipartRequest(final HttpServletRequest request) {
return request.getContentType() != null && request.getContentType().toLowerCase().startsWith("multipart");
}
private static boolean isServlet30() {
try {
return HttpServletRequest.class.getMethod("logout") != null;
} catch (final NoSuchMethodException e) {
return false;
}
}
/**
* Abstracts the ways we can force logout with the Servlet spec.
*/
private interface LogoutStrategy {
void logout(HttpServletRequest request);
}
private class Servlet25LogoutStrategy implements LogoutStrategy {
public void logout(final HttpServletRequest request) {
// nothing additional to do here
}
}
private class Servlet30LogoutStrategy implements LogoutStrategy {
public void logout(final HttpServletRequest request) {
try {
request.logout();
} catch (final ServletException e) {
logger.debug("Error performing request.logout.");
}
}
}
}

View File

@ -375,11 +375,16 @@ public final class CommonUtils {
*/
@Deprecated
public static String getResponseFromServer(final String constructedUrl, final String encoding) {
try {
return getResponseFromServer(new URL(constructedUrl), DEFAULT_URL_CONNECTION_FACTORY, encoding);
} catch (final Exception e) {
throw new RuntimeException(e);
}
try {
return getResponseFromServer(new URL(constructedUrl), DEFAULT_URL_CONNECTION_FACTORY, encoding);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
@Deprecated
public static String getResponseFromServer(final URL constructedUrl, final String encoding) {
return getResponseFromServer(constructedUrl, DEFAULT_URL_CONNECTION_FACTORY, encoding);
}
/**

View File

@ -16,13 +16,14 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Atlassian Event under Atlassian End User License
Atlassian JIRA - Code - Core under Atlassian End User License
Atlassian Seraph under BSD License
atlassian-osuser under BSD License
Atlassian Seraph under Atlassian End User License
atlassian-osuser under Atlassian End User License
Bouncy Castle Provider under Bouncy Castle Licence
Codec under The Apache Software License, Version 2.0
commons-collections under Apache License, Version 2.0
@ -33,7 +34,6 @@ This project includes:
Jasig CAS Client for Java - Atlassian Integration under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
<artifactId>cas-client</artifactId>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@ -27,7 +28,6 @@ This project includes:
Jasig CAS Client for Java - JBoss Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JBoss Application Server Tomcat under lgpl
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
<artifactId>cas-client</artifactId>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@ -26,7 +27,6 @@ This project includes:
Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>cas-client</artifactId>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@ -28,7 +29,6 @@ This project includes:
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 6.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>cas-client</artifactId>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@ -27,7 +28,6 @@ This project includes:
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>cas-client</artifactId>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@ -27,7 +28,6 @@ This project includes:
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>cas-client</artifactId>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache

View File

@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
"Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@ -27,7 +28,6 @@ This project includes:
Jasig CAS Client for Java - Distributed Proxy Storage Support:
Memcached under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>cas-client</artifactId>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jasig.cas.client</groupId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
<artifactId>cas-client</artifactId>
<packaging>pom</packaging>