diff --git a/cas-client-core/LICENSE.txt b/cas-client-core/LICENSE.txt
deleted file mode 100644
index 30c8573..0000000
--- a/cas-client-core/LICENSE.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-License for Use
-
-Copyright (c) 2000 The JA-SIG Collaborative. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes software developed by the JA-SIG Collaborative
- (http://www.ja-sig.org/)."
-
-This software is provided by the JA-SIG collaborative "as is" and any expressed
-or implied warranties, including, but not limited to, the implied warranties of
-merchantability and fitness for a particular purpose are disclaimed. In no
-event shall the JA-SIG collaborative or its contributors be liable for any
-direct, indirect, incidental, special, exemplary, or consequential damages
-(including, but not limited to, procurement of substitute goods or services;
-loss of use, data, or profits; or business interruption) however caused and on
-any theory of liability, whether in contract, strict liability, or tort
-(including negligence or otherwise) arising in any way out of the use of this
-software, even if advised of the possibility of such damage.
\ No newline at end of file
diff --git a/cas-client-core/README.txt b/cas-client-core/README.txt
deleted file mode 100644
index f5cd476..0000000
--- a/cas-client-core/README.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-CENTRAL AUTHENTICATION SERVICE (CAS)
---------------------------------------------------------------------
-http://www.ja-sig.org/products/cas/
-
-1. INTRODUCTION
-
-The Central Authentication Service (CAS) is the standard mechanism by which web
-applications should authenticate users. Any custom applications written benefit
-from using CAS.
-
-Note that CAS provides authentication; that is, it determines that your users
-are who they say they are. CAS should not be viewed as an access-control system;
-in particular, providers of applications that grant access to anyone who
-possesses a NetID should understand that loose affiliates of an organization may
-be granted NetIDs.
-
-The JA-SIG CAS Client for Java is a support library for Java applications to communicate
-with the CAS server.
-
-2. RELEASE INFO
-
-CAS requires J2SE 1.4 and J2EE1.3.
-
-Release conents:
-* "src/main/java" contains the Java source files for the framework
-* "src/test/java" contains the Java source files for CAS's test suite
-
-
diff --git a/cas-client-core/cas-client-core.iml b/cas-client-core/cas-client-core.iml
deleted file mode 100644
index d595813..0000000
--- a/cas-client-core/cas-client-core.iml
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
The authorization package contains the interface for a simple - abstraction for authorizing users to use an application. It is not a - complete role-based or access control authorization system.
- -For true authorization we recommend you look at the Security for Spring - project.
- - diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractProxyReceptorServlet.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractProxyReceptorServlet.java deleted file mode 100644 index 9ddf21e..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractProxyReceptorServlet.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.proxy; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jasig.cas.client.util.CommonUtils; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * Implementation of an HttpServlet that accepts ProxyGrantingTicketIous and - * ProxyGrantingTickets and stores them in an implementation of - * {@link ProxyGrantingTicketStorage}. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public abstract class AbstractProxyReceptorServlet extends HttpServlet { - - /** - * The name we expect the instance of ProxyGrantingTicketStorage to be - * instanciated under in the applicationContext. - */ - public static final String CONST_PROXY_GRANTING_TICKET_STORAGE_BEAN_NAME = "proxyGrantingTicketStorage"; - - /** - * Constant representing the ProxyGrantingTicket IOU Request Parameter. - */ - private static final String PARAM_PROXY_GRANTING_TICKET_IOU = "pgtIou"; - - /** - * Constant representing the ProxyGrantingTicket Request Parameter. - */ - private static final String PARAM_PROXY_GRANTING_TICKET = "pgtId"; - - /** - * Instance of ProxyGrantingTicketStorage to store ProxyGrantingTickets. - */ - private ProxyGrantingTicketStorage proxyGrantingTicketStorage; - - /** - * Instance of Commons Logging - */ - protected final Log logger = LogFactory.getLog(this.getClass()); - - /** - * Unique Id for Serialization. - */ - private static final long serialVersionUID = 8766956323018042995L; - - protected final void doGet(final HttpServletRequest request, - final HttpServletResponse response) throws ServletException, - IOException { - final String proxyGrantingTicketIou = request - .getParameter(PARAM_PROXY_GRANTING_TICKET_IOU); - - final String proxyGrantingTicket = request - .getParameter(PARAM_PROXY_GRANTING_TICKET); - - if (CommonUtils.isBlank(proxyGrantingTicket) - || CommonUtils.isBlank(proxyGrantingTicketIou)) { - response.getWriter().write(""); - return; - } - - if (logger.isDebugEnabled()) { - logger.debug("Received proxyGrantingTicketId [" - + proxyGrantingTicket + "] for proxyGrantingTicketIou [" - + proxyGrantingTicketIou + "]"); - } - - this.proxyGrantingTicketStorage.save(proxyGrantingTicketIou, - proxyGrantingTicket); - - response.getWriter().write(""); - response - .getWriter() - .write( - "retrieveProxyGrantingTicketStorageFromConfiguration().
- */
- public final void init(final ServletConfig servletConfig) throws ServletException {
- this.proxyGrantingTicketStorage = retrieveProxyGrantingTicketStorageFromConfiguration(servletConfig);
- }
-
- /**
- * Abstract class to retrieve the ProxyGrantingTicketStorage from the ServletConfig. Its up to
- * implementing classes to figure out where they are initializing/retrieving the object from.
- *
- * @param servletConfig the Servlet Config that has access to the ProxyGrantingTicketStorage.
- * @return the initialized ProxyGrantingTicketStorage.
- * @throws ServletException if there is an exception retrieving the ProxyGrantingTicketStorage.
- */
- protected abstract ProxyGrantingTicketStorage retrieveProxyGrantingTicketStorageFromConfiguration(final ServletConfig servletConfig) throws ServletException;
-}
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
deleted file mode 100644
index d49190c..0000000
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.proxy;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jasig.cas.authentication.principal.Service;
-import org.jasig.cas.client.util.CommonUtils;
-import org.jasig.cas.client.util.XmlUtils;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-/**
- * Implementation of a ProxyRetriever that follows the CAS 2.0 specification.
- * For more information on the CAS 2.0 specification, please see the specification
- * document.
- *
- * In general, this class will make a call to the CAS server with some specified
- * parameters and receive an XML response to parse.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class Cas20ProxyRetriever implements ProxyRetriever {
-
- /**
- * Instance of Commons Logging.
- */
- protected final Log log = LogFactory.getLog(this.getClass());
-
- /**
- * Url to CAS server.
- */
- private final String casServerUrl;
-
- /**
- * Instance of HttpClient for connecting to server.
- */
- private final HttpClient httpClient;
-
- /**
- * Main Constructor.
- *
- * @param casServerUrl the URL to the CAS server (i.e. http://localhost/cas/)
- * @param httpClient an Instance of a thread-safe HttpClient.
- */
- public Cas20ProxyRetriever(final String casServerUrl, final HttpClient httpClient) {
- CommonUtils.assertNotNull(casServerUrl,
- "casServerUrl cannot be null.");
- CommonUtils
- .assertNotNull(httpClient, "httpClient cannot be null.");
- this.casServerUrl = casServerUrl;
- this.httpClient = httpClient;
- }
-
- public String getProxyTicketIdFor(final String proxyGrantingTicketId,
- final Service targetService) {
-
- final String url = constructUrl(proxyGrantingTicketId, targetService
- .getId());
-
- final GetMethod method = new GetMethod(url);
- try {
- this.httpClient.executeMethod(method);
- final String response = method.getResponseBodyAsString();
-
- final String error = XmlUtils.getTextForElement(response,
- "proxyFailure");
-
- if (CommonUtils.isNotEmpty(error)) {
- log.debug(error);
- return null;
- }
-
- return XmlUtils.getTextForElement(response, "proxyTicket");
-
- } catch (IOException e) {
- log.error(e, e);
- return null;
- } finally {
- method.releaseConnection();
- }
- }
-
- private String constructUrl(final String proxyGrantingTicketId,
- final String targetService) {
- try {
- return this.casServerUrl + "proxy" + "?pgt="
- + proxyGrantingTicketId + "&targetService="
- + URLEncoder.encode(targetService, "UTF-8");
- } catch (final UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorage.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorage.java
deleted file mode 100644
index c541160..0000000
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.proxy;
-
-/**
- * Interface for the storage and retrieval of ProxyGrantingTicketIds by mapping
- * them to a specific ProxyGrantingTicketIou.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public interface ProxyGrantingTicketStorage {
-
- /**
- * Method to save the ProxyGrantingTicket to the backing storage facility.
- *
- * @param proxyGrantingTicketIou used as the key
- * @param proxyGrantingTicket used as the value
- */
- public void save(String proxyGrantingTicketIou, String proxyGrantingTicket);
-
- /**
- * Method to retrieve a ProxyGrantingTicket based on the
- * ProxyGrantingTicketIou. Note that implementations are not guaranteed to
- * return the same result if retrieve is called twice with the same
- * proxyGrantingTicketIou.
- *
- * @param proxyGrantingTicketIou used as the key
- * @return the ProxyGrantingTicket Id or null if it can't be found
- */
- public String retrieve(String proxyGrantingTicketIou);
-}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorageImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorageImpl.java
deleted file mode 100644
index 0e4283f..0000000
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorageImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.proxy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Implementation of {@link ProxyGrantingTicketStorage} that is backed by a
- * HashMap that keeps a ProxyGrantingTicket for a specified amount of time.
- *
- * A cleanup thread is run periodically to clean out the HashMap.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class ProxyGrantingTicketStorageImpl implements
- ProxyGrantingTicketStorage {
-
- /**
- * Default timeout in milliseconds.
- */
- private static final long DEFAULT_TIMEOUT = 60000;
-
- private final Map cache = new HashMap();
-
- /**
- * Constructor set the timeout to the default value.
- */
- public ProxyGrantingTicketStorageImpl() {
- this(DEFAULT_TIMEOUT);
- }
-
- /**
- * Sets the amount of time to hold on to a ProxyGrantingTicket if its never
- * been retrieved.
- *
- * @param timeout the time to hold on to the ProxyGrantingTicket
- */
- public ProxyGrantingTicketStorageImpl(final long timeout) {
- final Thread thread = new ProxyGrantingTicketCleanupThread(
- timeout, this.cache);
- thread.setDaemon(true);
- thread.start();
- }
-
- /**
- * NOTE: you can only retrieve a ProxyGrantingTicket once with this method.
- * Its removed after retrieval.
- */
- public String retrieve(final String proxyGrantingTicketIou) {
- final ProxyGrantingTicketHolder holder = (ProxyGrantingTicketHolder) this.cache
- .get(proxyGrantingTicketIou);
-
- if (holder == null) {
- return null;
- }
-
- this.cache.remove(holder);
-
- return holder.getProxyGrantingTicket();
- }
-
- public void save(final String proxyGrantingTicketIou,
- final String proxyGrantingTicket) {
- final ProxyGrantingTicketHolder holder = new ProxyGrantingTicketHolder(
- proxyGrantingTicket);
-
- this.cache.put(proxyGrantingTicketIou, holder);
- }
-
- private final class ProxyGrantingTicketHolder {
-
- private final String proxyGrantingTicket;
-
- private final long timeInserted;
-
- protected ProxyGrantingTicketHolder(final String proxyGrantingTicket) {
- this.proxyGrantingTicket = proxyGrantingTicket;
- this.timeInserted = System.currentTimeMillis();
- }
-
- public String getProxyGrantingTicket() {
- return this.proxyGrantingTicket;
- }
-
- final boolean isExpired(final long timeout) {
- return System.currentTimeMillis() - this.timeInserted > timeout;
- }
- }
-
- private final class ProxyGrantingTicketCleanupThread extends Thread {
-
- private final long timeout;
-
- private final Map cache;
-
- public ProxyGrantingTicketCleanupThread(final long timeout,
- final Map cache) {
- this.timeout = timeout;
- this.cache = cache;
- }
-
- public void run() {
-
- while (true) {
- try {
- Thread.sleep(this.timeout);
- } catch (final InterruptedException e) {
- // nothing to do
- }
-
- final List itemsToRemove = new ArrayList();
-
- synchronized (this.cache) {
- for (final Iterator iter = this.cache.keySet().iterator(); iter
- .hasNext();) {
- final Object key = iter.next();
- final ProxyGrantingTicketHolder holder = (ProxyGrantingTicketHolder) this.cache
- .get(key);
-
- if (holder.isExpired(this.timeout)) {
- itemsToRemove.add(key);
- }
- }
-
- for (final Iterator iter = itemsToRemove.iterator(); iter
- .hasNext();) {
- this.cache.remove(iter.next());
- }
- }
- }
- }
- }
-}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyRetriever.java
deleted file mode 100644
index bb69063..0000000
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/ProxyRetriever.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.proxy;
-
-import org.jasig.cas.authentication.principal.Service;
-
-/**
- * Interface to abstract the retrieval of a proxy ticket to make the
- * implementation a black box to the client.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public interface ProxyRetriever {
-
- /**
- * Retrieves a proxy ticket for a specific targetService.
- *
- * @param proxyGrantingTicketId the ProxyGrantingTicketId
- * @param targetService the service we want to proxy.
- * @return the ProxyTicket Id if Granted, null otherwise.
- */
- String getProxyTicketIdFor(String proxyGrantingTicketId,
- Service targetService);
-}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/SpringConfiguredProxyReceptorServlet.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/SpringConfiguredProxyReceptorServlet.java
deleted file mode 100644
index 9074fd2..0000000
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/SpringConfiguredProxyReceptorServlet.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.proxy;
-
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import java.util.Map;
-
-/**
- * Implementation of an HttpServlet that accepts ProxyGrantingTicketIous and
- * ProxyGrantingTickets and stores them in an implementation of
- * {@link ProxyGrantingTicketStorage}.
- *
- * Note that ProxyReceptorServlet attempts to load a
- * {@link ProxyGrantingTicketStorage} from the ApplicationContext either via the
- * name "proxyGrantingTicketStorage" or by type. One of these two must exist
- * within the applicationContext or the initialization of the
- * ProxyReceptorServlet will fail.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class SpringConfiguredProxyReceptorServlet extends
- AbstractProxyReceptorServlet {
-
- /**
- * Unique Id for serialization
- */
- private static final long serialVersionUID = -5642050740265266568L;
-
- protected ProxyGrantingTicketStorage retrieveProxyGrantingTicketStorageFromConfiguration(final ServletConfig servletConfig) throws ServletException {
- final WebApplicationContext context = WebApplicationContextUtils
- .getRequiredWebApplicationContext(servletConfig.getServletContext());
-
- if (context.containsBean(CONST_PROXY_GRANTING_TICKET_STORAGE_BEAN_NAME)) {
- return (ProxyGrantingTicketStorage) context
- .getBean(CONST_PROXY_GRANTING_TICKET_STORAGE_BEAN_NAME,
- ProxyGrantingTicketStorage.class);
- }
-
- final Map map = context
- .getBeansOfType(ProxyGrantingTicketStorage.class);
-
- if (map.isEmpty()) {
- throw new ServletException("No ProxyGrantingTicketStorage found!");
- }
-
- if (map.size() > 1) {
- throw new ServletException(
- "Expecting one ProxyGrantingTicketStorage and found multiple instances.");
- }
-
- return (ProxyGrantingTicketStorage) map.get(map
- .keySet().iterator().next());
- }
-}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/package.html b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/package.html
deleted file mode 100644
index c3cbfc5..0000000
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/package.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-The proxy package includes a servlet to act as a proxy receptor, - an interface for ProxyGrantingTicketStorage and an abstraction for - retrieving proxy tickets.
- - \ No newline at end of file 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 deleted file mode 100644 index 73e511b..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.util; - -import java.util.Collection; - -/** - * Common utilities so that we don't need to include Commons Lang. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public final class CommonUtils { - - private CommonUtils() { - // nothing to do - } - - /** - * Check whether the object is null or not. If it is, throw an exception and - * display the message. - * - * @param object the object to check. - * @param message the message to display if the object is null. - */ - public static void assertNotNull(final Object object, final String message) { - if (object == null) { - throw new IllegalArgumentException(message); - } - } - - /** - * Check whether the collection is null or empty. If it is, throw an - * exception and display the message. - * - * @param c the collecion to check. - * @param message the message to display if the object is null. - */ - public static void assertNotEmpty(final Collection c, final String message) { - assertNotNull(c, message); - if (c.isEmpty()) { - throw new IllegalArgumentException(message); - } - } - - /** - * Assert that the statement is true, otherwise throw an exception with the - * provided message. - * - * @param cond the codition to assert is true. - * @param message the message to display if the condition is not true. - */ - public static void assertTrue(final boolean cond, final String message) { - if (!cond) { - throw new IllegalArgumentException(message); - } - } - - /** - * Determines whether the String is null or of length 0. - * - * @param string the string to check - * @return true if its null or length of 0, false otherwise. - */ - public static boolean isEmpty(final String string) { - return string == null || string.length() == 0; - } - - /** - * Determines if the String is not empty. A string is not empty if it is not - * null and has a length > 0. - * - * @param string the string to check - * @return true if it is not empty, false otherwise. - */ - public static boolean isNotEmpty(final String string) { - return !isEmpty(string); - } - - /** - * Determines if a String is blank or not. A String is blank if its empty or - * if it only contains spaces. - * - * @param string the string to check - * @return true if its blank, false otherwise. - */ - public static boolean isBlank(final String string) { - return isEmpty(string) || string.trim().length() == 0; - } - - /** - * Determines if a string is not blank. A string is not blank if it contains - * at least one non-whitespace character. - * - * @param string the string to check. - * @return true if its not blank, false otherwise. - */ - public static boolean isNotBlank(final String string) { - return !isBlank(string); - } - -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/DelegatingFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/DelegatingFilter.java deleted file mode 100644 index 6a26bbf..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/util/DelegatingFilter.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import java.io.IOException; -import java.util.Iterator; -import java.util.Map; - -/** - * A Delegating Filter looks up a parameter in the request object and matches - * (either exact or using Regular Expressions) the value. If there is a match, - * the associated filter is executed. Otherwise, the normal chain is executed. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public final class DelegatingFilter implements Filter { - - /** - * Instance of Commons Logging. - */ - private final Log log = LogFactory.getLog(this.getClass()); - - /** - * The request parameter to look for in the Request object. - */ - private final String requestParameterName; - - /** - * The map of filters to delegate to and the criteria (as key). - */ - private final Map delegators; - - /** - * The default filter to use if there is no match. - */ - private final Filter defaultFilter; - - /** - * Whether the key in the delegators map is an exact match or a regular - * expression. - */ - private final boolean exactMatch; - - public DelegatingFilter(final String requestParameterName, final Map delegators, final boolean exactMatch) { - this(requestParameterName, delegators, exactMatch, null); - } - - public DelegatingFilter(final String requestParameterName, final Map delegators, final boolean exactMatch, final Filter defaultFilter) { - CommonUtils.assertNotNull(requestParameterName, - "requestParameterName cannot be null."); - CommonUtils.assertTrue(!delegators.isEmpty(), - "delegators cannot be empty."); - - for (final Iterator iter = delegators.keySet().iterator(); iter - .hasNext();) { - final Object object = delegators.get(iter.next()); - - if (!Filter.class.isAssignableFrom(object.getClass())) { - throw new IllegalArgumentException( - "All value objects in the delegators map must be filters."); - } - } - - this.requestParameterName = requestParameterName; - this.delegators = delegators; - this.defaultFilter = defaultFilter; - this.exactMatch = exactMatch; - } - - public void destroy() { - // nothing to do here - } - - public void doFilter(final ServletRequest request, - final ServletResponse response, final FilterChain filterChain) - throws IOException, ServletException { - - final String parameter = request - .getParameter(this.requestParameterName); - - if (CommonUtils.isNotEmpty(parameter)) { - for (final Iterator iter = this.delegators.keySet().iterator(); iter - .hasNext();) { - final String key = (String) iter.next(); - - if ((parameter.equals(key) && this.exactMatch) - || (parameter.matches(key) && !this.exactMatch)) { - final Filter filter = (Filter) this.delegators.get(key); - if (log.isDebugEnabled()) { - log.debug("Match found for parameter [" - + this.requestParameterName + "] with value [" - + parameter + "]. Delegating to filter [" - + filter.getClass().getName() + "]"); - } - filter.doFilter(request, response, filterChain); - return; - } - } - } - - log.debug("No match found for parameter [" + this.requestParameterName - + "] with value [" + parameter + "]"); - - if (this.defaultFilter != null) { - this.defaultFilter.doFilter(request, response, filterChain); - } else { - filterChain.doFilter(request, response); - } - } - - public void init(final FilterConfig filterConfig) throws ServletException { - // nothing to do here. - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/XmlUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/XmlUtils.java deleted file mode 100644 index 05892d6..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/util/XmlUtils.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.helpers.XMLReaderFactory; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; - -/** - * Common utilities for easily parsing XML without duplicating logic. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public final class XmlUtils { - - /** - * Static instance of Commons Logging. - */ - private final static Log LOG = LogFactory.getLog(XmlUtils.class); - - /** - * Get an instance of an XML reader from the XMLReaderFactory. - * - * @return the XMLReader. - */ - public static XMLReader getXmlReader() { - try { - return XMLReaderFactory.createXMLReader(); - } catch (final SAXException e) { - throw new RuntimeException("Unable to create XMLReader", e); - } - } - - /** - * Retrieve the text for a group of elements. Each text element is an entry - * in a list. - * - * @param xmlAsString the xml response - * @param element the element to look for - * @return the list of text from the elements. - */ - public static List getTextForElements(final String xmlAsString, - final String element) { - // XXX: optimized to 2, as most proxy chains have a length of no more than two - final List elements = new ArrayList(2); - final XMLReader reader = getXmlReader(); - - final DefaultHandler handler = new DefaultHandler() { - - private boolean foundElement = false; - - private StringBuffer buffer = new StringBuffer(); - - public void startElement(final String uri, final String localName, - final String qName, final Attributes attributes) - throws SAXException { - if (localName.equals(element)) { - this.foundElement = true; - } - } - - public void endElement(final String uri, final String localName, - final String qName) throws SAXException { - if (localName.equals(element)) { - this.foundElement = false; - elements.add(this.buffer.toString()); - this.buffer = new StringBuffer(); - } - } - - public void characters(char[] ch, int start, int length) - throws SAXException { - if (this.foundElement) { - this.buffer.append(ch, start, length); - } - } - }; - - reader.setContentHandler(handler); - reader.setErrorHandler(handler); - - try { - reader.parse(new InputSource(new StringReader(xmlAsString))); - } catch (final Exception e) { - LOG.error(e, e); - return null; - } - - return elements; - } - - /** - * Retrieve the text for a specific element (when we know there is only - * one). - * - * @param xmlAsString the xml response - * @param element the element to look for - * @return the text value of the element. - */ - public static String getTextForElement(final String xmlAsString, - final String element) { - final XMLReader reader = getXmlReader(); - final StringBuffer buffer = new StringBuffer(); - - final DefaultHandler handler = new DefaultHandler() { - - private boolean foundElement = false; - - public void startElement(final String uri, final String localName, - final String qName, final Attributes attributes) - throws SAXException { - if (localName.equals(element)) { - this.foundElement = true; - } - } - - public void endElement(final String uri, final String localName, - final String qName) throws SAXException { - if (localName.equals(element)) { - this.foundElement = false; - } - } - - public void characters(char[] ch, int start, int length) - throws SAXException { - if (this.foundElement) { - buffer.append(ch, start, length); - } - } - }; - - reader.setContentHandler(handler); - reader.setErrorHandler(handler); - - try { - reader.parse(new InputSource(new StringReader(xmlAsString))); - } catch (final Exception e) { - LOG.error(e, e); - return null; - } - - return buffer.toString(); - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/package.html b/cas-client-core/src/main/java/org/jasig/cas/client/util/package.html deleted file mode 100644 index d6d6b49..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/util/package.html +++ /dev/null @@ -1,5 +0,0 @@ - - -The validation package includes interfaces for validating Tickets, as well as the common implementations.
- - diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractUrlBasedTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractUrlBasedTicketValidator.java deleted file mode 100644 index f047f70..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractUrlBasedTicketValidator.java +++ /dev/null @@ -1,118 +0,0 @@ -package org.jasig.cas.client.validation; - -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jasig.cas.authentication.principal.Service; -import org.jasig.cas.client.util.CommonUtils; - -import java.net.URLEncoder; - -/** - * Abstract class for validating tickets that defines a workflow that all ticket - * validation should follow. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public abstract class AbstractUrlBasedTicketValidator implements - TicketValidator { - - /** - * Instance of Commons Logging. - */ - protected final Log log = LogFactory.getLog(this.getClass()); - - /** - * Url to CAS server. Generally of the form https://server:port/cas/ - */ - private final String casServerUrl; - - /** - * Whether this client is looking for an authentication from renew. - */ - private final boolean renew; - - /** - * Instance of HttpClient for connecting to server. Care should be taken only inject a multi-threaded HttpClient. - */ - private final HttpClient httpClient; - - public final Assertion validate(final String ticketId, final Service service) - throws ValidationException { - final String url = constructURL(ticketId, service); - final String response = getResponseFromURL(url); - - return parseResponse(response); - } - - /** - * Constructs the URL endpoint for contacting CAS for ticket validation. - * - * @param ticketId the opaque ticket id. - * @param service the service we are validating for. - * @return the fully constructed url. - */ - protected abstract String constructURL(final String ticketId, - final Service service); - - /** - * Parses the response retrieved from the url endpoint. - * - * @param response the String response. - * @return an Assertion based on the response. - * @throws ValidationException if there was an error validating the ticket. - */ - protected abstract Assertion parseResponse(final String response) - throws ValidationException; - - private String getResponseFromURL(final String url) - throws ValidationException { - final GetMethod method = new GetMethod(url); - - try { - this.httpClient.executeMethod(method); - return method.getResponseBodyAsString(); - } catch (Exception e) { - log.error(e, e); - throw new ValidationException( - "Unable to retrieve response from CAS Server.", e); - } finally { - method.releaseConnection(); - } - } - - protected AbstractUrlBasedTicketValidator(final String casServerUrl, final boolean renew, final HttpClient httpClient) { - CommonUtils.assertNotNull(casServerUrl, - "the validationUrl cannot be null"); - CommonUtils - .assertNotNull(httpClient, "httpClient cannot be null."); - this.casServerUrl = casServerUrl; - this.renew = renew; - this.httpClient = httpClient; - } - - /** - * Helper method to encode the service url. - * - * @param value the String to encode. - * @return the encoded String. - */ - protected final String urlEncode(final String value) { - try { - return URLEncoder.encode(value, "UTF-8"); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } - - protected final String getCasServerUrl() { - return this.casServerUrl; - } - - protected final boolean isRenew() { - return this.renew; - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Assertion.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Assertion.java deleted file mode 100644 index a751be5..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Assertion.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -import org.jasig.cas.authentication.principal.Principal; -import org.jasig.cas.authentication.principal.Service; - -import java.io.Serializable; -import java.util.Map; - -/** - * Interface to represent a successful response from the CAS Server. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public interface Assertion extends Serializable { - - /** - * Method to retrieve the principal. - * - * @return the principal. - */ - Principal getPrincipal(); - - /** - * Map of attributes returned by the CAS server. A client must know what - * attributes he is looking for as CAS makes no claims about what attributes - * are returned. - * - * @return the map of attributes. - */ - Map getAttributes(); - - /** - * Retrieves a proxy ticket for the specific service. - * - * @param service The service to proxy to. - * @return the Proxy Ticket Id or null. - */ - String getProxyTicketFor(Service service); -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AssertionHolder.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AssertionHolder.java deleted file mode 100644 index 26f877e..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AssertionHolder.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -/** - * Static holder that places Assertion in a threadlocal. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public class AssertionHolder { - - /** - * ThreadLocal to hold the Assertion for Threads to access. - */ - private static final ThreadLocal threadLocal = new ThreadLocal(); - - - /** - * Retrieve the assertion from the ThreadLocal. - */ - public static Assertion getAssertion() { - return (Assertion) threadLocal.get(); - } - - /** - * Add the Assertion to the ThreadLocal. - */ - public static void setAssertion(final Assertion assertion) { - threadLocal.set(assertion); - } - - /** - * Clear the ThreadLocal. - */ - public static void clear() { - threadLocal.set(null); - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AssertionImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AssertionImpl.java deleted file mode 100644 index a305a7c..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AssertionImpl.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -import org.jasig.cas.authentication.principal.Principal; -import org.jasig.cas.authentication.principal.Service; -import org.jasig.cas.client.proxy.ProxyRetriever; -import org.jasig.cas.client.util.CommonUtils; - -import java.util.HashMap; -import java.util.Map; - -/** - * Concrete implementation of an Assertion. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public class AssertionImpl implements Assertion { - - /** - * Unique id for serialization. - */ - private static final long serialVersionUID = 1L; - - /** - * Map of the attributes returned by the CAS server. This is optional as the - * CAS server spec makes no mention of attributes. - */ - private final Map attributes; - - /** - * The principal who was authenticated. - */ - private final Principal principal; - - /** - * The Proxy Granting Ticket Id returned by the server. - */ - private final String proxyGrantingTicketId; - - /** - * Reference to ProxyRetriever so that clients can retrieve proxy tickets for a service. - */ - private final ProxyRetriever proxyRetriever; - - - /** - * Simple constructor that accepts a Principal. - * - * @param principal the Principal this assertion is for. - */ - public AssertionImpl(final Principal principal) { - this(principal, null, null, null); - } - - /** - * Constructor that accepts a Principal and a map of attributes. - * - * @param principal the Principal this assertion is for. - * @param attributes a map of attributes about the principal. - */ - public AssertionImpl(final Principal principal, final Map attributes) { - this(principal, attributes, null, null); - } - - /** - * @param principal the Principal this assertion is for. - * @param attributes a map of attributes about the principal. - * @param proxyRetriever used to retrieve proxy tickets from CAS Server. - * @param proxyGrantingTicketId the Id to use to request proxy tickets. - */ - public AssertionImpl(final Principal principal, final Map attributes, - final ProxyRetriever proxyRetriever, final String proxyGrantingTicketId) { - CommonUtils.assertNotNull(principal, "principal cannot be null"); - - this.principal = principal; - this.attributes = attributes == null ? new HashMap() : attributes; - this.proxyGrantingTicketId = CommonUtils - .isNotEmpty(proxyGrantingTicketId) ? proxyGrantingTicketId : null; - this.proxyRetriever = proxyRetriever; - } - - public final Map getAttributes() { - return this.attributes; - } - - public String getProxyTicketFor(final Service service) { - if (proxyRetriever == null || proxyGrantingTicketId == null) { - return null; - } - - return this.proxyRetriever.getProxyTicketIdFor(this.proxyGrantingTicketId, service); - } - - public final Principal getPrincipal() { - return this.principal; - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidator.java deleted file mode 100644 index b82a1a9..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidator.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -import org.apache.commons.httpclient.HttpClient; -import org.jasig.cas.authentication.principal.Principal; -import org.jasig.cas.authentication.principal.Service; -import org.jasig.cas.authentication.principal.SimplePrincipal; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.StringReader; - -/** - * Implementation of TicketValidator that follows the CAS 1.0 protocol. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public final class Cas10TicketValidator extends AbstractUrlBasedTicketValidator { - - public Cas10TicketValidator(final String casServerUrl, final boolean renew, final HttpClient httpClient) { - super(casServerUrl, renew, httpClient); - } - - protected String constructURL(final String ticketId, final Service service) { - return getCasServerUrl() + "validate?ticket=" + ticketId - + (isRenew() ? "&renew=true" : "") + "&service=" - + urlEncode(service.getId()); - } - - protected final Assertion parseResponse(final String response) - throws ValidationException { - if (response == null || "no\n\n".equals(response) - || !response.startsWith("yes")) { - throw new ValidationException( - "'No' response returned from server for validation request."); - } - - try { - final BufferedReader reader = new BufferedReader(new StringReader( - response)); - reader.readLine(); - - final Principal principal = new SimplePrincipal(reader.readLine()); - return new AssertionImpl(principal, null); - } catch (final IOException e) { - throw new ValidationException("Unable to parse response.", e); - } - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyTicketValidator.java deleted file mode 100644 index 2c86e82..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyTicketValidator.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -import org.apache.commons.httpclient.HttpClient; -import org.jasig.cas.authentication.principal.Service; -import org.jasig.cas.authentication.principal.SimpleService; -import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage; -import org.jasig.cas.client.proxy.ProxyRetriever; -import org.jasig.cas.client.util.CommonUtils; -import org.jasig.cas.client.util.XmlUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -/** - * Implementation of the TicketValidator interface that knows how to handle - * proxy tickets. - * - * In your XML configuration file, proxy chains should be defined as - * follows: <list> <value> proxy1 proxy2 proxy3</value> - * <value> proxy2 proxy4 proxy5</value> <value> proxy4 - * proxy5 proxy6</value> </list> - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public class Cas20ProxyTicketValidator extends Cas20ServiceTicketValidator { - - /* List of proxy chains that we accept. */ - private final List proxyChains; - - /** - * Boolean whether we accept any proxy request or not. - */ - private final boolean acceptAnyProxy; - - /** - * @param casServerUrl the url to the CAS server, minus the endpoint. - * @param renew flag for whether we require authentication to be via an initial authentication. - * @param httpClient an instance of HttpClient to do the calls. - * @param proxyChains the chains of proxy lists that we accept tickets from. - * @param acceptAnyProxy flag on whether we accept any proxy or not. - */ - public Cas20ProxyTicketValidator(final String casServerUrl, final boolean renew, final HttpClient httpClient, List proxyChains, boolean acceptAnyProxy) { - this(casServerUrl, renew, httpClient, null, proxyChains, acceptAnyProxy, null, null); - } - - public Cas20ProxyTicketValidator(final String casServerUrl, final boolean renew, final HttpClient httpClient, final Service proxyCallbackUrl, List proxyChains, boolean acceptAnyProxy, final ProxyGrantingTicketStorage proxyGrantingTicketStorage, final ProxyRetriever proxyRetriever) { - super(casServerUrl, renew, httpClient, proxyCallbackUrl, proxyGrantingTicketStorage, proxyRetriever); - - CommonUtils.assertTrue(proxyChains != null || acceptAnyProxy, - "proxyChains cannot be null or acceptAnyProxy must be true."); - CommonUtils.assertTrue((proxyChains != null && !proxyChains - .isEmpty()) - || acceptAnyProxy, - "proxyChains cannot be empty or acceptAnyProxy must be true."); - - // assume each proxy chain has a length of 2 - final List tempProxyChains = new ArrayList(proxyChains.size() * 2); - for (final Iterator iter = proxyChains.iterator(); iter.hasNext();) { - final String[] values = ((String) iter.next()).split(" "); - final Service[] principals = new Service[values.length]; - - for (int i = 0; i < principals.length; i++) { - principals[i] = new SimpleService(values[i]); - } - - tempProxyChains.add(principals); - } - - this.proxyChains = tempProxyChains; - this.acceptAnyProxy = acceptAnyProxy; - } - - protected String getValidationUrlName() { - return "proxyValidate"; - } - - - protected Assertion getValidAssertionInternal(final String response, final String principal, final String proxyGrantingTicketIou) throws ValidationException { - final List proxies = XmlUtils.getTextForElements(response, "proxy"); - - // this means there was nothing in the proxy chain, which is okay - if (proxies.isEmpty() || this.acceptAnyProxy) { - return getAssertionBasedOnProxyGrantingTicketIou(proxyGrantingTicketIou, principal); - } - - final Service[] principals = new Service[proxies.size()]; - int i = 0; - for (final Iterator iter = proxies.iterator(); iter.hasNext();) { - principals[i++] = new SimpleService((String) iter.next()); - } - - for (Iterator iter = this.proxyChains.iterator(); iter.hasNext();) { - if (Arrays.equals(principals, (Object[]) iter.next())) { - return getAssertionBasedOnProxyGrantingTicketIou(proxyGrantingTicketIou, principal); - } - } - - throw new InvalidProxyChainValidationException(); - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidator.java deleted file mode 100644 index 54d5138..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidator.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -import org.apache.commons.httpclient.HttpClient; -import org.jasig.cas.authentication.principal.Service; -import org.jasig.cas.authentication.principal.SimplePrincipal; -import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage; -import org.jasig.cas.client.proxy.ProxyRetriever; -import org.jasig.cas.client.util.CommonUtils; -import org.jasig.cas.client.util.XmlUtils; - -/** - * Implementation of TicketValidator that follows the CAS 2.0 protocol (without - * proxying). - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public class Cas20ServiceTicketValidator extends - AbstractUrlBasedTicketValidator { - - /** - * Proxy callback url to send to the CAS server. - */ - private final Service proxyCallbackUrl; - - /** - * The storage mechanism for the ProxyGrantingTickets. - */ - private final ProxyGrantingTicketStorage proxyGrantingTicketStorage; - - /** - * Injected into Assertions to allow them to retrieve proxy tickets. - */ - private final ProxyRetriever proxyRetriever; - - public Cas20ServiceTicketValidator(final String casServerUrl, final boolean renew, final HttpClient httpClient) { - this(casServerUrl, renew, httpClient, null, null, null); - } - - public Cas20ServiceTicketValidator(final String casServerUrl, final boolean renew, final HttpClient httpClient, final Service proxyCallbackUrl, final ProxyGrantingTicketStorage proxyGrantingTicketStorage, final ProxyRetriever proxyRetriever) { - super(casServerUrl, renew, httpClient); - - if (proxyCallbackUrl != null) { - CommonUtils.assertNotNull(proxyGrantingTicketStorage, - "proxyGrantingTicketStorage cannot be null"); - CommonUtils.assertNotNull(proxyRetriever, "proxyRetriever cannot be null."); - } - this.proxyCallbackUrl = proxyCallbackUrl; - this.proxyGrantingTicketStorage = proxyGrantingTicketStorage; - this.proxyRetriever = proxyRetriever; - } - - protected String constructURL(final String ticketId, - final Service service) { - return getCasServerUrl() - + getValidationUrlName() - + "?ticket=" - + ticketId - + (isRenew() ? "&renew=true" : "") - + "&service=" - + urlEncode(service.getId()) - + (this.proxyCallbackUrl != null ? "&pgtUrl=" - + urlEncode(this.proxyCallbackUrl.getId()) : ""); - } - - protected final Assertion parseResponse(final String response) - throws ValidationException { - - final String error = XmlUtils.getTextForElement(response, - "authenticationFailure"); - - if (CommonUtils.isNotBlank(error)) { - log.debug("Validation of ticket failed: " + error); - throw new ValidationException(error); - } - - final String principal = XmlUtils.getTextForElement(response, "user"); - final String proxyGrantingTicketIou = XmlUtils.getTextForElement( - response, "proxyGrantingTicket"); - - if (CommonUtils.isEmpty(principal)) { - throw new ValidationException("No principal found."); - } - - return getValidAssertionInternal(response, principal, proxyGrantingTicketIou); - } - - protected String getValidationUrlName() { - return "serviceValidate"; - } - - protected final Assertion getAssertionBasedOnProxyGrantingTicketIou(final String proxyGrantingTicketIou, final String principal) { - if (CommonUtils.isNotBlank(proxyGrantingTicketIou)) { - return new AssertionImpl( - new SimplePrincipal(principal), null, this.proxyRetriever, this.proxyGrantingTicketStorage == null ? null : this.proxyGrantingTicketStorage - .retrieve(proxyGrantingTicketIou)); - } else { - return new AssertionImpl(new SimplePrincipal(principal)); - } - } - - protected Assertion getValidAssertionInternal(final String response, final String principal, final String proxyGrantingTicketIou) throws ValidationException { - return getAssertionBasedOnProxyGrantingTicketIou(proxyGrantingTicketIou, principal); - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/InvalidProxyChainValidationException.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/InvalidProxyChainValidationException.java deleted file mode 100644 index 00a9440..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/InvalidProxyChainValidationException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -/** - * Specific instance of a ValidationException that is thrown when the proxy - * chain does not match what is returned. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public final class InvalidProxyChainValidationException extends ValidationException { - - /** - * Unique id for serialization. - */ - private static final long serialVersionUID = 1L; - - public InvalidProxyChainValidationException() { - super(); - } - - public InvalidProxyChainValidationException(String message) { - super(message); - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml10TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml10TicketValidator.java deleted file mode 100644 index 556f0a7..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml10TicketValidator.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.jasig.cas.client.validation; - -import org.apache.commons.httpclient.HttpClient; -import org.jasig.cas.authentication.principal.Service; -import org.jasig.cas.authentication.principal.AttributePrincipal; -import org.jasig.cas.authentication.principal.SimpleAttributePrincipal; -import org.opensaml.SAMLAssertion; -import org.opensaml.SAMLAttribute; -import org.opensaml.SAMLAttributeStatement; -import org.opensaml.SAMLAuthenticationStatement; -import org.opensaml.SAMLException; -import org.opensaml.SAMLResponse; -import org.opensaml.SAMLStatement; -import org.opensaml.SAMLSubject; - -import java.io.ByteArrayInputStream; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.net.URLEncoder; - -/** - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.1 - */ -public class Saml10TicketValidator extends AbstractUrlBasedTicketValidator { - - /** - * Number of milliseconds the client/server clocks can be off by. - */ - private final long tolerance; - - public Saml10TicketValidator(final String casServerUrl, final HttpClient httpClient) { - super(casServerUrl, false, httpClient); - this.tolerance = 1000L; - } - - public Saml10TicketValidator(final String casServerUrl, final HttpClient httpClient, final long tolerance) { - super(casServerUrl, false, httpClient); - this.tolerance = tolerance; - } - - - protected String constructURL(final String ticketId, final Service service) { - return getCasServerUrl() + "/samlValidate?SAMLart=" + urlEncode(ticketId) + "&TARGET=" + urlEncode(service.getId()); - } - - protected Assertion parseResponse(final String response) throws ValidationException { - try { - log.debug(response); - final SAMLResponse samlResponse = new SAMLResponse(new ByteArrayInputStream(response.getBytes())); - - // check to see if we have any assertions - if (!samlResponse.getAssertions().hasNext()) { - throw new ValidationException("No assertions found."); - } - - for (final Iterator iter = samlResponse.getAssertions(); iter.hasNext();) { - final SAMLAssertion assertion = (SAMLAssertion) iter.next(); - - if (!isValidAssertion(assertion)) { - continue; - } - - final SAMLAuthenticationStatement authenticationStatement = getSAMLAuthenticationStatement(assertion); - - if (authenticationStatement == null) { - throw new ValidationException("No AuthentiationStatement found in SAML Assertion."); - } - final SAMLSubject subject = authenticationStatement.getSubject(); - - if (subject == null) { - throw new ValidationException("No Subject found in SAML Assertion."); - } - - final SAMLAttribute[] attributes = getAttributesFor(assertion, subject); - - final Map personAttributes = new HashMap(); - - for (int i = 0; i < attributes.length; i++) { - final SAMLAttribute samlAttribute = attributes[i]; - final List values = getValuesFrom(samlAttribute); - - personAttributes.put(samlAttribute.getName(), values.size() == 1 ? values.get(0) : values); - } - - final AttributePrincipal principal = new SimpleAttributePrincipal(subject.getNameIdentifier().getName(), personAttributes); - - - final Map authenticationAttributes = new HashMap(); - authenticationAttributes.put("samlAuthenticationStatement::authMethod", authenticationStatement.getAuthMethod()); - - final Assertion casAssertion = new AssertionImpl(principal, authenticationAttributes); - return casAssertion; - } - } catch (final SAMLException e) { - log.error(e,e); - throw new ValidationException(e); - } - - throw new ValidationException("No valid assertions from the SAML response found."); - } - - private boolean isValidAssertion(final SAMLAssertion assertion) { - final Date notBefore = assertion.getNotBefore(); - final Date notOnOrAfter = assertion.getNotOnOrAfter(); - - if (assertion.getNotBefore() == null || assertion.getNotOnOrAfter() == null) { - log.debug("Assertion has no bounding dates. Will not process."); - return false; - } - - final long currentTime = new Date().getTime(); - - if (currentTime + tolerance < notBefore.getTime()) { - log.debug("skipping assertion that's not yet valid..."); - return false; - } - - if (notOnOrAfter.getTime() <= currentTime - tolerance) { - log.debug("skipping expired assertion..."); - return false; - } - - return true; - } - - private SAMLAuthenticationStatement getSAMLAuthenticationStatement(final SAMLAssertion assertion) { - for (final Iterator iter = assertion.getStatements(); iter.hasNext();) { - final SAMLStatement statement = (SAMLStatement) iter.next(); - - if (statement instanceof SAMLAuthenticationStatement) { - return (SAMLAuthenticationStatement) statement; - } - } - - return null; - } - - private SAMLAttribute[] getAttributesFor(final SAMLAssertion assertion, final SAMLSubject subject) { - final List attributes = new ArrayList(); - for (final Iterator iter = assertion.getStatements(); iter.hasNext();) { - final SAMLStatement statement = (SAMLStatement) iter.next(); - - if (statement instanceof SAMLAttributeStatement) { - final SAMLAttributeStatement attributeStatement = (SAMLAttributeStatement) statement; - // used because SAMLSubject does not implement equals - if (subject.getNameIdentifier().getName().equals(attributeStatement.getSubject().getNameIdentifier().getName())) { - for (final Iterator iter2 = attributeStatement.getAttributes(); iter2.hasNext();) - attributes.add(iter2.next()); - } - } - } - - return (SAMLAttribute[]) attributes.toArray(new SAMLAttribute[attributes.size()]); - } - - private List getValuesFrom(final SAMLAttribute attribute) { - final List list = new ArrayList(); - for (final Iterator iter = attribute.getValues(); iter.hasNext();) { - list.add(iter.next()); - } - - return list; - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/TicketValidator.java deleted file mode 100644 index 5686aea..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/TicketValidator.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -import org.jasig.cas.authentication.principal.Service; - -/** - * Interface to encapsulate the validation of a ticket. The inteface is - * specification neutral. Any implementation can be provided, including - * something that parses CAS1 or CAS2 responses. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public interface TicketValidator { - - /** - * Method to validate a ticket for a give Service. - * - * @param ticketId the ticket to validate - * @param service the service to validate the ticket for - * @return the Assertion about the ticket (never null) - * @throws ValidationException if there is a problem validating the ticket. - */ - Assertion validate(String ticketId, Service service) - throws ValidationException; -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ValidationException.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ValidationException.java deleted file mode 100644 index 0311a7c..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ValidationException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.validation; - -/** - * Implementation of Exception to be thrown when there is an error validating - * the Ticket returned from the CAS server. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public class ValidationException extends Exception { - - /** - * Unique Id for serialization. - */ - private static final long serialVersionUID = 1L; - - /** - * Default constructor. - */ - public ValidationException() { - super(); - } - - /** - * Constructor that accepts a message and a chained exception. - * - * @param message the error message. - * @param cause the exception we are chaining with. - */ - public ValidationException(final String message, final Throwable cause) { - super(message, cause); - } - - /** - * Constructor that accepts a message. - * - * @param message the error message. - */ - public ValidationException(final String message) { - super(message); - } - - /** - * Constructor that accepts a chained exception. - * - * @param cause the exception we are chaining with. - */ - public ValidationException(final Throwable cause) { - super(cause); - } -} diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/package.html b/cas-client-core/src/main/java/org/jasig/cas/client/validation/package.html deleted file mode 100644 index e272813..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/package.html +++ /dev/null @@ -1,5 +0,0 @@ - - -This package contains common utilities used within the CAS client classes.
- - 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 deleted file mode 100644 index 03056b9..0000000 --- a/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/AbstractCasFilter.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license - * distributed with this file and available online at - * http://www.ja-sig.org/products/cas/overview/license/index.html - */ -package org.jasig.cas.client.web.filter; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jasig.cas.client.util.CommonUtils; -import org.jasig.cas.web.support.ArgumentExtractor; -import org.jasig.cas.web.support.CasArgumentExtractor; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * Abstract class that contains common functionality amongst CAS filters. - * - * You must specify the serverName (format: hostname:port) or the serviceUrl. If you specify both, the - * serviceUrl is used over the serverName. - * - * @author Scott Battaglia - * @version $Revision$ $Date$ - * @since 3.0 - */ -public abstract class AbstractCasFilter implements Filter { - - /** - * Constant representing where we store theAssertion in the
- * session.
- */
- public static final String CONST_ASSERTION = "_cas_assertion_";
-
- /**
- * Constant representing where we flag a gatewayed request in the session.
- */
- public static final String CONST_GATEWAY = "_cas_gateway_";
-
- /**
- * Constant representing where we flag a principal.
- */
- public static final String CONST_PRINCIPAL = "_cas_principal_";
-
- /**
- * Instance of Commons Logging.
- */
- protected final Log log = LogFactory.getLog(this.getClass());
-
- /**
- * The name of the server in the following format: request.getRemoteUser to the underlying Assertion object
- * stored in the user session.
- */
- public void doFilter(final ServletRequest servletRequest,
- final ServletResponse servletResponse, final FilterChain filterChain)
- throws IOException, ServletException {
- filterChain.doFilter(new CasHttpServletRequestWrapper(
- (HttpServletRequest) servletRequest), servletResponse);
- }
-
- public void init(final FilterConfig filterConfig) throws ServletException {
- // nothing to do
- }
-
- final class CasHttpServletRequestWrapper extends HttpServletRequestWrapper {
-
- CasHttpServletRequestWrapper(final HttpServletRequest request) {
- super(request);
- }
-
- public String getRemoteUser() {
- final org.jasig.cas.authentication.principal.Principal p = (org.jasig.cas.authentication.principal.Principal) this
- .getAttribute(AbstractCasFilter.CONST_PRINCIPAL);
-
- if (p != null) {
- return p.getId();
- }
-
- final Assertion assertion = (Assertion) WebUtils
- .getSessionAttribute(this,
- AbstractCasFilter.CONST_ASSERTION);
-
- if (assertion != null) {
- return assertion.getPrincipal().getId();
- }
-
- return null;
- }
- }
-}
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
deleted file mode 100644
index d3aef0d..0000000
--- a/cas-client-core/src/main/java/org/jasig/cas/client/web/filter/TicketValidationFilter.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.web.filter;
-
-import org.jasig.cas.authentication.principal.SimpleService;
-import org.jasig.cas.client.util.CommonUtils;
-import org.jasig.cas.client.validation.Assertion;
-import org.jasig.cas.client.validation.TicketValidator;
-import org.jasig.cas.client.validation.ValidationException;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * Implementation of a Filter that checks for a "ticket" and if one is found,
- * will attempt to validate the ticket. On a successful validation, it sets the
- * Assertion object into the session. On an unsuccessful validation attempt, it
- * sets the response code to 403.
- *
- * This filter needs to be configured after the authentication filter (if that
- * filter exists in the chain).
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @see TicketValidator
- * @since 3.0
- */
-public final class TicketValidationFilter extends AbstractCasFilter {
-
- /**
- * Instance of the ticket validator.
- */
- private final TicketValidator ticketValidator;
-
- /**
- * Specify whether the filter should redirect the user agent after a
- * successful validation to remove the ticket parameter from the query
- * string.
- */
- private boolean redirectAfterValidation = false;
-
- /** Determines whether an exception is thrown when there is a ticket validation failure. */
- private boolean exceptionOnValidationFailure = true;
-
- /**
- * Constructor that takes the severName (or serviceUrl), TicketValidator, useSession and redirectAfterValidation. Either serveName or serviceUrl is required (but not both).
- *
- * @param service the name of the server in This package contains all of the useful filters related to normal CAS processing, including Authentication, - Validation and Authorization.
- - diff --git a/cas-client-core/src/main/resources/cas-client.properties b/cas-client-core/src/main/resources/cas-client.properties deleted file mode 100644 index 03492ee..0000000 --- a/cas-client-core/src/main/resources/cas-client.properties +++ /dev/null @@ -1,6 +0,0 @@ -cas.server.gateway=false -cas.server.renew=false -cas.server.url=https://localhost:8443/cas/ -cas.server.proxyCallbackUrl=https://localhost:8443/manager/proxy/Receptor -cas.client.serverName=localhost:8443 -cas.client.proxyCallbackUrl=https://localhost:8443/myClientApp/casProxyReceptor \ No newline at end of file diff --git a/cas-client-core/src/main/resources/simpleFilter.xml b/cas-client-core/src/main/resources/simpleFilter.xml deleted file mode 100644 index 33f4d29..0000000 --- a/cas-client-core/src/main/resources/simpleFilter.xml +++ /dev/null @@ -1,91 +0,0 @@ - -DelegatingFilter
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class DelegatingFilterTests extends TestCase {
-
- private DelegatingFilter delegatingFilter;
-
- protected int filterExecuted = -1;
-
- protected void setUp() throws Exception {
- final Map delegators = new HashMap();
-
- delegators.put("1", new TestFilter(1));
-
- this.filterExecuted = -1;
- this.delegatingFilter = new DelegatingFilter("test", delegators, true, new TestFilter(0));
- this.delegatingFilter.init(null);
- }
-
- protected void tearDown() throws Exception {
- this.delegatingFilter.destroy();
- }
-
- public void testExactMatchFound() throws Exception {
- final MockHttpServletRequest request = new MockHttpServletRequest();
- request.addParameter("test", "1");
-
- this.delegatingFilter.doFilter(request, new MockHttpServletResponse(),
- null);
-
- assertEquals(1, this.filterExecuted);
- }
-
- public void testNoMatchFound() throws Exception {
- final MockHttpServletRequest request = new MockHttpServletRequest();
- request.addParameter("test", "0");
-
- this.delegatingFilter.doFilter(request, new MockHttpServletResponse(),
- null);
-
- assertEquals(0, this.filterExecuted);
- }
-
- public void testNoParam() throws Exception {
- this.delegatingFilter.doFilter(new MockHttpServletRequest(),
- new MockHttpServletResponse(), null);
-
- assertEquals(0, this.filterExecuted);
- }
-
- public void testRegularExpressionMatch() throws Exception {
-
- final Map delegators = new HashMap();
-
- delegators.put("1.*", new TestFilter(1));
-
- this.delegatingFilter = new DelegatingFilter("test", delegators, false, new TestFilter(0));
-
- MockHttpServletRequest request = new MockHttpServletRequest();
- request.addParameter("test", "1");
-
- this.delegatingFilter.doFilter(request, new MockHttpServletResponse(),
- null);
-
- assertEquals(1, this.filterExecuted);
- request = new MockHttpServletRequest();
- request.addParameter("test", "15");
-
- this.delegatingFilter.doFilter(request, new MockHttpServletResponse(),
- null);
-
- assertEquals(1, this.filterExecuted);
- request = new MockHttpServletRequest();
- request.addParameter("test", "0");
-
- this.delegatingFilter.doFilter(request, new MockHttpServletResponse(),
- null);
-
- assertEquals(0, this.filterExecuted);
- }
-
- public void testForIllegalArgument() {
- Map map = new HashMap();
- map.put("test", new Object());
-
- try {
- this.delegatingFilter = new DelegatingFilter("test", map, false, new TestFilter(0));
- fail("Exception expected.");
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- private final class TestFilter implements Filter {
-
- private final int i;
-
- public TestFilter(final int i) {
- this.i = i;
- }
-
- public void destroy() {
- // nothing to do here
- }
-
- public void doFilter(ServletRequest arg0, ServletResponse arg1,
- FilterChain arg2) throws IOException, ServletException {
- DelegatingFilterTests.this.filterExecuted = this.i;
-
- }
-
- public void init(FilterConfig arg0) throws ServletException {
- // nothing to do
- }
- }
-}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/AbstractTicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/AbstractTicketValidatorTests.java
deleted file mode 100644
index fdfaed5..0000000
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/AbstractTicketValidatorTests.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.validation;
-
-import junit.framework.TestCase;
-
-/**
- * Base class for all TicketValidator tests to inherit from.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public abstract class AbstractTicketValidatorTests extends TestCase {
-
- protected static final String CONST_CAS_SERVER_URL = "http://localhost:8085/";
-
- protected static final String CONST_USERNAME = "username";
-}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/AssertionImplTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/AssertionImplTests.java
deleted file mode 100644
index 91cd5c8..0000000
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/AssertionImplTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.validation;
-
-import junit.framework.TestCase;
-import org.jasig.cas.authentication.principal.Principal;
-import org.jasig.cas.authentication.principal.SimplePrincipal;
-import org.jasig.cas.authentication.principal.SimpleService;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Test cases for the {@link AssertionImpl}.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class AssertionImplTests extends TestCase {
-
- private static final Principal CONST_PRINCIPAL = new SimplePrincipal("test");
-
- private static final String CONST_PROXY_GRANTING_TICKET_IOU = "proxyGrantingTicketIou";
-
- private static final Map CONST_ATTRIBUTES = new HashMap();
-
- static {
- CONST_ATTRIBUTES.put("test", "test");
- }
-
- public void testPrincipalConstructor() {
- final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL);
-
- assertEquals(CONST_PRINCIPAL, assertion.getPrincipal());
- assertTrue(assertion.getAttributes().isEmpty());
- assertNull(assertion.getProxyTicketFor(new SimpleService("test")));
- }
-
- public void testCompleteConstructor() {
- final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL,
- CONST_ATTRIBUTES);
-
- assertEquals(CONST_PRINCIPAL, assertion.getPrincipal());
- assertEquals(CONST_ATTRIBUTES, assertion.getAttributes());
- }
-}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidatorTests.java
deleted file mode 100644
index c51b433..0000000
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidatorTests.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.validation;
-
-
-import org.apache.commons.httpclient.HttpClient;
-import org.jasig.cas.authentication.principal.SimpleService;
-import org.jasig.cas.client.PublicTestHttpServer;
-
-import java.io.UnsupportedEncodingException;
-
-/**
- * Test cases for the {@link Cas10TicketValidator}.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class Cas10TicketValidatorTests extends AbstractTicketValidatorTests {
-
- private Cas10TicketValidator ticketValidator;
-
- public Cas10TicketValidatorTests() {
- super();
- }
-
- protected void setUp() throws Exception {
- this.ticketValidator = new Cas10TicketValidator(CONST_CAS_SERVER_URL, true, new HttpClient());
- }
-
- public void testNoResponse() throws Exception {
- PublicTestHttpServer.instance().content = "no\n\n"
- .getBytes(PublicTestHttpServer.instance().encoding);
- try {
- this.ticketValidator.validate("testTicket", new SimpleService(
- "myService"));
- fail("ValidationException expected.");
- } catch (final ValidationException e) {
- // expected
- }
- }
-
- public void testYesResponse() throws ValidationException,
- UnsupportedEncodingException {
- PublicTestHttpServer.instance().content = "yes\nusername\n\n"
- .getBytes(PublicTestHttpServer.instance().encoding);
- final Assertion assertion = this.ticketValidator.validate("testTicket",
- new SimpleService("myService"));
- assertEquals(CONST_USERNAME, assertion.getPrincipal().getId());
- }
-
- public void testBadResponse() throws UnsupportedEncodingException {
- PublicTestHttpServer.instance().content = "falalala\n\n"
- .getBytes(PublicTestHttpServer.instance().encoding);
- try {
- this.ticketValidator.validate("testTicket", new SimpleService(
- "myService"));
- fail("ValidationException expected.");
- } catch (final ValidationException e) {
- // expected
- }
- }
-}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyTicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyTicketValidatorTests.java
deleted file mode 100644
index 58ada81..0000000
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyTicketValidatorTests.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.validation;
-
-
-import org.apache.commons.httpclient.HttpClient;
-import org.jasig.cas.authentication.principal.Service;
-import org.jasig.cas.authentication.principal.SimpleService;
-import org.jasig.cas.client.PublicTestHttpServer;
-import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
-import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
-import org.jasig.cas.client.proxy.ProxyRetriever;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Test cases for the {@link Cas20ProxyTicketValidator}.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class Cas20ProxyTicketValidatorTests extends
- AbstractTicketValidatorTests {
-
- private Cas20ProxyTicketValidator ticketValidator;
-
- public Cas20ProxyTicketValidatorTests() {
- super();
- }
-
- protected void setUp() throws Exception {
- final ProxyGrantingTicketStorage proxyGrantingTicketStorage = getProxyGrantingTicketStorage();
- final List list = new ArrayList();
- list.add("proxy1 proxy2 proxy3");
-
- this.ticketValidator = new Cas20ProxyTicketValidator(CONST_CAS_SERVER_URL, true, new HttpClient(), new SimpleService("test"), list, false, getProxyGrantingTicketStorage(), getProxyRetriever());
- }
-
- private ProxyGrantingTicketStorage getProxyGrantingTicketStorage() {
- final ProxyGrantingTicketStorageImpl proxyGrantingTicketStorageImpl = new ProxyGrantingTicketStorageImpl();
-
- return proxyGrantingTicketStorageImpl;
- }
-
- private ProxyRetriever getProxyRetriever() {
- final ProxyRetriever proxyRetriever = new ProxyRetriever() {
-
- public String getProxyTicketIdFor(String proxyGrantingTicketId, Service targetService) {
- return "test";
- }
- };
-
- return proxyRetriever;
- }
-
- public void testProxyChainWithValidProxy() throws ValidationException,
- UnsupportedEncodingException {
- final String USERNAME = "username";
- final String RESPONSE = "CONST_CAS_TICKET_VALIDATOR.
- */
- protected final TicketValidator ticketValidator;
-
- /**
- * The Service referenced by the constant CONST_CAS_SERVICE.
- */
- protected final Service service;
-
- /**
- * Default constructor retrieves and caches results from looking up entries
- * in the PortalApplicationContext for the Ticket Validator, Proxy Retriever
- * and Service.
- */
- public AbstractCasSecurityContextFactory() {
- this.ticketValidator = (TicketValidator) PortalApplicationContextFacade
- .getPortalApplicationContext().getBean(CONST_CAS_TICKET_VALIDATOR);
- this.service = (Service) PortalApplicationContextFacade
- .getPortalApplicationContext().getBean(CONST_CAS_SERVICE);
- }
-}
diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasConnectionContext.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasConnectionContext.java
deleted file mode 100644
index fad40dc..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasConnectionContext.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.cas.authentication.principal.SimpleService;
-import org.jasig.portal.ChannelRuntimeData;
-import org.jasig.portal.ChannelStaticData;
-import org.jasig.portal.security.ISecurityContext;
-import org.jasig.portal.security.LocalConnectionContext;
-
-import java.util.Enumeration;
-
-/**
- * Extension to LocalConnectionContext that will retrieve and append a proxy
- * ticket to a given descriptor.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class CasConnectionContext extends LocalConnectionContext {
-
- /**
- * Instance of ICasSecurityContext.
- */
- private ICasSecurityContext casSecurityContext;
-
- public String getDescriptor(String descriptor,
- final ChannelRuntimeData channelRuntimeData) {
- if (log.isTraceEnabled()) {
- log.trace("getDescriptor(" + descriptor + ", " + channelRuntimeData
- + ")");
- }
-
- descriptor = descriptor == null ? "null" : descriptor;
-
- if (channelRuntimeData.getHttpRequestMethod().equals("GET")) {
-
- if (this.casSecurityContext != null) {
- final String proxyTicket = this.casSecurityContext
- .getProxyTicket(new SimpleService(descriptor));
-
- if (proxyTicket != null) {
- // append ticket parameter and value to query string
- if (descriptor.indexOf('?') != -1) {
- descriptor = descriptor + "&ticket=" + proxyTicket;
- } else {
- descriptor = descriptor + "?ticket=" + proxyTicket;
- }
- }
- }
- }
-
- return descriptor;
- }
-
- public void init(final ChannelStaticData channelStaticData) {
- final ISecurityContext securityContext = channelStaticData.getPerson()
- .getSecurityContext();
-
- if (ICasSecurityContext.class.isAssignableFrom(securityContext
- .getClass())
- && securityContext.isAuthenticated()) {
- this.casSecurityContext = (ICasSecurityContext) securityContext;
- }
-
- final Enumeration enumeration = securityContext.getSubContexts();
-
- while (enumeration.hasMoreElements()) {
- final ISecurityContext context = (ISecurityContext) enumeration
- .nextElement();
-
- if (ISecurityContext.class.isAssignableFrom(context.getClass())
- && context.isAuthenticated()) {
- this.casSecurityContext = (ICasSecurityContext) context;
- }
- }
-
- if (this.casSecurityContext == null) {
- log.warn("Unable to find authenticated ICasSecurityContext");
- }
- }
-}
diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasSecurityContext.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasSecurityContext.java
deleted file mode 100644
index 59e91af..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasSecurityContext.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.cas.authentication.principal.Service;
-import org.jasig.cas.client.util.CommonUtils;
-import org.jasig.cas.client.validation.Assertion;
-import org.jasig.cas.client.validation.TicketValidator;
-import org.jasig.cas.client.validation.ValidationException;
-import org.jasig.portal.security.PortalSecurityException;
-import org.jasig.portal.security.provider.ChainingSecurityContext;
-
-/**
- * Implementation of ICasSecurityContext that knows how to handle CAS ticket
- * validation, as well as the retrieval of Proxy Tickets.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public class CasSecurityContext extends ChainingSecurityContext implements
- ICasSecurityContext {
-
- /**
- * Unique Id for Serialization
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Instance of TicketValidator to validate tickets.
- */
- private final TicketValidator ticketValidator;
-
- /**
- * Instance of Service representing uPortal instance.
- */
- private final Service service;
-
- /**
- * Assertion about the person this security context is for.
- */
- private Assertion assertion;
-
- /**
- * Instantiate a new CasSecurityContext, setting the required fields.
- *
- * @param ticketValidator the TicketValidator to validate tickets.
- * @param service the Service representing the portal.
- */
- public CasSecurityContext(final TicketValidator ticketValidator, final Service service) {
- CommonUtils.assertNotNull(ticketValidator, "ticketValidator cannot be null.");
- CommonUtils.assertNotNull(service, "service cannot be null.");
-
- log.trace("Initalizing CasSecurityContext");
- this.ticketValidator = ticketValidator;
- this.service = service;
- }
-
- public final String getProxyTicket(final Service targetService) {
- return this.assertion.getProxyTicketFor(targetService);
- }
-
- public final int getAuthType() {
- return ICasSecurityContext.CAS_AUTHTYPE;
- }
-
- public final synchronized void authenticate() throws PortalSecurityException {
- this.isauth = false;
- final String serviceTicket = new String(
- this.myOpaqueCredentials.credentialstring);
- final Service service = getService();
-
- if (log.isDebugEnabled()) {
- log.debug("Attempting to validate ticket [" + serviceTicket
- + "] for service [" + service.toString());
- }
-
- try {
- this.assertion = this.ticketValidator.validate(serviceTicket,
- service);
- this.myAdditionalDescriptor = null;
- this.myPrincipal.setUID(this.assertion.getPrincipal().getId());
- this.isauth = true;
- super.authenticate();
- } catch (final ValidationException e) {
- log.warn(e, e);
- throw new PortalSecurityException(e.getMessage(), e);
- }
- }
-
- protected Service getService() {
- return this.service;
- }
-}
diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasSecurityContextFactory.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasSecurityContextFactory.java
deleted file mode 100644
index f9ffb98..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/CasSecurityContextFactory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.portal.security.ISecurityContext;
-import org.jasig.portal.security.ISecurityContextFactory;
-
-/**
- * Implementation of an {@link ISecurityContextFactory} that on creation will
- * retrieve references to Spring managed CAS client objects and pass them to all
- * new CasSecurityContexts that are created.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class CasSecurityContextFactory extends AbstractCasSecurityContextFactory {
-
- public CasSecurityContextFactory() {
- super();
- }
-
- /**
- * Instantiate a new instance of CasSecurityContext.
- *
- * @return a new ISecurityContext instance, specifically an instance of CasSecurityContext.
- */
- public ISecurityContext getSecurityContext() {
- log
- .trace("Returning CasSecurityContext from CasSecurityContextFactory.");
- return new CasSecurityContext(this.ticketValidator, this.service);
- }
-}
diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ICasSecurityContext.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ICasSecurityContext.java
deleted file mode 100644
index fa01ddc..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ICasSecurityContext.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.cas.authentication.principal.Service;
-
-/**
- * Interface implemented by CAS security contexts. These implementations are
- * aware of proxying, and can retrieve a ticket from CAS for accessing a
- * specific service.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public interface ICasSecurityContext {
-
- /**
- * Authentication type for CAS authentication
- */
- public static final int CAS_AUTHTYPE = 0x1701;
-
- /**
- * Retrieve a Proxy Ticket Id for a particular service we wish to proxy against.
- *
- * @param service the service to retrieve a proxy ticket for.
- * @return the ticket id, or null if no ticket could be retrieved.
- */
- String getProxyTicket(Service service);
-}
diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ServiceHolder.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ServiceHolder.java
deleted file mode 100644
index 043f624..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ServiceHolder.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.cas.authentication.principal.Service;
-import org.jasig.cas.client.util.CommonUtils;
-
-/**
- * ThreadLocal container that exposes the service to lower layers in the authentication stack. Because of the ISecurityCcontext
- * API this service url is not normally available.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class ServiceHolder {
-
- private static final ThreadLocal threadLocal = new ThreadLocal();
-
- public static void setService(final Service service) {
- CommonUtils.assertNotNull(service, "service cannot be null.");
- threadLocal.set(service);
- }
-
- /**
- * Method to retrieve the service from the ThreadLocal
- *
- * @return the service. Should not ever be null.
- */
- public static Service getService() {
- return (Service) threadLocal.get();
- }
-
- /**
- * Reset the context to clear it out.
- */
- public static void clearContext() {
- threadLocal.set(null);
- }
-}
diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasSecurityContext.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasSecurityContext.java
deleted file mode 100644
index d3a360d..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasSecurityContext.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.cas.authentication.principal.Service;
-import org.jasig.cas.client.validation.TicketValidator;
-
-/**
- * Extension of AbstractCasSecurityContext that retrieves the Service from the
- * ServiceHolder ThreadLocal object. This allows for a more flexible service to
- * be provided for ticket validation. This is needed as the normal
- * ISecurityContext has no mechanism for service urls based on requests.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class ThreadLocalAwareCasSecurityContext extends
- CasSecurityContext {
-
- /**
- * Unique Id for Serialization.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Instantiate a new CasSecurityContext, setting the required fields.
- *
- * @param ticketValidator the Ticket Validator.
- * @param service the Service instance representing this uPortal instance.
- */
- public ThreadLocalAwareCasSecurityContext(
- final TicketValidator ticketValidator, final Service service) {
- super(ticketValidator, service);
- }
-
- protected Service getService() {
- return ServiceHolder.getService();
- }
-}
diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasSecurityContextFactory.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasSecurityContextFactory.java
deleted file mode 100644
index c09c80d..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasSecurityContextFactory.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.portal.security.ISecurityContext;
-
-/**
- * Factory to instantiate ThreadLocalAwareCasSecurityContexts.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class ThreadLocalAwareCasSecurityContextFactory extends
- AbstractCasSecurityContextFactory {
-
- public ISecurityContext getSecurityContext() {
- return new ThreadLocalAwareCasSecurityContext(this.ticketValidator,
- this.service);
- }
-}
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
deleted file mode 100644
index 3efa862..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/ThreadLocalAwareCasServiceFilter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.cas.authentication.principal.Service;
-import org.jasig.cas.authentication.principal.SimpleService;
-import org.jasig.cas.client.util.CommonUtils;
-import org.jasig.cas.client.web.filter.AbstractCasFilter;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * Filter to construct the service url from the request and place it in a
- * ThreadLocal so its available to the
- * {@link ThreadLocalAwareCasSecurityContext} in order to use it for Ticket
- * validation.
- * This filter places the Service in a {@link ServiceHolder}.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class ThreadLocalAwareCasServiceFilter extends AbstractCasFilter {
-
- public ThreadLocalAwareCasServiceFilter(final String service, final boolean isServerName) {
- super(service, isServerName);
- }
-
- protected void doFilterInternal(final HttpServletRequest request,
- final HttpServletResponse response, final FilterChain filterChain)
- throws IOException, ServletException {
- final boolean hasTicket = CommonUtils.isNotBlank(request
- .getParameter(getArgumentExtractor().getArtifactParameterName()));
- try {
- if (hasTicket) {
- final Service service = new SimpleService(constructServiceUrl(
- request, response));
- ServiceHolder.setService(service);
- }
-
- filterChain.doFilter(request, response);
- } finally {
- if (hasTicket) {
- ServiceHolder.clearContext();
- }
- }
- }
-}
diff --git a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/UPortalConfiguredProxyReceptorServlet.java b/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/UPortalConfiguredProxyReceptorServlet.java
deleted file mode 100644
index a67a8f4..0000000
--- a/cas-client-uportal/src/main/java/org/jasig/cas/client/integration/uportal/UPortalConfiguredProxyReceptorServlet.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2006 The JA-SIG Collaborative. All rights reserved. See license
- * distributed with this file and available online at
- * http://www.ja-sig.org/products/cas/overview/license/index.html
- */
-package org.jasig.cas.client.integration.uportal;
-
-import org.jasig.cas.client.proxy.AbstractProxyReceptorServlet;
-import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
-import org.jasig.portal.spring.PortalApplicationContextFacade;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-
-/**
- * Implementation of AbstractProxyReceptorServlet that retrieves the
- * ProxyGrantingTicket storage from the Portal Application Context instead of a
- * WebApplicationContext.
- *
- * @author Scott Battaglia
- * @version $Revision$ $Date$
- * @since 3.0
- */
-public final class UPortalConfiguredProxyReceptorServlet extends
- AbstractProxyReceptorServlet {
-
- /**
- * Unique Id for Serialization.
- */
- private static final long serialVersionUID = 6596608588362834646L;
-
-
- protected ProxyGrantingTicketStorage retrieveProxyGrantingTicketStorageFromConfiguration(final ServletConfig servletConfig) throws ServletException {
- logger.info("Retrieving ProxyGrantingTicketStorage from PortalApplicationContextFacade.");
- return (ProxyGrantingTicketStorage) PortalApplicationContextFacade
- .getPortalApplicationContext()
- .getBean(
- AbstractCasSecurityContextFactory.CONST_CAS_PROXY_GRANTING_TICKET_STORAGE);
- }
-}
diff --git a/cas-client-uportal/src/main/resources/uportalCasConfigurationContext.xml b/cas-client-uportal/src/main/resources/uportalCasConfigurationContext.xml
deleted file mode 100644
index fc09c28..0000000
--- a/cas-client-uportal/src/main/resources/uportalCasConfigurationContext.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-