diff --git a/NOTICE b/NOTICE index 5de596c..44db3d1 100644 --- a/NOTICE +++ b/NOTICE @@ -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 diff --git a/cas-client-core/NOTICE b/cas-client-core/NOTICE index 68fc9d2..2297c6f 100644 --- a/cas-client-core/NOTICE +++ b/cas-client-core/NOTICE @@ -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 diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml index f37b084..b0de44b 100644 --- a/cas-client-core/pom.xml +++ b/cas-client-core/pom.xml @@ -1,7 +1,7 @@ org.jasig.cas.client - 3.3.3-SNAPSHOT + 3.3.4-SNAPSHOT cas-client 4.0.0 diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java index 1146b48..e80304a 100644 --- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java +++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java @@ -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)) { diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java index cc049f7..162c7b9 100644 --- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java +++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java @@ -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 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."); + } + } + } } 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 ac0ca80..5f2ca61 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 @@ -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); } /** diff --git a/cas-client-integration-atlassian/NOTICE b/cas-client-integration-atlassian/NOTICE index 5d2091c..502f172 100644 --- a/cas-client-integration-atlassian/NOTICE +++ b/cas-client-integration-atlassian/NOTICE @@ -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 diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml index d94bbd5..96895e9 100644 --- a/cas-client-integration-atlassian/pom.xml +++ b/cas-client-integration-atlassian/pom.xml @@ -1,7 +1,7 @@ org.jasig.cas.client - 3.3.3-SNAPSHOT + 3.3.4-SNAPSHOT cas-client 4.0.0 diff --git a/cas-client-integration-jboss/NOTICE b/cas-client-integration-jboss/NOTICE index 2feec28..d373708 100644 --- a/cas-client-integration-jboss/NOTICE +++ b/cas-client-integration-jboss/NOTICE @@ -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 diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml index f2de056..5a118ea 100644 --- a/cas-client-integration-jboss/pom.xml +++ b/cas-client-integration-jboss/pom.xml @@ -1,7 +1,7 @@ org.jasig.cas.client - 3.3.3-SNAPSHOT + 3.3.4-SNAPSHOT cas-client 4.0.0 diff --git a/cas-client-integration-tomcat-common/NOTICE b/cas-client-integration-tomcat-common/NOTICE index 434c58a..7c109fc 100644 --- a/cas-client-integration-tomcat-common/NOTICE +++ b/cas-client-integration-tomcat-common/NOTICE @@ -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 diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml index e72e953..06a1c33 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.3.3-SNAPSHOT + 3.3.4-SNAPSHOT 4.0.0 diff --git a/cas-client-integration-tomcat-v6/NOTICE b/cas-client-integration-tomcat-v6/NOTICE index bc86731..05565bb 100644 --- a/cas-client-integration-tomcat-v6/NOTICE +++ b/cas-client-integration-tomcat-v6/NOTICE @@ -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 diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml index 067fa1b..5d40ce4 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.3.3-SNAPSHOT + 3.3.4-SNAPSHOT 4.0.0 diff --git a/cas-client-integration-tomcat-v7/NOTICE b/cas-client-integration-tomcat-v7/NOTICE index 0fe413f..c129bf4 100644 --- a/cas-client-integration-tomcat-v7/NOTICE +++ b/cas-client-integration-tomcat-v7/NOTICE @@ -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 diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml index 4139880..5bc817d 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.3.3-SNAPSHOT + 3.3.4-SNAPSHOT 4.0.0 diff --git a/cas-client-support-distributed-ehcache/NOTICE b/cas-client-support-distributed-ehcache/NOTICE index cef121a..e355d62 100644 --- a/cas-client-support-distributed-ehcache/NOTICE +++ b/cas-client-support-distributed-ehcache/NOTICE @@ -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 diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml index d556557..1e1f712 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.3.3-SNAPSHOT + 3.3.4-SNAPSHOT 4.0.0 Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache diff --git a/cas-client-support-distributed-memcached/NOTICE b/cas-client-support-distributed-memcached/NOTICE index ba79611..2fe29a8 100644 --- a/cas-client-support-distributed-memcached/NOTICE +++ b/cas-client-support-distributed-memcached/NOTICE @@ -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 diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml index 3143fdb..52a8640 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.3.3-SNAPSHOT + 3.3.4-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index c51b43e..70befae 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 org.jasig.cas.client - 3.3.3-SNAPSHOT + 3.3.4-SNAPSHOT cas-client pom