NOJIRA
updated for javadocs and configuration initialization checking
This commit is contained in:
parent
34b92ea884
commit
5a9b250559
|
|
@ -1,6 +1,7 @@
|
|||
package org.jasig.cas.client.authentication;
|
||||
|
||||
import org.jasig.cas.client.proxy.ProxyRetriever;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
|
@ -69,6 +70,9 @@ public class AttributePrincipalImpl implements AttributePrincipal{
|
|||
this.attributes = attributes;
|
||||
this.proxyGrantingTicket = proxyGrantingTicket;
|
||||
this.proxyRetriever = proxyRetriever;
|
||||
|
||||
CommonUtils.assertNotNull(this.name, "name cannot be null.");
|
||||
CommonUtils.assertNotNull(this.attributes, "attributes cannot be null.");
|
||||
}
|
||||
|
||||
public Map getAttributes() {
|
||||
|
|
|
|||
|
|
@ -5,16 +5,19 @@
|
|||
*/
|
||||
package org.jasig.cas.client.authentication;
|
||||
|
||||
import org.jasig.cas.client.util.AbstractCasFilter;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
import org.jasig.cas.client.util.AbstractCasFilter;
|
||||
|
||||
import javax.servlet.*;
|
||||
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 javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* Filter implementation to intercept all requests and attempt to authenticate
|
||||
|
|
@ -35,7 +38,7 @@ import java.net.URLEncoder;
|
|||
*/
|
||||
public class AuthenticationFilter extends AbstractCasFilter {
|
||||
|
||||
protected static final String CONST_CAS_GATEWAY = "_const_cas_gateway_";
|
||||
public static final String CONST_CAS_GATEWAY = "_const_cas_gateway_";
|
||||
|
||||
/**
|
||||
* The URL to the CAS Server login.
|
||||
|
|
@ -52,14 +55,19 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
*/
|
||||
private boolean gateway = false;
|
||||
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
super.init(filterConfig);
|
||||
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
|
||||
super.initInternal(filterConfig);
|
||||
setCasServerLoginUrl(getPropertyFromInitParams(filterConfig, "casServerLoginUrl", null));
|
||||
setRenew(Boolean.parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
|
||||
setGateway(Boolean.parseBoolean(getPropertyFromInitParams(filterConfig, "gateway", "false")));
|
||||
}
|
||||
|
||||
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
|
||||
public void init() {
|
||||
super.init();
|
||||
CommonUtils.assertNotNull(this.casServerLoginUrl, "casServerLoginUrl cannot be null.");
|
||||
}
|
||||
|
||||
public final void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
|
||||
final HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
final HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
final HttpSession session = request.getSession(false);
|
||||
|
|
@ -77,10 +85,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
}
|
||||
|
||||
final String serviceUrl = constructServiceUrl(request, response);
|
||||
final String urlToRedirectTo = this.casServerLoginUrl + "?" + getServiceParameterName() + "="
|
||||
+ URLEncoder.encode(serviceUrl, "UTF-8")
|
||||
+ (this.renew ? "&renew=true" : "")
|
||||
+ (this.gateway ? "&gateway=true" : "");
|
||||
final String urlToRedirectTo = CommonUtils.constructRedirectUrl(this.casServerLoginUrl, getServiceParameterName(), serviceUrl, this.renew, this.gateway);
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("redirecting to \"" + urlToRedirectTo + "\"");
|
||||
|
|
@ -98,15 +103,15 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
public void setRenew(final boolean renew) {
|
||||
public final void setRenew(final boolean renew) {
|
||||
this.renew = renew;
|
||||
}
|
||||
|
||||
public void setGateway(final boolean gateway) {
|
||||
public final void setGateway(final boolean gateway) {
|
||||
this.gateway = gateway;
|
||||
}
|
||||
|
||||
public void setCasServerLoginUrl(final String casServerLoginUrl) {
|
||||
public final void setCasServerLoginUrl(final String casServerLoginUrl) {
|
||||
this.casServerLoginUrl = casServerLoginUrl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
|
|||
/**
|
||||
* Instance of Commons Logging.
|
||||
*/
|
||||
protected final Log log = LogFactory.getLog(this.getClass());
|
||||
private final Log log = LogFactory.getLog(this.getClass());
|
||||
|
||||
/**
|
||||
* Url to CAS server.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ public final class ProxyGrantingTicketStorageImpl implements
|
|||
*/
|
||||
private static final long DEFAULT_TIMEOUT = 60000;
|
||||
|
||||
/**
|
||||
* Map that stores the PGTIOU to PGT mappings.
|
||||
*/
|
||||
private final Map cache = new HashMap();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import javax.servlet.http.HttpSession;
|
|||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Implements the Single Sign Out protocol.
|
||||
* Implements the Single Sign Out protocol. It handles registering the session and destroying the session.
|
||||
*
|
||||
* @author Scott Battaglia
|
||||
* @version $Revision$ $Date$
|
||||
|
|
@ -22,10 +22,19 @@ import java.io.IOException;
|
|||
*/
|
||||
public final class SingleSignOutFilter extends AbstractConfigurationFilter {
|
||||
|
||||
/**
|
||||
* The name of the artifact parameter. This is used to capture the session identifier.
|
||||
*/
|
||||
private String artifactParameterName = "ticket";
|
||||
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName", "ticket"));
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null.");
|
||||
}
|
||||
|
||||
public void setArtifactParameterName(final String artifactParameterName) {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@ import java.util.Map;
|
|||
* @version $Revision$ Date$
|
||||
* @since 3.1
|
||||
*/
|
||||
public class SingleSignOutHttpSessionListener implements HttpSessionListener {
|
||||
public final class SingleSignOutHttpSessionListener implements HttpSessionListener {
|
||||
|
||||
/**
|
||||
* Maps the ID from the CAS server to the Session.
|
||||
*/
|
||||
private static final Map MANAGED_SESSIONS = new HashMap();
|
||||
|
||||
/**
|
||||
* Maps the Session ID to the key from the CAS Server.
|
||||
*/
|
||||
private static final Map ID_TO_SESSION_KEY_MAPPING = new HashMap();
|
||||
|
||||
public void sessionCreated(final HttpSessionEvent event) {
|
||||
|
|
@ -40,6 +46,12 @@ public class SingleSignOutHttpSessionListener implements HttpSessionListener {
|
|||
MANAGED_SESSIONS.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to remove the session from the mapping based on the key returned from the
|
||||
* CAS server.
|
||||
*
|
||||
* @param key the key to look up in the map of sessions.
|
||||
*/
|
||||
public static void removeSession(final String key) {
|
||||
final HttpSession session = (HttpSession) MANAGED_SESSIONS.get(key);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,10 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
|
|||
/** Instance of commons logging for logging purposes. */
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
/** Defines the parameter to look for for the artifact. */
|
||||
private String artifactParameterName = "ticket";
|
||||
|
||||
/** Defines the parameter to look for for the service. */
|
||||
private String serviceParameterName = "service";
|
||||
|
||||
/**
|
||||
|
|
@ -42,78 +44,36 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
|
|||
/** The exact url of the service. */
|
||||
private String service;
|
||||
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
public final void init(final FilterConfig filterConfig) throws ServletException {
|
||||
setServerName(getPropertyFromInitParams(filterConfig, "serverName", null));
|
||||
setService(getPropertyFromInitParams(filterConfig, "service", null));
|
||||
setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName", "ticket"));
|
||||
setServiceParameterName(getPropertyFromInitParams(filterConfig, "serviceParameterName", "service"));
|
||||
|
||||
initInternal(filterConfig);
|
||||
init();
|
||||
}
|
||||
|
||||
/** Controls the ordering of filter initialiation and checking by defining a method that runs before the init. */
|
||||
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
|
||||
// template method
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization method. Called by Filter's init method or by Spring.
|
||||
*/
|
||||
public void init() {
|
||||
CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null.");
|
||||
CommonUtils.assertNotNull(this.serviceParameterName, "serviceParameterName cannot be null.");
|
||||
CommonUtils.assertTrue(CommonUtils.isNotEmpty(this.serverName) || CommonUtils.isNotEmpty(this.service), "serverName or service must be set.");
|
||||
}
|
||||
|
||||
public final void destroy() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a service url from the HttpServletRequest or from the given
|
||||
* serviceUrl. Prefers the serviceUrl provided if both a serviceUrl and a
|
||||
* serviceName.
|
||||
*
|
||||
* @param request the HttpServletRequest
|
||||
* @param response the HttpServletResponse
|
||||
* @return the service url to use.
|
||||
*/
|
||||
protected final String constructServiceUrl(final HttpServletRequest request,
|
||||
final HttpServletResponse response) {
|
||||
if (CommonUtils.isNotBlank(this.service)) {
|
||||
return response.encodeURL(this.service);
|
||||
}
|
||||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
|
||||
synchronized (buffer) {
|
||||
if (!this.serverName.startsWith("https://") && !this.serverName.startsWith("http://")) {
|
||||
buffer.append(request.isSecure() ? "https://" : "http://");
|
||||
}
|
||||
|
||||
buffer.append(this.serverName);
|
||||
buffer.append(request.getRequestURI());
|
||||
|
||||
if (CommonUtils.isNotBlank(request.getQueryString())) {
|
||||
final int location = request.getQueryString().indexOf(
|
||||
this.artifactParameterName + "=");
|
||||
|
||||
if (location == 0) {
|
||||
final String returnValue = response.encodeURL(buffer
|
||||
.toString());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("serviceUrl generated: " + returnValue);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
buffer.append("?");
|
||||
|
||||
if (location == -1) {
|
||||
buffer.append(request.getQueryString());
|
||||
} else if (location > 0) {
|
||||
final int actualLocation = request.getQueryString()
|
||||
.indexOf("&" + this.artifactParameterName + "=");
|
||||
|
||||
if (actualLocation == -1) {
|
||||
buffer.append(request.getQueryString());
|
||||
} else if (actualLocation > 0) {
|
||||
buffer.append(request.getQueryString().substring(0,
|
||||
actualLocation));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final String returnValue = response.encodeURL(buffer.toString());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("serviceUrl generated: " + returnValue);
|
||||
}
|
||||
return returnValue;
|
||||
protected final String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response) {
|
||||
return CommonUtils.constructServiceUrl(request, response, this.service, this.serverName, this.artifactParameterName);
|
||||
}
|
||||
|
||||
public final void setServerName(final String serverName) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@
|
|||
*/
|
||||
package org.jasig.cas.client.util;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
|
|
@ -16,6 +23,9 @@ import java.util.Collection;
|
|||
*/
|
||||
public final class CommonUtils {
|
||||
|
||||
/** Instance of Commons Logging. */
|
||||
private static final Log LOG = LogFactory.getLog(CommonUtils.class);
|
||||
|
||||
private CommonUtils() {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
@ -103,4 +113,88 @@ public final class CommonUtils {
|
|||
return !isBlank(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the URL to use to redirect to the CAS server.
|
||||
*
|
||||
* @param casServerLoginUrl the CAS Server login url.
|
||||
* @param serviceParameterName the name of the parameter that defines the service.
|
||||
* @param serviceUrl the actual service's url.
|
||||
* @param renew whether we should send renew or not.
|
||||
* @param gateway where we should send gateway or not.
|
||||
* @return the fully constructed redirect url.
|
||||
*/
|
||||
public static final String constructRedirectUrl(final String casServerLoginUrl, final String serviceParameterName, final String serviceUrl, final boolean renew, final boolean gateway) {
|
||||
try {
|
||||
return casServerLoginUrl + "?" + serviceParameterName + "="
|
||||
+ URLEncoder.encode(serviceUrl, "UTF-8")
|
||||
+ (renew ? "&renew=true" : "")
|
||||
+ (gateway ? "&gateway=true" : "");
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a service url from the HttpServletRequest or from the given
|
||||
* serviceUrl. Prefers the serviceUrl provided if both a serviceUrl and a
|
||||
* serviceName.
|
||||
*
|
||||
* @param request the HttpServletRequest
|
||||
* @param response the HttpServletResponse
|
||||
* @return the service url to use.
|
||||
*/
|
||||
public static final String constructServiceUrl(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final String service, final String serverName, final String artifactParameterName) {
|
||||
if (CommonUtils.isNotBlank(service)) {
|
||||
return response.encodeURL(service);
|
||||
}
|
||||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
|
||||
synchronized (buffer) {
|
||||
if (!serverName.startsWith("https://") && !serverName.startsWith("http://")) {
|
||||
buffer.append(request.isSecure() ? "https://" : "http://");
|
||||
}
|
||||
|
||||
buffer.append(serverName);
|
||||
buffer.append(request.getRequestURI());
|
||||
|
||||
if (CommonUtils.isNotBlank(request.getQueryString())) {
|
||||
final int location = request.getQueryString().indexOf(
|
||||
artifactParameterName + "=");
|
||||
|
||||
if (location == 0) {
|
||||
final String returnValue = response.encodeURL(buffer
|
||||
.toString());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("serviceUrl generated: " + returnValue);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
buffer.append("?");
|
||||
|
||||
if (location == -1) {
|
||||
buffer.append(request.getQueryString());
|
||||
} else if (location > 0) {
|
||||
final int actualLocation = request.getQueryString()
|
||||
.indexOf("&" + artifactParameterName + "=");
|
||||
|
||||
if (actualLocation == -1) {
|
||||
buffer.append(request.getQueryString());
|
||||
} else if (actualLocation > 0) {
|
||||
buffer.append(request.getQueryString().substring(0,
|
||||
actualLocation));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final String returnValue = response.encodeURL(buffer.toString());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("serviceUrl generated: " + returnValue);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public abstract class AbstractCasProtocolUrlBasedTicketValidator extends Abstrac
|
|||
}
|
||||
|
||||
} catch (final IOException e) {
|
||||
log.error(e,e);
|
||||
return null;
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
|
|
|
|||
|
|
@ -54,14 +54,19 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
super.init(filterConfig);
|
||||
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
|
||||
super.initInternal(filterConfig);
|
||||
setExceptionOnValidationFailure(Boolean.parseBoolean(getPropertyFromInitParams(filterConfig, "exceptionOnValidationFailure", "true")));
|
||||
setRedirectAfterValidation(Boolean.parseBoolean(getPropertyFromInitParams(filterConfig, "redirectAfterValidation", "false")));
|
||||
setUseSession(Boolean.parseBoolean(getPropertyFromInitParams(filterConfig, "useSession", "true")));
|
||||
setTicketValidator(getTicketValidator(filterConfig));
|
||||
}
|
||||
|
||||
public void init() {
|
||||
super.init();
|
||||
CommonUtils.assertNotNull(this.ticketValidator, "ticketValidator cannot be null.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-process the request before the normal filter process starts. This could be useful for pre-empting code.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.jasig.cas.client.validation;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
|
|
@ -44,6 +45,7 @@ public abstract class AbstractUrlBasedTicketValidator implements TicketValidator
|
|||
*/
|
||||
protected AbstractUrlBasedTicketValidator(final String casServerUrlPrefix) {
|
||||
this.casServerUrlPrefix = casServerUrlPrefix;
|
||||
CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +53,7 @@ public abstract class AbstractUrlBasedTicketValidator implements TicketValidator
|
|||
*
|
||||
* @param urlParameters the map containing the parameters.
|
||||
*/
|
||||
protected void populateUrlAttributeMap(Map urlParameters) {
|
||||
protected void populateUrlAttributeMap(final Map urlParameters) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.jasig.cas.client.validation;
|
|||
|
||||
import org.jasig.cas.client.authentication.AttributePrincipal;
|
||||
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
|
@ -15,7 +16,7 @@ import java.util.Map;
|
|||
* @since 3.1
|
||||
*
|
||||
*/
|
||||
public class AssertionImpl implements Assertion {
|
||||
public final class AssertionImpl implements Assertion {
|
||||
|
||||
/** The date from which the assertion is valid. */
|
||||
private final Date validFromDate;
|
||||
|
|
@ -70,6 +71,10 @@ public class AssertionImpl implements Assertion {
|
|||
this.validFromDate = validFromDate;
|
||||
this.validUntilDate = validUntilDate;
|
||||
this.attributes = attributes;
|
||||
|
||||
CommonUtils.assertNotNull(this.principal, "principal cannot be null.");
|
||||
CommonUtils.assertNotNull(this.validFromDate, "validFromDate cannot be null.");
|
||||
CommonUtils.assertNotNull(this.attributes, "attributes cannot be null.");
|
||||
}
|
||||
public Date getValidFromDate() {
|
||||
return this.validFromDate;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import java.io.StringReader;
|
|||
* @version $Revision$ $Date$
|
||||
* @since 3.1
|
||||
*/
|
||||
public class Cas10TicketValidator extends AbstractCasProtocolUrlBasedTicketValidator {
|
||||
public final class Cas10TicketValidator extends AbstractCasProtocolUrlBasedTicketValidator {
|
||||
|
||||
public Cas10TicketValidator(final String casServerUrlPrefix) {
|
||||
super(casServerUrlPrefix);
|
||||
|
|
|
|||
|
|
@ -48,11 +48,17 @@ public final class Cas20ProxyReceivingTicketValidationFilter extends AbstractTic
|
|||
*/
|
||||
private ProxyGrantingTicketStorage proxyGrantingTicketStorage = new ProxyGrantingTicketStorageImpl();
|
||||
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
super.init(filterConfig);
|
||||
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
|
||||
super.initInternal(filterConfig);
|
||||
setProxyReceptorUrl(getPropertyFromInitParams(filterConfig, "proxyReceptorUrl", null));
|
||||
}
|
||||
|
||||
public void init() {
|
||||
super.init();
|
||||
CommonUtils.assertNotNull(this.proxyReceptorUrl, "proxyReceptorUrl cannot be null.");
|
||||
CommonUtils.assertNotNull(this.proxyGrantingTicketStorage, "proxyGrantingTicketStorage cannot be null.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Cas20ServiceTicketValidator or a Cas20ProxyTicketValidator based on supplied parameters.
|
||||
*
|
||||
|
|
@ -95,7 +101,7 @@ public final class Cas20ProxyReceivingTicketValidationFilter extends AbstractTic
|
|||
/**
|
||||
* This processes the ProxyReceptor request before the ticket validation code executes.
|
||||
*/
|
||||
protected final boolean preFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
|
||||
protected boolean preFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
|
||||
final HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
final HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
final String requestUri = request.getRequestURI();
|
||||
|
|
@ -126,18 +132,15 @@ public final class Cas20ProxyReceivingTicketValidationFilter extends AbstractTic
|
|||
proxyGrantingTicket);
|
||||
|
||||
response.getWriter().write("<?xml version=\"1.0\"?>");
|
||||
response
|
||||
.getWriter()
|
||||
.write(
|
||||
"<casClient:proxySuccess xmlns:casClient=\"http://www.yale.edu/tp/casClient\" />");
|
||||
response.getWriter().write("<casClient:proxySuccess xmlns:casClient=\"http://www.yale.edu/tp/casClient\" />");
|
||||
return false;
|
||||
}
|
||||
|
||||
public final void setProxyReceptorUrl(final String proxyReceptorUrl) {
|
||||
public void setProxyReceptorUrl(final String proxyReceptorUrl) {
|
||||
this.proxyReceptorUrl = proxyReceptorUrl;
|
||||
}
|
||||
|
||||
public final void setProxyGrantingTicketStorage(final ProxyGrantingTicketStorage proxyGrantingTicketStorage) {
|
||||
public void setProxyGrantingTicketStorage(final ProxyGrantingTicketStorage proxyGrantingTicketStorage) {
|
||||
this.proxyGrantingTicketStorage = proxyGrantingTicketStorage;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.jasig.cas.client.validation;
|
|||
|
||||
import org.jasig.cas.client.util.XmlUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
|
@ -13,12 +14,12 @@ import java.util.List;
|
|||
* @version $Revision$ $Date$
|
||||
* @since 3.1
|
||||
*/
|
||||
public class Cas20ProxyTicketValidator extends Cas20ServiceTicketValidator {
|
||||
public final class Cas20ProxyTicketValidator extends Cas20ServiceTicketValidator {
|
||||
|
||||
private boolean acceptAnyProxy;
|
||||
|
||||
/** This should be a list of an array of Strings */
|
||||
private List allowedProxyChains;
|
||||
private List allowedProxyChains = new ArrayList();
|
||||
|
||||
public Cas20ProxyTicketValidator(final String casServerUrlPrefix) {
|
||||
super(casServerUrlPrefix);
|
||||
|
|
@ -33,7 +34,7 @@ public class Cas20ProxyTicketValidator extends Cas20ServiceTicketValidator {
|
|||
final String[] proxiedList = (String[]) proxies.toArray(new String[proxies.size()]);
|
||||
|
||||
// this means there was nothing in the proxy chain, which is okay
|
||||
if (proxies.isEmpty() || this.acceptAnyProxy) {
|
||||
if (proxies == null || proxies.isEmpty() || this.acceptAnyProxy) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package org.jasig.cas.client.validation;
|
|||
* @version $Revision$ $Date$
|
||||
* @since 3.1
|
||||
*/
|
||||
public class InvalidProxyChainTicketValidationException extends TicketValidationException {
|
||||
public final class InvalidProxyChainTicketValidationException extends TicketValidationException {
|
||||
|
||||
/**
|
||||
* Constructs an exception with the supplied message.
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ import java.util.List;
|
|||
* @since 3.1
|
||||
*
|
||||
*/
|
||||
public class ProxyListPropertyEditor extends PropertyEditorSupport {
|
||||
public final class ProxyListPropertyEditor extends PropertyEditorSupport {
|
||||
|
||||
/**
|
||||
* The new list of proxies to create. Its a list of String arrays.
|
||||
*/
|
||||
private List proxyChains = new ArrayList();
|
||||
private final List proxyChains = new ArrayList();
|
||||
|
||||
public Object getValue() {
|
||||
return this.proxyChains;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import javax.servlet.FilterConfig;
|
|||
* @version $Revision$ $Date$
|
||||
* @since 3.1
|
||||
*/
|
||||
public class Saml11TicketValidationFilter extends AbstractTicketValidationFilter {
|
||||
public final class Saml11TicketValidationFilter extends AbstractTicketValidationFilter {
|
||||
|
||||
public Saml11TicketValidationFilter() {
|
||||
setArtifactParameterName("SAMLart");
|
||||
|
|
|
|||
5
pom.xml
5
pom.xml
|
|
@ -137,6 +137,11 @@
|
|||
<name>Ibiblio Repository</name>
|
||||
<url>http://www.ibiblio.org/maven2</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jboss</id>
|
||||
<name>JBoss Repository</name>
|
||||
<url>http://repository.jboss.com/maven2</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
|
|
|
|||
Loading…
Reference in New Issue