From ace712b5a72df009747f5e4996d613814bd4c11b Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Tue, 10 Jul 2012 14:52:20 -0700
Subject: [PATCH 001/239] CASC-182 - reset the redirectAfterValidation
parameter to false when useSession is false.
---
.../client/validation/AbstractTicketValidationFilter.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index 71b62e7ed..e29a321d7 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -103,6 +103,13 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
log.trace("Setting redirectAfterValidation parameter: " + this.redirectAfterValidation);
setUseSession(parseBoolean(getPropertyFromInitParams(filterConfig, "useSession", "true")));
log.trace("Setting useSession parameter: " + this.useSession);
+
+ if (!this.useSession && this.redirectAfterValidation) {
+ log.warn("redirectAfterValidation parameter may not be true when useSession parameter is false.");
+ setRedirectAfterValidation(false);
+ log.warn("Setting redirectAfterValidation parameter to " + this.redirectAfterValidation);
+ }
+
setTicketValidator(getTicketValidator(filterConfig));
super.initInternal(filterConfig);
}
From 6b3590ce88f180ec7923cc78f3041c9fee9f6167 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 11 Jul 2012 10:12:20 -0700
Subject: [PATCH 002/239] CASC-182: Combined logging statements into one.
---
.../cas/client/validation/AbstractTicketValidationFilter.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index e29a321d7..e9e1c5c54 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -105,9 +105,8 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
log.trace("Setting useSession parameter: " + this.useSession);
if (!this.useSession && this.redirectAfterValidation) {
- log.warn("redirectAfterValidation parameter may not be true when useSession parameter is false.");
+ log.warn("redirectAfterValidation parameter may not be true when useSession parameter is false. Resetting it to false in order to prevent infinite redirects.");
setRedirectAfterValidation(false);
- log.warn("Setting redirectAfterValidation parameter to " + this.redirectAfterValidation);
}
setTicketValidator(getTicketValidator(filterConfig));
From 67999a7bf26ad2747dbd1a57058805f9a6e0f4fd Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Mon, 23 Jul 2012 22:09:09 -0400
Subject: [PATCH 003/239] CASC-184
upgrade to OpenSAML2
---
cas-client-core/pom.xml | 6 +-
.../validation/Saml11TicketValidator.java | 119 ++++++++++--------
2 files changed, 70 insertions(+), 55 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 2b25337bb..752b4bf71 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -24,10 +24,9 @@
org.opensamlopensaml
- 1.1
+ ${opensaml.version}jar
- provided
- true
+ compile
@@ -90,5 +89,6 @@
2.5.6.SEC01
+ 2.5.1-1
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 117cbe3ec..9213f9149 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -22,7 +22,18 @@
import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
import org.jasig.cas.client.util.CommonUtils;
+import org.joda.time.DateTime;
import org.opensaml.*;
+import org.opensaml.common.IdentifierGenerator;
+import org.opensaml.common.impl.SecureRandomIdentifierGenerator;
+import org.opensaml.saml1.core.*;
+import org.opensaml.xml.io.Unmarshaller;
+import org.opensaml.xml.io.UnmarshallerFactory;
+import org.opensaml.xml.io.UnmarshallingException;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.opensaml.xml.parse.XMLParserException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import java.io.*;
import java.net.HttpURLConnection;
@@ -44,8 +55,21 @@ public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator
/** Time tolerance to allow for time drifting. */
private long tolerance = 1000L;
+ private final BasicParserPool basicParserPool;
+
+ private final IdentifierGenerator identifierGenerator;
+
+
public Saml11TicketValidator(final String casServerUrlPrefix) {
super(casServerUrlPrefix);
+ try {
+ DefaultBootstrap.bootstrap();
+ this.basicParserPool = new BasicParserPool();
+ this.basicParserPool.setNamespaceAware(true);
+ this.identifierGenerator = new SecureRandomIdentifierGenerator();
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
}
protected String getUrlSuffix() {
@@ -62,9 +86,7 @@ protected void populateUrlAttributeMap(final Map urlParameters)
@Override
protected void setDisableXmlSchemaValidation(final boolean disabled) {
if (disabled) {
- // according to our reading of the SAML 1.1 code, this should disable the schema checking. However, there may be a couple
- // of error messages that slip through on start up!
- XML.parserPool.setDefaultSchemas(null, null);
+ this.basicParserPool.setSchema(null);
}
}
@@ -80,69 +102,76 @@ protected Assertion parseResponseFromServer(final String response) throws Ticket
try {
final String removeStartOfSoapBody = response.substring(response.indexOf("") + 15);
final String removeEndOfSoapBody = removeStartOfSoapBody.substring(0, removeStartOfSoapBody.indexOf(""));
- final SAMLResponse samlResponse = new SAMLResponse(new ByteArrayInputStream(getBytes(removeEndOfSoapBody)));
+ final Document responseDocument = this.basicParserPool.parse(new ByteArrayInputStream(getBytes(removeEndOfSoapBody)));
+ final Element responseRoot = responseDocument.getDocumentElement();
+ final UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
+ final Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(responseRoot);
- if (!samlResponse.getAssertions().hasNext()) {
+ final Response samlResponse = (Response) unmarshaller.unmarshall(responseRoot);
+
+ final List assertions = samlResponse.getAssertions();
+ if (assertions.isEmpty()) {
throw new TicketValidationException("No assertions found.");
}
- for (final Iterator> iter = samlResponse.getAssertions(); iter.hasNext();) {
- final SAMLAssertion assertion = (SAMLAssertion) iter.next();
+ for (final org.opensaml.saml1.core.Assertion assertion : assertions) {
if (!isValidAssertion(assertion)) {
continue;
}
- final SAMLAuthenticationStatement authenticationStatement = getSAMLAuthenticationStatement(assertion);
+ final AuthenticationStatement authenticationStatement = getSAMLAuthenticationStatement(assertion);
if (authenticationStatement == null) {
throw new TicketValidationException("No AuthentiationStatement found in SAML Assertion.");
}
- final SAMLSubject subject = authenticationStatement.getSubject();
+ final Subject subject = authenticationStatement.getSubject();
if (subject == null) {
throw new TicketValidationException("No Subject found in SAML Assertion.");
}
- final SAMLAttribute[] attributes = getAttributesFor(assertion, subject);
+ final List attributes = getAttributesFor(assertion, subject);
final Map personAttributes = new HashMap();
- for (final SAMLAttribute samlAttribute : attributes) {
+ for (final Attribute samlAttribute : attributes) {
final List> values = getValuesFrom(samlAttribute);
- personAttributes.put(samlAttribute.getName(), values.size() == 1 ? values.get(0) : values);
+ personAttributes.put(samlAttribute.getAttributeName(), values.size() == 1 ? values.get(0) : values);
}
- final AttributePrincipal principal = new AttributePrincipalImpl(subject.getNameIdentifier().getName(), personAttributes);
+ final AttributePrincipal principal = new AttributePrincipalImpl(subject.getNameIdentifier().getNameIdentifier(), personAttributes);
final Map authenticationAttributes = new HashMap();
- authenticationAttributes.put("samlAuthenticationStatement::authMethod", authenticationStatement.getAuthMethod());
+ authenticationAttributes.put("samlAuthenticationStatement::authMethod", authenticationStatement.getAuthenticationMethod());
return new AssertionImpl(principal, authenticationAttributes);
}
- } catch (final SAMLException e) {
+ } catch (final UnmarshallingException e) {
+ throw new TicketValidationException(e);
+ } catch (final XMLParserException e) {
throw new TicketValidationException(e);
}
throw new TicketValidationException("No Assertion found within valid time range. Either there's a replay of the ticket or there's clock drift. Check tolerance range, or server/client synchronization.");
}
- private boolean isValidAssertion(final SAMLAssertion assertion) {
- final Date notBefore = assertion.getNotBefore();
- final Date notOnOrAfter = assertion.getNotOnOrAfter();
+ private boolean isValidAssertion(final org.opensaml.saml1.core.Assertion assertion) {
+ final DateTime notBefore = assertion.getConditions().getNotBefore();
+ final DateTime notOnOrAfter = assertion.getConditions().getNotOnOrAfter();
- if (assertion.getNotBefore() == null || assertion.getNotOnOrAfter() == null) {
+ if (notBefore == null || notOnOrAfter == null) {
log.debug("Assertion has no bounding dates. Will not process.");
return false;
}
final long currentTime = getCurrentTimeInUtc().getTime();
- if (currentTime + tolerance < notBefore.getTime()) {
+ if (currentTime + tolerance < notBefore.getMillis()) {
log.debug("skipping assertion that's not yet valid...");
return false;
}
- if (notOnOrAfter.getTime() <= currentTime - tolerance) {
+ if (notOnOrAfter.getMillis() <= currentTime - tolerance) {
log.debug("skipping expired assertion...");
return false;
}
@@ -150,40 +179,32 @@ private boolean isValidAssertion(final SAMLAssertion assertion) {
return true;
}
- private SAMLAuthenticationStatement getSAMLAuthenticationStatement(final SAMLAssertion assertion) {
- for (final Iterator> iter = assertion.getStatements(); iter.hasNext();) {
- final SAMLStatement statement = (SAMLStatement) iter.next();
+ private AuthenticationStatement getSAMLAuthenticationStatement(final org.opensaml.saml1.core.Assertion assertion) {
+ final List statements = assertion.getAuthenticationStatements();
- if (statement instanceof SAMLAuthenticationStatement) {
- return (SAMLAuthenticationStatement) statement;
- }
+ if (statements.isEmpty()) {
+ return null;
}
- return null;
+ return statements.get(0);
}
- 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((SAMLAttribute) iter2.next());
- }
+ private List getAttributesFor(final org.opensaml.saml1.core.Assertion assertion, final Subject subject) {
+ final List attributes = new ArrayList();
+ for (final AttributeStatement attribute : assertion.getAttributeStatements()) {
+ if (subject.getNameIdentifier().getNameIdentifier().equals(attribute.getSubject().getNameIdentifier().getNameIdentifier())) {
+ attributes.addAll(attribute.getAttributes());
}
}
- return attributes.toArray(new SAMLAttribute[attributes.size()]);
+ return attributes;
}
- private List> getValuesFrom(final SAMLAttribute attribute) {
+ private List> getValuesFrom(final Attribute attribute) {
final List
@@ -56,6 +62,12 @@
spring-core${spring.version}test
+
+
+ commons-logging
+ commons-logging
+
+
@@ -88,7 +100,7 @@
- 2.5.6.SEC01
+ 3.1.3.RELEASE2.5.1-1
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
index e93978b39..562e7d30b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
@@ -19,10 +19,10 @@
package org.jasig.cas.client.authentication;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.proxy.ProxyRetriever;
import org.jasig.cas.client.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Collections;
import java.util.Map;
@@ -35,8 +35,8 @@
* @since 3.1
*/
public class AttributePrincipalImpl extends SimplePrincipal implements AttributePrincipal {
-
- private static final Log LOG = LogFactory.getLog(AttributePrincipalImpl.class);
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AttributePrincipalImpl.class);
/** Unique Id for Serialization */
private static final long serialVersionUID = -1443182634624927187L;
@@ -106,7 +106,7 @@ public String getProxyTicketFor(String service) {
return this.proxyRetriever.getProxyTicketIdFor(this.proxyGrantingTicket, service);
}
- LOG.debug("No ProxyGrantingTicket was supplied, so no Proxy Ticket can be retrieved.");
+ LOGGER.debug("No ProxyGrantingTicket was supplied, so no Proxy Ticket can be retrieved.");
return null;
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 67f36332b..04b0187fa 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -73,11 +73,11 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
if (!isIgnoreInitConfiguration()) {
super.initInternal(filterConfig);
setCasServerLoginUrl(getPropertyFromInitParams(filterConfig, "casServerLoginUrl", null));
- log.trace("Loaded CasServerLoginUrl parameter: " + this.casServerLoginUrl);
+ logger.trace("Loaded CasServerLoginUrl parameter: {}", this.casServerLoginUrl);
setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
- log.trace("Loaded renew parameter: " + this.renew);
+ logger.trace("Loaded renew parameter: {}", this.renew);
setGateway(parseBoolean(getPropertyFromInitParams(filterConfig, "gateway", "false")));
- log.trace("Loaded gateway parameter: " + this.gateway);
+ logger.trace("Loaded gateway parameter: {}", this.gateway);
final String gatewayStorageClass = getPropertyFromInitParams(filterConfig, "gatewayStorageClass", null);
@@ -85,7 +85,7 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
try {
this.gatewayStorage = (GatewayResolver) Class.forName(gatewayStorageClass).newInstance();
} catch (final Exception e) {
- log.error(e,e);
+ logger.error(e.getMessage(),e);
throw new ServletException(e);
}
}
@@ -119,23 +119,19 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
final String modifiedServiceUrl;
- log.debug("no ticket and no assertion found");
+ logger.debug("no ticket and no assertion found");
if (this.gateway) {
- log.debug("setting gateway attribute in session");
+ logger.debug("setting gateway attribute in session");
modifiedServiceUrl = this.gatewayStorage.storeGatewayInformation(request, serviceUrl);
} else {
modifiedServiceUrl = serviceUrl;
}
- if (log.isDebugEnabled()) {
- log.debug("Constructed service url: " + modifiedServiceUrl);
- }
+ logger.debug("Constructed service url: {}", modifiedServiceUrl);
final String urlToRedirectTo = CommonUtils.constructRedirectUrl(this.casServerLoginUrl, getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway);
- if (log.isDebugEnabled()) {
- log.debug("redirecting to \"" + urlToRedirectTo + "\"");
- }
+ logger.debug("redirecting to \"{}\"", urlToRedirectTo);
response.sendRedirect(urlToRedirectTo);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
index 7b363690f..456f1bf01 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
@@ -26,8 +26,7 @@ public final class DefaultGatewayResolverImpl implements GatewayResolver {
public static final String CONST_CAS_GATEWAY = "_const_cas_gateway_";
- public boolean hasGatewayedAlready(final HttpServletRequest request,
- final String serviceUrl) {
+ public boolean hasGatewayedAlready(final HttpServletRequest request, final String serviceUrl) {
final HttpSession session = request.getSession(false);
if (session == null) {
@@ -39,8 +38,7 @@ public boolean hasGatewayedAlready(final HttpServletRequest request,
return result;
}
- public String storeGatewayInformation(final HttpServletRequest request,
- final String serviceUrl) {
+ public String storeGatewayInformation(final HttpServletRequest request, final String serviceUrl) {
request.getSession(true).setAttribute(CONST_CAS_GATEWAY, "yes");
return serviceUrl;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
index b0db0c223..71edc717c 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
@@ -36,8 +36,8 @@ public class Saml11AuthenticationFilter extends AuthenticationFilter {
protected final void initInternal(final FilterConfig filterConfig) throws ServletException {
super.initInternal(filterConfig);
- log.warn("SAML1.1 compliance requires the [artifactParameterName] and [serviceParameterName] to be set to specified values.");
- log.warn("This filter will overwrite any user-provided values (if any are provided)");
+ logger.warn("SAML1.1 compliance requires the [artifactParameterName] and [serviceParameterName] to be set to specified values.");
+ logger.warn("This filter will overwrite any user-provided values (if any are provided)");
setArtifactParameterName("SAMLart");
setServiceParameterName("TARGET");
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
index 02454e854..7c73f8f23 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
@@ -45,14 +45,14 @@
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.authentication.SimpleGroup;
import org.jasig.cas.client.authentication.SimplePrincipal;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.TicketValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* JAAS login module that delegates to a CAS {@link TicketValidator} component
@@ -149,7 +149,7 @@ public class CasLoginModule implements LoginModule {
protected static final Map ASSERTION_CACHE = new HashMap();
/** Logger instance */
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
/** JAAS authentication subject */
protected Subject subject;
@@ -232,39 +232,39 @@ public final void initialize(
String ticketValidatorClass = null;
for (final String key : options.keySet()) {
- log.trace("Processing option " + key);
+ logger.trace("Processing option {}", key);
if ("service".equals(key)) {
this.service = (String) options.get(key);
- log.debug("Set service=" + this.service);
+ logger.debug("Set service={}", this.service);
} else if ("ticketValidatorClass".equals(key)) {
ticketValidatorClass = (String) options.get(key);
- log.debug("Set ticketValidatorClass=" + ticketValidatorClass);
+ logger.debug("Set ticketValidatorClass={}", ticketValidatorClass);
} else if ("defaultRoles".equals(key)) {
final String roles = (String) options.get(key);
- log.trace("Got defaultRoles value " + roles);
+ logger.trace("Got defaultRoles value {}", roles);
this.defaultRoles = roles.split(",\\s*");
- log.debug("Set defaultRoles=" + Arrays.asList(this.defaultRoles));
+ logger.debug("Set defaultRoles={}", Arrays.asList(this.defaultRoles));
} else if ("roleAttributeNames".equals(key)) {
final String attrNames = (String) options.get(key);
- log.trace("Got roleAttributeNames value " + attrNames);
+ logger.trace("Got roleAttributeNames value {}", attrNames);
final String[] attributes = attrNames.split(",\\s*");
this.roleAttributeNames.addAll(Arrays.asList(attributes));
- log.debug("Set roleAttributeNames=" + this.roleAttributeNames);
+ logger.debug("Set roleAttributeNames={}", this.roleAttributeNames);
} else if ("principalGroupName".equals(key)) {
this.principalGroupName = (String) options.get(key);
- log.debug("Set principalGroupName=" + this.principalGroupName);
+ logger.debug("Set principalGroupName={}",this.principalGroupName);
} else if ("roleGroupName".equals(key)) {
this.roleGroupName = (String) options.get(key);
- log.debug("Set roleGroupName=" + this.roleGroupName);
+ logger.debug("Set roleGroupName={}", this.roleGroupName);
} else if ("cacheAssertions".equals(key)) {
this.cacheAssertions = Boolean.parseBoolean((String) options.get(key));
- log.debug("Set cacheAssertions=" + this.cacheAssertions);
+ logger.debug("Set cacheAssertions={}", this.cacheAssertions);
} else if ("cacheTimeout".equals(key)) {
this.cacheTimeout = Integer.parseInt((String) options.get(key));
- log.debug("Set cacheTimeout=" + this.cacheTimeout);
+ logger.debug("Set cacheTimeout={}", this.cacheTimeout);
} else if ("cacheTimeoutUnit".equals(key)) {
this.cacheTimeoutUnit = Enum.valueOf(TimeUnit.class, (String) options.get(key));
- log.debug("Set cacheTimeoutUnit=" + this.cacheTimeoutUnit);
+ logger.debug("Set cacheTimeoutUnit={}", this.cacheTimeoutUnit);
}
}
@@ -295,10 +295,10 @@ protected void postLogin(final boolean result) {
}
public final boolean login() throws LoginException {
- log.debug("Performing login.");
+ logger.debug("Performing login.");
if (!preLogin()) {
- log.debug("preLogin failed.");
+ logger.debug("preLogin failed.");
return false;
}
@@ -309,10 +309,10 @@ public final boolean login() throws LoginException {
try {
this.callbackHandler.handle(new Callback[] { ticketCallback, serviceCallback });
} catch (final IOException e) {
- log.info("Login failed due to IO exception in callback handler: " + e);
+ logger.info("Login failed due to IO exception in callback handler: {}", e);
throw (LoginException) new LoginException("IO exception in callback handler: " + e).initCause(e);
} catch (final UnsupportedCallbackException e) {
- log.info("Login failed due to unsupported callback: " + e);
+ logger.info("Login failed due to unsupported callback: {}", e);
throw (LoginException) new LoginException(
"Callback handler does not support PasswordCallback and TextInputCallback.").initCause(e);
}
@@ -325,31 +325,29 @@ public final boolean login() throws LoginException {
if (this.cacheAssertions) {
this.assertion = ASSERTION_CACHE.get(ticket);
if (this.assertion != null) {
- log.debug("Assertion found in cache.");
+ logger.debug("Assertion found in cache.");
}
}
if (this.assertion == null) {
- log.debug("CAS assertion is null; ticket validation required.");
+ logger.debug("CAS assertion is null; ticket validation required.");
if (CommonUtils.isBlank(service)) {
- log.info("Login failed because required CAS service parameter not provided.");
+ logger.info("Login failed because required CAS service parameter not provided.");
throw new LoginException(
"Neither login module nor callback handler provided required service parameter.");
}
try {
- if (log.isDebugEnabled()) {
- log.debug("Attempting ticket validation with service=" + service + " and ticket=" + ticket);
- }
+ logger.debug("Attempting ticket validation with service={} and ticket={}", service, this.ticket);
this.assertion = this.ticketValidator.validate(this.ticket.getName(), service);
} catch (final Exception e) {
- log.info("Login failed due to CAS ticket validation failure: " + e);
+ logger.info("Login failed due to CAS ticket validation failure: {}", e);
throw (LoginException) new LoginException("CAS ticket validation failed: " + e).initCause(e);
}
}
- log.info("Login succeeded.");
+ logger.info("Login succeeded.");
} else {
- log.info("Login failed because callback handler did not provide CAS ticket.");
+ logger.info("Login failed because callback handler did not provide CAS ticket.");
throw new LoginException("Callback handler did not provide CAS ticket.");
}
result = true;
@@ -437,16 +435,10 @@ public final boolean commit() throws LoginException {
// Place principal name in shared state for downstream JAAS modules (module chaining use case)
this.sharedState.put(LOGIN_NAME, assertion.getPrincipal().getName());
- if (log.isDebugEnabled()) {
- if (log.isDebugEnabled()) {
- log.debug("Created JAAS subject with principals: " + subject.getPrincipals());
- }
- }
+ logger.debug("Created JAAS subject with principals: {}", subject.getPrincipals());
if (this.cacheAssertions) {
- if (log.isDebugEnabled()) {
- log.debug("Caching assertion for principal " + this.assertion.getPrincipal());
- }
+ logger.debug("Caching assertion for principal {}", this.assertion.getPrincipal());
ASSERTION_CACHE.put(this.ticket, this.assertion);
}
} else {
@@ -464,7 +456,7 @@ public final boolean commit() throws LoginException {
}
public final boolean logout() throws LoginException {
- log.debug("Performing logout.");
+ logger.debug("Performing logout.");
if (!preLogout()) {
return false;
@@ -478,7 +470,7 @@ public final boolean logout() throws LoginException {
// Remove all CAS credentials
removeCredentialsOfType(TicketCredential.class);
- log.info("Logout succeeded.");
+ logger.info("Logout succeeded.");
postLogout();
return true;
@@ -520,14 +512,14 @@ private TicketValidator createTicketValidator(final String className, final Map<
for (final String property : propertyMap.keySet()) {
if (!"casServerUrlPrefix".equals(property)) {
- log.debug("Attempting to set TicketValidator property " + property);
+ logger.debug("Attempting to set TicketValidator property {}", property);
final String value = (String) propertyMap.get(property);
final PropertyDescriptor pd = ReflectUtils.getPropertyDescriptor(info, property);
if (pd != null) {
ReflectUtils.setProperty(property, convertIfNecessary(pd, value), validator, info);
- log.debug("Set " + property + "=" + value);
+ logger.debug("Set {} = {}", property, value);
} else {
- log.warn("Cannot find property " + property + " on " + className);
+ logger.warn("Cannot find property {} on {}", property, className);
}
}
}
@@ -584,9 +576,7 @@ private void removeCredentialsOfType(final Class extends Principal> clazz) {
* Removes expired entries from the assertion cache.
*/
private void cleanCache() {
- if (log.isDebugEnabled()) {
- log.debug("Cleaning assertion cache of size " + ASSERTION_CACHE.size());
- }
+ logger.debug("Cleaning assertion cache of size {}", ASSERTION_CACHE.size());
final Iterator> iter = ASSERTION_CACHE.entrySet().iterator();
final Calendar cutoff = Calendar.getInstance();
cutoff.setTimeInMillis(System.currentTimeMillis() - this.cacheTimeoutUnit.toMillis(this.cacheTimeout));
@@ -595,9 +585,7 @@ private void cleanCache() {
final Calendar created = Calendar.getInstance();
created.setTime(assertion.getValidFromDate());
if (created.before(cutoff)) {
- if (log.isDebugEnabled()) {
- log.debug("Removing expired assertion for principal " + assertion.getPrincipal());
- }
+ logger.debug("Removing expired assertion for principal {}", assertion.getPrincipal());
iter.remove();
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index 45adbaed4..798eca742 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -19,10 +19,10 @@
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 org.jasig.cas.client.util.XmlUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@@ -48,7 +48,7 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
/**
* Instance of Commons Logging.
*/
- private final Log log = LogFactory.getLog(this.getClass());
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* Url to CAS server.
@@ -77,7 +77,7 @@ public String getProxyTicketIdFor(final String proxyGrantingTicketId,
final String error = XmlUtils.getTextForElement(response, "proxyFailure");
if (CommonUtils.isNotEmpty(error)) {
- log.debug(error);
+ logger.debug(error);
return null;
}
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
index b62592be4..30478a4bb 100644
--- 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
@@ -23,9 +23,9 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Implementation of {@link ProxyGrantingTicketStorage} that is backed by a
@@ -41,7 +41,7 @@
*/
public final class ProxyGrantingTicketStorageImpl implements ProxyGrantingTicketStorage {
- private final Log log = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
/**
* Default timeout in milliseconds.
@@ -90,24 +90,20 @@ public String retrieve(final String proxyGrantingTicketIou) {
final ProxyGrantingTicketHolder holder = this.cache.get(proxyGrantingTicketIou);
if (holder == null) {
- log.info("No Proxy Ticket found for [" + proxyGrantingTicketIou + "].");
+ logger.info("No Proxy Ticket found for [{}].", proxyGrantingTicketIou);
return null;
}
this.cache.remove(proxyGrantingTicketIou);
- if (log.isDebugEnabled()) {
- log.debug("Returned ProxyGrantingTicket of [" + holder.getProxyGrantingTicket() + "]");
- }
+ logger.debug("Returned ProxyGrantingTicket of [{}]", holder.getProxyGrantingTicket());
return holder.getProxyGrantingTicket();
}
public void save(final String proxyGrantingTicketIou, final String proxyGrantingTicket) {
final ProxyGrantingTicketHolder holder = new ProxyGrantingTicketHolder(proxyGrantingTicket);
- if (log.isDebugEnabled()) {
- log.debug("Saving ProxyGrantingTicketIOU and ProxyGrantingTicket combo: [" + proxyGrantingTicketIou + ", " + proxyGrantingTicket + "]");
- }
+ logger.debug("Saving ProxyGrantingTicketIOU and ProxyGrantingTicket combo: [{}, {}]", proxyGrantingTicketIou, proxyGrantingTicket);
this.cache.put(proxyGrantingTicketIou, holder);
}
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
index 14c006f7b..e35d9e5e4 100644
--- 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
@@ -38,6 +38,5 @@ public interface ProxyRetriever extends Serializable {
* @param targetService the service we want to proxy.
* @return the ProxyTicket Id if Granted, null otherwise.
*/
- String getProxyTicketIdFor(String proxyGrantingTicketId,
- String targetService);
+ String getProxyTicketIdFor(String proxyGrantingTicketId, String targetService);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
index c58e3a47b..afcaa81de 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
@@ -19,8 +19,8 @@
package org.jasig.cas.client.session;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
@@ -47,7 +47,7 @@ public final class HashMapBackedSessionMappingStorage implements SessionMappingS
*/
private final Map ID_TO_SESSION_KEY_MAPPING = new HashMap();
- private final Log log = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
public synchronized void addSessionById(String mappingId, HttpSession session) {
ID_TO_SESSION_KEY_MAPPING.put(session.getId(), mappingId);
@@ -55,18 +55,16 @@ public synchronized void addSessionById(String mappingId, HttpSession session) {
}
- public synchronized void removeBySessionById(String sessionId) {
- if (log.isDebugEnabled()) {
- log.debug("Attempting to remove Session=[" + sessionId + "]");
- }
+ public synchronized void removeBySessionById(final String sessionId) {
+ logger.debug("Attempting to remove Session=[{}]", sessionId);
final String key = ID_TO_SESSION_KEY_MAPPING.get(sessionId);
- if (log.isDebugEnabled()) {
+ if (logger.isDebugEnabled()) {
if (key != null) {
- log.debug("Found mapping for session. Session Removed.");
+ logger.debug("Found mapping for session. Session Removed.");
} else {
- log.debug("No mapping for session found. Ignoring.");
+ logger.debug("No mapping for session found. Ignoring.");
}
}
MANAGED_SESSIONS.remove(key);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 31f3e24d7..b47e94ff6 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -22,10 +22,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.XmlUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List;
@@ -41,7 +41,7 @@
public final class SingleSignOutHandler {
/** Logger instance */
- private final Log log = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
/** Mapping of token IDs and session IDs to HTTP sessions */
private SessionMappingStorage sessionMappingStorage = new HashMapBackedSessionMappingStorage();
@@ -131,9 +131,7 @@ public void recordSession(final HttpServletRequest request) {
final HttpSession session = request.getSession(true);
final String token = CommonUtils.safeGetParameter(request, this.artifactParameterName, this.safeParameters);
- if (log.isDebugEnabled()) {
- log.debug("Recording session for token " + token);
- }
+ logger.debug("Recording session for token {}", token);
try {
this.sessionMappingStorage.removeBySessionById(session.getId());
@@ -150,10 +148,8 @@ public void recordSession(final HttpServletRequest request) {
*/
public void destroySession(final HttpServletRequest request) {
final String logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName, this.safeParameters);
- if (log.isTraceEnabled()) {
- log.trace ("Logout request:\n" + logoutMessage);
- }
-
+ logger.trace ("Logout request:\n{}", logoutMessage);
+
final String token = XmlUtils.getTextForElement(logoutMessage, "SessionIndex");
if (CommonUtils.isNotBlank(token)) {
final HttpSession session = this.sessionMappingStorage.removeSessionByMappingId(token);
@@ -161,13 +157,12 @@ public void destroySession(final HttpServletRequest request) {
if (session != null) {
String sessionID = session.getId();
- if (log.isDebugEnabled()) {
- log.debug ("Invalidating session [" + sessionID + "] for token [" + token + "]");
- }
+ logger.debug ("Invalidating session [{}] for token [{}]", sessionID, token);
+
try {
session.invalidate();
} catch (final IllegalStateException e) {
- log.debug("Error invalidating session.", e);
+ logger.debug("Error invalidating session.", e);
}
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index 79c94b327..cdf90a9a9 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -19,8 +19,8 @@
package org.jasig.cas.client.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
@@ -46,9 +46,6 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
/** Represents the constant for where the assertion will be located in memory. */
public static final String CONST_CAS_ASSERTION = "_const_cas_assertion_";
- /** 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";
@@ -69,15 +66,15 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
public final void init(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
setServerName(getPropertyFromInitParams(filterConfig, "serverName", null));
- log.trace("Loading serverName property: " + this.serverName);
+ logger.trace("Loading serverName property: {}", this.serverName);
setService(getPropertyFromInitParams(filterConfig, "service", null));
- log.trace("Loading service property: " + this.service);
+ logger.trace("Loading service property: {}", this.service);
setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName", "ticket"));
- log.trace("Loading artifact parameter name property: " + this.artifactParameterName);
+ logger.trace("Loading artifact parameter name property: {}", this.artifactParameterName);
setServiceParameterName(getPropertyFromInitParams(filterConfig, "serviceParameterName", "service"));
- log.trace("Loading serviceParameterName property: " + this.serviceParameterName);
+ logger.trace("Loading serviceParameterName property: {} ", this.serviceParameterName);
setEncodeServiceUrl(parseBoolean(getPropertyFromInitParams(filterConfig, "encodeServiceUrl", "true")));
- log.trace("Loading encodeServiceUrl property: " + this.encodeServiceUrl);
+ logger.trace("Loading encodeServiceUrl property: {}", this.encodeServiceUrl);
initInternal(filterConfig);
}
@@ -122,7 +119,7 @@ protected final String constructServiceUrl(final HttpServletRequest request, fin
public final void setServerName(final String serverName) {
if (serverName != null && serverName.endsWith("/")) {
this.serverName = serverName.substring(0, serverName.length()-1);
- log.info(String.format("Eliminated extra slash from serverName [%s]. It is now [%s]", serverName, this.serverName));
+ logger.info("Eliminated extra slash from serverName [{}]. It is now [{}]", serverName, this.serverName);
} else {
this.serverName = serverName;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
index de6dca7e1..eebb2d910 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
@@ -24,8 +24,8 @@
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Abstracts out the ability to configure the filters from the initial properties provided.
@@ -36,7 +36,7 @@
*/
public abstract class AbstractConfigurationFilter implements Filter {
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
private boolean ignoreInitConfiguration = false;
@@ -68,21 +68,21 @@ protected final String getPropertyFromInitParams(final FilterConfig filterConfig
final String value = filterConfig.getInitParameter(propertyName);
if (CommonUtils.isNotBlank(value)) {
- log.info("Property [" + propertyName + "] loaded from FilterConfig.getInitParameter with value [" + value + "]");
+ logger.info("Property [{}] loaded from FilterConfig.getInitParameter with value [{}]", propertyName, value);
return value;
}
final String value2 = filterConfig.getServletContext().getInitParameter(propertyName);
if (CommonUtils.isNotBlank(value2)) {
- log.info("Property [" + propertyName + "] loaded from ServletContext.getInitParameter with value [" + value2 + "]");
+ logger.info("Property [{}] loaded from ServletContext.getInitParameter with value [{}]", propertyName, value2);
return value2;
}
InitialContext context;
try {
context = new InitialContext();
} catch (final NamingException e) {
- log.warn(e,e);
+ logger.warn(e.getMessage(), e);
return defaultValue;
}
@@ -91,18 +91,18 @@ protected final String getPropertyFromInitParams(final FilterConfig filterConfig
final String value3 = loadFromContext(context, "java:comp/env/cas/" + shortName + "/" + propertyName);
if (CommonUtils.isNotBlank(value3)) {
- log.info("Property [" + propertyName + "] loaded from JNDI Filter Specific Property with value [" + value3 + "]");
+ logger.info("Property [{}] loaded from JNDI Filter Specific Property with value [{}]", propertyName, value3);
return value3;
}
final String value4 = loadFromContext(context, "java:comp/env/cas/" + propertyName);
if (CommonUtils.isNotBlank(value4)) {
- log.info("Property [" + propertyName + "] loaded from JNDI with value [" + value4 + "]");
+ logger.info("Property [{}] loaded from JNDI with value [{}]", propertyName, value4);
return value4;
}
- log.info("Property [" + propertyName + "] not found. Using default value [" + defaultValue + "]");
+ logger.info("Property [{}] not found. Using default value [{}]", propertyName, defaultValue);
return defaultValue;
}
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
index 0012b5e86..9bddb68e6 100644
--- 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
@@ -19,9 +19,9 @@
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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
@@ -44,7 +44,7 @@ public abstract class AbstractUrlBasedTicketValidator implements TicketValidator
/**
* Commons Logging instance.
*/
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
/**
* Hostname verifier used when making an SSL request to the CAS server.
@@ -113,7 +113,7 @@ protected void populateUrlAttributeMap(final Map urlParameters) {
protected final String constructValidationUrl(final String ticket, final String serviceUrl) {
final Map urlParameters = new HashMap();
- log.debug("Placing URL parameters in map.");
+ logger.debug("Placing URL parameters in map.");
urlParameters.put("ticket", ticket);
urlParameters.put("service", encodeUrl(serviceUrl));
@@ -121,10 +121,10 @@ protected final String constructValidationUrl(final String ticket, final String
urlParameters.put("renew", "true");
}
- log.debug("Calling template URL attribute map.");
+ logger.debug("Calling template URL attribute map.");
populateUrlAttributeMap(urlParameters);
- log.debug("Loading custom parameters from configuration.");
+ logger.debug("Loading custom parameters from configuration.");
if (this.customParameters != null) {
urlParameters.putAll(this.customParameters);
}
@@ -198,21 +198,17 @@ public final Assertion validate(final String ticket, final String service) throw
final String validationUrl = constructValidationUrl(ticket, service);
- if (log.isDebugEnabled()) {
- log.debug("Constructing validation url: " + validationUrl);
- }
+ logger.debug("Constructing validation url: {}", validationUrl);
try {
- log.debug("Retrieving response from server.");
+ logger.debug("Retrieving response from server.");
final String serverResponse = retrieveResponseFromServer(new URL(validationUrl), ticket);
if (serverResponse == null) {
throw new TicketValidationException("The CAS server returned no response.");
}
- if (log.isDebugEnabled()) {
- log.debug("Server response: " + serverResponse);
- }
+ logger.debug("Server response: {}", serverResponse);
return parseResponseFromServer(serverResponse);
} catch (final MalformedURLException e) {
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 043b34081..beb9c43a7 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -531,7 +531,11 @@
jndijndi
-
+
+
+ commons-logging
+ commons-logging
+
diff --git a/pom.xml b/pom.xml
index 8cb137f0e..f21d18277 100644
--- a/pom.xml
+++ b/pom.xml
@@ -162,24 +162,10 @@ NwXMoqnmqmUUnosrspqmmmmmmUUnosrspqmmmmmmUUA1jJ
test
- commons-logging
- commons-logging
- 1.1
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}compile
-
-
- log4j
- log4j
-
-
- logkit
- logkit
-
-
- avalon-framework
- avalon-framework
-
- javax.servlet
@@ -189,19 +175,20 @@ NwXMoqnmqmUUnosrspqmmmmmmUUnosrspqmmmmmmUUA1jJ
-
- cas-client-core
- cas-client-integration-atlassian
- cas-client-integration-jboss
- cas-client-support-distributed-ehcache
- cas-client-support-distributed-memcached
- cas-client-integration-tomcat-common
- cas-client-integration-tomcat-v6
- cas-client-integration-tomcat-v7
-
+
+ cas-client-core
+ cas-client-integration-atlassian
+ cas-client-integration-jboss
+ cas-client-support-distributed-ehcache
+ cas-client-support-distributed-memcached
+ cas-client-integration-tomcat-common
+ cas-client-integration-tomcat-v6
+ cas-client-integration-tomcat-v7
+
-
- 2.2.0
- 3.0.2
-
+
+ 2.2.0
+ 3.0.2
+ 1.7.1
+
From a2be7e030cf79ffb4eeec6cc4324b32ee7dfb26f Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Fri, 11 Jan 2013 22:23:49 -0500
Subject: [PATCH 026/239] CASC-202
migration to SLF4J
---
cas-client-core/pom.xml | 7 ++++
.../client/session/SingleSignOutFilter.java | 2 +-
.../client/session/SingleSignOutHandler.java | 2 +-
.../jasig/cas/client/util/CommonUtils.java | 35 ++++++-------------
.../cas/client/util/DelegatingFilter.java | 15 +++-----
.../cas/client/util/ErrorRedirectFilter.java | 8 ++---
.../util/HttpServletRequestWrapperFilter.java | 10 +++---
.../org/jasig/cas/client/util/XmlUtils.java | 33 +++--------------
.../AbstractTicketValidationFilter.java | 24 ++++++-------
.../AbstractUrlBasedTicketValidator.java | 3 --
...0ProxyReceivingTicketValidationFilter.java | 4 +--
.../Cas20ServiceTicketValidator.java | 2 +-
.../Saml11TicketValidationFilter.java | 4 +--
.../validation/Saml11TicketValidator.java | 8 ++---
cas-client-integration-atlassian/pom.xml | 6 ++++
.../atlassian/Jira44CasAuthenticator.java | 20 +++++------
.../atlassian/JiraCasAuthenticator.java | 18 ++++------
cas-client-integration-jboss/pom.xml | 4 +++
.../WebAuthenticationFilter.java | 10 +++---
.../client/tomcat/AbstractLogoutHandler.java | 14 ++++----
.../client/tomcat/AuthenticatorDelegate.java | 16 ++++-----
.../tomcat/PropertiesCasRealmDelegate.java | 8 ++---
.../tomcat/v6/AbstractAuthenticator.java | 10 +++---
.../client/tomcat/v6/AbstractCasRealm.java | 6 ++--
.../tomcat/v6/AbstractLifecycleValve.java | 10 +++---
.../client/tomcat/v6/AbstractLogoutValve.java | 2 +-
.../client/tomcat/v6/AssertionCasRealm.java | 2 +-
.../tomcat/v6/Cas10CasAuthenticator.java | 2 +-
.../tomcat/v6/Cas20CasAuthenticator.java | 2 +-
.../tomcat/v6/Cas20ProxyCasAuthenticator.java | 2 +-
.../client/tomcat/v6/PropertiesCasRealm.java | 2 +-
.../client/tomcat/v6/ProxyCallbackValve.java | 4 +--
.../client/tomcat/v6/RegexUriLogoutValve.java | 2 +-
.../client/tomcat/v6/Saml11Authenticator.java | 2 +-
.../client/tomcat/v6/SingleSignOutValve.java | 6 ++--
.../tomcat/v6/StaticUriLogoutValve.java | 2 +-
.../tomcat/v7/AbstractAuthenticator.java | 12 +++----
.../client/tomcat/v7/AbstractLogoutValve.java | 8 ++---
.../client/tomcat/v7/ProxyCallbackValve.java | 10 +++---
.../client/tomcat/v7/RegexUriLogoutValve.java | 2 +-
.../client/tomcat/v7/SingleSignOutValve.java | 14 ++++----
.../tomcat/v7/StaticUriLogoutValve.java | 2 +-
.../pom.xml | 10 ------
...eBackedProxyGrantingTicketStorageImpl.java | 14 +++-----
pom.xml | 24 +++++++++++++
45 files changed, 187 insertions(+), 216 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 8a13a6744..849bcebde 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -77,6 +77,13 @@
test
+
+ org.slf4j
+ jcl-over-slf4j
+ ${slf4j.version}
+ test
+
+
log4jlog4j
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index a9c850481..cc8ff7179 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -72,7 +72,7 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
// Do not continue up filter chain
return;
} else {
- log.trace("Ignoring URI " + request.getRequestURI());
+ logger.trace("Ignoring URI {}", request.getRequestURI());
}
filterChain.doFilter(servletRequest, servletResponse);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 04cceebb0..e6f09db85 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -137,7 +137,7 @@ public void recordSession(final HttpServletRequest request) {
final HttpSession session = request.getSession(this.eagerlyCreateSessions);
if (session == null) {
- log.debug("No session currently exists (and none created). Cannot record session information for single sign out.");
+ logger.debug("No session currently exists (and none created). Cannot record session information for single sign out.");
return;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 733393f3d..a88c0dd73 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -19,11 +19,11 @@
package org.jasig.cas.client.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.validation.ProxyList;
import org.jasig.cas.client.validation.ProxyListEditor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
@@ -52,8 +52,7 @@
*/
public final class CommonUtils {
- /** Instance of Commons Logging. */
- private static final Log LOG = LogFactory.getLog(CommonUtils.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(CommonUtils.class);
/**
* Constant representing the ProxyGrantingTicket IOU Request Parameter.
@@ -189,20 +188,12 @@ public static void readAndRespondToProxyReceptorRequest(final HttpServletRequest
return;
}
- if (LOG.isDebugEnabled()) {
- LOG.debug("Received proxyGrantingTicketId ["
- + proxyGrantingTicket + "] for proxyGrantingTicketIou ["
- + proxyGrantingTicketIou + "]");
- }
+ LOGGER.debug("Received proxyGrantingTicketId [{}] for proxyGrantingTicketIou [{}]", proxyGrantingTicket, proxyGrantingTicketIou);
proxyGrantingTicketStorage.save(proxyGrantingTicketIou, proxyGrantingTicket);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Successfully saved proxyGrantingTicketId ["
- + proxyGrantingTicket + "] for proxyGrantingTicketIou ["
- + proxyGrantingTicketIou + "]");
- }
-
+ LOGGER.debug("Successfully saved proxyGrantingTicketId [{}] for proxyGrantingTicketIou [{}]", proxyGrantingTicket, proxyGrantingTicketIou);
+
response.getWriter().write("");
response.getWriter().write("");
}
@@ -275,9 +266,7 @@ public static String constructServiceUrl(final HttpServletRequest request, final
if (location == 0) {
final String returnValue = encode ? response.encodeURL(buffer.toString()): buffer.toString();
- if (LOG.isDebugEnabled()) {
- LOG.debug("serviceUrl generated: " + returnValue);
- }
+ LOGGER.debug("serviceUrl generated: {}", returnValue);
return returnValue;
}
@@ -299,9 +288,7 @@ public static String constructServiceUrl(final HttpServletRequest request, final
}
final String returnValue = encode ? response.encodeURL(buffer.toString()) : buffer.toString();
- if (LOG.isDebugEnabled()) {
- LOG.debug("serviceUrl generated: " + returnValue);
- }
+ LOGGER.debug("serviceUrl generated: {}", returnValue);
return returnValue;
}
@@ -323,7 +310,7 @@ public static String constructServiceUrl(final HttpServletRequest request, final
*/
public static String safeGetParameter(final HttpServletRequest request, final String parameter, final List parameters) {
if ("POST".equals(request.getMethod()) && parameters.contains(parameter)) {
- LOG.debug("safeGetParameter called on a POST HttpServletRequest for Restricted Parameters. Cannot complete check safely. Reverting to standard behavior for this Parameter");
+ LOGGER.debug("safeGetParameter called on a POST HttpServletRequest for Restricted Parameters. Cannot complete check safely. Reverting to standard behavior for this Parameter");
return request.getParameter(parameter);
}
return request.getQueryString() == null || !request.getQueryString().contains(parameter) ? null : request.getParameter(parameter);
@@ -376,7 +363,7 @@ public static String getResponseFromServer(final URL constructedUrl, final Hostn
}
return stringBuffer.toString();
} catch (final Exception e) {
- LOG.error(e.getMessage(), e);
+ LOGGER.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (conn != null && conn instanceof HttpURLConnection) {
@@ -420,7 +407,7 @@ public static void sendRedirect(final HttpServletResponse response, final String
try {
response.sendRedirect(url);
} catch (final Exception e) {
- LOG.warn(e.getMessage(), e);
+ LOGGER.warn(e.getMessage(), e);
}
}
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
index 6c71ef831..4dfd5f6ed 100644
--- 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
@@ -19,8 +19,8 @@
package org.jasig.cas.client.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@@ -46,7 +46,7 @@ public final class DelegatingFilter implements Filter {
/**
* Instance of Commons Logging.
*/
- private final Log log = LogFactory.getLog(this.getClass());
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* The request parameter to look for in the Request object.
@@ -95,19 +95,14 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
for (final String key : this.delegators.keySet()) {
if ((parameter.equals(key) && this.exactMatch) || (parameter.matches(key) && !this.exactMatch)) {
final 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() + "]");
- }
+ logger.debug("Match found for parameter [{}] with value [{}]. Delegating to filter [{}]", this.requestParameterName, parameter, filter.getClass().getName());
filter.doFilter(request, response, filterChain);
return;
}
}
}
- log.debug("No match found for parameter [" + this.requestParameterName + "] with value [" + parameter + "]");
+ logger.debug("No match found for parameter [{}] with value [{}]", this.requestParameterName , parameter);
if (this.defaultFilter != null) {
this.defaultFilter.doFilter(request, response, filterChain);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
index 9ad2862fb..f630a56e9 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
@@ -32,8 +32,8 @@
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Filters that redirects to the supplied url based on an exception. Exceptions and the urls are configured via
@@ -51,7 +51,7 @@
*/
public final class ErrorRedirectFilter implements Filter {
- private final Log log = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
private final List errors = new ArrayList();
@@ -97,7 +97,7 @@ public void init(final FilterConfig filterConfig) throws ServletException {
this.errors.add(new ErrorHolder(className, filterConfig.getInitParameter(className)));
}
} catch (final ClassNotFoundException e) {
- log.warn("Class [" + className + "] cannot be found in ClassLoader. Ignoring.");
+ logger.warn("Class [{}] cannot be found in ClassLoader. Ignoring.", className);
}
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
index 56920b0df..c63a04c8d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
@@ -107,17 +107,17 @@ public String getRemoteUser() {
public boolean isUserInRole(final String role) {
if (CommonUtils.isBlank(role)) {
- log.debug("No valid role provided. Returning false.");
+ logger.debug("No valid role provided. Returning false.");
return false;
}
if (this.principal == null) {
- log.debug("No Principal in Request. Returning false.");
+ logger.debug("No Principal in Request. Returning false.");
return false;
}
if (CommonUtils.isBlank(roleAttribute)) {
- log.debug("No Role Attribute Configured. Returning false.");
+ logger.debug("No Role Attribute Configured. Returning false.");
return false;
}
@@ -126,14 +126,14 @@ public boolean isUserInRole(final String role) {
if (value instanceof Collection>) {
for (final Object o : (Collection>) value) {
if (rolesEqual(role, o)) {
- log.debug("User [" + getRemoteUser() + "] is in role [" + role + "]: " + true);
+ logger.debug("User [{}] is in role [{}]: true", getRemoteUser(), role);
return true;
}
}
}
final boolean isMember = rolesEqual(role, value);
- log.debug("User [" + getRemoteUser() + "] is in role [" + role + "]: " + isMember);
+ logger.debug("User [{}] is in role [{}]: {}", getRemoteUser(), role, isMember);
return isMember;
}
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
index 62abfdfe0..3fd1cf17d 100644
--- 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
@@ -19,8 +19,8 @@
package org.jasig.cas.client.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.Attributes;
@@ -50,7 +50,7 @@ public final class XmlUtils {
/**
* Static instance of Commons Logging.
*/
- private final static Log LOG = LogFactory.getLog(XmlUtils.class);
+ private final static Logger LOGGER = LoggerFactory.getLogger(XmlUtils.class);
/**
* Get an instance of an XML reader from the XMLReaderFactory.
@@ -118,7 +118,7 @@ public void characters(char[] ch, int start, int length)
try {
reader.parse(new InputSource(new StringReader(xmlAsString)));
} catch (final Exception e) {
- LOG.error(e, e);
+ LOGGER.error(e.getMessage(), e);
return null;
}
@@ -171,33 +171,10 @@ public void characters(char[] ch, int start, int length)
try {
reader.parse(new InputSource(new StringReader(xmlAsString)));
} catch (final Exception e) {
- LOG.error(e, e);
+ LOGGER.error(e.getMessage(), e);
return null;
}
return builder.toString();
}
-
- /**
- * Retrieve the child nodes from xml string, for a specific element.
- *
- * @param xmlAsString the xml response
- * @param tagName the element to look for
- * @return the {@link org.w3c.dom.NodeList NodeList} containing the child nodes.
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- */
- public static NodeList getNodeListForElements(final String xmlAsString, final String tagName)
- throws ParserConfigurationException,
- IOException,
- SAXException {
-
- final DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- final InputSource inStream = new InputSource();
- inStream.setCharacterStream(new StringReader(xmlAsString));
- final Document document = documentBuilder.parse(inStream);
-
- return document.getElementsByTagName(tagName).item(0).getChildNodes();
- }
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index 7f650468b..594becc77 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -90,9 +90,9 @@ protected TicketValidator getTicketValidator(final FilterConfig filterConfig) {
*/
protected HostnameVerifier getHostnameVerifier(final FilterConfig filterConfig) {
final String className = getPropertyFromInitParams(filterConfig, "hostnameVerifier", null);
- log.trace("Using hostnameVerifier parameter: " + className);
+ logger.trace("Using hostnameVerifier parameter: {}", className);
final String config = getPropertyFromInitParams(filterConfig, "hostnameVerifierConfig", null);
- log.trace("Using hostnameVerifierConfig parameter: " + config);
+ logger.trace("Using hostnameVerifierConfig parameter: {}", config);
if (className != null) {
if (config != null) {
return ReflectUtils.newInstance(className, config);
@@ -105,14 +105,14 @@ protected HostnameVerifier getHostnameVerifier(final FilterConfig filterConfig)
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
setExceptionOnValidationFailure(parseBoolean(getPropertyFromInitParams(filterConfig, "exceptionOnValidationFailure", "true")));
- log.trace("Setting exceptionOnValidationFailure parameter: " + this.exceptionOnValidationFailure);
+ logger.trace("Setting exceptionOnValidationFailure parameter: {}", this.exceptionOnValidationFailure);
setRedirectAfterValidation(parseBoolean(getPropertyFromInitParams(filterConfig, "redirectAfterValidation", "true")));
- log.trace("Setting redirectAfterValidation parameter: " + this.redirectAfterValidation);
+ logger.trace("Setting redirectAfterValidation parameter: {}", this.redirectAfterValidation);
setUseSession(parseBoolean(getPropertyFromInitParams(filterConfig, "useSession", "true")));
- log.trace("Setting useSession parameter: " + this.useSession);
+ logger.trace("Setting useSession parameter: {}", this.useSession);
if (!this.useSession && this.redirectAfterValidation) {
- log.warn("redirectAfterValidation parameter may not be true when useSession parameter is false. Resetting it to false in order to prevent infinite redirects.");
+ logger.warn("redirectAfterValidation parameter may not be true when useSession parameter is false. Resetting it to false in order to prevent infinite redirects.");
setRedirectAfterValidation(false);
}
@@ -174,16 +174,12 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
final String ticket = retrieveTicketFromRequest(request);
if (CommonUtils.isNotBlank(ticket)) {
- if (log.isDebugEnabled()) {
- log.debug("Attempting to validate ticket: " + ticket);
- }
+ logger.debug("Attempting to validate ticket: {}", ticket);
try {
final Assertion assertion = this.ticketValidator.validate(ticket, constructServiceUrl(request, response));
- if (log.isDebugEnabled()) {
- log.debug("Successfully authenticated user: " + assertion.getPrincipal().getName());
- }
+ logger.debug("Successfully authenticated user: {}", assertion.getPrincipal().getName());
request.setAttribute(CONST_CAS_ASSERTION, assertion);
@@ -193,13 +189,13 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
onSuccessfulValidation(request, response, assertion);
if (this.redirectAfterValidation) {
- log. debug("Redirecting after successful ticket validation.");
+ logger. debug("Redirecting after successful ticket validation.");
response.sendRedirect(constructServiceUrl(request, response));
return;
}
} catch (final TicketValidationException e) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- log.warn(e, e);
+ logger.warn(e.getMessage(), e);
onFailedValidation(request, response);
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
index 9bddb68e6..0b3cad708 100644
--- 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
@@ -41,9 +41,6 @@
*/
public abstract class AbstractUrlBasedTicketValidator implements TicketValidator {
- /**
- * Commons Logging instance.
- */
protected final Logger logger = LoggerFactory.getLogger(getClass());
/**
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 894bfefee..90ca2281e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -94,7 +94,7 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
}
}
- log.trace("Setting proxyReceptorUrl parameter: " + this.proxyReceptorUrl);
+ logger.trace("Setting proxyReceptorUrl parameter: {}", this.proxyReceptorUrl);
this.millisBetweenCleanUps = Integer.parseInt(getPropertyFromInitParams(filterConfig, "millisBetweenCleanUps", Integer.toString(DEFAULT_MILLIS_BETWEEN_CLEANUPS)));
super.initInternal(filterConfig);
}
@@ -185,7 +185,7 @@ protected final boolean preFilter(final ServletRequest servletRequest, final Ser
try {
CommonUtils.readAndRespondToProxyReceptorRequest(request, response, this.proxyGrantingTicketStorage);
} catch (final RuntimeException e) {
- log.error(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
throw e;
}
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
index 99637ace5..642afccd9 100644
--- 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
@@ -145,7 +145,7 @@ protected Map extractCustomAttributes(final String xml) {
xmlReader.parse(new InputSource(new StringReader(xml)));
return handler.getAttributes();
} catch (final Exception e) {
- log.error(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
return Collections.emptyMap();
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
index 26a2f7454..f768a3965 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
@@ -42,8 +42,8 @@ public Saml11TicketValidationFilter() {
protected final void initInternal(final FilterConfig filterConfig) throws ServletException {
super.initInternal(filterConfig);
- log.warn("SAML1.1 compliance requires the [artifactParameterName] and [serviceParameterName] to be set to specified values.");
- log.warn("This filter will overwrite any user-provided values (if any are provided)");
+ logger.warn("SAML1.1 compliance requires the [artifactParameterName] and [serviceParameterName] to be set to specified values.");
+ logger.warn("This filter will overwrite any user-provided values (if any are provided)");
setArtifactParameterName("SAMLart");
setServiceParameterName("TARGET");
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 624aea5dd..2482bc44b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -176,7 +176,7 @@ private boolean isValidAssertion(final org.opensaml.saml1.core.Assertion asserti
final DateTime notOnOrAfter = assertion.getConditions().getNotOnOrAfter();
if (notBefore == null || notOnOrAfter == null) {
- log.debug("Assertion has no bounding dates. Will not process.");
+ logger.debug("Assertion has no bounding dates. Will not process.");
return false;
}
@@ -184,16 +184,16 @@ private boolean isValidAssertion(final org.opensaml.saml1.core.Assertion asserti
final Interval validityRange = new Interval(notBefore.minus(this.tolerance), notOnOrAfter.plus(this.tolerance));
if (validityRange.contains(currentTime)) {
- log.debug("Current time is within the interval validity.");
+ logger.debug("Current time is within the interval validity.");
return true;
}
if (currentTime.isBefore(validityRange.getStart())) {
- log.debug("skipping assertion that's not yet valid...");
+ logger.debug("skipping assertion that's not yet valid...");
return false;
}
- log.debug("skipping expired assertion...");
+ logger.debug("skipping expired assertion...");
return false;
}
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index beb9c43a7..17f64d3ed 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -36,6 +36,12 @@
providedjartrue
+
+
+ commons-logging
+ commons-logging
+
+
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
index 689561d16..3ba8991d2 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
@@ -26,6 +26,8 @@
import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -47,15 +49,13 @@ public final class Jira44CasAuthenticator extends JiraSeraphAuthenticator {
/** Jira43CasAuthenticator.java */
private static final long serialVersionUID = 3852011252741183166L;
- private static final Log LOG = LogFactory.getLog(Jira44CasAuthenticator.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(Jira44CasAuthenticator.class);
public Principal getUser(final HttpServletRequest request, final HttpServletResponse response) {
// First, check to see if this session has already been authenticated during a previous request.
Principal existingUser = getUserFromSession(request);
if (existingUser != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Session found; user already logged in.");
- }
+ LOGGER.debug("Session found; user already logged in.");
}
final HttpSession session = request.getSession();
@@ -69,13 +69,9 @@ public Principal getUser(final HttpServletRequest request, final HttpServletResp
putPrincipalInSessionContext(request, user);
getElevatedSecurityGuard().onSuccessfulLoginAttempt(request, username);
LoginReason.OK.stampRequestResponse(request, response);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Logging in [" + username + "] from CAS.");
- }
+ LOGGER.debug("Logging in [{}] from CAS.", username);
} else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Failed logging [" + username + "] from CAS.");
- }
+ LOGGER.debug("Failed logging [{}] from CAS.", username);
getElevatedSecurityGuard().onFailedLoginAttempt(request, username);
}
return user;
@@ -88,8 +84,8 @@ public boolean logout(final HttpServletRequest request, final HttpServletRespons
final HttpSession session = request.getSession();
final Principal p = (Principal) session.getAttribute(LOGGED_IN_KEY);
- if (LOG.isDebugEnabled() && p != null) {
- LOG.debug("Logging out [" + p.getName() + "] from CAS.");
+ if (p != null) {
+ LOGGER.debug("Logging out [{}] from CAS.", p.getName());
}
removePrincipalFromSessionContext(request);
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
index aeb48f11a..9cd197649 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
@@ -28,6 +28,8 @@
import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -48,7 +50,7 @@ public final class JiraCasAuthenticator extends DefaultAuthenticator {
/** JiraCasAuthenticator.java */
private static final long serialVersionUID = 3452011252741183166L;
- private static final Log LOG = LogFactory.getLog(JiraCasAuthenticator.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(JiraCasAuthenticator.class);
@Override
protected boolean authenticate(final Principal principal, final String password) throws AuthenticatorException {
@@ -60,7 +62,7 @@ protected Principal getUser(final String username) {
try {
return UserManager.getInstance().getUser(username);
} catch (final EntityNotFoundException e) {
- LOG.warn("Could not find user '" + username + "' in UserManager : " + e);
+ LOGGER.warn("Could not find user '{}' in UserManager : {}", username, e);
}
return null;
}
@@ -70,9 +72,7 @@ public Principal getUser(final HttpServletRequest request, final HttpServletResp
// user already exists
if (session.getAttribute(LOGGED_IN_KEY) != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Session found; user already logged in.");
- }
+ LOGGER.debug("Session found; user already logged in.");
return (Principal) session.getAttribute(LOGGED_IN_KEY);
}
@@ -81,9 +81,7 @@ public Principal getUser(final HttpServletRequest request, final HttpServletResp
if (assertion != null) {
final Principal p = getUser(assertion.getPrincipal().getName());
- if (LOG.isDebugEnabled()) {
- LOG.debug("Logging in [" + p.getName() + "] from CAS.");
- }
+ LOGGER.debug("Logging in [{}] from CAS.", p.getName());
session.setAttribute(LOGGED_IN_KEY, p);
session.setAttribute(LOGGED_OUT_KEY, null);
@@ -97,9 +95,7 @@ public boolean logout(final HttpServletRequest request, final HttpServletRespons
final HttpSession session = request.getSession();
final Principal p = (Principal) session.getAttribute(LOGGED_IN_KEY);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Logging out [" + p.getName() + "] from CAS.");
- }
+ LOGGER.debug("Logging out [{}] from CAS.", p.getName());
session.setAttribute(LOGGED_OUT_KEY, p);
session.setAttribute(LOGGED_IN_KEY, null);
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index b631df1be..1e98f1d87 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -47,6 +47,10 @@
javax.securityjacc
+
+ commons-logging
+ commons-logging
+
diff --git a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
index 9eefd67ae..7a7870dbb 100644
--- a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
+++ b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
@@ -63,17 +63,17 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
if (session != null && session.getAttribute(CONST_CAS_ASSERTION) == null && ticket != null) {
try {
final String service = constructServiceUrl(request, response);
- log.debug("Attempting CAS ticket validation with service=" + service + " and ticket=" + ticket);
+ logger.debug("Attempting CAS ticket validation with service={} and ticket={}", service, ticket);
if (!new WebAuthentication().login(service, ticket)) {
- log.debug("JBoss Web authentication failed.");
+ logger.debug("JBoss Web authentication failed.");
throw new GeneralSecurityException("JBoss Web authentication failed.");
}
if (request.getUserPrincipal() instanceof AssertionPrincipal) {
final AssertionPrincipal principal = (AssertionPrincipal) request.getUserPrincipal();
- log.debug("Installing CAS assertion into session.");
+ logger.debug("Installing CAS assertion into session.");
request.getSession().setAttribute(CONST_CAS_ASSERTION, principal.getAssertion());
} else {
- log.debug("Aborting -- principal is not of type AssertionPrincipal");
+ logger.debug("Aborting -- principal is not of type AssertionPrincipal");
throw new GeneralSecurityException("JBoss Web authentication did not produce CAS AssertionPrincipal.");
}
} catch (final GeneralSecurityException e) {
@@ -83,7 +83,7 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
// There is evidence that in some cases the principal can disappear
// in JBoss despite a valid session.
// This block forces consistency between principal and assertion.
- log.info("User principal not found. Removing CAS assertion from session to force re-authentication.");
+ logger.info("User principal not found. Removing CAS assertion from session to force re-authentication.");
session.removeAttribute(CONST_CAS_ASSERTION);
}
chain.doFilter(request, response);
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
index bc8660600..681a041d6 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
@@ -23,11 +23,11 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.Assertion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Base class for all logout handlers.
@@ -38,7 +38,7 @@
*/
public abstract class AbstractLogoutHandler implements LogoutHandler {
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
protected String redirectUrl;
@@ -48,20 +48,20 @@ public void setRedirectUrl(final String redirectUrl) {
/** {@inheritDoc} */
public void logout(final HttpServletRequest request, final HttpServletResponse response) {
- log.debug("Processing logout request from CAS server.");
+ logger.debug("Processing logout request from CAS server.");
final Assertion assertion;
final HttpSession httpSession = request.getSession(false);
if (httpSession != null && (assertion = (Assertion) httpSession.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION)) != null) {
httpSession.removeAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
- log.info("Successfully logged out " + assertion.getPrincipal());
+ logger.info("Successfully logged out {}", assertion.getPrincipal());
} else {
- log.info("Session already ended.");
+ logger.info("Session already ended.");
}
final String redirectUrl = constructRedirectUrl(request);
if (redirectUrl != null) {
- log.debug("Redirecting to " + redirectUrl);
+ logger.debug("Redirecting to {}", redirectUrl);
CommonUtils.sendRedirect(response, redirectUrl);
}
}
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
index 3b2660144..dcb940101 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
@@ -26,13 +26,13 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
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.validation.TicketValidationException;
import org.jasig.cas.client.validation.TicketValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Version-agnostic authenticator which encapsulates the core CAS workflow of
@@ -49,7 +49,7 @@
public final class AuthenticatorDelegate {
/** Log instance */
- private final Log log = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
private String serviceUrl;
@@ -86,19 +86,19 @@ public final Principal authenticate(final HttpServletRequest request, final Http
assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
}
if (assertion == null) {
- log.debug("CAS assertion not found in session -- authentication required.");
+ logger.debug("CAS assertion not found in session -- authentication required.");
final String token = request.getParameter(this.artifactParameterName);
final String service = CommonUtils.constructServiceUrl(request, response, this.serviceUrl, this.serverName, this.artifactParameterName, true);
if (CommonUtils.isBlank(token)) {
final String redirectUrl = CommonUtils.constructRedirectUrl(this.casServerLoginUrl, this.serviceParameterName, service, false, false);
- log.debug("Redirecting to " + redirectUrl);
+ logger.debug("Redirecting to {}", redirectUrl);
CommonUtils.sendRedirect(response, redirectUrl);
return null;
}
try {
- log.debug("Attempting to validate " + token + " for " + service);
+ logger.debug("Attempting to validate {} for {}", token, service);
assertion = this.ticketValidator.validate(token, service);
- log.debug("CAS authentication succeeded.");
+ logger.debug("CAS authentication succeeded.");
if (session == null) {
session = request.getSession(true);
}
@@ -110,7 +110,7 @@ public final Principal authenticate(final HttpServletRequest request, final Http
}
Principal p = realm.authenticate(assertion.getPrincipal());
if (p == null) {
- log.debug(assertion.getPrincipal().getName() + " failed to authenticate to " + realm);
+ logger.debug("{} failed to authenticate to {}", assertion.getPrincipal().getName(), realm);
setUnauthorized(response, null);
}
return p;
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
index 9512cad10..f34f4d318 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
@@ -26,9 +26,9 @@
import java.security.Principal;
import java.util.*;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* {@link CasRealm} implementation with users and roles defined by a properties
@@ -49,7 +49,7 @@
public class PropertiesCasRealmDelegate implements CasRealm {
/** Log instance */
- private final Log log = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
/** Path to backing properties file */
private String propertiesFilePath;
@@ -73,7 +73,7 @@ public void readProperties() {
}
CommonUtils.assertTrue(file.exists(), "File not found " + file);
CommonUtils.assertTrue(file.canRead(), "Cannot read " + file);
- log.debug("Loading users/roles from " + file);
+ logger.debug("Loading users/roles from {}", file);
final Properties properties = new Properties();
try {
properties.load(new BufferedInputStream(new FileInputStream(file)));
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractAuthenticator.java
index 4e1c7cc72..83d6a72af 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractAuthenticator.java
@@ -27,12 +27,12 @@
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.LoginConfig;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.tomcat.AuthenticatorDelegate;
import org.jasig.cas.client.tomcat.CasRealm;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.TicketValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.security.Principal;
@@ -46,7 +46,7 @@
*/
public abstract class AbstractAuthenticator extends AuthenticatorBase implements LifecycleListener {
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
private final AuthenticatorDelegate delegate = new AuthenticatorDelegate();
@@ -84,7 +84,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
public void start() throws LifecycleException {
super.start();
- this.log.debug(getName() + " starting.");
+ logger.debug("{} starting.", getName());
final Realm realm = this.context.getRealm();
try {
CommonUtils.assertTrue(realm instanceof CasRealm, "Expected CasRealm but got " + realm.getInfo());
@@ -166,7 +166,7 @@ public final boolean authenticate(final Request request, final Response response
/** {@inheritDoc} */
public void lifecycleEvent(final LifecycleEvent event) {
if (AFTER_START_EVENT.equals(event.getType())) {
- this.log.debug(getName() + " processing lifecycle event " + AFTER_START_EVENT);
+ logger.debug("{} processing lifecycle event {}", getName(), AFTER_START_EVENT);
this.delegate.setTicketValidator(getTicketValidator());
this.delegate.setArtifactParameterName(getArtifactParameterName());
this.delegate.setServiceParameterName(getServiceParameterName());
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
index a08cebca9..5394a7332 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
@@ -22,9 +22,9 @@
import java.security.Principal;
import org.apache.catalina.realm.RealmBase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.tomcat.CasRealm;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Base Realm implementation for all CAS realms.
@@ -36,7 +36,7 @@
public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
/** Logger instance */
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
/** {@inheritDoc} */
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLifecycleValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLifecycleValve.java
index 50a0984f7..358019058 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLifecycleValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLifecycleValve.java
@@ -24,8 +24,8 @@
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.valves.ValveBase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Base Valve implementation for valves that need Catalina lifecycle
@@ -38,7 +38,7 @@
public abstract class AbstractLifecycleValve extends ValveBase implements Lifecycle {
/** Logger instance */
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
/** Lifecycle listeners */
private LifecycleSupport lifecycle = new LifecycleSupport(this);
@@ -61,12 +61,12 @@ public void removeLifecycleListener(final LifecycleListener listener) {
/** {@inheritDoc} */
public void start() throws LifecycleException {
- log.debug(getName() + " starting.");
+ logger.debug("{} starting.", getName());
}
/** {@inheritDoc} */
public void stop() throws LifecycleException {
- log.debug(getName() + " stopping.");
+ logger.debug("{} stopping.", getName());
}
/**
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLogoutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLogoutValve.java
index 8a9d8eeca..d01f1a84c 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLogoutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLogoutValve.java
@@ -43,7 +43,7 @@ public final void invoke(final Request request, final Response response) throws
return;
}
- this.log.debug("URI is not a logout request: " + request.getRequestURI());
+ logger.debug("URI is not a logout request: {}", request.getRequestURI());
getNext().invoke(request, response);
}
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AssertionCasRealm.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AssertionCasRealm.java
index 9dcbc15a8..42652d65c 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AssertionCasRealm.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AssertionCasRealm.java
@@ -40,7 +40,7 @@ public class AssertionCasRealm extends AbstractCasRealm {
/** {@inheritDoc} */
public void start() throws LifecycleException {
super.start();
- log.info("Startup completed.");
+ logger.info("Startup completed.");
}
/**
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas10CasAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas10CasAuthenticator.java
index b30bdb4b0..362cba45e 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas10CasAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas10CasAuthenticator.java
@@ -54,6 +54,6 @@ public void start() throws LifecycleException {
super.start();
this.ticketValidator = new Cas10TicketValidator(getCasServerUrlPrefix());
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
- log.info("Startup completed.");
+ logger.info("Startup completed.");
}
}
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20CasAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20CasAuthenticator.java
index 462094d71..07392cbc9 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20CasAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20CasAuthenticator.java
@@ -60,6 +60,6 @@ public void start() throws LifecycleException {
this.ticketValidator.setProxyGrantingTicketStorage(ProxyCallbackValve.getProxyGrantingTicketStorage());
this.ticketValidator.setRenew(isRenew());
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
}
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20ProxyCasAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20ProxyCasAuthenticator.java
index cc577f0ca..387f10a6d 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20ProxyCasAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20ProxyCasAuthenticator.java
@@ -75,6 +75,6 @@ public void start() throws LifecycleException {
this.ticketValidator.setEncoding(getEncoding());
}
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
}
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/PropertiesCasRealm.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/PropertiesCasRealm.java
index 080d1acfc..81eada990 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/PropertiesCasRealm.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/PropertiesCasRealm.java
@@ -54,7 +54,7 @@ public void setPropertiesFilePath(final String path) {
public void start() throws LifecycleException {
super.start();
this.delegate.readProperties();
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
/** {@inheritDoc} */
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/ProxyCallbackValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/ProxyCallbackValve.java
index 3d1dc161e..1fb291c7d 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/ProxyCallbackValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/ProxyCallbackValve.java
@@ -73,12 +73,12 @@ public void start() throws LifecycleException {
} catch (final Exception e) {
throw new LifecycleException(e);
}
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
public void invoke(final Request request, final Response response) throws IOException, ServletException {
if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
- this.log.debug("Processing proxy callback request.");
+ logger.debug("Processing proxy callback request.");
CommonUtils.readAndRespondToProxyReceptorRequest(request, response, PROXY_GRANTING_TICKET_STORAGE);
return;
}
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/RegexUriLogoutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/RegexUriLogoutValve.java
index 150e377b7..2d3691abe 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/RegexUriLogoutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/RegexUriLogoutValve.java
@@ -48,7 +48,7 @@ public void setLogoutUriRegex(final String regex) {
public void start() throws LifecycleException {
super.start();
this.logoutHandler.init();
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
/** {@inheritDoc} */
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Saml11Authenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Saml11Authenticator.java
index 924798594..19b7f50a1 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Saml11Authenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Saml11Authenticator.java
@@ -60,7 +60,7 @@ public void start() throws LifecycleException {
}
this.ticketValidator.setRenew(isRenew());
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
protected TicketValidator getTicketValidator() {
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
index d7c5d1238..6588d5618 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
@@ -64,7 +64,7 @@ public void setSessionMappingStorage(final SessionMappingStorage storage) {
public void start() throws LifecycleException {
super.start();
handler.init();
- log.info("Startup completed.");
+ logger.info("Startup completed.");
}
/** {@inheritDoc} */
@@ -78,7 +78,7 @@ else if (this.handler.isLogoutRequest(request)) {
// Do not proceed up valve chain
return;
} else {
- log.debug("Ignoring URI " + request.getRequestURI());
+ logger.debug("Ignoring URI {}", request.getRequestURI());
}
getNext().invoke(request, response);
}
@@ -87,7 +87,7 @@ else if (this.handler.isLogoutRequest(request)) {
/** {@inheritDoc} */
public void sessionEvent(final SessionEvent event) {
if (Session.SESSION_DESTROYED_EVENT.equals(event.getType())) {
- this.log.debug("Cleaning up SessionMappingStorage on destroySession event");
+ logger.debug("Cleaning up SessionMappingStorage on destroySession event");
this.handler.getSessionMappingStorage().removeBySessionById(event.getSession().getId());
}
}
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/StaticUriLogoutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/StaticUriLogoutValve.java
index 0ddbd0990..91757e957 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/StaticUriLogoutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/StaticUriLogoutValve.java
@@ -48,7 +48,7 @@ public void setLogoutUri(final String logoutUri) {
public void start() throws LifecycleException {
super.start();
this.logoutHandler.init();
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
/** {@inheritDoc} */
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
index 137367659..b733a3d05 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
@@ -27,12 +27,12 @@
import org.apache.catalina.authenticator.AuthenticatorBase;
import org.apache.catalina.connector.Request;
import org.apache.catalina.deploy.LoginConfig;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.tomcat.AuthenticatorDelegate;
import org.jasig.cas.client.tomcat.CasRealm;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.TicketValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@@ -47,7 +47,7 @@
*/
public abstract class AbstractAuthenticator extends AuthenticatorBase implements LifecycleListener {
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
private final AuthenticatorDelegate delegate = new AuthenticatorDelegate();
@@ -94,7 +94,7 @@ protected String getAuthMethod() {
protected void startInternal() throws LifecycleException {
super.startInternal();
- this.log.debug(getName() + " starting.");
+ logger.debug("{} starting.", getName());
final Realm realm = this.context.getRealm();
try {
CommonUtils.assertTrue(realm instanceof CasRealm, "Expected CasRealm but got " + realm.getInfo());
@@ -175,7 +175,7 @@ public final boolean authenticate(final Request request, final HttpServletRespon
/** {@inheritDoc} */
public void lifecycleEvent(final LifecycleEvent event) {
if (AFTER_START_EVENT.equals(event.getType())) {
- this.log.debug(getName() + " processing lifecycle event " + AFTER_START_EVENT);
+ logger.debug("{} processing lifecycle event {}", getName(), AFTER_START_EVENT);
this.delegate.setTicketValidator(getTicketValidator());
this.delegate.setArtifactParameterName(getArtifactParameterName());
this.delegate.setServiceParameterName(getServiceParameterName());
@@ -191,7 +191,7 @@ public String getInfo() {
protected synchronized void setState(LifecycleState state, Object data) {
super.setState(state, data);
if (LifecycleState.STARTED.equals(state)) {
- this.log.info(getName() + " started.");
+ logger.info("{} started.", getName());
}
}
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractLogoutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractLogoutValve.java
index dd24e28a2..aba02c3d5 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractLogoutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractLogoutValve.java
@@ -22,9 +22,9 @@
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.ValveBase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.tomcat.LogoutHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -40,7 +40,7 @@
*/
public abstract class AbstractLogoutValve extends ValveBase {
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
public final void invoke(final Request request, final Response response) throws IOException, ServletException {
if (getLogoutHandler().isLogoutRequest(request)) {
@@ -49,7 +49,7 @@ public final void invoke(final Request request, final Response response) throws
return;
}
- this.log.debug("URI is not a logout request: " + request.getRequestURI());
+ logger.debug("URI is not a logout request: {}", request.getRequestURI());
getNext().invoke(request, response);
}
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/ProxyCallbackValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/ProxyCallbackValve.java
index 5966ba1c0..bd54cb21a 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/ProxyCallbackValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/ProxyCallbackValve.java
@@ -23,11 +23,11 @@
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.ValveBase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -48,7 +48,7 @@ public final class ProxyCallbackValve extends ValveBase {
private static ProxyGrantingTicketStorage PROXY_GRANTING_TICKET_STORAGE;
/** Logger instance */
- private final Log log = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
private String proxyGrantingTicketStorageClass;
@@ -77,12 +77,12 @@ protected void startInternal() throws LifecycleException {
} catch (final Exception e) {
throw new LifecycleException(e);
}
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
public void invoke(final Request request, final Response response) throws IOException, ServletException {
if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
- this.log.debug("Processing proxy callback request.");
+ logger.debug("Processing proxy callback request.");
CommonUtils.readAndRespondToProxyReceptorRequest(request, response, PROXY_GRANTING_TICKET_STORAGE);
return;
}
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/RegexUriLogoutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/RegexUriLogoutValve.java
index c87ad7f83..5e63a1a22 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/RegexUriLogoutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/RegexUriLogoutValve.java
@@ -46,7 +46,7 @@ public void setLogoutUriRegex(final String regex) {
protected void startInternal() throws LifecycleException {
super.startInternal();
this.logoutHandler.init();
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
/** {@inheritDoc} */
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
index f1b024957..66068d5d6 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
@@ -30,11 +30,11 @@
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.ValveBase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.session.SessionMappingStorage;
import org.jasig.cas.client.session.SingleSignOutHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Handles logout request messages sent from the CAS server by ending the current
@@ -48,7 +48,7 @@
public class SingleSignOutValve extends ValveBase implements SessionListener {
/** Logger instance */
- private final Log log = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
private final SingleSignOutHandler handler = new SingleSignOutHandler();
@@ -76,7 +76,7 @@ else if (this.handler.isLogoutRequest(request)) {
// Do not proceed up valve chain
return;
} else {
- this.log.debug("Ignoring URI " + request.getRequestURI());
+ logger.debug("Ignoring URI {}", request.getRequestURI());
}
getNext().invoke(request, response);
}
@@ -85,7 +85,7 @@ else if (this.handler.isLogoutRequest(request)) {
/** {@inheritDoc} */
public void sessionEvent(final SessionEvent event) {
if (Session.SESSION_DESTROYED_EVENT.equals(event.getType())) {
- this.log.debug("Cleaning up SessionMappingStorage on destroySession event");
+ logger.debug("Cleaning up SessionMappingStorage on destroySession event");
this.handler.getSessionMappingStorage().removeBySessionById(event.getSession().getId());
}
}
@@ -93,8 +93,8 @@ public void sessionEvent(final SessionEvent event) {
/** {@inheritDoc} */
protected void startInternal() throws LifecycleException {
super.startInternal();
- this.log.info("Starting...");
+ logger.info("Starting...");
handler.init();
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
}
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/StaticUriLogoutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/StaticUriLogoutValve.java
index aaf550292..812732296 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/StaticUriLogoutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/StaticUriLogoutValve.java
@@ -46,7 +46,7 @@ public void setLogoutUri(final String logoutUri) {
protected void startInternal() throws LifecycleException {
super.startInternal();
this.logoutHandler.init();
- this.log.info("Startup completed.");
+ logger.info("Startup completed.");
}
/** {@inheritDoc} */
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 43c22fa50..8d01ace0b 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -24,21 +24,11 @@
-
net.sf.ehcacheehcache-core${ehcache.version}compilejar
-
-
- org.slf4j
- slf4j-api
- 1.6.1
- test
-
-
-
\ No newline at end of file
diff --git a/cas-client-support-distributed-ehcache/src/main/java/org/jasig/cas/client/proxy/EhcacheBackedProxyGrantingTicketStorageImpl.java b/cas-client-support-distributed-ehcache/src/main/java/org/jasig/cas/client/proxy/EhcacheBackedProxyGrantingTicketStorageImpl.java
index 573129202..71b1e52e6 100644
--- a/cas-client-support-distributed-ehcache/src/main/java/org/jasig/cas/client/proxy/EhcacheBackedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-support-distributed-ehcache/src/main/java/org/jasig/cas/client/proxy/EhcacheBackedProxyGrantingTicketStorageImpl.java
@@ -23,12 +23,8 @@
import net.sf.ehcache.Element;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.distribution.RemoteCacheException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.spec.InvalidKeySpecException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Scott Battaglia
@@ -39,13 +35,13 @@ public final class EhcacheBackedProxyGrantingTicketStorageImpl extends AbstractE
public static final String EHCACHE_CACHE_NAME = "org.jasig.cas.client.proxy.EhcacheBackedProxyGrantingTicketStorageImpl.cache";
- private static final Log log = LogFactory.getLog(EhcacheBackedProxyGrantingTicketStorageImpl.class);
+ private static final Logger logger = LoggerFactory.getLogger(EhcacheBackedProxyGrantingTicketStorageImpl.class);
final Cache cache;
public EhcacheBackedProxyGrantingTicketStorageImpl() {
this(CacheManager.getInstance().getCache(EHCACHE_CACHE_NAME));
- log.info("Created cache with name: " + this.cache.getName());
+ logger.info("Created cache with name: {}", this.cache.getName());
}
public EhcacheBackedProxyGrantingTicketStorageImpl(final Cache cache) {
@@ -58,7 +54,7 @@ public void saveInternal(final String proxyGrantingTicketIou, final String proxy
try {
this.cache.put(element);
} catch (final RemoteCacheException e) {
- log.warn("Exception accessing one of the remote servers: " + e.getMessage(), e);
+ logger.warn("Exception accessing one of the remote servers: {}", e.getMessage(), e);
}
}
diff --git a/pom.xml b/pom.xml
index f21d18277..bdd2bade5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -151,6 +151,30 @@ NwXMoqnmqmUUnosrspqmmmmmmUUnosrspqmmmmmmUUA1jJ
-->
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 1.0
+
+
+ enforce-banned-dependencies
+
+ enforce
+
+
+
+
+
+ commons-logging
+ cglib:cglib
+
+
+
+ true
+
+
+
+
From 485cc2116b7af4135db36d6fba5241cc5460dda9 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Fri, 11 Jan 2013 23:25:52 -0500
Subject: [PATCH 027/239] CASC-202
convert Commons Logging to SLF4J. Add Enforcer.
---
cas-client-core/pom.xml | 7 ----
cas-client-integration-atlassian/pom.xml | 4 ++
.../Confluence35CasAuthenticator.java | 22 ++++-------
.../atlassian/ConfluenceCasAuthenticator.java | 18 +++------
.../atlassian/Jira44CasAuthenticator.java | 2 -
.../atlassian/JiraCasAuthenticator.java | 3 --
pom.xml | 37 ++++++++++++-------
7 files changed, 42 insertions(+), 51 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 849bcebde..8a13a6744 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -77,13 +77,6 @@
test
-
- org.slf4j
- jcl-over-slf4j
- ${slf4j.version}
- test
-
-
log4jlog4j
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 17f64d3ed..e1390e9ae 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -520,6 +520,10 @@
bouncycastlebcprov-jdk14
+
+ commons-logging
+ commons-logging
+
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
index d1f4dcb1a..61815ed85 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
@@ -24,10 +24,10 @@
import com.atlassian.confluence.user.ConfluenceAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
import com.atlassian.seraph.auth.LoginReason;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -49,14 +49,12 @@
public final class Confluence35CasAuthenticator extends ConfluenceAuthenticator {
private static final long serialVersionUID = -6097438206488390678L;
- private static final Log LOG = LogFactory.getLog(Confluence35CasAuthenticator.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(Confluence35CasAuthenticator.class);
public Principal getUser(final HttpServletRequest request, final HttpServletResponse response) {
Principal existingUser = getUserFromSession(request);
if (existingUser != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Session found; user already logged in.");
- }
+ LOGGER.debug("Session found; user already logged in.");
LoginReason.OK.stampRequestResponse(request, response);
return existingUser;
}
@@ -76,13 +74,9 @@ public Principal getUser(final HttpServletRequest request, final HttpServletResp
// Firing this event is necessary to ensure the user's personal information is initialised correctly.
getEventPublisher().publish(new LoginEvent(this, username, request.getSession().getId(), remoteHost, remoteIP));
LoginReason.OK.stampRequestResponse(request, response);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Logging in [" + username + "] from CAS.");
- }
+ LOGGER.debug("Logging in [{}] from CAS.", username);
} else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Failed logging [" + username + "] from CAS.");
- }
+ LOGGER.debug("Failed logging [{}] from CAS.", username);
getElevatedSecurityGuard().onFailedLoginAttempt(request, username);
getEventPublisher().publish(new LoginFailedEvent(this, username, request.getSession().getId(), remoteHost, remoteIP));
}
@@ -97,8 +91,8 @@ public boolean logout(final HttpServletRequest request, final HttpServletRespons
final Principal principal = (Principal) session.getAttribute(LOGGED_IN_KEY);
- if (LOG.isDebugEnabled() && principal != null) {
- LOG.debug("Logging out [" + principal.getName() + "] from CAS.");
+ if (principal != null) {
+ LOGGER.debug("Logging out [{}] from CAS.", principal.getName());
}
removePrincipalFromSessionContext(request);
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
index 3f88bea79..30ef63e34 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
@@ -21,10 +21,10 @@
import com.atlassian.confluence.user.ConfluenceAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -45,16 +45,14 @@ public final class ConfluenceCasAuthenticator extends ConfluenceAuthenticator {
/** ConfluenceCasAuthenticator.java */
private static final long serialVersionUID = -6097438206488390677L;
- private static final Log LOG = LogFactory.getLog(ConfluenceCasAuthenticator.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConfluenceCasAuthenticator.class);
public Principal getUser(final HttpServletRequest request, final HttpServletResponse response) {
final HttpSession session = request.getSession();
// user already exists
if (session.getAttribute(LOGGED_IN_KEY) != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Session found; user already logged in.");
- }
+ LOGGER.debug("Session found; user already logged in.");
return (Principal) session.getAttribute(LOGGED_IN_KEY);
}
@@ -63,9 +61,7 @@ public Principal getUser(final HttpServletRequest request, final HttpServletResp
if (assertion != null) {
final Principal p = getUser(assertion.getPrincipal().getName());
- if (LOG.isDebugEnabled()) {
- LOG.debug("Logging in [" + p.getName() + "] from CAS.");
- }
+ LOGGER.debug("Logging in [{}] from CAS.", p.getName());
session.setAttribute(LOGGED_IN_KEY, p);
session.setAttribute(LOGGED_OUT_KEY, null);
@@ -80,9 +76,7 @@ public boolean logout(final HttpServletRequest request, final HttpServletRespons
final Principal principal = (Principal) session.getAttribute(LOGGED_IN_KEY);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Logging out [" + principal.getName() + "] from CAS.");
- }
+ LOGGER.debug("Logging out [{}] from CAS.", principal.getName());
session.setAttribute(LOGGED_OUT_KEY, principal);
session.setAttribute(LOGGED_IN_KEY, null);
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
index 3ba8991d2..65b44a95f 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
@@ -22,8 +22,6 @@
import com.atlassian.jira.security.login.JiraSeraphAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
import com.atlassian.seraph.auth.LoginReason;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
index 9cd197649..5f3c519bf 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
@@ -22,10 +22,7 @@
import com.atlassian.seraph.auth.DefaultAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
import com.opensymphony.user.EntityNotFoundException;
-import com.opensymphony.user.User;
import com.opensymphony.user.UserManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
diff --git a/pom.xml b/pom.xml
index bdd2bade5..9472fbdde 100644
--- a/pom.xml
+++ b/pom.xml
@@ -166,7 +166,6 @@ NwXMoqnmqmUUnosrspqmmmmmmUUnosrspqmmmmmmUUA1jJ
commons-logging
- cglib:cglib
@@ -180,23 +179,35 @@ NwXMoqnmqmUUnosrspqmmmmmmUUnosrspqmmmmmmUUA1jJ
- junit
- junit
- 4.8.2
- test
+ junit
+ junit
+ 4.8.2
+ test
- org.slf4j
- slf4j-api
- ${slf4j.version}
- compile
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+ compile
- javax.servlet
- servlet-api
- 2.4
- provided
+ javax.servlet
+ servlet-api
+ 2.4
+ provided
+
+ org.slf4j
+ jcl-over-slf4j
+ ${slf4j.version}
+ test
+
+
+ org.slf4j
+ slf4j-simple
+ ${slf4j.version}
+ test
+
From 25e2b6c696a7d72066647e7445e53da45e114d5b Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 15 Jan 2013 22:04:16 -0500
Subject: [PATCH 028/239] Fix formatting of pom.xml and update licensing to
match CAS project.
---
assembly.xml | 13 +-
.../authentication/AttributePrincipal.java | 15 +-
.../AttributePrincipalImpl.java | 15 +-
.../authentication/AuthenticationFilter.java | 15 +-
.../DefaultGatewayResolverImpl.java | 15 +-
.../authentication/GatewayResolver.java | 15 +-
.../Saml11AuthenticationFilter.java | 15 +-
.../client/authentication/SimpleGroup.java | 15 +-
.../authentication/SimplePrincipal.java | 15 +-
.../cas/client/jaas/AssertionPrincipal.java | 15 +-
.../jasig/cas/client/jaas/CasLoginModule.java | 19 +-
.../jaas/ServiceAndTicketCallbackHandler.java | 15 +-
.../cas/client/jaas/TicketCredential.java | 15 +-
...cryptedProxyGrantingTicketStorageImpl.java | 18 +
.../cas/client/proxy/Cas20ProxyRetriever.java | 15 +-
.../cas/client/proxy/CleanUpTimerTask.java | 15 +-
.../proxy/ProxyGrantingTicketStorage.java | 15 +-
.../proxy/ProxyGrantingTicketStorageImpl.java | 15 +-
.../cas/client/proxy/ProxyRetriever.java | 15 +-
.../org/jasig/cas/client/proxy/package.html | 13 +-
.../HashMapBackedSessionMappingStorage.java | 15 +-
.../client/session/SessionMappingStorage.java | 15 +-
.../client/session/SingleSignOutFilter.java | 15 +-
.../client/session/SingleSignOutHandler.java | 17 +-
.../SingleSignOutHttpSessionListener.java | 15 +-
.../cas/client/ssl/AnyHostnameVerifier.java | 15 +-
.../cas/client/ssl/RegexHostnameVerifier.java | 17 +-
.../client/ssl/WhitelistHostnameVerifier.java | 19 +-
.../cas/client/util/AbstractCasFilter.java | 15 +-
.../util/AbstractConfigurationFilter.java | 15 +-
.../cas/client/util/AssertionHolder.java | 17 +-
.../util/AssertionThreadLocalFilter.java | 15 +-
.../jasig/cas/client/util/CommonUtils.java | 15 +-
.../cas/client/util/DelegatingFilter.java | 15 +-
.../cas/client/util/ErrorRedirectFilter.java | 15 +-
.../util/HttpServletRequestWrapperFilter.java | 15 +-
.../jasig/cas/client/util/ReflectUtils.java | 17 +-
.../org/jasig/cas/client/util/XmlUtils.java | 15 +-
.../org/jasig/cas/client/util/package.html | 13 +-
...actCasProtocolUrlBasedTicketValidator.java | 15 +-
.../AbstractTicketValidationFilter.java | 15 +-
.../AbstractUrlBasedTicketValidator.java | 17 +-
.../cas/client/validation/Assertion.java | 15 +-
.../cas/client/validation/AssertionImpl.java | 15 +-
.../Cas10TicketValidationFilter.java | 15 +-
.../validation/Cas10TicketValidator.java | 15 +-
...0ProxyReceivingTicketValidationFilter.java | 15 +-
.../validation/Cas20ProxyTicketValidator.java | 15 +-
.../Cas20ServiceTicketValidator.java | 15 +-
...idProxyChainTicketValidationException.java | 15 +-
.../cas/client/validation/ProxyList.java | 15 +-
.../client/validation/ProxyListEditor.java | 15 +-
.../Saml11TicketValidationFilter.java | 15 +-
.../validation/Saml11TicketValidator.java | 19 +-
.../validation/TicketValidationException.java | 15 +-
.../client/validation/TicketValidator.java | 15 +-
.../cas/client/PublicTestHttpServer.java | 15 +-
.../jasig/cas/client/SerializationTests.java | 15 +-
.../AuthenticationFilterTests.java | 15 +-
.../cas/client/jaas/CasLoginModuleTests.java | 17 +-
.../client/proxy/CleanUpTimerTaskTest.java | 15 +-
.../ProxyGrantingTicketStorageImplTest.java | 15 +-
.../session/SingleSignoutHandlerTests.java | 18 +
.../ssl/RegexHostnameVerifierTests.java | 15 +-
.../ssl/WhitelistHostnameVerifierTests.java | 15 +-
.../jasig/cas/client/util/CasFilterTests.java | 20 +-
.../cas/client/util/CommonUtilsTests.java | 15 +-
.../HttpServletRequestWrapperFilterTests.java | 15 +-
.../org/jasig/cas/client/util/MethodFlag.java | 15 +-
.../cas/client/util/ReflectUtilsTests.java | 15 +-
.../AbstractTicketValidatorTests.java | 15 +-
.../client/validation/AssertionImplTests.java | 15 +-
.../validation/Cas10TicketValidatorTests.java | 17 +-
...yReceivingTicketValidationFilterTests.java | 17 +-
.../Cas20ProxyTicketValidatorTests.java | 15 +-
.../Cas20ServiceTicketValidatorTests.java | 17 +-
.../Saml11TicketValidatorTests.java | 15 +-
.../resources/cas20ProxyTicketValidator.xml | 13 +-
cas-client-integration-atlassian/pom.xml | 4 -
.../Confluence35CasAuthenticator.java | 15 +-
.../atlassian/ConfluenceCasAuthenticator.java | 15 +-
.../atlassian/Jira44CasAuthenticator.java | 15 +-
.../atlassian/JiraCasAuthenticator.java | 15 +-
cas-client-integration-jboss/pom.xml | 2 -
.../WebAuthenticationFilter.java | 15 +-
.../client/tomcat/AbstractLogoutHandler.java | 15 +-
.../tomcat/AssertionCasRealmDelegate.java | 17 +-
.../client/tomcat/AuthenticatorDelegate.java | 15 +-
.../org/jasig/cas/client/tomcat/CasRealm.java | 15 +-
.../cas/client/tomcat/LogoutHandler.java | 15 +-
.../tomcat/PropertiesCasRealmDelegate.java | 15 +-
.../client/tomcat/RegexUriLogoutHandler.java | 15 +-
.../client/tomcat/StaticUriLogoutHandler.java | 15 +-
.../PropertiesCasRealmDelegateTests.java | 15 +-
.../cas/client/tomcat/user-roles.properties | 12 +-
.../tomcat/v6/AbstractAuthenticator.java | 15 +-
.../tomcat/v6/AbstractCasAuthenticator.java | 17 +-
.../client/tomcat/v6/AbstractCasRealm.java | 17 +-
.../tomcat/v6/AbstractLifecycleValve.java | 15 +-
.../client/tomcat/v6/AbstractLogoutValve.java | 15 +-
.../client/tomcat/v6/AssertionCasRealm.java | 15 +-
.../tomcat/v6/Cas10CasAuthenticator.java | 15 +-
.../tomcat/v6/Cas20CasAuthenticator.java | 15 +-
.../tomcat/v6/Cas20ProxyCasAuthenticator.java | 15 +-
.../client/tomcat/v6/PropertiesCasRealm.java | 15 +-
.../client/tomcat/v6/ProxyCallbackValve.java | 15 +-
.../client/tomcat/v6/RegexUriLogoutValve.java | 15 +-
.../client/tomcat/v6/Saml11Authenticator.java | 15 +-
.../client/tomcat/v6/SingleSignOutValve.java | 15 +-
.../tomcat/v6/StaticUriLogoutValve.java | 15 +-
.../tomcat/v7/AbstractAuthenticator.java | 15 +-
.../tomcat/v7/AbstractCasAuthenticator.java | 15 +-
.../client/tomcat/v7/AbstractCasRealm.java | 15 +-
.../client/tomcat/v7/AbstractLogoutValve.java | 15 +-
.../client/tomcat/v7/AssertionCasRealm.java | 15 +-
.../tomcat/v7/Cas10CasAuthenticator.java | 15 +-
.../tomcat/v7/Cas20CasAuthenticator.java | 15 +-
.../tomcat/v7/Cas20ProxyCasAuthenticator.java | 15 +-
.../client/tomcat/v7/PropertiesCasRealm.java | 15 +-
.../client/tomcat/v7/ProxyCallbackValve.java | 15 +-
.../client/tomcat/v7/RegexUriLogoutValve.java | 15 +-
.../client/tomcat/v7/Saml11Authenticator.java | 17 +-
.../client/tomcat/v7/SingleSignOutValve.java | 17 +-
.../tomcat/v7/StaticUriLogoutValve.java | 15 +-
...eBackedProxyGrantingTicketStorageImpl.java | 15 +-
...edProxyGrantingTicketStorageImplTests.java | 18 +
...dBackedProxyGrantingTicketStorageImpl.java | 17 +-
pom.xml | 389 +++++++++---------
src/licensing/header-definitions.xml | 12 +
src/licensing/header.txt | 16 +
130 files changed, 1132 insertions(+), 1211 deletions(-)
create mode 100644 src/licensing/header-definitions.xml
create mode 100644 src/licensing/header.txt
diff --git a/assembly.xml b/assembly.xml
index 26f7cab12..f640d7aae 100644
--- a/assembly.xml
+++ b/assembly.xml
@@ -5,20 +5,19 @@
for additional information regarding copyright ownership.
Jasig licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a
- copy of the License at:
+ except in compliance with the License. You may obtain a
+ copy of the License at the following location:
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on
- an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
release
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipal.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipal.java
index d17c97fd6..b86ebcbd6 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipal.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipal.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import java.io.Serializable;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
index 562e7d30b..c7ca08f35 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import org.jasig.cas.client.proxy.ProxyRetriever;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 04b0187fa..3ff189620 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import org.jasig.cas.client.util.AbstractCasFilter;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
index 456f1bf01..0844afcc8 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import javax.servlet.http.HttpServletRequest;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/GatewayResolver.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/GatewayResolver.java
index 9c587fb93..4b7688bd6 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/GatewayResolver.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/GatewayResolver.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import javax.servlet.http.HttpServletRequest;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
index 71edc717c..6c853ec6a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import javax.servlet.FilterConfig;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimpleGroup.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimpleGroup.java
index 0abe6029a..c2110b1dc 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimpleGroup.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimpleGroup.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import java.security.Principal;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimplePrincipal.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimplePrincipal.java
index fba5e09aa..eebb5524f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimplePrincipal.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimplePrincipal.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import java.io.Serializable;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/AssertionPrincipal.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/AssertionPrincipal.java
index 6abeff65b..2f8b1e4cb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/AssertionPrincipal.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/AssertionPrincipal.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.jaas;
import java.io.Serializable;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
index 7c73f8f23..500693fb1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.jaas;
import java.beans.BeanInfo;
@@ -491,8 +490,6 @@ protected boolean preLogout() {
protected void postLogout() {
// template method
}
-
-
/**
* Creates a {@link TicketValidator} instance from a class name and map of property name/value pairs.
* @param className Fully-qualified name of {@link TicketValidator} concrete class.
@@ -570,8 +567,6 @@ private void removePrincipalsOfType(final Class extends Principal> clazz) {
private void removeCredentialsOfType(final Class extends Principal> clazz) {
this.subject.getPrivateCredentials().removeAll(this.subject.getPrivateCredentials(clazz));
}
-
-
/**
* Removes expired entries from the assertion cache.
*/
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/ServiceAndTicketCallbackHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/ServiceAndTicketCallbackHandler.java
index 62bced724..9aacd5814 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/ServiceAndTicketCallbackHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/ServiceAndTicketCallbackHandler.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.jaas;
import java.io.IOException;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/TicketCredential.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/TicketCredential.java
index 2f7e92e5f..99b86e2ed 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/TicketCredential.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/TicketCredential.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.jaas;
import java.security.Principal;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
index 7842ac33d..55124bdfb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.proxy;
import javax.crypto.Cipher;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index 798eca742..2910f5f39 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/CleanUpTimerTask.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/CleanUpTimerTask.java
index e48986c4e..aa460fd5d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/CleanUpTimerTask.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/CleanUpTimerTask.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
import java.util.TimerTask;
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
index d4bf58ae9..4df350859 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
/**
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
index 30478a4bb..059a87abd 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
import java.util.*;
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
index e35d9e5e4..07e01a48d 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
import java.io.Serializable;
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
index fa0cb0635..17c3c9c5c 100644
--- 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
@@ -5,20 +5,19 @@
for additional information regarding copyright ownership.
Jasig licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a
- copy of the License at:
+ except in compliance with the License. You may obtain a
+ copy of the License at the following location:
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on
- an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
The proxy package includes a servlet to act as a proxy receptor,
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
index afcaa81de..a4ed3db4b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.session;
import org.slf4j.Logger;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SessionMappingStorage.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SessionMappingStorage.java
index 32e53a133..f0d6b2c3f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SessionMappingStorage.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SessionMappingStorage.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.session;
import javax.servlet.http.HttpSession;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index cc8ff7179..6219d80d4 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.session;
import org.jasig.cas.client.util.AbstractConfigurationFilter;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index e6f09db85..28f3d109b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.session;
import javax.servlet.http.HttpServletRequest;
@@ -57,8 +56,6 @@ public final class SingleSignOutHandler {
private boolean eagerlyCreateSessions = true;
private List safeParameters;
-
-
public void setSessionMappingStorage(final SessionMappingStorage storage) {
this.sessionMappingStorage = storage;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHttpSessionListener.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHttpSessionListener.java
index 7d28bd16c..8df6a85db 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHttpSessionListener.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHttpSessionListener.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.session;
import javax.servlet.http.HttpSession;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/AnyHostnameVerifier.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/AnyHostnameVerifier.java
index 14fe4ec99..c9672ce27 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/AnyHostnameVerifier.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/AnyHostnameVerifier.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.ssl;
import javax.net.ssl.HostnameVerifier;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/RegexHostnameVerifier.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/RegexHostnameVerifier.java
index 6bb707406..475706dd1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/RegexHostnameVerifier.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/RegexHostnameVerifier.java
@@ -1,21 +1,22 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
+
package org.jasig.cas.client.ssl;
import java.util.regex.Pattern;
@@ -46,8 +47,6 @@ public final class RegexHostnameVerifier implements HostnameVerifier {
public RegexHostnameVerifier(final String regex) {
this.pattern = Pattern.compile(regex);
}
-
-
/** {@inheritDoc} */
public boolean verify(final String hostname, final SSLSession session) {
return pattern.matcher(hostname).matches();
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifier.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifier.java
index c09002a70..918a9f449 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifier.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifier.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.ssl;
import javax.net.ssl.HostnameVerifier;
@@ -34,8 +33,6 @@ public final class WhitelistHostnameVerifier implements HostnameVerifier {
/** Allowed hosts */
private String[] allowedHosts;
-
-
/**
* Creates a new instance using the given array of allowed hosts.
*
@@ -44,8 +41,6 @@ public final class WhitelistHostnameVerifier implements HostnameVerifier {
public WhitelistHostnameVerifier(final String[] allowed) {
this.allowedHosts = allowed;
}
-
-
/**
* Creates a new instance using the given list of allowed hosts.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index cdf90a9a9..6586389c7 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import org.slf4j.Logger;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
index eebb2d910..e9e2183c5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import javax.naming.InitialContext;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AssertionHolder.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AssertionHolder.java
index 7959ca0ec..f1e011b27 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AssertionHolder.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AssertionHolder.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import org.jasig.cas.client.validation.Assertion;
@@ -34,8 +33,6 @@ 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.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AssertionThreadLocalFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AssertionThreadLocalFilter.java
index d0af95e58..b65a75684 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AssertionThreadLocalFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AssertionThreadLocalFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import org.jasig.cas.client.validation.Assertion;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index a88c0dd73..91a3aaa9e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
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
index 4dfd5f6ed..3b12267d1 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import org.slf4j.Logger;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
index f630a56e9..1cdd3841e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import java.io.IOException;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
index c63a04c8d..d37fb02fb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import org.jasig.cas.client.authentication.AttributePrincipal;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ReflectUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ReflectUtils.java
index 0b1f963ef..7148f6cdb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ReflectUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ReflectUtils.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import java.beans.BeanInfo;
@@ -53,8 +52,6 @@ public static Class loadClass(final String className) throws IllegalArgum
throw new IllegalArgumentException(className + " class not found.");
}
}
-
-
/**
* Creates a new instance of the given class by passing the given arguments
* to the constructor.
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
index 3fd1cf17d..dd237377b 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import org.slf4j.Logger;
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
index 300a79b89..fcf85e2f9 100644
--- 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
@@ -5,20 +5,19 @@
for additional information regarding copyright ownership.
Jasig licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a
- copy of the License at:
+ except in compliance with the License. You may obtain a
+ copy of the License at the following location:
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on
- an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
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/AbstractCasProtocolUrlBasedTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
index 84d9e6740..7e736d7d1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index 594becc77..00339b492 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.util.AbstractCasFilter;
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
index 0b3cad708..5606ac551 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.util.CommonUtils;
@@ -192,8 +191,6 @@ protected final String encodeUrl(final String url) {
protected abstract String retrieveResponseFromServer(URL validationUrl, String ticket);
public final Assertion validate(final String ticket, final String service) throws TicketValidationException {
-
-
final String validationUrl = constructValidationUrl(ticket, service);
logger.debug("Constructing validation url: {}", validationUrl);
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
index 1f518699c..fbee1cb1d 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.authentication.AttributePrincipal;
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
index d2612e769..bfba26f19 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.authentication.AttributePrincipal;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
index 51f59e7b2..657f1e823 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import javax.servlet.FilterConfig;
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
index 7bdfd0442..dce9a50a0 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import java.io.BufferedReader;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 90ca2281e..5d31060bb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import java.io.IOException;
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
index c2768ac7e..7c437adfe 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.util.XmlUtils;
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
index 642afccd9..c626d6d03 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.authentication.AttributePrincipal;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/InvalidProxyChainTicketValidationException.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/InvalidProxyChainTicketValidationException.java
index d0f9c002a..ff5e0a624 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/InvalidProxyChainTicketValidationException.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/InvalidProxyChainTicketValidationException.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
/**
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
index 812e97062..83254e468 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
index ed5e78494..745fc198c 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
index f768a3965..8ac6e5290 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import javax.servlet.FilterConfig;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 2482bc44b..8a1d7759a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.authentication.AttributePrincipal;
@@ -72,8 +71,6 @@ public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator
private final BasicParserPool basicParserPool;
private final IdentifierGenerator identifierGenerator;
-
-
public Saml11TicketValidator(final String casServerUrlPrefix) {
super(casServerUrlPrefix);
this.basicParserPool = new BasicParserPool();
@@ -234,8 +231,6 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
final String MESSAGE_TO_SEND = ""
+ "" + ticket
+ "";
-
-
HttpURLConnection conn = null;
try {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/TicketValidationException.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/TicketValidationException.java
index e383fedb8..6639ec2d8 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/TicketValidationException.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/TicketValidationException.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
/**
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
index 2efa2b9cb..69888e309 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
/**
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/PublicTestHttpServer.java b/cas-client-core/src/test/java/org/jasig/cas/client/PublicTestHttpServer.java
index 57de8d2d3..d47e361b5 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/PublicTestHttpServer.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/PublicTestHttpServer.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client;
import java.io.*;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/SerializationTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/SerializationTests.java
index 76de0bc7b..20d8ff8e1 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/SerializationTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/SerializationTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client;
import java.io.ByteArrayInputStream;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index b3a273f51..9b41a749c 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.authentication;
import junit.framework.TestCase;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/jaas/CasLoginModuleTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/jaas/CasLoginModuleTests.java
index ede32b005..ce0cbf9ca 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/jaas/CasLoginModuleTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/jaas/CasLoginModuleTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.jaas;
import java.security.Principal;
@@ -188,8 +187,6 @@ public void testAssertionCaching() throws Exception {
assertEquals(this.subject.getPrincipals().size(), 3);
assertEquals(TICKET, this.subject.getPrivateCredentials().iterator().next().toString());
}
-
-
/**
* Verify that cached assertions that are expired are never be accessible
* by {@link org.jasig.cas.client.jaas.CasLoginModule#login()} method.
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/proxy/CleanUpTimerTaskTest.java b/cas-client-core/src/test/java/org/jasig/cas/client/proxy/CleanUpTimerTaskTest.java
index 55d0d5d01..a831de56d 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/proxy/CleanUpTimerTaskTest.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/proxy/CleanUpTimerTaskTest.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
import java.util.TimerTask;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorageImplTest.java b/cas-client-core/src/test/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorageImplTest.java
index 746ada99e..d68eb5c36 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorageImplTest.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/proxy/ProxyGrantingTicketStorageImplTest.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
import junit.framework.TestCase;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignoutHandlerTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignoutHandlerTests.java
index 16a18c0e3..f263e44fa 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignoutHandlerTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignoutHandlerTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.session;
import org.junit.Before;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/RegexHostnameVerifierTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/RegexHostnameVerifierTests.java
index 91996ff82..31448fe1d 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/RegexHostnameVerifierTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/RegexHostnameVerifierTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
/*
$Id$
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifierTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifierTests.java
index 9fe857e34..ae3f4fea8 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifierTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifierTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
/*
$Id$
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CasFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CasFilterTests.java
index 01da8bf8b..f44d2561f 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CasFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CasFilterTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.util;
import org.junit.Test;
@@ -36,8 +54,6 @@ public void serverName() {
testCasFilter.setServerName(serverNameWithSlash);
assertTrue(testCasFilter.constructServiceUrl(request, response).startsWith("http://www.cnn.com/cas/test"));
-
-
}
private static class TestCasFilter extends AbstractCasFilter {
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index e2435c24b..7b6ff0663 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import junit.framework.TestCase;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilterTests.java
index 74b1c619b..aa620a15c 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilterTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import junit.framework.TestCase;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/MethodFlag.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/MethodFlag.java
index cf39d46e4..0ec5fec34 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/MethodFlag.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/MethodFlag.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
/**
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/ReflectUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/ReflectUtilsTests.java
index 47d50f18a..34ca54771 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/ReflectUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/ReflectUtilsTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import junit.framework.TestCase;
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
index fa6036f63..77af2b856 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
/**
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
index d94d2a896..c790f696a 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import junit.framework.TestCase;
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
index 7a8a991d3..bda0211d7 100644
--- 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
@@ -1,25 +1,22 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
-
-
import org.jasig.cas.client.PublicTestHttpServer;
import org.junit.AfterClass;
import org.junit.Before;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
index 8539f952f..073ad3fd9 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import junit.framework.TestCase;
@@ -179,8 +178,6 @@ public void run() {}
config3.addInitParameter("casServerUrlPrefix", "https://cas.jasig.org/");
assertNotNull(filter.getTicketValidator(config3));
}
-
-
/**
* construct a working {@link org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter}
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
index 691d89bb2..b374cae28 100644
--- 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
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.PublicTestHttpServer;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidatorTests.java
index 0b1f13783..71e4f3992 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidatorTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidatorTests.java
@@ -1,25 +1,22 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
-
-
import org.jasig.cas.client.PublicTestHttpServer;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
index 8ec7977c0..6b2e56268 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.validation;
import org.jasig.cas.client.PublicTestHttpServer;
diff --git a/cas-client-core/src/test/resources/cas20ProxyTicketValidator.xml b/cas-client-core/src/test/resources/cas20ProxyTicketValidator.xml
index 3f3838908..3a069da21 100644
--- a/cas-client-core/src/test/resources/cas20ProxyTicketValidator.xml
+++ b/cas-client-core/src/test/resources/cas20ProxyTicketValidator.xml
@@ -5,20 +5,19 @@
for additional information regarding copyright ownership.
Jasig licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a
- copy of the License at:
+ except in compliance with the License. You may obtain a
+ copy of the License at the following location:
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on
- an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
-
-
atlassian
@@ -565,6 +563,4 @@
http://repository.atlassian.com/maven2/
-
-
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
index 61815ed85..7ffe254b5 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.integration.atlassian;
import com.atlassian.confluence.event.events.security.LoginEvent;
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
index 30ef63e34..398d9ee60 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.integration.atlassian;
import com.atlassian.confluence.user.ConfluenceAuthenticator;
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
index 65b44a95f..7f603d51e 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.integration.atlassian;
import com.atlassian.jira.security.login.JiraSeraphAuthenticator;
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
index 5f3c519bf..4c8078f19 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.integration.atlassian;
import com.atlassian.seraph.auth.DefaultAuthenticator;
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 1e98f1d87..1e2e17c6e 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -63,8 +63,6 @@
https://repository.jboss.org/nexus/content/groups/public//
-
-
6.1.0.Final
diff --git a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
index 7a7870dbb..6c6707356 100644
--- a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
+++ b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.jboss.authentication;
import java.io.IOException;
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
index 681a041d6..d298920eb 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import javax.servlet.http.HttpServletRequest;
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
index 88b4b821b..7d26c2aba 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import java.security.Principal;
@@ -47,8 +46,6 @@ public class AssertionCasRealmDelegate implements CasRealm {
/** Name of the role attribute in the principal's attributes */
private String roleAttributeName = DEFAULT_ROLE_NAME;
-
-
/**
* @param name Name of the attribute in the principal that contains role data.
*/
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
index dcb940101..61209d094 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import java.io.IOException;
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/CasRealm.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/CasRealm.java
index 3e1a58b26..6e221a283 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/CasRealm.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/CasRealm.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import java.security.Principal;
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/LogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/LogoutHandler.java
index 0bd45b805..a53502b5f 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/LogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/LogoutHandler.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import javax.servlet.http.HttpServletRequest;
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
index f34f4d318..b2836b2a9 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import java.io.BufferedInputStream;
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
index e50f75d82..8a9955610 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import java.util.regex.Pattern;
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
index d4a4fdcb5..f6e85bd4a 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import javax.servlet.http.HttpServletRequest;
diff --git a/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java b/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
index 317190643..b6e843626 100644
--- a/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
+++ b/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat;
import java.security.Principal;
diff --git a/cas-client-integration-tomcat-common/src/test/resources/org/jasig/cas/client/tomcat/user-roles.properties b/cas-client-integration-tomcat-common/src/test/resources/org/jasig/cas/client/tomcat/user-roles.properties
index 81302fbbd..a72413d0f 100644
--- a/cas-client-integration-tomcat-common/src/test/resources/org/jasig/cas/client/tomcat/user-roles.properties
+++ b/cas-client-integration-tomcat-common/src/test/resources/org/jasig/cas/client/tomcat/user-roles.properties
@@ -4,15 +4,15 @@
# for additional information regarding copyright ownership.
# Jasig licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a
-# copy of the License at:
+# except in compliance with the License. You may obtain a
+# copy of the License at the following location:
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on
-# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractAuthenticator.java
index 83d6a72af..1960e527e 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleEvent;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasAuthenticator.java
index e4c84acf8..921679a32 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
/**
@@ -29,8 +28,6 @@
public abstract class AbstractCasAuthenticator extends AbstractAuthenticator {
private String proxyCallbackUrl;
-
-
protected final String getProxyCallbackUrl() {
return this.proxyCallbackUrl;
}
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
index 5394a7332..932c76dec 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import java.security.Principal;
@@ -37,8 +36,6 @@ public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
/** Logger instance */
protected final Logger logger = LoggerFactory.getLogger(getClass());
-
-
/** {@inheritDoc} */
public Principal authenticate(final Principal p) {
return getDelegate().authenticate(p);
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLifecycleValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLifecycleValve.java
index 358019058..b511dc6eb 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLifecycleValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLifecycleValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.Lifecycle;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLogoutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLogoutValve.java
index d01f1a84c..eafa8d779 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLogoutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractLogoutValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.connector.Request;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AssertionCasRealm.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AssertionCasRealm.java
index 42652d65c..08fb69d0d 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AssertionCasRealm.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AssertionCasRealm.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas10CasAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas10CasAuthenticator.java
index 362cba45e..46768d4e5 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas10CasAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas10CasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20CasAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20CasAuthenticator.java
index 07392cbc9..087d9e378 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20CasAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20CasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20ProxyCasAuthenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20ProxyCasAuthenticator.java
index 387f10a6d..41e86b7b5 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20ProxyCasAuthenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Cas20ProxyCasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/PropertiesCasRealm.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/PropertiesCasRealm.java
index 81eada990..00d9e960b 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/PropertiesCasRealm.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/PropertiesCasRealm.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/ProxyCallbackValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/ProxyCallbackValve.java
index 1fb291c7d..92fca01af 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/ProxyCallbackValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/ProxyCallbackValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/RegexUriLogoutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/RegexUriLogoutValve.java
index 2d3691abe..94e4bf2af 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/RegexUriLogoutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/RegexUriLogoutValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Saml11Authenticator.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Saml11Authenticator.java
index 19b7f50a1..d349504e3 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Saml11Authenticator.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/Saml11Authenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
index 6588d5618..6e3549bfc 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import java.io.IOException;
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/StaticUriLogoutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/StaticUriLogoutValve.java
index 91757e957..845501f29 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/StaticUriLogoutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/StaticUriLogoutValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
index b733a3d05..a2d11d896 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleEvent;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasAuthenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasAuthenticator.java
index 1dfa263bc..7f451e801 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasAuthenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
/**
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
index 26091a39c..1a5beb244 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import java.security.Principal;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractLogoutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractLogoutValve.java
index aba02c3d5..b20289a2a 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractLogoutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractLogoutValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.connector.Request;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AssertionCasRealm.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AssertionCasRealm.java
index edfddba00..43bd27ca5 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AssertionCasRealm.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AssertionCasRealm.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.jasig.cas.client.tomcat.AssertionCasRealmDelegate;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas10CasAuthenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas10CasAuthenticator.java
index 3d2d59329..4f82c9a13 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas10CasAuthenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas10CasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas20CasAuthenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas20CasAuthenticator.java
index c17d99239..b8d21328e 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas20CasAuthenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas20CasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas20ProxyCasAuthenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas20ProxyCasAuthenticator.java
index cc3d2756c..3f1760893 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas20ProxyCasAuthenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Cas20ProxyCasAuthenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/PropertiesCasRealm.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/PropertiesCasRealm.java
index ce1dee1f0..39a360610 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/PropertiesCasRealm.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/PropertiesCasRealm.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/ProxyCallbackValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/ProxyCallbackValve.java
index bd54cb21a..6b78c147d 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/ProxyCallbackValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/ProxyCallbackValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/RegexUriLogoutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/RegexUriLogoutValve.java
index 5e63a1a22..2b8ab8e87 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/RegexUriLogoutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/RegexUriLogoutValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Saml11Authenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Saml11Authenticator.java
index 84877951b..25281c989 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Saml11Authenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/Saml11Authenticator.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleException;
@@ -41,8 +40,6 @@ public final class Saml11Authenticator extends AbstractAuthenticator {
/** SAML protocol clock drift tolerance in ms */
private int tolerance = -1;
-
-
/**
* @param ms SAML clock drift tolerance in milliseconds.
*/
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
index 66068d5d6..f314a0333 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import java.io.IOException;
@@ -63,8 +62,6 @@ public void setLogoutParameterName(final String name) {
public void setSessionMappingStorage(final SessionMappingStorage storage) {
handler.setSessionMappingStorage(storage);
}
-
-
/** {@inheritDoc} */
public void invoke(final Request request, final Response response) throws IOException, ServletException {
if (this.handler.isTokenRequest(request)) {
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/StaticUriLogoutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/StaticUriLogoutValve.java
index 812732296..c3641e7e5 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/StaticUriLogoutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/StaticUriLogoutValve.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.tomcat.v7;
import org.apache.catalina.LifecycleException;
diff --git a/cas-client-support-distributed-ehcache/src/main/java/org/jasig/cas/client/proxy/EhcacheBackedProxyGrantingTicketStorageImpl.java b/cas-client-support-distributed-ehcache/src/main/java/org/jasig/cas/client/proxy/EhcacheBackedProxyGrantingTicketStorageImpl.java
index 71b1e52e6..d57ab63a7 100644
--- a/cas-client-support-distributed-ehcache/src/main/java/org/jasig/cas/client/proxy/EhcacheBackedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-support-distributed-ehcache/src/main/java/org/jasig/cas/client/proxy/EhcacheBackedProxyGrantingTicketStorageImpl.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
import net.sf.ehcache.Cache;
diff --git a/cas-client-support-distributed-ehcache/src/test/java/EhCacheBackedProxyGrantingTicketStorageImplTests.java b/cas-client-support-distributed-ehcache/src/test/java/EhCacheBackedProxyGrantingTicketStorageImplTests.java
index ea5600377..cefe949f3 100644
--- a/cas-client-support-distributed-ehcache/src/test/java/EhCacheBackedProxyGrantingTicketStorageImplTests.java
+++ b/cas-client-support-distributed-ehcache/src/test/java/EhCacheBackedProxyGrantingTicketStorageImplTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
import junit.framework.TestCase;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
diff --git a/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java b/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
index 910eb8ec4..d58a29150 100644
--- a/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
@@ -1,22 +1,21 @@
-/**
+/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at:
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.proxy;
import net.spy.memcached.MemcachedClient;
@@ -90,8 +89,6 @@ public MemcachedBackedProxyGrantingTicketStorageImpl(final String[] hostnamesAnd
throw new IllegalStateException(e);
}
}
-
-
public void saveInternal(final String proxyGrantingTicketIou, final String proxyGrantingTicket) {
handleSynchronousRequest(this.client.add(proxyGrantingTicketIou, 120, proxyGrantingTicket));
}
diff --git a/pom.xml b/pom.xml
index 9472fbdde..db7b34262 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,214 +1,203 @@
-
- org.jasig.parent
- jasig-parent
- 31
-
- 4.0.0
- org.jasig.cas.client
- 3.3-SNAPSHOT
- cas-client
- pom
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ org.jasig.parent
+ jasig-parent
+ 31
+
+ 4.0.0
+ org.jasig.cas.client
+ 3.3-SNAPSHOT
+ cas-client
+ pom
- Jasig CAS Client for Java
- Jasig CAS Client for Java is the integration point for
- applications that want to speak with a CAS
- server, either via the CAS 1.0 or CAS 2.0 protocol.
-
- http://www.jasig.org/cas
+ Jasig CAS Client for Java
+
+ Jasig CAS Client for Java is the integration point forapplications that want to speak with a CAS
+ server, either via the CAS 1.0 or CAS 2.0 protocol.
+
+ http://www.jasig.org/cas
-
- JIRA
- https://issues.jasig.org/browse/CASC
-
+
+ JIRA
+ https://issues.jasig.org/browse/CASC
+
-
- scm:git:git@github.com:Jasig/java-cas-client.git
- scm:git:git@github.com:Jasig/java-cas-client.git
- https://github.com/Jasig/java-cas-client
-
+
+ scm:git:git@github.com:Jasig/java-cas-client.git
+ scm:git:git@github.com:Jasig/java-cas-client.git
+ https://github.com/Jasig/java-cas-client
+
- 2006
+ 2006
-
-
- battags
- Scott Battaglia
- scott.battaglia@gmail.com
- http://www.scottbattaglia.com
-
- Project Admin
- Developer
-
- -5
-
-
- serac
- Marvin S. Addison
- marvin.addison@gmail.com
-
- Developer
-
- -5
-
-
+
+
+ battags
+ Scott Battaglia
+ scott.battaglia@gmail.com
+ http://www.scottbattaglia.com
+
+ Project Admin
+ Developer
+
+ -5
+
+
+ serac
+ Marvin S. Addison
+ marvin.addison@gmail.com
+
+ Developer
+
+ -5
+
+
-
- Jasig
- http://www.jasig.org
-
+
+ Jasig
+ http://www.jasig.org
+
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 2.2-beta-1
-
-
- ${basedir}/assembly.xml
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.6
-
-
- **/*Tests*
-
- false
- 1
-
-
-
- maven-source-plugin
-
-
- attach-sources
-
- jar
-
-
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- 2.2.1
-
- forked-path
- v@{project.version}
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- 1.0
-
-
- enforce-banned-dependencies
-
- enforce
-
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.2-beta-1
-
-
-
- commons-logging
-
-
-
- true
+
+ ${basedir}/assembly.xml
+
-
-
-
-
-
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.5
+ 1.5
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.6
+
+
+ **/*Tests*
+
+ false
+ 1
+
+
+
+ maven-source-plugin
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.2.1
+
+ forked-path
+ v@{project.version}
+
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 1.0
+
+
+ enforce-banned-dependencies
+
+ enforce
+
+
+
+
+
+ commons-logging
+
+
+
+ true
+
+
+
+
+
+ com.mycila.maven-license-plugin
+ maven-license-plugin
+
+ src/licensing/header.txt
+
+ src/licensing/header-definitions.xml
+
+ true
+
+ **/.idea/**
+ LICENSE
+ **/INSTALL*
+ **/NOTICE*
+ **/README*
+ **/readme*
+ **/*.log
+ **/*.license
+ **/*.txt
+ **/*.crt
+ **/*.crl
+ **/*.key
+ **/.gitignore
+ **/overlays/**
+ src/licensing/**
+
+
+
+
+
-
-
- junit
- junit
- 4.8.2
- test
-
-
- org.slf4j
- slf4j-api
- ${slf4j.version}
- compile
-
-
- javax.servlet
- servlet-api
- 2.4
- provided
-
-
- org.slf4j
- jcl-over-slf4j
- ${slf4j.version}
- test
-
-
- org.slf4j
- slf4j-simple
- ${slf4j.version}
- test
-
-
+
+
+ junit
+ junit
+ 4.8.2
+ test
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+ compile
+
+
+ javax.servlet
+ servlet-api
+ 2.4
+ provided
+
+
+ org.slf4j
+ jcl-over-slf4j
+ ${slf4j.version}
+ test
+
+
+ org.slf4j
+ slf4j-simple
+ ${slf4j.version}
+ test
+
+ cas-client-core
diff --git a/src/licensing/header-definitions.xml b/src/licensing/header-definitions.xml
new file mode 100644
index 000000000..39fb559bc
--- /dev/null
+++ b/src/licensing/header-definitions.xml
@@ -0,0 +1,12 @@
+
+
+
+ /*
+ *
+ */
+ ( |\t)*/\*( |\t)*$
+ ( |\t)*\*/( |\t)*$
+ true
+ true
+
+
\ No newline at end of file
diff --git a/src/licensing/header.txt b/src/licensing/header.txt
new file mode 100644
index 000000000..81fb4278b
--- /dev/null
+++ b/src/licensing/header.txt
@@ -0,0 +1,16 @@
+Licensed to Jasig under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Jasig licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
\ No newline at end of file
From 62f9058b78db1065e4b911d9408c08b7c08ce220 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Thu, 24 Jan 2013 12:01:47 -0700
Subject: [PATCH 029/239] CASC-180 - Add support for Client Side Certificates
In order to utilize client side certificates, this commit facilitates the creation of a SSLSocketFactory on HttpsURLConnection for the client. The configuration is encapsulated inside a url factory instance that applies the adjustments where necessary.
This commit is continuation of the posted pending pull on github that is at:
https://github.com/Jasig/java-cas-client/pull/26
...and applies the suggestions and fixes that were brought to light during the code review.
---
.../cas/client/proxy/Cas20ProxyRetriever.java | 5 +-
.../jasig/cas/client/util/CommonUtils.java | 46 ++++---
.../util/HttpsURLConnectionFactory.java | 126 ++++++++++++++++++
.../cas/client/util/URLConnectionFactory.java | 44 ++++++
...actCasProtocolUrlBasedTicketValidator.java | 6 +-
.../AbstractTicketValidationFilter.java | 27 ++++
.../AbstractUrlBasedTicketValidator.java | 28 ++--
.../Cas10TicketValidationFilter.java | 7 +-
...0ProxyReceivingTicketValidationFilter.java | 5 +-
.../Saml11TicketValidationFilter.java | 8 +-
.../validation/Saml11TicketValidator.java | 21 ++-
pom.xml | 2 +
12 files changed, 269 insertions(+), 56 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/util/URLConnectionFactory.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index 2910f5f39..42c21efb5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -29,20 +29,19 @@
/**
* Implementation of a ProxyRetriever that follows the CAS 2.0 specification.
* For more information on the CAS 2.0 specification, please see the specification
+ * href="http://www.jasig.org/cas/protocol">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: 11729 $ $Date: 2007-09-26 14:22:30 -0400 (Tue, 26 Sep 2007) $
* @since 3.0
*/
public final class Cas20ProxyRetriever implements ProxyRetriever {
/** Unique Id for serialization. */
- private static final long serialVersionUID = 560409469568911791L;
+ private static final long serialVersionUID = 560409469568911791L;
/**
* Instance of Commons Logging.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 91a3aaa9e..9f30256e3 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -24,20 +24,20 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.Closeable;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
+import java.net.MalformedURLException;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.net.URL;
import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -323,28 +323,16 @@ public static String safeGetParameter(final HttpServletRequest request, final St
* Contacts the remote URL and returns the response.
*
* @param constructedUrl the url to contact.
+ * @param factory connection factory to prepare the URL connection instance
* @param encoding the encoding to use.
* @return the response.
*/
- public static String getResponseFromServer(final URL constructedUrl, final String encoding) {
- return getResponseFromServer(constructedUrl, HttpsURLConnection.getDefaultHostnameVerifier(), encoding);
- }
+ public static String getResponseFromServer(final URL constructedUrl, final URLConnectionFactory factory, final String encoding) {
- /**
- * Contacts the remote URL and returns the response.
- *
- * @param constructedUrl the url to contact.
- * @param hostnameVerifier Host name verifier to use for HTTPS connections.
- * @param encoding the encoding to use.
- * @return the response.
- */
- public static String getResponseFromServer(final URL constructedUrl, final HostnameVerifier hostnameVerifier, final String encoding) {
URLConnection conn = null;
try {
- conn = constructedUrl.openConnection();
- if (conn instanceof HttpsURLConnection) {
- ((HttpsURLConnection)conn).setHostnameVerifier(hostnameVerifier);
- }
+ conn = factory.getURLConnection(constructedUrl.openConnection());
+
final BufferedReader in;
if (CommonUtils.isEmpty(encoding)) {
@@ -371,6 +359,7 @@ public static String getResponseFromServer(final URL constructedUrl, final Hostn
}
}
+
/**
* Contacts the remote URL and returns the response.
*
@@ -380,12 +369,12 @@ public static String getResponseFromServer(final URL constructedUrl, final Hostn
*/
public static String getResponseFromServer(final String url, String encoding) {
try {
- return getResponseFromServer(new URL(url), encoding);
+ return getResponseFromServer(new URL(url), new HttpsURLConnectionFactory(), encoding);
} catch (final MalformedURLException e) {
throw new IllegalArgumentException(e);
}
}
-
+
public static ProxyList createProxyList(final String proxies) {
if (CommonUtils.isBlank(proxies)) {
return new ProxyList();
@@ -410,4 +399,19 @@ public static void sendRedirect(final HttpServletResponse response, final String
}
}
+
+ /**
+ * Unconditionally close a {@link Closeable}. Equivalent to {@link java.io.Closeable#close()}close(), except any exceptions
+ * will be ignored. This is typically used in finally blocks.
+ * @param resource
+ */
+ public static void closeQuietly(final Closeable resource) {
+ try {
+ if (resource != null) {
+ resource.close();
+ }
+ } catch (final IOException e) {
+ //ignore
+ }
+ }
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java
new file mode 100644
index 000000000..e87335ac0
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java
@@ -0,0 +1,126 @@
+package org.jasig.cas.client.util;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URLConnection;
+import java.security.KeyStore;
+import java.util.Properties;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An implementation of the {@link URLConnectionFactory} whose responsible to configure
+ * the underlying https connection, if needed, with a given hostname and SSL socket factory based on the
+ * configuration provided.
+ *
+ * @author Misagh Moayyed
+ * @since 3.3
+ * @see #setHostnameVerifier(HostnameVerifier)
+ * @see #setSSLConfiguration(Properties)
+ */
+public final class HttpsURLConnectionFactory implements URLConnectionFactory {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(HttpsURLConnectionFactory.class);
+
+ /**
+ * Hostname verifier used when making an SSL request to the CAS server.
+ * Defaults to {@link HttpsURLConnection#getDefaultHostnameVerifier()}
+ */
+ private HostnameVerifier hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
+
+ /**
+ * Properties file that can contains key/trust info for Client Side Certificates
+ */
+ private Properties sslConfiguration = new Properties();
+
+ public HttpsURLConnectionFactory() {}
+
+ public HttpsURLConnectionFactory(final HostnameVerifier verifier, final Properties config) {
+ setHostnameVerifier(verifier);
+ setSSLConfiguration(config);
+ }
+
+ public final void setSSLConfiguration(final Properties config) {
+ this.sslConfiguration = config;
+ }
+
+ public final void setHostnameVerifier(final HostnameVerifier verifier) {
+ this.hostnameVerifier = verifier;
+ }
+
+ public URLConnection getURLConnection(final URLConnection url) {
+ return this.configureHttpsConnectionIfNeeded(url);
+ }
+
+ /**
+ * Configures the connection with specific settings for secure http connections
+ * If the connection instance is not a {@link HttpsURLConnection},
+ * no additional changes will be made and the connection itself is simply returned.
+ *
+ * @param conn the http connection
+ */
+ private URLConnection configureHttpsConnectionIfNeeded(final URLConnection conn) {
+ if (conn instanceof HttpsURLConnection) {
+ final HttpsURLConnection httpsConnection = (HttpsURLConnection) conn;
+ final SSLSocketFactory socketFactory = this.createSSLSocketFactory();
+ if (socketFactory != null) {
+ httpsConnection.setSSLSocketFactory(socketFactory);
+ }
+
+ if (this.hostnameVerifier != null) {
+ httpsConnection.setHostnameVerifier(this.hostnameVerifier);
+ }
+ }
+ return conn;
+ }
+
+ /**
+ * Creates a {@link SSLSocketFactory} based on the configuration specified
+ *
+ * @param sslConfig {@link Properties}
+ * @return the {@link SSLSocketFactory}
+ */
+ private SSLSocketFactory createSSLSocketFactory() {
+ InputStream keyStoreIS = null;
+ try {
+ final SSLContext sslContext = SSLContext.getInstance(this.sslConfiguration.getProperty("protocol", "SSL"));
+
+ if (this.sslConfiguration.getProperty("keyStoreType") != null) {
+ final KeyStore keyStore = KeyStore.getInstance(this.sslConfiguration.getProperty("keyStoreType"));
+ if (this.sslConfiguration.getProperty("keyStorePath") != null) {
+ keyStoreIS = new FileInputStream(this.sslConfiguration.getProperty("keyStorePath"));
+ if (this.sslConfiguration.getProperty("keyStorePass") != null) {
+ keyStore.load(keyStoreIS, this.sslConfiguration.getProperty("keyStorePass").toCharArray());
+ LOGGER.debug("Keystore has {} keys", keyStore.size());
+ final KeyManagerFactory keyManager = KeyManagerFactory.getInstance(this.sslConfiguration.getProperty("keyManagerType", "SunX509"));
+ keyManager.init(keyStore, this.sslConfiguration.getProperty("certificatePassword").toCharArray());
+ sslContext.init(keyManager.getKeyManagers(), null, null);
+ }
+ }
+ }
+
+ return sslContext.getSocketFactory();
+ } catch (final Exception e) {
+ LOGGER.error(e.getMessage(), e);
+ } finally {
+ CommonUtils.closeQuietly(keyStoreIS);
+ }
+ return null;
+ }
+
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/URLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/URLConnectionFactory.java
new file mode 100644
index 000000000..9a08fe014
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/URLConnectionFactory.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.util;
+
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * A factory to prepare and configure {@link java.net.URLConnection} instances.
+ *
+ * @author Misagh Moayyed
+ * @since 3.3
+ */
+public interface URLConnectionFactory {
+
+ /**
+ * Receives a {@link URLConnection} instance typically as a result of a {@link URL}
+ * opening a connection to a remote resource. The received url connection is then
+ * configured and prepared appropriately depending on its type and is then returned to the caller
+ * to accommodate method chaining.
+ *
+ * @param url The url connection that needs to be configured
+ * @return The configured {@link URLConnection} instance
+ *
+ * @see {@link HttpsURLConnectionFactory}
+ */
+ URLConnection getURLConnection(final URLConnection url);
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
index 7e736d7d1..c19ec9f0f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
@@ -43,10 +43,6 @@ protected final void setDisableXmlSchemaValidation(final boolean disable) {
* Retrieves the response from the server by opening a connection and merely reading the response.
*/
protected final String retrieveResponseFromServer(final URL validationUrl, final String ticket) {
- if (this.hostnameVerifier != null) {
- return CommonUtils.getResponseFromServer(validationUrl, this.hostnameVerifier, getEncoding());
- } else {
- return CommonUtils.getResponseFromServer(validationUrl, getEncoding());
- }
+ return CommonUtils.getResponseFromServer(validationUrl, getURLConnectionFactory(), getEncoding());
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index 00339b492..5edabb973 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -31,6 +31,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.io.FileInputStream;
+import java.util.Properties;
/**
* The filter that handles all the work of validating ticket requests.
@@ -81,6 +83,31 @@ protected TicketValidator getTicketValidator(final FilterConfig filterConfig) {
return this.ticketValidator;
}
+ /**
+ * Gets the ssl config to use for HTTPS connections
+ * if one is configured for this filter.
+ * @param filterConfig Servlet filter configuration.
+ * @return Properties that can contains key/trust info for Client Side Certificates
+ */
+ protected Properties getSSLConfig(final FilterConfig filterConfig) {
+ final Properties properties = new Properties();
+ final String fileName = getPropertyFromInitParams(filterConfig, "sslConfigFile", null);
+
+ if (fileName != null) {
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(fileName);
+ properties.load(fis);
+ logger.trace("Loaded {} entries from {}", properties.size(), fileName);
+ } catch(final IOException ioe) {
+ logger.error(ioe.getMessage(), ioe);
+ } finally {
+ CommonUtils.closeQuietly(fis);
+ }
+ }
+ return properties;
+ }
+
/**
* Gets the configured {@link HostnameVerifier} to use for HTTPS connections
* if one is configured for this filter.
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
index 5606ac551..b1df5ad99 100644
--- 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
@@ -19,6 +19,8 @@
package org.jasig.cas.client.validation;
import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.HttpsURLConnectionFactory;
+import org.jasig.cas.client.util.URLConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,24 +31,22 @@
import java.util.HashMap;
import java.util.Map;
-import javax.net.ssl.HostnameVerifier;
-
/**
* Abstract validator implementation for tickets that must be validated against a server.
*
* @author Scott Battaglia
- * @version $Revision$ $Date$
* @since 3.1
*/
public abstract class AbstractUrlBasedTicketValidator implements TicketValidator {
protected final Logger logger = LoggerFactory.getLogger(getClass());
-
+
/**
- * Hostname verifier used when making an SSL request to the CAS server.
+ * URLConnection factory instance to use when making validation requests to the CAS server.
+ * Defaults to {@link HttpsURLConnectionFactory}
*/
- protected HostnameVerifier hostnameVerifier;
-
+ private URLConnectionFactory urlConnectionFactory = new HttpsURLConnectionFactory();
+
/**
* Prefix for the CAS server. Should be everything up to the url endpoint, including the /.
*
@@ -217,10 +217,6 @@ public final void setRenew(final boolean renew) {
public final void setCustomParameters(final Map customParameters) {
this.customParameters = customParameters;
}
-
- public final void setHostnameVerifier(final HostnameVerifier verifier) {
- this.hostnameVerifier = verifier;
- }
public final void setEncoding(final String encoding) {
this.encoding = encoding;
@@ -241,4 +237,12 @@ protected final String getCasServerUrlPrefix() {
protected final Map getCustomParameters() {
return this.customParameters;
}
-}
\ No newline at end of file
+
+ protected URLConnectionFactory getURLConnectionFactory() {
+ return this.urlConnectionFactory;
+ }
+
+ public void setURLConnectionFactory(final URLConnectionFactory urlConnectionFactory) {
+ this.urlConnectionFactory = urlConnectionFactory;
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
index 657f1e823..dc910c361 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
@@ -20,6 +20,9 @@
import javax.servlet.FilterConfig;
+import org.jasig.cas.client.util.HttpsURLConnectionFactory;
+import org.jasig.cas.client.util.URLConnectionFactory;
+
/**
* Implementation of AbstractTicketValidatorFilter that instanciates a Cas10TicketValidator.
*
Deployers can provide the "casServerPrefix" and the "renew" attributes via the standard context or filter init
@@ -35,7 +38,9 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
final String casServerUrlPrefix = getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null);
final Cas10TicketValidator validator = new Cas10TicketValidator(casServerUrlPrefix);
validator.setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
- validator.setHostnameVerifier(getHostnameVerifier(filterConfig));
+
+ final URLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
+ validator.setURLConnectionFactory(factory);
validator.setEncoding(getPropertyFromInitParams(filterConfig, "encoding", null));
return validator;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 5d31060bb..8767e409a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -31,7 +31,9 @@
import org.jasig.cas.client.proxy.*;
import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.HttpsURLConnectionFactory;
import org.jasig.cas.client.util.ReflectUtils;
+import org.jasig.cas.client.util.URLConnectionFactory;
/**
* Creates either a CAS20ProxyTicketValidator or a CAS20ServiceTicketValidator depending on whether any of the
@@ -159,7 +161,8 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
}
validator.setCustomParameters(additionalParameters);
- validator.setHostnameVerifier(getHostnameVerifier(filterConfig));
+ final URLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
+ validator.setURLConnectionFactory(factory);
return validator;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
index 8ac6e5290..25f74f057 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
@@ -21,6 +21,9 @@
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
+import org.jasig.cas.client.util.HttpsURLConnectionFactory;
+import org.jasig.cas.client.util.URLConnectionFactory;
+
/**
* Implementation of TicketValidationFilter that can instanciate a SAML 1.1 Ticket Validator.
*
@@ -53,7 +56,10 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
final String tolerance = getPropertyFromInitParams(filterConfig, "tolerance", "1000");
validator.setTolerance(Long.parseLong(tolerance));
validator.setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
- validator.setHostnameVerifier(getHostnameVerifier(filterConfig));
+
+ final URLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
+ validator.setURLConnectionFactory(factory);
+
validator.setEncoding(getPropertyFromInitParams(filterConfig, "encoding", null));
validator.setDisableXmlSchemaValidation(parseBoolean(getPropertyFromInitParams(filterConfig, "disableXmlSchemaValidation", "false")));
return validator;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 8a1d7759a..0f97a9475 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -45,13 +45,10 @@
import java.nio.charset.Charset;
import java.util.*;
-import javax.net.ssl.HttpsURLConnection;
-
/**
* TicketValidator that can understand validating a SAML artifact. This includes the SOAP request/response.
*
* @author Scott Battaglia
- * @version $Revision$ $Date$
* @since 3.1
*/
public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator {
@@ -232,12 +229,11 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
+ "" + ticket
+ "";
HttpURLConnection conn = null;
-
+ DataOutputStream out = null;
+ BufferedReader in = null;
+
try {
- conn = (HttpURLConnection) validationUrl.openConnection();
- if (this.hostnameVerifier != null && conn instanceof HttpsURLConnection) {
- ((HttpsURLConnection)conn).setHostnameVerifier(this.hostnameVerifier);
- }
+ conn = (HttpURLConnection) this.getURLConnectionFactory().getURLConnection(validationUrl.openConnection());
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml");
conn.setRequestProperty("Content-Length", Integer.toString(MESSAGE_TO_SEND.length()));
@@ -246,12 +242,11 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
conn.setDoInput(true);
conn.setDoOutput(true);
- final DataOutputStream out = new DataOutputStream(conn.getOutputStream());
+ out = new DataOutputStream(conn.getOutputStream());
out.writeBytes(MESSAGE_TO_SEND);
out.flush();
- out.close();
-
- final BufferedReader in = new BufferedReader(CommonUtils.isNotBlank(getEncoding()) ? new InputStreamReader(conn.getInputStream(), Charset.forName(getEncoding())) : new InputStreamReader(conn.getInputStream()));
+
+ in = new BufferedReader(CommonUtils.isNotBlank(getEncoding()) ? new InputStreamReader(conn.getInputStream(), Charset.forName(getEncoding())) : new InputStreamReader(conn.getInputStream()));
final StringBuilder buffer = new StringBuilder(256);
String line;
@@ -263,6 +258,8 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
} catch (final IOException e) {
throw new RuntimeException(e);
} finally {
+ CommonUtils.closeQuietly(out);
+ CommonUtils.closeQuietly(in);
if (conn != null) {
conn.disconnect();
}
diff --git a/pom.xml b/pom.xml
index db7b34262..3f9630773 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,7 @@
org.apache.maven.pluginsmaven-compiler-plugin
+ 3.01.51.5
@@ -94,6 +95,7 @@
maven-source-plugin
+ 2.2.1attach-sources
From 442b9ab5be27f06ac017b1ac947470378ff521c6 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Thu, 24 Jan 2013 12:07:22 -0700
Subject: [PATCH 030/239] Fixed javadoc for unused parameter.
---
.../org/jasig/cas/client/util/HttpsURLConnectionFactory.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java
index e87335ac0..b9e6f60c4 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java
@@ -92,7 +92,6 @@ private URLConnection configureHttpsConnectionIfNeeded(final URLConnection conn)
* keyStorePass=changeit
* certificatePassword=aGoodPass
*
- * @param sslConfig {@link Properties}
* @return the {@link SSLSocketFactory}
*/
private SSLSocketFactory createSSLSocketFactory() {
From 035c946c8dbb40fcb76de70000a99cf260eb396c Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Thu, 24 Jan 2013 15:47:22 -0700
Subject: [PATCH 031/239] CASC-180 - Add support for Client Side Certificates
Moved url connection factory interface and its https impl into the ssl package.
---
.../{util => ssl}/HttpsURLConnectionFactory.java | 10 +++++++++-
.../cas/client/{util => ssl}/URLConnectionFactory.java | 2 +-
.../java/org/jasig/cas/client/util/CommonUtils.java | 2 ++
.../validation/AbstractUrlBasedTicketValidator.java | 4 ++--
.../client/validation/Cas10TicketValidationFilter.java | 4 ++--
.../Cas20ProxyReceivingTicketValidationFilter.java | 4 ++--
.../validation/Saml11TicketValidationFilter.java | 4 ++--
7 files changed, 20 insertions(+), 10 deletions(-)
rename cas-client-core/src/main/java/org/jasig/cas/client/{util => ssl}/HttpsURLConnectionFactory.java (94%)
rename cas-client-core/src/main/java/org/jasig/cas/client/{util => ssl}/URLConnectionFactory.java (97%)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
similarity index 94%
rename from cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java
rename to cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
index b9e6f60c4..2fc3ed296 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
@@ -1,4 +1,4 @@
-package org.jasig.cas.client.util;
+package org.jasig.cas.client.ssl;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -12,6 +12,7 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
+import org.jasig.cas.client.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,6 +52,13 @@ public final void setSSLConfiguration(final Properties config) {
this.sslConfiguration = config;
}
+ /**
+ * Set the host name verifier for the https connection received.
+ *
+ * @see AnyHostnameVerifier
+ * @see RegexHostnameVerifier
+ * @see WhitelistHostnameVerifier
+ */
public final void setHostnameVerifier(final HostnameVerifier verifier) {
this.hostnameVerifier = verifier;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/URLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java
similarity index 97%
rename from cas-client-core/src/main/java/org/jasig/cas/client/util/URLConnectionFactory.java
rename to cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java
index 9a08fe014..45b7dd010 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/URLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.jasig.cas.client.util;
+package org.jasig.cas.client.ssl;
import java.net.URL;
import java.net.URLConnection;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 9f30256e3..fe264ac68 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -19,6 +19,8 @@
package org.jasig.cas.client.util;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
+import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
+import org.jasig.cas.client.ssl.URLConnectionFactory;
import org.jasig.cas.client.validation.ProxyList;
import org.jasig.cas.client.validation.ProxyListEditor;
import org.slf4j.Logger;
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
index b1df5ad99..6d7a71f65 100644
--- 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
@@ -18,9 +18,9 @@
*/
package org.jasig.cas.client.validation;
+import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
+import org.jasig.cas.client.ssl.URLConnectionFactory;
import org.jasig.cas.client.util.CommonUtils;
-import org.jasig.cas.client.util.HttpsURLConnectionFactory;
-import org.jasig.cas.client.util.URLConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
index dc910c361..47e6eb3cd 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
@@ -20,8 +20,8 @@
import javax.servlet.FilterConfig;
-import org.jasig.cas.client.util.HttpsURLConnectionFactory;
-import org.jasig.cas.client.util.URLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
+import org.jasig.cas.client.ssl.URLConnectionFactory;
/**
* Implementation of AbstractTicketValidatorFilter that instanciates a Cas10TicketValidator.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 8767e409a..45f5473a9 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -30,10 +30,10 @@
import javax.servlet.http.HttpServletResponse;
import org.jasig.cas.client.proxy.*;
+import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
+import org.jasig.cas.client.ssl.URLConnectionFactory;
import org.jasig.cas.client.util.CommonUtils;
-import org.jasig.cas.client.util.HttpsURLConnectionFactory;
import org.jasig.cas.client.util.ReflectUtils;
-import org.jasig.cas.client.util.URLConnectionFactory;
/**
* Creates either a CAS20ProxyTicketValidator or a CAS20ServiceTicketValidator depending on whether any of the
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
index 25f74f057..30f5ae3c8 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
@@ -21,8 +21,8 @@
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
-import org.jasig.cas.client.util.HttpsURLConnectionFactory;
-import org.jasig.cas.client.util.URLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
+import org.jasig.cas.client.ssl.URLConnectionFactory;
/**
* Implementation of TicketValidationFilter that can instanciate a SAML 1.1 Ticket Validator.
From a24995233d2c9dd2c77ba0f39579a8bf72aee01d Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 4 Mar 2013 10:43:55 -0500
Subject: [PATCH 032/239] CASC-204 Prevent renew misconfiguration.
Prevent renew from being configured via filter init param, which can lead
to a half-configured state where authentication filter is configured for
renew without validation filter. With this change in place, renew MUST be
configured by a global configuration facility such as context parameter or
JNDI to ensure proper configuration.
---
.../util/AbstractConfigurationFilter.java | 4 ++
.../AuthenticationFilterTests.java | 43 +++++++++++---
.../Cas10TicketValidationFilterTests.java | 58 +++++++++++++++++++
...yReceivingTicketValidationFilterTests.java | 30 +++++++++-
.../Saml11TicketValidationFilterTests.java | 58 +++++++++++++++++++
5 files changed, 183 insertions(+), 10 deletions(-)
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
index e9e2183c5..e2425108e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
@@ -67,6 +67,10 @@ protected final String getPropertyFromInitParams(final FilterConfig filterConfig
final String value = filterConfig.getInitParameter(propertyName);
if (CommonUtils.isNotBlank(value)) {
+ if ("renew".equals(propertyName)) {
+ throw new IllegalArgumentException(
+ "Renew MUST be specified via context parameter or JNDI environment to avoid misconfiguration.");
+ }
logger.info("Property [{}] loaded from FilterConfig.getInitParameter with value [{}]", propertyName, value);
return value;
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index 9b41a749c..b2a520bd7 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -18,6 +18,15 @@
*/
package org.jasig.cas.client.authentication;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.net.URLEncoder;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
import junit.framework.TestCase;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.AssertionImpl;
@@ -25,13 +34,7 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockHttpSession;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import java.io.IOException;
-import java.net.URLEncoder;
+import org.springframework.mock.web.MockServletContext;
/**
* Tests for the AuthenticationFilter.
@@ -177,4 +180,30 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1)
assertNull(session.getAttribute(DefaultGatewayResolverImpl.CONST_CAS_GATEWAY));
assertNull(response2.getRedirectedUrl());
}
+
+ public void testRenewInitParamThrows() throws Exception {
+ final AuthenticationFilter f = new AuthenticationFilter();
+ final MockFilterConfig config = new MockFilterConfig();
+ config.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
+ config.addInitParameter("service", "https://localhost:8443/service");
+ config.addInitParameter("renew", "true");
+ try {
+ f.init(config);
+ fail("Should have thrown IllegalArgumentException.");
+ } catch (final IllegalArgumentException e) {
+ assertTrue(e.getMessage().contains("Renew MUST"));
+ }
+ }
+
+ public void testAllowsRenewContextParam() throws Exception {
+ final AuthenticationFilter f = new AuthenticationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerLoginUrl", "https://cas.example.com/login");
+ context.addInitParameter("service", "https://localhost:8443/service");
+ context.addInitParameter("renew", "true");
+ f.init(new MockFilterConfig(context));
+ final Field renewField = AuthenticationFilter.class.getDeclaredField("renew");
+ renewField.setAccessible(true);
+ assertTrue((Boolean) renewField.get(f));
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
new file mode 100644
index 000000000..e15e7f2ce
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.validation;
+
+import org.junit.Test;
+import org.springframework.mock.web.MockFilterConfig;
+import org.springframework.mock.web.MockServletContext;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit test for {@link Cas10TicketValidationFilter}.
+ *
+ * @author Marvin S. Addison
+ */
+public class Cas10TicketValidationFilterTests {
+ @Test
+ public void testThrowsRenewInitParam() throws Exception {
+ final Cas10TicketValidationFilter f = new Cas10TicketValidationFilter();
+ final MockFilterConfig config = new MockFilterConfig();
+ config.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
+ config.addInitParameter("renew", "true");
+ try {
+ f.init(config);
+ fail("Should have thrown IllegalArgumentException.");
+ } catch (final IllegalArgumentException e) {
+ assertTrue(e.getMessage().contains("Renew MUST"));
+ }
+ }
+
+ @Test
+ public void testAllowsRenewContextParam() throws Exception {
+ final Cas10TicketValidationFilter f = new Cas10TicketValidationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
+ context.addInitParameter("renew", "true");
+ final TicketValidator validator = f.getTicketValidator(new MockFilterConfig(context));
+ assertTrue(validator instanceof Cas10TicketValidator);
+ assertTrue(((Cas10TicketValidator) validator).isRenew());
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
index 073ad3fd9..eeb59ddd5 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
@@ -18,15 +18,16 @@
*/
package org.jasig.cas.client.validation;
+import java.util.Timer;
+import java.util.TimerTask;
+
import junit.framework.TestCase;
import org.jasig.cas.client.proxy.CleanUpTimerTask;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
import org.jasig.cas.client.util.MethodFlag;
import org.springframework.mock.web.MockFilterConfig;
-
-import java.util.Timer;
-import java.util.TimerTask;
+import org.springframework.mock.web.MockServletContext;
/**
* Unit test for {@link org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter}
@@ -179,6 +180,29 @@ public void run() {}
assertNotNull(filter.getTicketValidator(config3));
}
+ public void testRenewInitParamThrows() throws Exception {
+ final Cas20ProxyReceivingTicketValidationFilter f = new Cas20ProxyReceivingTicketValidationFilter();
+ final MockFilterConfig config = new MockFilterConfig();
+ config.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
+ config.addInitParameter("renew", "true");
+ try {
+ f.init(config);
+ fail("Should have thrown IllegalArgumentException.");
+ } catch (final IllegalArgumentException e) {
+ assertTrue(e.getMessage().contains("Renew MUST"));
+ }
+ }
+
+ public void testAllowsRenewContextParam() throws Exception {
+ final Cas20ProxyReceivingTicketValidationFilter f = new Cas20ProxyReceivingTicketValidationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
+ context.addInitParameter("renew", "true");
+ final TicketValidator validator = f.getTicketValidator(new MockFilterConfig(context));
+ assertTrue(validator instanceof AbstractUrlBasedTicketValidator);
+ assertTrue(((AbstractUrlBasedTicketValidator) validator).isRenew());
+ }
+
/**
* construct a working {@link org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter}
*/
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
new file mode 100644
index 000000000..cb64c6310
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.validation;
+
+import org.junit.Test;
+import org.springframework.mock.web.MockFilterConfig;
+import org.springframework.mock.web.MockServletContext;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit test for {@link Saml11TicketValidationFilter}.
+ *
+ * @author Marvin S. Addison
+ */
+public class Saml11TicketValidationFilterTests {
+ @Test
+ public void testRenewInitParamThrows() throws Exception {
+ final Saml11TicketValidationFilter f = new Saml11TicketValidationFilter();
+ final MockFilterConfig config = new MockFilterConfig();
+ config.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
+ config.addInitParameter("renew", "true");
+ try {
+ f.init(config);
+ fail("Should have thrown IllegalArgumentException.");
+ } catch (final IllegalArgumentException e) {
+ assertTrue(e.getMessage().contains("Renew MUST"));
+ }
+ }
+
+ @Test
+ public void testAllowsRenewContextParam() throws Exception {
+ final Saml11TicketValidationFilter f = new Saml11TicketValidationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
+ context.addInitParameter("renew", "true");
+ final TicketValidator validator = f.getTicketValidator(new MockFilterConfig(context));
+ assertTrue(validator instanceof Saml11TicketValidator);
+ assertTrue(((Saml11TicketValidator) validator).isRenew());
+ }
+}
From c970d5b68d1076ef8a03d50927aeb954c595f339 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Mon, 4 Mar 2013 14:17:55 -0700
Subject: [PATCH 033/239] CASC-180: Fix the issue with casting to http url
connections and provide a default instance for the http url factory.
---
.../cas/client/ssl/HttpsURLConnectionFactory.java | 9 ++++++---
.../org/jasig/cas/client/ssl/URLConnectionFactory.java | 5 +++--
.../java/org/jasig/cas/client/util/CommonUtils.java | 10 +++++-----
.../cas/client/validation/Saml11TicketValidator.java | 2 +-
4 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
index 2fc3ed296..30826079e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
@@ -2,6 +2,7 @@
import java.io.FileInputStream;
import java.io.InputStream;
+import java.net.HttpURLConnection;
import java.net.URLConnection;
import java.security.KeyStore;
import java.util.Properties;
@@ -30,6 +31,8 @@ public final class HttpsURLConnectionFactory implements URLConnectionFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpsURLConnectionFactory.class);
+ public static final HttpsURLConnectionFactory INSTANCE = new HttpsURLConnectionFactory();
+
/**
* Hostname verifier used when making an SSL request to the CAS server.
* Defaults to {@link HttpsURLConnection#getDefaultHostnameVerifier()}
@@ -63,7 +66,7 @@ public final void setHostnameVerifier(final HostnameVerifier verifier) {
this.hostnameVerifier = verifier;
}
- public URLConnection getURLConnection(final URLConnection url) {
+ public HttpURLConnection buildHttpURLConnection(final URLConnection url) {
return this.configureHttpsConnectionIfNeeded(url);
}
@@ -74,7 +77,7 @@ public URLConnection getURLConnection(final URLConnection url) {
*
* @param conn the http connection
*/
- private URLConnection configureHttpsConnectionIfNeeded(final URLConnection conn) {
+ private HttpURLConnection configureHttpsConnectionIfNeeded(final URLConnection conn) {
if (conn instanceof HttpsURLConnection) {
final HttpsURLConnection httpsConnection = (HttpsURLConnection) conn;
final SSLSocketFactory socketFactory = this.createSSLSocketFactory();
@@ -86,7 +89,7 @@ private URLConnection configureHttpsConnectionIfNeeded(final URLConnection conn)
httpsConnection.setHostnameVerifier(this.hostnameVerifier);
}
}
- return conn;
+ return (HttpURLConnection)conn;
}
/**
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java
index 45b7dd010..28bbadc51 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java
@@ -18,6 +18,7 @@
*/
package org.jasig.cas.client.ssl;
+import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
@@ -36,9 +37,9 @@ public interface URLConnectionFactory {
* to accommodate method chaining.
*
* @param url The url connection that needs to be configured
- * @return The configured {@link URLConnection} instance
+ * @return The configured {@link HttpURLConnection} instance
*
* @see {@link HttpsURLConnectionFactory}
*/
- URLConnection getURLConnection(final URLConnection url);
+ HttpURLConnection buildHttpURLConnection(final URLConnection url);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index fe264ac68..03f481dd7 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -331,9 +331,9 @@ public static String safeGetParameter(final HttpServletRequest request, final St
*/
public static String getResponseFromServer(final URL constructedUrl, final URLConnectionFactory factory, final String encoding) {
- URLConnection conn = null;
+ HttpURLConnection conn = null;
try {
- conn = factory.getURLConnection(constructedUrl.openConnection());
+ conn = factory.buildHttpURLConnection(constructedUrl.openConnection());
final BufferedReader in;
@@ -355,8 +355,8 @@ public static String getResponseFromServer(final URL constructedUrl, final URLCo
LOGGER.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
- if (conn != null && conn instanceof HttpURLConnection) {
- ((HttpURLConnection)conn).disconnect();
+ if (conn != null) {
+ conn.disconnect();
}
}
@@ -371,7 +371,7 @@ public static String getResponseFromServer(final URL constructedUrl, final URLCo
*/
public static String getResponseFromServer(final String url, String encoding) {
try {
- return getResponseFromServer(new URL(url), new HttpsURLConnectionFactory(), encoding);
+ return getResponseFromServer(new URL(url), HttpsURLConnectionFactory.INSTANCE, encoding);
} catch (final MalformedURLException e) {
throw new IllegalArgumentException(e);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 0f97a9475..7176a9d21 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -233,7 +233,7 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
BufferedReader in = null;
try {
- conn = (HttpURLConnection) this.getURLConnectionFactory().getURLConnection(validationUrl.openConnection());
+ conn = this.getURLConnectionFactory().buildHttpURLConnection(validationUrl.openConnection());
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml");
conn.setRequestProperty("Content-Length", Integer.toString(MESSAGE_TO_SEND.length()));
From c50b143c3f3b069807fdadd720ca9e40fb94d54d Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 6 Mar 2013 09:34:39 -0700
Subject: [PATCH 034/239] CASC-180: Removed the default url connection factory,
allowed proxy retrieval to use the configured factory instance.
---
.../AttributePrincipalImpl.java | 3 +-
.../cas/client/proxy/Cas20ProxyRetriever.java | 37 ++++++++++++-------
.../client/ssl/HttpsURLConnectionFactory.java | 4 +-
.../jasig/cas/client/util/CommonUtils.java | 16 --------
...0ProxyReceivingTicketValidationFilter.java | 9 +++--
.../Cas20ServiceTicketValidator.java | 5 +--
.../Cas20ProxyTicketValidatorTests.java | 1 -
7 files changed, 33 insertions(+), 42 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
index c7ca08f35..acc982314 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
@@ -30,7 +30,6 @@
* Concrete implementation of the AttributePrincipal interface.
*
* @author Scott Battaglia
- * @version $Revision$ $Date$
* @since 3.1
*/
public class AttributePrincipalImpl extends SimplePrincipal implements AttributePrincipal {
@@ -80,7 +79,7 @@ public AttributePrincipalImpl(final String name, final String proxyGrantingTicke
}
/**
- * Constructs a new principal witht he supplied name, attributes, and proxying capabilities.
+ * Constructs a new principal with the supplied name, attributes, and proxying capabilities.
*
* @param name the unique identifier for the principal.
* @param attributes the key/value pairs for this principal.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index 42c21efb5..90cb0840f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -18,12 +18,15 @@
*/
package org.jasig.cas.client.proxy;
+import org.jasig.cas.client.ssl.URLConnectionFactory;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.XmlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.net.URLEncoder;
/**
@@ -43,7 +46,7 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
/** Unique Id for serialization. */
private static final long serialVersionUID = 560409469568911791L;
- /**
+ /**
* Instance of Commons Logging.
*/
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -55,31 +58,39 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
private final String encoding;
+ /** Url connection factory to use when communicating with the server **/
+ private final URLConnectionFactory urlConnectionFactory;
+
/**
* Main Constructor.
*
* @param casServerUrl the URL to the CAS server (i.e. http://localhost/cas/)
* @param encoding the encoding to use.
+ * @param urlFactory url connection factory use when retrieving proxy responses from the server
*/
- public Cas20ProxyRetriever(final String casServerUrl, final String encoding) {
+ public Cas20ProxyRetriever(final String casServerUrl, final String encoding, final URLConnectionFactory urlFactory) {
CommonUtils.assertNotNull(casServerUrl, "casServerUrl cannot be null.");
this.casServerUrl = casServerUrl;
this.encoding = encoding;
+ this.urlConnectionFactory = urlFactory;
}
-
+
public String getProxyTicketIdFor(final String proxyGrantingTicketId,
final String targetService) {
-
- final String url = constructUrl(proxyGrantingTicketId, targetService);
- final String response = CommonUtils.getResponseFromServer(url, this.encoding);
- final String error = XmlUtils.getTextForElement(response, "proxyFailure");
-
- if (CommonUtils.isNotEmpty(error)) {
- logger.debug(error);
- return null;
+ try {
+ final String url = constructUrl(proxyGrantingTicketId, targetService);
+ final String response = CommonUtils.getResponseFromServer(new URL(url), this.urlConnectionFactory, this.encoding);
+ final String error = XmlUtils.getTextForElement(response, "proxyFailure");
+
+ if (CommonUtils.isNotEmpty(error)) {
+ logger.debug(error);
+ return null;
+ }
+
+ return XmlUtils.getTextForElement(response, "proxyTicket");
+ } catch (final MalformedURLException ex) {
+ throw new RuntimeException(ex);
}
-
- return XmlUtils.getTextForElement(response, "proxyTicket");
}
private String constructUrl(final String proxyGrantingTicketId, final String targetService) {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
index 30826079e..67e442d49 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
@@ -31,8 +31,6 @@ public final class HttpsURLConnectionFactory implements URLConnectionFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpsURLConnectionFactory.class);
- public static final HttpsURLConnectionFactory INSTANCE = new HttpsURLConnectionFactory();
-
/**
* Hostname verifier used when making an SSL request to the CAS server.
* Defaults to {@link HttpsURLConnection#getDefaultHostnameVerifier()}
@@ -89,7 +87,7 @@ private HttpURLConnection configureHttpsConnectionIfNeeded(final URLConnection c
httpsConnection.setHostnameVerifier(this.hostnameVerifier);
}
}
- return (HttpURLConnection)conn;
+ return (HttpURLConnection) conn;
}
/**
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 03f481dd7..c592711a4 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -359,22 +359,6 @@ public static String getResponseFromServer(final URL constructedUrl, final URLCo
conn.disconnect();
}
}
-
- }
-
- /**
- * Contacts the remote URL and returns the response.
- *
- * @param url the url to contact.
- * @param encoding the encoding to use.
- * @return the response.
- */
- public static String getResponseFromServer(final String url, String encoding) {
- try {
- return getResponseFromServer(new URL(url), HttpsURLConnectionFactory.INSTANCE, encoding);
- } catch (final MalformedURLException e) {
- throw new IllegalArgumentException(e);
- }
}
public static ProxyList createProxyList(final String proxies) {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 45f5473a9..6e5814213 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -145,7 +145,11 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
}
validator.setProxyCallbackUrl(getPropertyFromInitParams(filterConfig, "proxyCallbackUrl", null));
validator.setProxyGrantingTicketStorage(this.proxyGrantingTicketStorage);
- validator.setProxyRetriever(new Cas20ProxyRetriever(casServerUrlPrefix, getPropertyFromInitParams(filterConfig, "encoding", null)));
+
+ final URLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
+ validator.setURLConnectionFactory(factory);
+
+ validator.setProxyRetriever(new Cas20ProxyRetriever(casServerUrlPrefix, getPropertyFromInitParams(filterConfig, "encoding", null), factory));
validator.setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
validator.setEncoding(getPropertyFromInitParams(filterConfig, "encoding", null));
@@ -161,9 +165,6 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
}
validator.setCustomParameters(additionalParameters);
- final URLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
- validator.setURLConnectionFactory(factory);
-
return validator;
}
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
index c626d6d03..9c90eafd1 100644
--- 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
@@ -25,7 +25,6 @@
import org.jasig.cas.client.proxy.ProxyRetriever;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.XmlUtils;
-import org.w3c.dom.NodeList;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -41,7 +40,6 @@
* Implementation of the TicketValidator that will validate Service Tickets in compliance with the CAS 2.
*
* @author Scott Battaglia
- * @version $Revision$ $Date$
* @since 3.1
*/
public class Cas20ServiceTicketValidator extends AbstractCasProtocolUrlBasedTicketValidator {
@@ -60,10 +58,11 @@ public class Cas20ServiceTicketValidator extends AbstractCasProtocolUrlBasedTick
* CAS server url prefix.
*
* @param casServerUrlPrefix the CAS Server URL prefix.
+ * @param urlFactory URL connection factory to use when communicating with the server
*/
public Cas20ServiceTicketValidator(final String casServerUrlPrefix) {
super(casServerUrlPrefix);
- this.proxyRetriever = new Cas20ProxyRetriever(casServerUrlPrefix, getEncoding());
+ this.proxyRetriever = new Cas20ProxyRetriever(casServerUrlPrefix, getEncoding(), getURLConnectionFactory());
}
/**
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
index b374cae28..ce6f415af 100644
--- 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
@@ -22,7 +22,6 @@
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
import org.jasig.cas.client.proxy.ProxyRetriever;
-import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
From 9dfa3a16a9dac77542243ec60fbb8be433f151cd Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 9 Mar 2013 15:00:45 -0700
Subject: [PATCH 035/239] CASC-180: Fixed try/catch block issue with URL
creation.
---
.../cas/client/proxy/Cas20ProxyRetriever.java | 36 +++++++++----------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index 90cb0840f..bca497a41 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -75,30 +75,28 @@ public Cas20ProxyRetriever(final String casServerUrl, final String encoding, fin
this.urlConnectionFactory = urlFactory;
}
- public String getProxyTicketIdFor(final String proxyGrantingTicketId,
- final String targetService) {
- try {
- final String url = constructUrl(proxyGrantingTicketId, targetService);
- final String response = CommonUtils.getResponseFromServer(new URL(url), this.urlConnectionFactory, this.encoding);
- final String error = XmlUtils.getTextForElement(response, "proxyFailure");
-
- if (CommonUtils.isNotEmpty(error)) {
- logger.debug(error);
- return null;
- }
+ public String getProxyTicketIdFor(final String proxyGrantingTicketId, final String targetService) {
+ CommonUtils.assertNotNull(proxyGrantingTicketId, "proxyGrantingTicketId cannot be null.");
+ CommonUtils.assertNotNull(targetService, "targetService cannot be null.");
+
+ final URL url = constructUrl(proxyGrantingTicketId, targetService);
+ final String response = CommonUtils.getResponseFromServer(url, this.urlConnectionFactory, this.encoding);
+ final String error = XmlUtils.getTextForElement(response, "proxyFailure");
- return XmlUtils.getTextForElement(response, "proxyTicket");
- } catch (final MalformedURLException ex) {
- throw new RuntimeException(ex);
+ if (CommonUtils.isNotEmpty(error)) {
+ logger.debug(error);
+ return null;
}
+
+ return XmlUtils.getTextForElement(response, "proxyTicket");
}
- private String constructUrl(final String proxyGrantingTicketId, final String targetService) {
+ private URL constructUrl(final String proxyGrantingTicketId, final String targetService) {
try {
- return this.casServerUrl + (this.casServerUrl.endsWith("/") ? "" : "/") + "proxy" + "?pgt="
- + proxyGrantingTicketId + "&targetService="
- + URLEncoder.encode(targetService, "UTF-8");
- } catch (final UnsupportedEncodingException e) {
+ return new URL(this.casServerUrl + (this.casServerUrl.endsWith("/") ? "" : "/") + "proxy"
+ + "?pgt=" + proxyGrantingTicketId
+ + "&targetService=" + URLEncoder.encode(targetService, "UTF-8"));
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
From b7699170a55431b8703f6b5f0482e98b473f328f Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 10 Mar 2013 20:51:27 -0700
Subject: [PATCH 036/239] CASC-180: Renamed factory to be
HttpURLConnectionFactory.
---
.../org/jasig/cas/client/proxy/Cas20ProxyRetriever.java | 6 +++---
...nnectionFactory.java => HttpURLConnectionFactory.java} | 2 +-
.../jasig/cas/client/ssl/HttpsURLConnectionFactory.java | 4 ++--
.../main/java/org/jasig/cas/client/util/CommonUtils.java | 4 ++--
.../validation/AbstractUrlBasedTicketValidator.java | 8 ++++----
.../client/validation/Cas10TicketValidationFilter.java | 4 ++--
.../Cas20ProxyReceivingTicketValidationFilter.java | 4 ++--
.../client/validation/Saml11TicketValidationFilter.java | 4 ++--
8 files changed, 18 insertions(+), 18 deletions(-)
rename cas-client-core/src/main/java/org/jasig/cas/client/ssl/{URLConnectionFactory.java => HttpURLConnectionFactory.java} (97%)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index bca497a41..a77b11f03 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -18,7 +18,7 @@
*/
package org.jasig.cas.client.proxy;
-import org.jasig.cas.client.ssl.URLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.XmlUtils;
import org.slf4j.Logger;
@@ -59,7 +59,7 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
private final String encoding;
/** Url connection factory to use when communicating with the server **/
- private final URLConnectionFactory urlConnectionFactory;
+ private final HttpURLConnectionFactory urlConnectionFactory;
/**
* Main Constructor.
@@ -68,7 +68,7 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
* @param encoding the encoding to use.
* @param urlFactory url connection factory use when retrieving proxy responses from the server
*/
- public Cas20ProxyRetriever(final String casServerUrl, final String encoding, final URLConnectionFactory urlFactory) {
+ public Cas20ProxyRetriever(final String casServerUrl, final String encoding, final HttpURLConnectionFactory urlFactory) {
CommonUtils.assertNotNull(casServerUrl, "casServerUrl cannot be null.");
this.casServerUrl = casServerUrl;
this.encoding = encoding;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
similarity index 97%
rename from cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java
rename to cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
index 28bbadc51..c3a33ce5b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/URLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
@@ -28,7 +28,7 @@
* @author Misagh Moayyed
* @since 3.3
*/
-public interface URLConnectionFactory {
+public interface HttpURLConnectionFactory {
/**
* Receives a {@link URLConnection} instance typically as a result of a {@link URL}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
index 67e442d49..2475e5abc 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
@@ -18,7 +18,7 @@
import org.slf4j.LoggerFactory;
/**
- * An implementation of the {@link URLConnectionFactory} whose responsible to configure
+ * An implementation of the {@link HttpURLConnectionFactory} whose responsible to configure
* the underlying https connection, if needed, with a given hostname and SSL socket factory based on the
* configuration provided.
*
@@ -27,7 +27,7 @@
* @see #setHostnameVerifier(HostnameVerifier)
* @see #setSSLConfiguration(Properties)
*/
-public final class HttpsURLConnectionFactory implements URLConnectionFactory {
+public final class HttpsURLConnectionFactory implements HttpURLConnectionFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpsURLConnectionFactory.class);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index c592711a4..e75494198 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -20,7 +20,7 @@
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
-import org.jasig.cas.client.ssl.URLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.validation.ProxyList;
import org.jasig.cas.client.validation.ProxyListEditor;
import org.slf4j.Logger;
@@ -329,7 +329,7 @@ public static String safeGetParameter(final HttpServletRequest request, final St
* @param encoding the encoding to use.
* @return the response.
*/
- public static String getResponseFromServer(final URL constructedUrl, final URLConnectionFactory factory, final String encoding) {
+ public static String getResponseFromServer(final URL constructedUrl, final HttpURLConnectionFactory factory, final String encoding) {
HttpURLConnection conn = null;
try {
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
index 6d7a71f65..5410669eb 100644
--- 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
@@ -19,7 +19,7 @@
package org.jasig.cas.client.validation;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
-import org.jasig.cas.client.ssl.URLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +45,7 @@ public abstract class AbstractUrlBasedTicketValidator implements TicketValidator
* URLConnection factory instance to use when making validation requests to the CAS server.
* Defaults to {@link HttpsURLConnectionFactory}
*/
- private URLConnectionFactory urlConnectionFactory = new HttpsURLConnectionFactory();
+ private HttpURLConnectionFactory urlConnectionFactory = new HttpsURLConnectionFactory();
/**
* Prefix for the CAS server. Should be everything up to the url endpoint, including the /.
@@ -238,11 +238,11 @@ protected final Map getCustomParameters() {
return this.customParameters;
}
- protected URLConnectionFactory getURLConnectionFactory() {
+ protected HttpURLConnectionFactory getURLConnectionFactory() {
return this.urlConnectionFactory;
}
- public void setURLConnectionFactory(final URLConnectionFactory urlConnectionFactory) {
+ public void setURLConnectionFactory(final HttpURLConnectionFactory urlConnectionFactory) {
this.urlConnectionFactory = urlConnectionFactory;
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
index 47e6eb3cd..2e8424cf1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
@@ -21,7 +21,7 @@
import javax.servlet.FilterConfig;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
-import org.jasig.cas.client.ssl.URLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
/**
* Implementation of AbstractTicketValidatorFilter that instanciates a Cas10TicketValidator.
@@ -39,7 +39,7 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
final Cas10TicketValidator validator = new Cas10TicketValidator(casServerUrlPrefix);
validator.setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
- final URLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
+ final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
validator.setURLConnectionFactory(factory);
validator.setEncoding(getPropertyFromInitParams(filterConfig, "encoding", null));
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 6e5814213..48935c53a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -31,7 +31,7 @@
import org.jasig.cas.client.proxy.*;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
-import org.jasig.cas.client.ssl.URLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
@@ -146,7 +146,7 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
validator.setProxyCallbackUrl(getPropertyFromInitParams(filterConfig, "proxyCallbackUrl", null));
validator.setProxyGrantingTicketStorage(this.proxyGrantingTicketStorage);
- final URLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
+ final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
validator.setURLConnectionFactory(factory);
validator.setProxyRetriever(new Cas20ProxyRetriever(casServerUrlPrefix, getPropertyFromInitParams(filterConfig, "encoding", null), factory));
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
index 30f5ae3c8..e35bf83b2 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
@@ -22,7 +22,7 @@
import javax.servlet.ServletException;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
-import org.jasig.cas.client.ssl.URLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
/**
* Implementation of TicketValidationFilter that can instanciate a SAML 1.1 Ticket Validator.
@@ -57,7 +57,7 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
validator.setTolerance(Long.parseLong(tolerance));
validator.setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
- final URLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
+ final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig), getSSLConfig(filterConfig));
validator.setURLConnectionFactory(factory);
validator.setEncoding(getPropertyFromInitParams(filterConfig, "encoding", null));
From 7d130c9bfc2d760dda1229b96ccc1ad32959208e Mon Sep 17 00:00:00 2001
From: mores
Date: Thu, 25 Apr 2013 09:11:11 -0400
Subject: [PATCH 037/239] Fix to allow client to work with Server 3.5.2
---
.../org/jasig/cas/client/validation/Saml11TicketValidator.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 7176a9d21..6f467d86b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -36,6 +36,7 @@
import org.opensaml.xml.parse.BasicParserPool;
import org.opensaml.xml.parse.XMLParserException;
import org.opensaml.xml.schema.XSAny;
+import org.opensaml.xml.schema.XSString;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -217,6 +218,8 @@ private List> getValuesFrom(final Attribute attribute) {
for (final Object o : attribute.getAttributeValues()) {
if (o instanceof XSAny) {
list.add(((XSAny) o).getTextContent());
+ } else if (o instanceof XSString) {
+ list.add(((XSString) o).getValue());
} else {
list.add(o.toString());
}
From 4b1cdd8f479e6557774b96051de7295a28b7dbd4 Mon Sep 17 00:00:00 2001
From: mores
Date: Mon, 6 May 2013 13:46:47 -0400
Subject: [PATCH 038/239] getSocketFactory() should only be called on a
sslContext that has been initialized.
---
.../org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
index 2475e5abc..298069acd 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
@@ -118,11 +118,11 @@ private SSLSocketFactory createSSLSocketFactory() {
final KeyManagerFactory keyManager = KeyManagerFactory.getInstance(this.sslConfiguration.getProperty("keyManagerType", "SunX509"));
keyManager.init(keyStore, this.sslConfiguration.getProperty("certificatePassword").toCharArray());
sslContext.init(keyManager.getKeyManagers(), null, null);
+ return sslContext.getSocketFactory();
}
}
}
- return sslContext.getSocketFactory();
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
} finally {
From abca315fe80a04e3c80db0c87549b9dac181513d Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 18 Jun 2013 21:56:58 -0400
Subject: [PATCH 039/239] Added redirect strategy to support Faces.
---
.../authentication/AuthenticationFilter.java | 27 +++++++++----
.../AuthenticationRedirectStrategy.java | 14 +++++++
...DefaultAuthenticationRedirectStrategy.java | 18 +++++++++
...patibleAuthenticationRedirectStrategy.java | 34 ++++++++++++++++
...ltAuthenticationRedirectStrategyTests.java | 28 +++++++++++++
...leAuthenticationRedirectStrategyTests.java | 39 +++++++++++++++++++
6 files changed, 152 insertions(+), 8 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategyTests.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 3ff189620..3807969c9 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -68,6 +68,8 @@ public class AuthenticationFilter extends AbstractCasFilter {
private GatewayResolver gatewayStorage = new DefaultGatewayResolverImpl();
+ private AuthenticationRedirectStrategy authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
+
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
super.initInternal(filterConfig);
@@ -81,16 +83,26 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
final String gatewayStorageClass = getPropertyFromInitParams(filterConfig, "gatewayStorageClass", null);
if (gatewayStorageClass != null) {
- try {
- this.gatewayStorage = (GatewayResolver) Class.forName(gatewayStorageClass).newInstance();
- } catch (final Exception e) {
- logger.error(e.getMessage(),e);
- throw new ServletException(e);
- }
+ this.gatewayStorage = classNameToClass(gatewayStorageClass);
+ }
+
+ final String authenticationRedirectStrategyClass = getPropertyFromInitParams(filterConfig, "authenticationRedirectStrategyClass", null);
+
+ if (authenticationRedirectStrategyClass != null) {
+ this.authenticationRedirectStrategy = classNameToClass(authenticationRedirectStrategyClass);
}
}
}
+ private T classNameToClass(final String className) throws ServletException {
+ try {
+ return (T) Class.forName(className).newInstance();
+ } catch (final Exception e) {
+ logger.error(e.getMessage(),e);
+ throw new ServletException(e);
+ }
+ }
+
public void init() {
super.init();
CommonUtils.assertNotNull(this.casServerLoginUrl, "casServerLoginUrl cannot be null.");
@@ -131,8 +143,7 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
final String urlToRedirectTo = CommonUtils.constructRedirectUrl(this.casServerLoginUrl, getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway);
logger.debug("redirecting to \"{}\"", urlToRedirectTo);
-
- response.sendRedirect(urlToRedirectTo);
+ this.authenticationRedirectStrategy.redirect(request, response, urlToRedirectTo);
}
public final void setRenew(final boolean renew) {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
new file mode 100644
index 000000000..701d8528c
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
@@ -0,0 +1,14 @@
+package org.jasig.cas.client.authentication;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * Created by battags on 6/18/13.
+ */
+public interface AuthenticationRedirectStrategy {
+
+ void redirect(HttpServletRequest request, HttpServletResponse response, String potentialRedirectUrl) throws IOException;
+
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
new file mode 100644
index 000000000..0d34e4c58
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
@@ -0,0 +1,18 @@
+package org.jasig.cas.client.authentication;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * Implementation of the {@link AuthenticationRedirectStrategy} class that preserves the original behavior that existed prior to 3.3.0.
+ *
+ * @author Scott Battaglia
+ * @since 3.3.0
+ */
+public final class DefaultAuthenticationRedirectStrategy implements AuthenticationRedirectStrategy {
+
+ public void redirect(final HttpServletRequest request, final HttpServletResponse response, final String potentialRedirectUrl) throws IOException {
+ response.sendRedirect(potentialRedirectUrl);
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
new file mode 100644
index 000000000..13ff374b0
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
@@ -0,0 +1,34 @@
+package org.jasig.cas.client.authentication;
+
+import org.jasig.cas.client.util.CommonUtils;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * Implementation of the redirect strategy that can handle a Faces Ajax request in addition to the standard redirect style.
+ *
+ * @author Scott Battaglia
+ * @since 3.3.0
+ */
+public final class FacesCompatibleAuthenticationRedirectStrategy implements AuthenticationRedirectStrategy {
+
+ private static final String FACES_PARTIAL_AJAX_PARAMETER = "javax.faces.partial.ajax";
+
+ public void redirect(final HttpServletRequest request, final HttpServletResponse response, final String potentialRedirectUrl) throws IOException {
+
+ if (CommonUtils.isNotBlank(request.getParameter(FACES_PARTIAL_AJAX_PARAMETER))) {
+ // this is an ajax request - redirect ajaxly
+ response.setContentType("text/xml");
+ response.setStatus(200);
+
+ final PrintWriter writer = response.getWriter();
+ writer.write("");
+ writer.write(String.format("", potentialRedirectUrl));
+ } else {
+ response.sendRedirect(potentialRedirectUrl);
+ }
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategyTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategyTests.java
new file mode 100644
index 000000000..0b1389e31
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategyTests.java
@@ -0,0 +1,28 @@
+package org.jasig.cas.client.authentication;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+public class DefaultAuthenticationRedirectStrategyTests {
+
+ private DefaultAuthenticationRedirectStrategy strategy;
+
+ @Before
+ public void setUp() throws Exception {
+ this.strategy = new DefaultAuthenticationRedirectStrategy();
+ }
+
+ @Test
+ public void didWeRedirect() throws Exception {
+ final String redirectUrl = "http://www.jasig.org";
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ this.strategy.redirect(request, response, redirectUrl);
+ assertEquals(redirectUrl, response.getRedirectedUrl());
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
new file mode 100644
index 000000000..920cf7fc5
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
@@ -0,0 +1,39 @@
+package org.jasig.cas.client.authentication;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import static org.junit.Assert.*;
+
+public class FacesCompatibleAuthenticationRedirectStrategyTests {
+
+ private FacesCompatibleAuthenticationRedirectStrategy strategy;
+
+ @Before
+ public void setUp() throws Exception {
+ this.strategy = new FacesCompatibleAuthenticationRedirectStrategy();
+ }
+
+ @Test
+ public void didWeRedirect() throws Exception {
+ final String redirectUrl = "http://www.jasig.org";
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ this.strategy.redirect(request, response, redirectUrl);
+ assertEquals(redirectUrl, response.getRedirectedUrl());
+ }
+
+ @Test
+ public void facesPartialResponse() throws Exception {
+ final String redirectUrl = "http://www.jasig.org";
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ request.setParameter("javax.faces.partial.ajax", "true");
+ this.strategy.redirect(request, response, redirectUrl);
+ assertNull(response.getRedirectedUrl());
+ assertTrue(response.getContentAsString().contains(redirectUrl));
+ }
+}
From 29216562f61d1938f926ad43238764e992fd840b Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 18 Jun 2013 21:57:22 -0400
Subject: [PATCH 040/239] Fixed failing test case that was missing an import
statement.
---
.../cas/client/validation/Cas20ServiceTicketValidatorTests.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidatorTests.java
index ed599c4e4..83e6c00ab 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidatorTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ServiceTicketValidatorTests.java
@@ -28,6 +28,7 @@
import static org.junit.Assert.*;
import java.io.UnsupportedEncodingException;
+import java.util.List;
/**
* Test cases for the {@link Cas20ServiceTicketValidator}.
From 22d092c72a00aae977bbba7ba998216304b13ca2 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 18 Jun 2013 22:07:50 -0400
Subject: [PATCH 041/239] Added missing javadoc
---
.../AuthenticationRedirectStrategy.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
index 701d8528c..cb3e2e8e4 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
@@ -5,10 +5,23 @@
import java.io.IOException;
/**
- * Created by battags on 6/18/13.
+ * Interface to abstract the authentication strategy for redirecting. The traditional method was to always just redirect,
+ * but due to AJAX, etc. we may need to support other strategies. This interface is designed to hold that logic such that
+ * authentication filter class does not get crazily complex.
+ *
+ * @author Scott Battaglia
+ * @since 3.3.0
*/
public interface AuthenticationRedirectStrategy {
+ /**
+ * Method name is a bit of a misnomer. This method handles "redirection" for a localized version of redirection (i.e. AJAX might mean an XML fragment that contains the url to go to).
+ *
+ * @param request the original HttpServletRequest. MAY NOT BE NULL.
+ * @param response the original HttpServletResponse. MAY NOT BE NULL.
+ * @param potentialRedirectUrl the url that might be used (there are no guarantees of course!)
+ * @throws IOException the exception to throw if there is some type of error. This will bubble up through the filter.
+ */
void redirect(HttpServletRequest request, HttpServletResponse response, String potentialRedirectUrl) throws IOException;
}
From 4f8dfb8543b491c8cbc6935e9cd2fffa3c7c1ee8 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 18 Jun 2013 22:38:25 -0400
Subject: [PATCH 042/239] CASC-207
Converted logger to static for de-serialization purposes.
---
.../org/jasig/cas/client/proxy/Cas20ProxyRetriever.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index a77b11f03..4a5a26aee 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -44,12 +44,9 @@
public final class Cas20ProxyRetriever implements ProxyRetriever {
/** Unique Id for serialization. */
- private static final long serialVersionUID = 560409469568911791L;
+ private static final long serialVersionUID = 560409469568911792L;
- /**
- * Instance of Commons Logging.
- */
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ private static final Logger logger = LoggerFactory.getLogger(Cas20ProxyRetriever.class);
/**
* Url to CAS server.
From 727037d1f5b966cac53a3ef3e28a1911b6e13888 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 19 Jun 2013 22:26:09 -0400
Subject: [PATCH 043/239] Swithed to existing Reflection utils. Added
supporting unit test.
---
.../authentication/AuthenticationFilter.java | 14 ++-------
.../AuthenticationFilterTests.java | 31 ++++++++++++++++---
2 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 3807969c9..38d16f478 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -20,6 +20,7 @@
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.ReflectUtils;
import org.jasig.cas.client.validation.Assertion;
import javax.servlet.FilterChain;
@@ -83,26 +84,17 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
final String gatewayStorageClass = getPropertyFromInitParams(filterConfig, "gatewayStorageClass", null);
if (gatewayStorageClass != null) {
- this.gatewayStorage = classNameToClass(gatewayStorageClass);
+ this.gatewayStorage = ReflectUtils.newInstance(gatewayStorageClass);
}
final String authenticationRedirectStrategyClass = getPropertyFromInitParams(filterConfig, "authenticationRedirectStrategyClass", null);
if (authenticationRedirectStrategyClass != null) {
- this.authenticationRedirectStrategy = classNameToClass(authenticationRedirectStrategyClass);
+ this.authenticationRedirectStrategy = ReflectUtils.newInstance(authenticationRedirectStrategyClass);
}
}
}
- private T classNameToClass(final String className) throws ServletException {
- try {
- return (T) Class.forName(className).newInstance();
- } catch (final Exception e) {
- logger.error(e.getMessage(),e);
- throw new ServletException(e);
- }
- }
-
public void init() {
super.init();
CommonUtils.assertNotNull(this.casServerLoginUrl, "casServerLoginUrl cannot be null.");
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index b2a520bd7..2a615ab7e 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -27,15 +27,19 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import junit.framework.TestCase;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.AssertionImpl;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.mock.web.MockServletContext;
+import static org.junit.Assert.*;
+
/**
* Tests for the AuthenticationFilter.
*
@@ -43,7 +47,7 @@
* @version $Revision: 11753 $ $Date: 2007-01-03 13:37:26 -0500 (Wed, 03 Jan 2007) $
* @since 3.0
*/
-public final class AuthenticationFilterTests extends TestCase {
+public final class AuthenticationFilterTests {
private static final String CAS_SERVICE_URL = "https://localhost:8443/service";
@@ -51,7 +55,8 @@ public final class AuthenticationFilterTests extends TestCase {
private AuthenticationFilter filter;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
// TODO CAS_SERVICE_URL, false, CAS_LOGIN_URL
this.filter = new AuthenticationFilter();
final MockFilterConfig config = new MockFilterConfig();
@@ -60,10 +65,12 @@ protected void setUp() throws Exception {
this.filter.init(config);
}
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
this.filter.destroy();
}
+ @Test
public void testRedirect() throws Exception {
final MockHttpSession session = new MockHttpSession();
final MockHttpServletRequest request = new MockHttpServletRequest();
@@ -84,6 +91,7 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1)
.getRedirectedUrl());
}
+ @Test
public void testRedirectWithQueryString() throws Exception {
final MockHttpSession session = new MockHttpSession();
final MockHttpServletRequest request = new MockHttpServletRequest();
@@ -116,6 +124,7 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1)
"UTF-8"), response.getRedirectedUrl());
}
+ @Test
public void testAssertion() throws Exception {
final MockHttpSession session = new MockHttpSession();
final MockHttpServletRequest request = new MockHttpServletRequest();
@@ -136,6 +145,7 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1)
assertNull(response.getRedirectedUrl());
}
+ @Test
public void testRenew() throws Exception {
final MockHttpSession session = new MockHttpSession();
final MockHttpServletRequest request = new MockHttpServletRequest();
@@ -156,6 +166,7 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1)
assertTrue(response.getRedirectedUrl().indexOf("renew=true") != -1);
}
+ @Test
public void testGateway() throws Exception {
final MockHttpSession session = new MockHttpSession();
final MockHttpServletRequest request = new MockHttpServletRequest();
@@ -181,6 +192,7 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1)
assertNull(response2.getRedirectedUrl());
}
+ @Test
public void testRenewInitParamThrows() throws Exception {
final AuthenticationFilter f = new AuthenticationFilter();
final MockFilterConfig config = new MockFilterConfig();
@@ -195,6 +207,7 @@ public void testRenewInitParamThrows() throws Exception {
}
}
+ @Test
public void testAllowsRenewContextParam() throws Exception {
final AuthenticationFilter f = new AuthenticationFilter();
final MockServletContext context = new MockServletContext();
@@ -206,4 +219,14 @@ public void testAllowsRenewContextParam() throws Exception {
renewField.setAccessible(true);
assertTrue((Boolean) renewField.get(f));
}
+
+ @Test
+ public void customRedirectStrategy() throws Exception {
+ final AuthenticationFilter f = new AuthenticationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerLoginUrl", "https://cas.example.com/login");
+ context.addInitParameter("service", "https://localhost:8443/service");
+ context.addInitParameter("authenticationRedirectStrategyClass", "org.jasig.cas.client.authentication.FacesCompatibleAuthenticationRedirectStrategy");
+ f.init(new MockFilterConfig(context));
+ }
}
From 3b11774158829de9629272fccfbd1f5ef66c98e7 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 19 Jun 2013 22:50:02 -0400
Subject: [PATCH 044/239] Reformat all files using shared CAS Eclipse
formatter.
---
cas-client-core/pom.xml | 184 +--
.../authentication/AttributePrincipal.java | 2 +-
.../AttributePrincipalImpl.java | 27 +-
.../AuthenticationRedirectStrategy.java | 5 +-
...DefaultAuthenticationRedirectStrategy.java | 5 +-
.../DefaultGatewayResolverImpl.java | 32 +-
...patibleAuthenticationRedirectStrategy.java | 13 +-
.../authentication/GatewayResolver.java | 34 +-
.../client/authentication/SimpleGroup.java | 2 +-
.../authentication/SimplePrincipal.java | 3 +-
.../cas/client/jaas/AssertionPrincipal.java | 3 +-
.../jasig/cas/client/jaas/CasLoginModule.java | 98 +-
.../jaas/ServiceAndTicketCallbackHandler.java | 11 +-
.../cas/client/jaas/TicketCredential.java | 11 +-
...cryptedProxyGrantingTicketStorageImpl.java | 9 +-
.../cas/client/proxy/Cas20ProxyRetriever.java | 27 +-
.../cas/client/proxy/CleanUpTimerTask.java | 1 +
.../proxy/ProxyGrantingTicketStorage.java | 2 +-
.../proxy/ProxyGrantingTicketStorageImpl.java | 22 +-
.../HashMapBackedSessionMappingStorage.java | 28 +-
.../client/session/SessionMappingStorage.java | 42 +-
.../client/session/SingleSignOutFilter.java | 29 +-
.../client/session/SingleSignOutHandler.java | 29 +-
.../SingleSignOutHttpSessionListener.java | 12 +-
.../client/ssl/HttpURLConnectionFactory.java | 2 +-
.../client/ssl/HttpsURLConnectionFactory.java | 37 +-
.../cas/client/ssl/RegexHostnameVerifier.java | 5 +-
.../client/ssl/WhitelistHostnameVerifier.java | 2 +
.../cas/client/util/AbstractCasFilter.java | 22 +-
.../util/AbstractConfigurationFilter.java | 50 +-
.../cas/client/util/AssertionHolder.java | 1 +
.../util/AssertionThreadLocalFilter.java | 19 +-
.../jasig/cas/client/util/CommonUtils.java | 128 +-
.../cas/client/util/DelegatingFilter.java | 30 +-
.../cas/client/util/ErrorRedirectFilter.java | 155 ++-
.../util/HttpServletRequestWrapperFilter.java | 33 +-
.../jasig/cas/client/util/ReflectUtils.java | 12 +-
.../org/jasig/cas/client/util/XmlUtils.java | 41 +-
...actCasProtocolUrlBasedTicketValidator.java | 3 +-
.../AbstractTicketValidationFilter.java | 51 +-
.../AbstractUrlBasedTicketValidator.java | 46 +-
.../cas/client/validation/Assertion.java | 5 +-
.../cas/client/validation/AssertionImpl.java | 24 +-
.../Cas10TicketValidationFilter.java | 8 +-
...0ProxyReceivingTicketValidationFilter.java | 51 +-
.../validation/Cas20ProxyTicketValidator.java | 14 +-
.../Cas20ServiceTicketValidator.java | 33 +-
...idProxyChainTicketValidationException.java | 8 +-
.../cas/client/validation/ProxyList.java | 9 +-
.../client/validation/ProxyListEditor.java | 45 +-
.../Saml11TicketValidationFilter.java | 16 +-
.../validation/Saml11TicketValidator.java | 57 +-
.../validation/TicketValidationException.java | 8 +-
.../cas/client/PublicTestHttpServer.java | 6 +-
.../jasig/cas/client/SerializationTests.java | 24 +-
...ltAuthenticationRedirectStrategyTests.java | 3 +-
...leAuthenticationRedirectStrategyTests.java | 3 +-
.../cas/client/jaas/CasLoginModuleTests.java | 75 +-
.../client/proxy/CleanUpTimerTaskTest.java | 10 +-
.../ProxyGrantingTicketStorageImplTest.java | 9 +-
.../session/SingleSignoutHandlerTests.java | 4 +-
.../ssl/WhitelistHostnameVerifierTests.java | 3 +-
.../jasig/cas/client/util/CasFilterTests.java | 15 +-
.../cas/client/util/CommonUtilsTests.java | 16 +-
.../HttpServletRequestWrapperFilterTests.java | 51 +-
.../org/jasig/cas/client/util/MethodFlag.java | 2 +-
.../cas/client/util/ReflectUtilsTests.java | 11 +-
.../client/validation/AssertionImplTests.java | 10 +-
.../Cas10TicketValidationFilterTests.java | 5 +-
.../validation/Cas10TicketValidatorTests.java | 24 +-
...yReceivingTicketValidationFilterTests.java | 15 +-
.../Cas20ProxyTicketValidatorTests.java | 33 +-
.../Cas20ServiceTicketValidatorTests.java | 46 +-
.../Saml11TicketValidationFilterTests.java | 5 +-
.../Saml11TicketValidatorTests.java | 107 +-
cas-client-integration-atlassian/pom.xml | 1110 ++++++++---------
.../Confluence35CasAuthenticator.java | 20 +-
.../atlassian/ConfluenceCasAuthenticator.java | 14 +-
.../atlassian/Jira44CasAuthenticator.java | 14 +-
.../atlassian/JiraCasAuthenticator.java | 16 +-
cas-client-integration-jboss/pom.xml | 122 +-
.../WebAuthenticationFilter.java | 9 +-
cas-client-integration-tomcat-common/pom.xml | 38 +-
.../client/tomcat/AbstractLogoutHandler.java | 4 +-
.../tomcat/AssertionCasRealmDelegate.java | 5 +-
.../client/tomcat/AuthenticatorDelegate.java | 22 +-
.../org/jasig/cas/client/tomcat/CasRealm.java | 2 +-
.../tomcat/PropertiesCasRealmDelegate.java | 13 +-
.../client/tomcat/RegexUriLogoutHandler.java | 4 +-
.../client/tomcat/StaticUriLogoutHandler.java | 1 -
.../PropertiesCasRealmDelegateTests.java | 8 +-
cas-client-integration-tomcat-v6/pom.xml | 66 +-
.../tomcat/v6/AbstractAuthenticator.java | 19 +-
.../tomcat/v6/AbstractCasAuthenticator.java | 1 +
.../client/tomcat/v6/AbstractCasRealm.java | 4 +-
.../tomcat/v6/AbstractLifecycleValve.java | 5 +-
.../client/tomcat/v6/AbstractLogoutValve.java | 7 +-
.../client/tomcat/v6/AssertionCasRealm.java | 2 +-
.../tomcat/v6/Cas10CasAuthenticator.java | 2 +-
.../tomcat/v6/Cas20CasAuthenticator.java | 4 +-
.../tomcat/v6/Cas20ProxyCasAuthenticator.java | 4 +-
.../client/tomcat/v6/PropertiesCasRealm.java | 2 +-
.../client/tomcat/v6/ProxyCallbackValve.java | 5 +-
.../client/tomcat/v6/RegexUriLogoutValve.java | 2 +-
.../client/tomcat/v6/Saml11Authenticator.java | 8 +-
.../client/tomcat/v6/SingleSignOutValve.java | 13 +-
.../tomcat/v6/StaticUriLogoutValve.java | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 66 +-
.../tomcat/v7/AbstractAuthenticator.java | 26 +-
.../client/tomcat/v7/AbstractCasRealm.java | 3 +-
.../client/tomcat/v7/AbstractLogoutValve.java | 7 +-
.../tomcat/v7/Cas10CasAuthenticator.java | 4 +-
.../tomcat/v7/Cas20CasAuthenticator.java | 4 +-
.../tomcat/v7/Cas20ProxyCasAuthenticator.java | 4 +-
.../client/tomcat/v7/PropertiesCasRealm.java | 2 +-
.../client/tomcat/v7/ProxyCallbackValve.java | 7 +-
.../client/tomcat/v7/RegexUriLogoutValve.java | 2 +-
.../client/tomcat/v7/Saml11Authenticator.java | 11 +-
.../client/tomcat/v7/SingleSignOutValve.java | 14 +-
.../tomcat/v7/StaticUriLogoutValve.java | 2 +-
.../pom.xml | 52 +-
...eBackedProxyGrantingTicketStorageImpl.java | 2 +-
...edProxyGrantingTicketStorageImplTests.java | 9 +-
.../pom.xml | 80 +-
...dBackedProxyGrantingTicketStorageImpl.java | 15 +-
pom.xml | 14 +-
126 files changed, 1902 insertions(+), 1993 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 8a13a6744..ffea8c697 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,106 +1,106 @@
-
+
+ org.jasig.cas.client
+ 3.3-SNAPSHOT
+ cas-client
+
+ 4.0.0org.jasig.cas.client
- 3.3-SNAPSHOT
- cas-client
-
- 4.0.0
- org.jasig.cas.client
- cas-client-core
- jar
- Jasig CAS Client for Java - Core
+ cas-client-core
+ jar
+ Jasig CAS Client for Java - Core
-
-
- xml-security
- xmlsec
- 1.3.0
- runtime
- true
-
+
+
+ xml-security
+ xmlsec
+ 1.3.0
+ runtime
+ true
+
-
- org.opensaml
- opensaml
- ${opensaml.version}
- jar
- compile
-
-
- org.slf4j
- jcl-over-slf4j
-
-
-
+
+ org.opensaml
+ opensaml
+ ${opensaml.version}
+ jar
+ compile
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+
-
- commons-codec
- commons-codec
- 1.4
- jar
- true
-
+
+ commons-codec
+ commons-codec
+ 1.4
+ jar
+ true
+
-
- org.springframework
- spring-beans
- ${spring.version}
- provided
-
+
+ org.springframework
+ spring-beans
+ ${spring.version}
+ provided
+
-
- org.springframework
- spring-test
- ${spring.version}
- test
-
+
+ org.springframework
+ spring-test
+ ${spring.version}
+ test
+
-
- org.springframework
- spring-core
- ${spring.version}
- test
-
-
- commons-logging
- commons-logging
-
-
-
+
+ org.springframework
+ spring-core
+ ${spring.version}
+ test
+
+
+ commons-logging
+ commons-logging
+
+
+
-
- org.springframework
- spring-context
- ${spring.version}
- test
-
+
+ org.springframework
+ spring-context
+ ${spring.version}
+ test
+
-
- log4j
- log4j
- test
- 1.2.15
-
-
- jmxri
- com.sun.jmx
-
-
- com.sun.jdmk
- jmxtools
-
-
- javax.jms
- jms
-
-
-
-
+
+ log4j
+ log4j
+ test
+ 1.2.15
+
+
+ jmxri
+ com.sun.jmx
+
+
+ com.sun.jdmk
+ jmxtools
+
+
+ javax.jms
+ jms
+
+
+
+
-
- 3.1.3.RELEASE
- 2.5.1-1
-
+
+ 3.1.3.RELEASE
+ 2.5.1-1
+
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipal.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipal.java
index b86ebcbd6..3a454501b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipal.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipal.java
@@ -47,6 +47,6 @@ public interface AttributePrincipal extends Principal, Serializable {
* The Map of key/value pairs associated with this principal.
* @return the map of key/value pairs associated with this principal.
*/
- Map getAttributes();
+ Map getAttributes();
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
index acc982314..d4f7d61f1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
@@ -18,14 +18,13 @@
*/
package org.jasig.cas.client.authentication;
+import java.util.Collections;
+import java.util.Map;
import org.jasig.cas.client.proxy.ProxyRetriever;
import org.jasig.cas.client.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Collections;
-import java.util.Map;
-
/**
* Concrete implementation of the AttributePrincipal interface.
*
@@ -40,7 +39,7 @@ public class AttributePrincipalImpl extends SimplePrincipal implements Attribute
private static final long serialVersionUID = -1443182634624927187L;
/** Map of key/value pairs about this principal. */
- private final Map attributes;
+ private final Map attributes;
/** The CAS 2 ticket used to retrieve a proxy ticket. */
private final String proxyGrantingTicket;
@@ -54,7 +53,7 @@ public class AttributePrincipalImpl extends SimplePrincipal implements Attribute
* @param name the unique identifier for the principal.
*/
public AttributePrincipalImpl(final String name) {
- this(name, Collections.emptyMap());
+ this(name, Collections. emptyMap());
}
/**
@@ -63,8 +62,8 @@ public AttributePrincipalImpl(final String name) {
* @param name the unique identifier for the principal.
* @param attributes the key/value pairs for this principal.
*/
- public AttributePrincipalImpl(final String name, final Map attributes) {
- this(name, attributes, null, null);
+ public AttributePrincipalImpl(final String name, final Map attributes) {
+ this(name, attributes, null, null);
}
/**
@@ -74,8 +73,9 @@ public AttributePrincipalImpl(final String name, final Map attrib
* @param proxyGrantingTicket the ticket associated with this principal.
* @param proxyRetriever the ProxyRetriever implementation to call back to the CAS server.
*/
- public AttributePrincipalImpl(final String name, final String proxyGrantingTicket, final ProxyRetriever proxyRetriever) {
- this(name, Collections.emptyMap(), proxyGrantingTicket, proxyRetriever);
+ public AttributePrincipalImpl(final String name, final String proxyGrantingTicket,
+ final ProxyRetriever proxyRetriever) {
+ this(name, Collections. emptyMap(), proxyGrantingTicket, proxyRetriever);
}
/**
@@ -86,7 +86,8 @@ public AttributePrincipalImpl(final String name, final String proxyGrantingTicke
* @param proxyGrantingTicket the ticket associated with this principal.
* @param proxyRetriever the ProxyRetriever implementation to call back to the CAS server.
*/
- public AttributePrincipalImpl(final String name, final Map attributes, final String proxyGrantingTicket, final ProxyRetriever proxyRetriever) {
+ public AttributePrincipalImpl(final String name, final Map attributes,
+ final String proxyGrantingTicket, final ProxyRetriever proxyRetriever) {
super(name);
this.attributes = attributes;
this.proxyGrantingTicket = proxyGrantingTicket;
@@ -95,7 +96,7 @@ public AttributePrincipalImpl(final String name, final Map attrib
CommonUtils.assertNotNull(this.attributes, "attributes cannot be null.");
}
- public Map getAttributes() {
+ public Map getAttributes() {
return this.attributes;
}
@@ -103,8 +104,8 @@ public String getProxyTicketFor(String service) {
if (proxyGrantingTicket != null) {
return this.proxyRetriever.getProxyTicketIdFor(this.proxyGrantingTicket, service);
}
-
- LOGGER.debug("No ProxyGrantingTicket was supplied, so no Proxy Ticket can be retrieved.");
+
+ LOGGER.debug("No ProxyGrantingTicket was supplied, so no Proxy Ticket can be retrieved.");
return null;
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
index cb3e2e8e4..01219b2fe 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
@@ -1,8 +1,8 @@
package org.jasig.cas.client.authentication;
+import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
/**
* Interface to abstract the authentication strategy for redirecting. The traditional method was to always just redirect,
@@ -22,6 +22,7 @@ public interface AuthenticationRedirectStrategy {
* @param potentialRedirectUrl the url that might be used (there are no guarantees of course!)
* @throws IOException the exception to throw if there is some type of error. This will bubble up through the filter.
*/
- void redirect(HttpServletRequest request, HttpServletResponse response, String potentialRedirectUrl) throws IOException;
+ void redirect(HttpServletRequest request, HttpServletResponse response, String potentialRedirectUrl)
+ throws IOException;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
index 0d34e4c58..994b0bc6b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
@@ -1,8 +1,8 @@
package org.jasig.cas.client.authentication;
+import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
/**
* Implementation of the {@link AuthenticationRedirectStrategy} class that preserves the original behavior that existed prior to 3.3.0.
@@ -12,7 +12,8 @@
*/
public final class DefaultAuthenticationRedirectStrategy implements AuthenticationRedirectStrategy {
- public void redirect(final HttpServletRequest request, final HttpServletResponse response, final String potentialRedirectUrl) throws IOException {
+ public void redirect(final HttpServletRequest request, final HttpServletResponse response,
+ final String potentialRedirectUrl) throws IOException {
response.sendRedirect(potentialRedirectUrl);
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
index 0844afcc8..d0d24756d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultGatewayResolverImpl.java
@@ -22,23 +22,23 @@
import javax.servlet.http.HttpSession;
public final class DefaultGatewayResolverImpl implements GatewayResolver {
-
+
public static final String CONST_CAS_GATEWAY = "_const_cas_gateway_";
- public boolean hasGatewayedAlready(final HttpServletRequest request, final String serviceUrl) {
- final HttpSession session = request.getSession(false);
-
- if (session == null) {
- return false;
- }
-
- final boolean result = session.getAttribute(CONST_CAS_GATEWAY) != null;
- session.removeAttribute(CONST_CAS_GATEWAY);
- return result;
- }
+ public boolean hasGatewayedAlready(final HttpServletRequest request, final String serviceUrl) {
+ final HttpSession session = request.getSession(false);
+
+ if (session == null) {
+ return false;
+ }
+
+ final boolean result = session.getAttribute(CONST_CAS_GATEWAY) != null;
+ session.removeAttribute(CONST_CAS_GATEWAY);
+ return result;
+ }
- public String storeGatewayInformation(final HttpServletRequest request, final String serviceUrl) {
- request.getSession(true).setAttribute(CONST_CAS_GATEWAY, "yes");
- return serviceUrl;
- }
+ public String storeGatewayInformation(final HttpServletRequest request, final String serviceUrl) {
+ request.getSession(true).setAttribute(CONST_CAS_GATEWAY, "yes");
+ return serviceUrl;
+ }
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
index 13ff374b0..4666bf196 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
@@ -1,11 +1,10 @@
package org.jasig.cas.client.authentication;
-import org.jasig.cas.client.util.CommonUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Implementation of the redirect strategy that can handle a Faces Ajax request in addition to the standard redirect style.
@@ -17,7 +16,8 @@ public final class FacesCompatibleAuthenticationRedirectStrategy implements Auth
private static final String FACES_PARTIAL_AJAX_PARAMETER = "javax.faces.partial.ajax";
- public void redirect(final HttpServletRequest request, final HttpServletResponse response, final String potentialRedirectUrl) throws IOException {
+ public void redirect(final HttpServletRequest request, final HttpServletResponse response,
+ final String potentialRedirectUrl) throws IOException {
if (CommonUtils.isNotBlank(request.getParameter(FACES_PARTIAL_AJAX_PARAMETER))) {
// this is an ajax request - redirect ajaxly
@@ -26,7 +26,8 @@ public void redirect(final HttpServletRequest request, final HttpServletResponse
final PrintWriter writer = response.getWriter();
writer.write("");
- writer.write(String.format("", potentialRedirectUrl));
+ writer.write(String.format("",
+ potentialRedirectUrl));
} else {
response.sendRedirect(potentialRedirectUrl);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/GatewayResolver.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/GatewayResolver.java
index 4b7688bd6..9499a1947 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/GatewayResolver.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/GatewayResolver.java
@@ -31,21 +31,21 @@
*/
public interface GatewayResolver {
- /**
- * Determines if the request has been gatewayed already. Should also do gateway clean up.
- *
- * @param request the Http Servlet Request
- * @param serviceUrl the service url
- * @return true if yes, false otherwise.
- */
- boolean hasGatewayedAlready(HttpServletRequest request, String serviceUrl);
-
- /**
- * Storage the request for gatewaying and return the service url, which can be modified.
- *
- * @param request the HttpServletRequest.
- * @param serviceUrl the service url
- * @return the potentially modified service url to redirect to
- */
- String storeGatewayInformation(HttpServletRequest request, String serviceUrl);
+ /**
+ * Determines if the request has been gatewayed already. Should also do gateway clean up.
+ *
+ * @param request the Http Servlet Request
+ * @param serviceUrl the service url
+ * @return true if yes, false otherwise.
+ */
+ boolean hasGatewayedAlready(HttpServletRequest request, String serviceUrl);
+
+ /**
+ * Storage the request for gatewaying and return the service url, which can be modified.
+ *
+ * @param request the HttpServletRequest.
+ * @param serviceUrl the service url
+ * @return the potentially modified service url to redirect to
+ */
+ String storeGatewayInformation(HttpServletRequest request, String serviceUrl);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimpleGroup.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimpleGroup.java
index c2110b1dc..37e7f5930 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimpleGroup.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimpleGroup.java
@@ -64,7 +64,7 @@ public Enumeration extends Principal> members() {
public boolean removeMember(final Principal user) {
return this.members.remove(user);
}
-
+
public String toString() {
return super.toString() + ": " + members.toString();
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimplePrincipal.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimplePrincipal.java
index eebb5524f..4f73a7340 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimplePrincipal.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/SimplePrincipal.java
@@ -20,7 +20,6 @@
import java.io.Serializable;
import java.security.Principal;
-
import org.jasig.cas.client.util.CommonUtils;
/**
@@ -62,7 +61,7 @@ public boolean equals(final Object o) {
} else if (!(o instanceof SimplePrincipal)) {
return false;
} else {
- return getName().equals(((SimplePrincipal)o).getName());
+ return getName().equals(((SimplePrincipal) o).getName());
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/AssertionPrincipal.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/AssertionPrincipal.java
index 2f8b1e4cb..8ae58947c 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/AssertionPrincipal.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/AssertionPrincipal.java
@@ -19,7 +19,6 @@
package org.jasig.cas.client.jaas;
import java.io.Serializable;
-
import org.jasig.cas.client.authentication.SimplePrincipal;
import org.jasig.cas.client.validation.Assertion;
@@ -32,7 +31,7 @@
*
*/
public class AssertionPrincipal extends SimplePrincipal implements Serializable {
-
+
/** AssertionPrincipal.java */
private static final long serialVersionUID = 2288520214366461693L;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
index 500693fb1..d181dd97f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
@@ -25,25 +25,12 @@
import java.io.IOException;
import java.security.Principal;
import java.security.acl.Group;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.TimeUnit;
-
import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.callback.*;
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
-
import org.jasig.cas.client.authentication.SimpleGroup;
import org.jasig.cas.client.authentication.SimplePrincipal;
import org.jasig.cas.client.util.CommonUtils;
@@ -116,14 +103,14 @@
public class CasLoginModule implements LoginModule {
/** Constant for login name stored in shared state. */
public static final String LOGIN_NAME = "javax.security.auth.login.name";
-
+
/**
* Default group name for storing caller principal.
* The default value supports JBoss, but is configurable to hopefully
* support other JEE containers.
*/
public static final String DEFAULT_PRINCIPAL_GROUP_NAME = "CallerPrincipal";
-
+
/**
* Default group name for storing role membership data.
* The default value supports JBoss, but is configurable to hopefully
@@ -145,41 +132,41 @@ public class CasLoginModule implements LoginModule {
* CAS tickets are one-time-use, a cached assertion must be provided on
* re-authentication.
*/
- protected static final Map ASSERTION_CACHE = new HashMap();
+ protected static final Map ASSERTION_CACHE = new HashMap();
/** Logger instance */
protected final Logger logger = LoggerFactory.getLogger(getClass());
-
+
/** JAAS authentication subject */
protected Subject subject;
-
+
/** JAAS callback handler */
protected CallbackHandler callbackHandler;
-
+
/** CAS ticket validator */
protected TicketValidator ticketValidator;
-
+
/** CAS service parameter used if no service is provided via TextCallback on login */
protected String service;
-
+
/** CAS assertion */
protected Assertion assertion;
-
+
/** CAS ticket credential */
protected TicketCredential ticket;
-
+
/** Login module shared state */
- protected Map sharedState;
-
+ protected Map sharedState;
+
/** Roles to be added to all authenticated principals by default */
protected String[] defaultRoles;
-
+
/** Names of attributes in the CAS assertion that should be used for role data */
protected Set roleAttributeNames = new HashSet();
-
+
/** Name of JAAS Group containing caller principal */
protected String principalGroupName = DEFAULT_PRINCIPAL_GROUP_NAME;
-
+
/** Name of JAAS Group containing role data */
protected String roleGroupName = DEFAULT_ROLE_GROUP_NAME;
@@ -216,10 +203,7 @@ public class CasLoginModule implements LoginModule {
* names, e.g. DAYS, HOURS, MINUTES, SECONDS, MILLISECONDS. Default unit is MINUTES.
*
*/
- public final void initialize(
- final Subject subject,
- final CallbackHandler handler,
- final Map state,
+ public final void initialize(final Subject subject, final CallbackHandler handler, final Map state,
final Map options) {
this.assertion = null;
@@ -227,7 +211,7 @@ public final void initialize(
this.subject = subject;
this.sharedState = (Map) state;
this.sharedState = new HashMap(state);
-
+
String ticketValidatorClass = null;
for (final String key : options.keySet()) {
@@ -251,7 +235,7 @@ public final void initialize(
logger.debug("Set roleAttributeNames={}", this.roleAttributeNames);
} else if ("principalGroupName".equals(key)) {
this.principalGroupName = (String) options.get(key);
- logger.debug("Set principalGroupName={}",this.principalGroupName);
+ logger.debug("Set principalGroupName={}", this.principalGroupName);
} else if ("roleGroupName".equals(key)) {
this.roleGroupName = (String) options.get(key);
logger.debug("Set roleGroupName={}", this.roleGroupName);
@@ -311,15 +295,15 @@ public final boolean login() throws LoginException {
logger.info("Login failed due to IO exception in callback handler: {}", e);
throw (LoginException) new LoginException("IO exception in callback handler: " + e).initCause(e);
} catch (final UnsupportedCallbackException e) {
- logger.info("Login failed due to unsupported callback: {}", e);
+ logger.info("Login failed due to unsupported callback: {}", e);
throw (LoginException) new LoginException(
"Callback handler does not support PasswordCallback and TextInputCallback.").initCause(e);
}
if (ticketCallback.getPassword() != null) {
this.ticket = new TicketCredential(new String(ticketCallback.getPassword()));
- final String service = CommonUtils.isNotBlank(
- serviceCallback.getName()) ? serviceCallback.getName() : this.service;
+ final String service = CommonUtils.isNotBlank(serviceCallback.getName()) ? serviceCallback.getName()
+ : this.service;
if (this.cacheAssertions) {
this.assertion = ASSERTION_CACHE.get(ticket);
@@ -336,7 +320,8 @@ public final boolean login() throws LoginException {
"Neither login module nor callback handler provided required service parameter.");
}
try {
- logger.debug("Attempting ticket validation with service={} and ticket={}", service, this.ticket);
+ logger.debug("Attempting ticket validation with service={} and ticket={}", service,
+ this.ticket);
this.assertion = this.ticketValidator.validate(this.ticket.getName(), service);
} catch (final Exception e) {
@@ -398,8 +383,8 @@ public final boolean commit() throws LoginException {
throw new LoginException("Ticket credential not found.");
}
- final AssertionPrincipal casPrincipal = new AssertionPrincipal(
- this.assertion.getPrincipal().getName(), this.assertion);
+ final AssertionPrincipal casPrincipal = new AssertionPrincipal(this.assertion.getPrincipal().getName(),
+ this.assertion);
this.subject.getPrincipals().add(casPrincipal);
// Add group containing principal as sole member
@@ -415,7 +400,7 @@ public final boolean commit() throws LoginException {
roleGroup.addMember(new SimplePrincipal(defaultRole));
}
- final Map attributes = this.assertion.getPrincipal().getAttributes();
+ final Map attributes = this.assertion.getPrincipal().getAttributes();
for (final String key : attributes.keySet()) {
if (this.roleAttributeNames.contains(key)) {
// Attribute value is Object if singular or Collection if plural
@@ -465,7 +450,7 @@ public final boolean logout() throws LoginException {
removePrincipalsOfType(AssertionPrincipal.class);
removePrincipalsOfType(SimplePrincipal.class);
removePrincipalsOfType(SimpleGroup.class);
-
+
// Remove all CAS credentials
removeCredentialsOfType(TicketCredential.class);
@@ -490,19 +475,20 @@ protected boolean preLogout() {
protected void postLogout() {
// template method
}
+
/**
* Creates a {@link TicketValidator} instance from a class name and map of property name/value pairs.
* @param className Fully-qualified name of {@link TicketValidator} concrete class.
* @param propertyMap Map of property name/value pairs to set on validator instance.
* @return Ticket validator with properties set.
*/
- private TicketValidator createTicketValidator(final String className, final Map propertyMap) {
- CommonUtils.assertTrue(
- propertyMap.containsKey("casServerUrlPrefix"), "Required property casServerUrlPrefix not found.");
+ private TicketValidator createTicketValidator(final String className, final Map propertyMap) {
+ CommonUtils.assertTrue(propertyMap.containsKey("casServerUrlPrefix"),
+ "Required property casServerUrlPrefix not found.");
final Class validatorClass = ReflectUtils.loadClass(className);
- final TicketValidator validator = ReflectUtils.newInstance(
- validatorClass, propertyMap.get("casServerUrlPrefix"));
+ final TicketValidator validator = ReflectUtils.newInstance(validatorClass,
+ propertyMap.get("casServerUrlPrefix"));
try {
final BeanInfo info = Introspector.getBeanInfo(validatorClass);
@@ -513,8 +499,8 @@ private TicketValidator createTicketValidator(final String className, final Map<
final String value = (String) propertyMap.get(property);
final PropertyDescriptor pd = ReflectUtils.getPropertyDescriptor(info, property);
if (pd != null) {
- ReflectUtils.setProperty(property, convertIfNecessary(pd, value), validator, info);
- logger.debug("Set {} = {}", property, value);
+ ReflectUtils.setProperty(property, convertIfNecessary(pd, value), validator, info);
+ logger.debug("Set {} = {}", property, value);
} else {
logger.warn("Cannot find property {} on {}", property, className);
}
@@ -523,7 +509,7 @@ private TicketValidator createTicketValidator(final String className, final Map<
} catch (final IntrospectionException e) {
throw new RuntimeException("Error getting bean info for " + validatorClass, e);
}
-
+
return validator;
}
@@ -547,8 +533,8 @@ private static Object convertIfNecessary(final PropertyDescriptor pd, final Stri
} else if (long.class.equals(pd.getPropertyType())) {
return new Long(value);
} else {
- throw new IllegalArgumentException(
- "No conversion strategy exists for property " + pd.getName() + " of type " + pd.getPropertyType());
+ throw new IllegalArgumentException("No conversion strategy exists for property " + pd.getName()
+ + " of type " + pd.getPropertyType());
}
}
@@ -567,11 +553,12 @@ private void removePrincipalsOfType(final Class extends Principal> clazz) {
private void removeCredentialsOfType(final Class extends Principal> clazz) {
this.subject.getPrivateCredentials().removeAll(this.subject.getPrivateCredentials(clazz));
}
+
/**
* Removes expired entries from the assertion cache.
*/
private void cleanCache() {
- logger.debug("Cleaning assertion cache of size {}", ASSERTION_CACHE.size());
+ logger.debug("Cleaning assertion cache of size {}", ASSERTION_CACHE.size());
final Iterator> iter = ASSERTION_CACHE.entrySet().iterator();
final Calendar cutoff = Calendar.getInstance();
cutoff.setTimeInMillis(System.currentTimeMillis() - this.cacheTimeoutUnit.toMillis(this.cacheTimeout));
@@ -586,4 +573,3 @@ private void cleanCache() {
}
}
}
-
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/ServiceAndTicketCallbackHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/ServiceAndTicketCallbackHandler.java
index 9aacd5814..7fc88ef4f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/ServiceAndTicketCallbackHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/ServiceAndTicketCallbackHandler.java
@@ -19,12 +19,7 @@
package org.jasig.cas.client.jaas;
import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.callback.*;
/**
* Callback handler that provides the CAS service and ticket to a
@@ -40,10 +35,10 @@ public class ServiceAndTicketCallbackHandler implements CallbackHandler {
/** CAS service URL */
private final String service;
-
+
/** CAS service ticket */
private final String ticket;
-
+
/**
* Creates a new instance with the given service and ticket.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/TicketCredential.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/TicketCredential.java
index 99b86e2ed..621da53fd 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/TicketCredential.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/TicketCredential.java
@@ -32,7 +32,7 @@ public final class TicketCredential implements Principal {
/** Hash code seed value */
private static final int HASHCODE_SEED = 17;
-
+
/** Ticket ID string */
private String ticket;
@@ -53,12 +53,15 @@ public String toString() {
}
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
final TicketCredential that = (TicketCredential) o;
- if (ticket != null ? !ticket.equals(that.ticket) : that.ticket != null) return false;
+ if (ticket != null ? !ticket.equals(that.ticket) : that.ticket != null)
+ return false;
return true;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
index 55124bdfb..69cc75dcf 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
@@ -18,13 +18,13 @@
*/
package org.jasig.cas.client.proxy;
-import javax.crypto.Cipher;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.DESedeKeySpec;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESedeKeySpec;
/**
* Provides encryption capabilities. Not entirely safe to configure since we have no way of controlling the
@@ -42,7 +42,8 @@ public abstract class AbstractEncryptedProxyGrantingTicketStorageImpl implements
private String cipherAlgorithm = DEFAULT_ENCRYPTION_ALGORITHM;
- public final void setSecretKey(final String key) throws NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException {
+ public final void setSecretKey(final String key) throws NoSuchAlgorithmException, InvalidKeyException,
+ InvalidKeySpecException {
this.key = SecretKeyFactory.getInstance(this.cipherAlgorithm).generateSecret(new DESedeKeySpec(key.getBytes()));
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index 4a5a26aee..1146b48c2 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -18,17 +18,14 @@
*/
package org.jasig.cas.client.proxy;
+import java.net.URL;
+import java.net.URLEncoder;
import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.XmlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-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 cache = new ConcurrentHashMap();
+ private final ConcurrentMap cache = new ConcurrentHashMap();
/**
* time, in milliseconds, before a {@link ProxyGrantingTicketHolder}
@@ -58,7 +57,7 @@ public final class ProxyGrantingTicketStorageImpl implements ProxyGrantingTicket
*
* @see ProxyGrantingTicketStorageImpl#DEFAULT_TIMEOUT
*/
- private long timeout;
+ private long timeout;
/**
* Constructor set the timeout to the default value.
@@ -74,7 +73,7 @@ public ProxyGrantingTicketStorageImpl() {
* @param timeout the time to hold on to the ProxyGrantingTicket
*/
public ProxyGrantingTicketStorageImpl(final long timeout) {
- this.timeout = timeout;
+ this.timeout = timeout;
}
/**
@@ -89,7 +88,7 @@ public String retrieve(final String proxyGrantingTicketIou) {
final ProxyGrantingTicketHolder holder = this.cache.get(proxyGrantingTicketIou);
if (holder == null) {
- logger.info("No Proxy Ticket found for [{}].", proxyGrantingTicketIou);
+ logger.info("No Proxy Ticket found for [{}].", proxyGrantingTicketIou);
return null;
}
@@ -102,7 +101,8 @@ public String retrieve(final String proxyGrantingTicketIou) {
public void save(final String proxyGrantingTicketIou, final String proxyGrantingTicket) {
final ProxyGrantingTicketHolder holder = new ProxyGrantingTicketHolder(proxyGrantingTicket);
- logger.debug("Saving ProxyGrantingTicketIOU and ProxyGrantingTicket combo: [{}, {}]", proxyGrantingTicketIou, proxyGrantingTicket);
+ logger.debug("Saving ProxyGrantingTicketIOU and ProxyGrantingTicket combo: [{}, {}]", proxyGrantingTicketIou,
+ proxyGrantingTicket);
this.cache.put(proxyGrantingTicketIou, holder);
}
@@ -111,13 +111,13 @@ public void save(final String proxyGrantingTicketIou, final String proxyGranting
* called regularly via an external thread or timer.
*/
public void cleanUp() {
- for (final Map.Entry holder : this.cache.entrySet()) {
+ for (final Map.Entry holder : this.cache.entrySet()) {
if (holder.getValue().isExpired(this.timeout)) {
this.cache.remove(holder.getKey());
}
}
}
-
+
private static final class ProxyGrantingTicketHolder {
private final String proxyGrantingTicket;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
index a4ed3db4b..27a6c6018 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/HashMapBackedSessionMappingStorage.java
@@ -18,13 +18,11 @@
*/
package org.jasig.cas.client.session;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.HashMap;
import java.util.Map;
-
import javax.servlet.http.HttpSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* HashMap backed implementation of SessionMappingStorage.
@@ -35,26 +33,26 @@
*
*/
public final class HashMapBackedSessionMappingStorage implements SessionMappingStorage {
-
+
/**
* Maps the ID from the CAS server to the Session.
*/
- private final Map MANAGED_SESSIONS = new HashMap();
+ private final Map MANAGED_SESSIONS = new HashMap();
/**
* Maps the Session ID to the key from the CAS Server.
*/
- private final Map ID_TO_SESSION_KEY_MAPPING = new HashMap();
+ private final Map ID_TO_SESSION_KEY_MAPPING = new HashMap();
private final Logger logger = LoggerFactory.getLogger(getClass());
- public synchronized void addSessionById(String mappingId, HttpSession session) {
+ public synchronized void addSessionById(String mappingId, HttpSession session) {
ID_TO_SESSION_KEY_MAPPING.put(session.getId(), mappingId);
MANAGED_SESSIONS.put(mappingId, session);
- }
+ }
- public synchronized void removeBySessionById(final String sessionId) {
+ public synchronized void removeBySessionById(final String sessionId) {
logger.debug("Attempting to remove Session=[{}]", sessionId);
final String key = ID_TO_SESSION_KEY_MAPPING.get(sessionId);
@@ -68,15 +66,15 @@ public synchronized void removeBySessionById(final String sessionId) {
}
MANAGED_SESSIONS.remove(key);
ID_TO_SESSION_KEY_MAPPING.remove(sessionId);
- }
+ }
- public synchronized HttpSession removeSessionByMappingId(String mappingId) {
- final HttpSession session = MANAGED_SESSIONS.get(mappingId);
+ public synchronized HttpSession removeSessionByMappingId(String mappingId) {
+ final HttpSession session = MANAGED_SESSIONS.get(mappingId);
if (session != null) {
- removeBySessionById(session.getId());
+ removeBySessionById(session.getId());
}
return session;
- }
+ }
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SessionMappingStorage.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SessionMappingStorage.java
index f0d6b2c3f..ab0dce4b0 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SessionMappingStorage.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SessionMappingStorage.java
@@ -29,26 +29,26 @@
*
*/
public interface SessionMappingStorage {
-
- /**
- * Remove the HttpSession based on the mappingId.
- *
- * @param mappingId the id the session is keyed under.
- * @return the HttpSession if it exists.
- */
- HttpSession removeSessionByMappingId(String mappingId);
-
- /**
- * Remove a session by its Id.
- * @param sessionId the id of the session.
- */
- void removeBySessionById(String sessionId);
-
- /**
- * Add a session by its mapping Id.
- * @param mappingId the id to map the session to.
- * @param session the HttpSession.
- */
- void addSessionById(String mappingId, HttpSession session);
+
+ /**
+ * Remove the HttpSession based on the mappingId.
+ *
+ * @param mappingId the id the session is keyed under.
+ * @return the HttpSession if it exists.
+ */
+ HttpSession removeSessionByMappingId(String mappingId);
+
+ /**
+ * Remove a session by its Id.
+ * @param sessionId the id of the session.
+ */
+ void removeBySessionById(String sessionId);
+
+ /**
+ * Add a session by its mapping Id.
+ * @param mappingId the id to map the session to.
+ * @param session the HttpSession.
+ */
+ void addSessionById(String mappingId, HttpSession session);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index 6219d80d4..109791d2b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -18,15 +18,10 @@
*/
package org.jasig.cas.client.session;
-import org.jasig.cas.client.util.AbstractConfigurationFilter;
-
-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 java.io.IOException;
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import org.jasig.cas.client.util.AbstractConfigurationFilter;
/**
* Implements the Single Sign Out protocol. It handles registering the session and destroying the session.
@@ -42,9 +37,12 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
public void init(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
handler.setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName", "ticket"));
- handler.setLogoutParameterName(getPropertyFromInitParams(filterConfig, "logoutParameterName", "logoutRequest"));
- handler.setArtifactParameterOverPost(parseBoolean(getPropertyFromInitParams(filterConfig, "artifactParameterOverPost", "false")));
- handler.setEagerlyCreateSessions(parseBoolean(getPropertyFromInitParams(filterConfig, "eagerlyCreateSessions", "true")));
+ handler.setLogoutParameterName(getPropertyFromInitParams(filterConfig, "logoutParameterName",
+ "logoutRequest"));
+ handler.setArtifactParameterOverPost(parseBoolean(getPropertyFromInitParams(filterConfig,
+ "artifactParameterOverPost", "false")));
+ handler.setEagerlyCreateSessions(parseBoolean(getPropertyFromInitParams(filterConfig,
+ "eagerlyCreateSessions", "true")));
}
handler.init();
}
@@ -52,7 +50,7 @@ public void init(final FilterConfig filterConfig) throws ServletException {
public void setArtifactParameterName(final String name) {
handler.setArtifactParameterName(name);
}
-
+
public void setLogoutParameterName(final String name) {
handler.setLogoutParameterName(name);
}
@@ -60,8 +58,9 @@ public void setLogoutParameterName(final String name) {
public void setSessionMappingStorage(final SessionMappingStorage storage) {
handler.setSessionMappingStorage(storage);
}
-
- public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
+
+ public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
+ final FilterChain filterChain) throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) servletRequest;
if (handler.isTokenRequest(request)) {
@@ -80,7 +79,7 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
public void destroy() {
// nothing to do
}
-
+
protected static SingleSignOutHandler getSingleSignOutHandler() {
return handler;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 28f3d109b..ebd3323e0 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -18,17 +18,15 @@
*/
package org.jasig.cas.client.session;
+import java.util.Arrays;
+import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.XmlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Arrays;
-import java.util.List;
-
/**
* Performs CAS single sign-out operations in an API-agnostic fashion.
*
@@ -44,7 +42,7 @@ public final class SingleSignOutHandler {
/** Mapping of token IDs and session IDs to HTTP sessions */
private SessionMappingStorage sessionMappingStorage = new HashMapBackedSessionMappingStorage();
-
+
/** The name of the artifact parameter. This is used to capture the session identifier. */
private String artifactParameterName = "ticket";
@@ -56,6 +54,7 @@ public final class SingleSignOutHandler {
private boolean eagerlyCreateSessions = true;
private List safeParameters;
+
public void setSessionMappingStorage(final SessionMappingStorage storage) {
this.sessionMappingStorage = storage;
}
@@ -100,7 +99,7 @@ public void init() {
this.safeParameters = Arrays.asList(this.logoutParameterName);
}
}
-
+
/**
* Determines whether the given request contains an authentication token.
*
@@ -109,7 +108,8 @@ public void init() {
* @return True if request contains authentication token, false otherwise.
*/
public boolean isTokenRequest(final HttpServletRequest request) {
- return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.artifactParameterName, this.safeParameters));
+ return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.artifactParameterName,
+ this.safeParameters));
}
/**
@@ -120,8 +120,10 @@ public boolean isTokenRequest(final HttpServletRequest request) {
* @return True if request is logout request, false otherwise.
*/
public boolean isLogoutRequest(final HttpServletRequest request) {
- return "POST".equals(request.getMethod()) && !isMultipartRequest(request) &&
- CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName, this.safeParameters));
+ return "POST".equals(request.getMethod())
+ && !isMultipartRequest(request)
+ && CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName,
+ this.safeParameters));
}
/**
@@ -148,15 +150,16 @@ public void recordSession(final HttpServletRequest request) {
}
sessionMappingStorage.addSessionById(token, session);
}
-
+
/**
* Destroys the current HTTP session for the given CAS logout request.
*
* @param request HTTP request containing a CAS logout message.
*/
public void destroySession(final HttpServletRequest request) {
- final String logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName, this.safeParameters);
- logger.trace ("Logout request:\n{}", logoutMessage);
+ final String logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName,
+ this.safeParameters);
+ logger.trace("Logout request:\n{}", logoutMessage);
final String token = XmlUtils.getTextForElement(logoutMessage, "SessionIndex");
if (CommonUtils.isNotBlank(token)) {
@@ -165,7 +168,7 @@ public void destroySession(final HttpServletRequest request) {
if (session != null) {
String sessionID = session.getId();
- logger.debug ("Invalidating session [{}] for token [{}]", sessionID, token);
+ logger.debug("Invalidating session [{}] for token [{}]", sessionID, token);
try {
session.invalidate();
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHttpSessionListener.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHttpSessionListener.java
index 8df6a85db..d1f3b5d11 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHttpSessionListener.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHttpSessionListener.java
@@ -34,16 +34,16 @@
*/
public final class SingleSignOutHttpSessionListener implements HttpSessionListener {
- private SessionMappingStorage sessionMappingStorage;
-
+ private SessionMappingStorage sessionMappingStorage;
+
public void sessionCreated(final HttpSessionEvent event) {
// nothing to do at the moment
}
public void sessionDestroyed(final HttpSessionEvent event) {
- if (sessionMappingStorage == null) {
- sessionMappingStorage = getSessionMappingStorage();
- }
+ if (sessionMappingStorage == null) {
+ sessionMappingStorage = getSessionMappingStorage();
+ }
final HttpSession session = event.getSession();
sessionMappingStorage.removeBySessionById(session.getId());
}
@@ -55,6 +55,6 @@ public void sessionDestroyed(final HttpSessionEvent event) {
* @return the SessionMappingStorage
*/
protected static SessionMappingStorage getSessionMappingStorage() {
- return SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage();
+ return SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage();
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
index c3a33ce5b..e280b7a62 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
@@ -29,7 +29,7 @@
* @since 3.3
*/
public interface HttpURLConnectionFactory {
-
+
/**
* Receives a {@link URLConnection} instance typically as a result of a {@link URL}
* opening a connection to a remote resource. The received url connection is then
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
index 298069acd..3b27c0ed2 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
@@ -6,13 +6,7 @@
import java.net.URLConnection;
import java.security.KeyStore;
import java.util.Properties;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
-
+import javax.net.ssl.*;
import org.jasig.cas.client.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,29 +24,30 @@
public final class HttpsURLConnectionFactory implements HttpURLConnectionFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpsURLConnectionFactory.class);
-
+
/**
* Hostname verifier used when making an SSL request to the CAS server.
* Defaults to {@link HttpsURLConnection#getDefaultHostnameVerifier()}
*/
private HostnameVerifier hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
-
+
/**
* Properties file that can contains key/trust info for Client Side Certificates
*/
- private Properties sslConfiguration = new Properties();
-
- public HttpsURLConnectionFactory() {}
-
+ private Properties sslConfiguration = new Properties();
+
+ public HttpsURLConnectionFactory() {
+ }
+
public HttpsURLConnectionFactory(final HostnameVerifier verifier, final Properties config) {
setHostnameVerifier(verifier);
setSSLConfiguration(config);
}
-
+
public final void setSSLConfiguration(final Properties config) {
this.sslConfiguration = config;
}
-
+
/**
* Set the host name verifier for the https connection received.
*
@@ -67,7 +62,7 @@ public final void setHostnameVerifier(final HostnameVerifier verifier) {
public HttpURLConnection buildHttpURLConnection(final URLConnection url) {
return this.configureHttpsConnectionIfNeeded(url);
}
-
+
/**
* Configures the connection with specific settings for secure http connections
* If the connection instance is not a {@link HttpsURLConnection},
@@ -81,7 +76,7 @@ private HttpURLConnection configureHttpsConnectionIfNeeded(final URLConnection c
final SSLSocketFactory socketFactory = this.createSSLSocketFactory();
if (socketFactory != null) {
httpsConnection.setSSLSocketFactory(socketFactory);
- }
+ }
if (this.hostnameVerifier != null) {
httpsConnection.setHostnameVerifier(this.hostnameVerifier);
@@ -89,7 +84,7 @@ private HttpURLConnection configureHttpsConnectionIfNeeded(final URLConnection c
}
return (HttpURLConnection) conn;
}
-
+
/**
* Creates a {@link SSLSocketFactory} based on the configuration specified
*
org.apache.maven.plugins
From 125ee6f633fb1e3244faa5eabe43c9b5068fc8a6 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 19 Jun 2013 23:11:22 -0400
Subject: [PATCH 045/239] Changed default for exceptionOnValidationFailure and
message.
This seems to have some formatting changes in it also for some reason.
---
assembly.xml | 118 +++++++++---------
.../AttributePrincipalImpl.java | 5 +-
.../authentication/AuthenticationFilter.java | 32 +++--
.../AuthenticationRedirectStrategy.java | 2 +-
...DefaultAuthenticationRedirectStrategy.java | 2 +-
...patibleAuthenticationRedirectStrategy.java | 7 +-
...cryptedProxyGrantingTicketStorageImpl.java | 6 +-
...actCasProtocolUrlBasedTicketValidator.java | 3 +-
.../AbstractTicketValidationFilter.java | 9 +-
.../cas/client/validation/Assertion.java | 3 +-
.../cas/client/validation/AssertionImpl.java | 7 +-
.../validation/Cas20ProxyTicketValidator.java | 3 +-
.../Cas20ServiceTicketValidator.java | 9 +-
.../client/validation/ProxyListEditor.java | 3 +-
.../AuthenticationFilterTests.java | 48 +++----
...leAuthenticationRedirectStrategyTests.java | 3 +-
.../cas/client/util/CommonUtilsTests.java | 5 +-
.../client/validation/AssertionImplTests.java | 5 +-
.../Cas10TicketValidationFilterTests.java | 5 +-
.../Saml11TicketValidationFilterTests.java | 5 +-
.../resources/cas20ProxyTicketValidator.xml | 36 +++---
.../Confluence35CasAuthenticator.java | 9 +-
.../atlassian/ConfluenceCasAuthenticator.java | 9 +-
.../atlassian/Jira44CasAuthenticator.java | 9 +-
.../WebAuthenticationFilter.java | 13 +-
.../client/tomcat/AbstractLogoutHandler.java | 7 +-
.../tomcat/AssertionCasRealmDelegate.java | 5 +-
.../client/tomcat/AuthenticatorDelegate.java | 11 +-
.../tomcat/PropertiesCasRealmDelegate.java | 7 +-
.../client/tomcat/RegexUriLogoutHandler.java | 5 +-
.../client/tomcat/StaticUriLogoutHandler.java | 3 +-
.../PropertiesCasRealmDelegateTests.java | 5 +-
.../client/tomcat/v6/AbstractCasRealm.java | 3 +-
.../client/tomcat/v6/SingleSignOutValve.java | 5 +-
.../tomcat/v7/AbstractAuthenticator.java | 7 +-
.../client/tomcat/v7/AbstractCasRealm.java | 3 +-
.../client/tomcat/v7/SingleSignOutValve.java | 5 +-
...dBackedProxyGrantingTicketStorageImpl.java | 3 +-
src/licensing/header-definitions.xml | 18 +--
39 files changed, 229 insertions(+), 214 deletions(-)
diff --git a/assembly.xml b/assembly.xml
index f640d7aae..3bf2928eb 100644
--- a/assembly.xml
+++ b/assembly.xml
@@ -19,66 +19,66 @@
-->
- release
-
- zip
- tar.gz
-
- true
-
-
- unix
- true
- false
- ${basedir}
-
-
- *.xml
- *.txt
-
-
-
-
-
-
-
-
-
- src
- src
- unix
- true
-
+ release
+
+ zip
+ tar.gz
+
+ true
+
+
+ unix
+ true
+ false
+ ${basedir}
+
+
+ *.xml
+ *.txt
+
+
+
+
+
+
+
+
+
+ src
+ src
+ unix
+ true
+
-
- unix
- true
-
- *.xml
-
-
+
+ unix
+ true
+
+ *.xml
+
+
-
- unix
- target/site/apidocs/
- true
- docs
-
- **/*
-
-
-
+
+ unix
+ target/site/apidocs/
+ true
+ docs
+
+ **/*
+
+
+
- true
- true
-
-
- modules
- true
- false
- true
-
-
-
-
+ true
+ true
+
+
+ modules
+ true
+ false
+ true
+
+
+
+
\ No newline at end of file
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
index d4f7d61f1..6e5acbfe7 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
@@ -18,13 +18,14 @@
*/
package org.jasig.cas.client.authentication;
-import java.util.Collections;
-import java.util.Map;
import org.jasig.cas.client.proxy.ProxyRetriever;
import org.jasig.cas.client.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Collections;
+import java.util.Map;
+
/**
* Concrete implementation of the AttributePrincipal interface.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 38d16f478..2e7355655 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -18,21 +18,16 @@
*/
package org.jasig.cas.client.authentication;
+import java.io.IOException;
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
import org.jasig.cas.client.validation.Assertion;
-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;
-
/**
* Filter implementation to intercept all requests and attempt to authenticate
* the user by redirecting them to CAS (unless the user has a ticket).
@@ -66,7 +61,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
* Whether to send the gateway request or not.
*/
private boolean gateway = false;
-
+
private GatewayResolver gatewayStorage = new DefaultGatewayResolverImpl();
private AuthenticationRedirectStrategy authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
@@ -87,7 +82,8 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
this.gatewayStorage = ReflectUtils.newInstance(gatewayStorageClass);
}
- final String authenticationRedirectStrategyClass = getPropertyFromInitParams(filterConfig, "authenticationRedirectStrategyClass", null);
+ final String authenticationRedirectStrategyClass = getPropertyFromInitParams(filterConfig,
+ "authenticationRedirectStrategyClass", null);
if (authenticationRedirectStrategyClass != null) {
this.authenticationRedirectStrategy = ReflectUtils.newInstance(authenticationRedirectStrategyClass);
@@ -100,7 +96,8 @@ public void 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 {
+ 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);
@@ -130,9 +127,10 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
modifiedServiceUrl = serviceUrl;
}
- logger.debug("Constructed service url: {}", modifiedServiceUrl);
+ logger.debug("Constructed service url: {}", modifiedServiceUrl);
- final String urlToRedirectTo = CommonUtils.constructRedirectUrl(this.casServerLoginUrl, getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway);
+ final String urlToRedirectTo = CommonUtils.constructRedirectUrl(this.casServerLoginUrl,
+ getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway);
logger.debug("redirecting to \"{}\"", urlToRedirectTo);
this.authenticationRedirectStrategy.redirect(request, response, urlToRedirectTo);
@@ -149,8 +147,8 @@ public final void setGateway(final boolean gateway) {
public final void setCasServerLoginUrl(final String casServerLoginUrl) {
this.casServerLoginUrl = casServerLoginUrl;
}
-
+
public final void setGatewayStorage(final GatewayResolver gatewayStorage) {
- this.gatewayStorage = gatewayStorage;
+ this.gatewayStorage = gatewayStorage;
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
index 01219b2fe..6c7cb8ee4 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
@@ -1,8 +1,8 @@
package org.jasig.cas.client.authentication;
-import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
/**
* Interface to abstract the authentication strategy for redirecting. The traditional method was to always just redirect,
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
index 994b0bc6b..336cf8db8 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
@@ -1,8 +1,8 @@
package org.jasig.cas.client.authentication;
-import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
/**
* Implementation of the {@link AuthenticationRedirectStrategy} class that preserves the original behavior that existed prior to 3.3.0.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
index 4666bf196..a6d0acca5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
@@ -1,10 +1,11 @@
package org.jasig.cas.client.authentication;
-import java.io.IOException;
-import java.io.PrintWriter;
+import org.jasig.cas.client.util.CommonUtils;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.jasig.cas.client.util.CommonUtils;
+import java.io.IOException;
+import java.io.PrintWriter;
/**
* Implementation of the redirect strategy that can handle a Faces Ajax request in addition to the standard redirect style.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
index 69cc75dcf..81c0c96c5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
@@ -18,13 +18,13 @@
*/
package org.jasig.cas.client.proxy;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESedeKeySpec;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
-import javax.crypto.Cipher;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.DESedeKeySpec;
/**
* Provides encryption capabilities. Not entirely safe to configure since we have no way of controlling the
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
index b5d5c2fac..c19ec9f0f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
@@ -18,9 +18,10 @@
*/
package org.jasig.cas.client.validation;
-import java.net.URL;
import org.jasig.cas.client.util.CommonUtils;
+import java.net.URL;
+
/**
* Abstract class that knows the protocol for validating a CAS ticket.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index f2480d3d5..58f57c462 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -60,7 +60,7 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
private boolean redirectAfterValidation = true;
/** Determines whether an exception is thrown when there is a ticket validation failure. */
- private boolean exceptionOnValidationFailure = true;
+ private boolean exceptionOnValidationFailure = false;
/**
* Specify whether the Assertion should be stored in a session
@@ -126,7 +126,7 @@ protected HostnameVerifier getHostnameVerifier(final FilterConfig filterConfig)
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
setExceptionOnValidationFailure(parseBoolean(getPropertyFromInitParams(filterConfig,
- "exceptionOnValidationFailure", "true")));
+ "exceptionOnValidationFailure", "false")));
logger.trace("Setting exceptionOnValidationFailure parameter: {}", this.exceptionOnValidationFailure);
setRedirectAfterValidation(parseBoolean(getPropertyFromInitParams(filterConfig, "redirectAfterValidation",
"true")));
@@ -221,8 +221,7 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
return;
}
} catch (final TicketValidationException e) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- logger.warn(e.getMessage(), e);
+ logger.debug(e.getMessage(), e);
onFailedValidation(request, response);
@@ -230,7 +229,7 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
throw new ServletException(e);
}
- response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
return;
}
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
index 06d98aa59..1ce9f0b01 100644
--- 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
@@ -18,10 +18,11 @@
*/
package org.jasig.cas.client.validation;
+import org.jasig.cas.client.authentication.AttributePrincipal;
+
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
-import org.jasig.cas.client.authentication.AttributePrincipal;
/**
* Represents a response to a validation request.
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
index 86e286fd7..1ab674fb5 100644
--- 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
@@ -18,13 +18,14 @@
*/
package org.jasig.cas.client.validation;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Map;
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;
+import java.util.Map;
+
/**
* Concrete Implementation of the {@link Assertion}.
*
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
index 592c33049..c10528e33 100644
--- 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
@@ -18,9 +18,10 @@
*/
package org.jasig.cas.client.validation;
-import java.util.List;
import org.jasig.cas.client.util.XmlUtils;
+import java.util.List;
+
/**
* Extension to the traditional Service Ticket validation that will validate service tickets and proxy tickets.
*
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
index 4380348b2..6d10eb751 100644
--- 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
@@ -18,10 +18,6 @@
*/
package org.jasig.cas.client.validation;
-import java.io.StringReader;
-import java.util.*;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
import org.jasig.cas.client.proxy.Cas20ProxyRetriever;
@@ -35,6 +31,11 @@
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.StringReader;
+import java.util.*;
+
/**
* Implementation of the TicketValidator that will validate Service Tickets in compliance with the CAS 2.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
index dd5ce68f4..41920d732 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
@@ -18,13 +18,14 @@
*/
package org.jasig.cas.client.validation;
+import org.jasig.cas.client.util.CommonUtils;
+
import java.beans.PropertyEditorSupport;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
-import org.jasig.cas.client.util.CommonUtils;
/**
* Convert a String-formatted list of acceptable proxies to an array.
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index 2a615ab7e..b9cc6e780 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -18,27 +18,20 @@
*/
package org.jasig.cas.client.authentication;
+import static org.junit.Assert.*;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URLEncoder;
-
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.AssertionImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.springframework.mock.web.MockFilterConfig;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.mock.web.MockHttpSession;
-import org.springframework.mock.web.MockServletContext;
-
-import static org.junit.Assert.*;
+import org.springframework.mock.web.*;
/**
* Tests for the AuthenticationFilter.
@@ -77,8 +70,7 @@ public void testRedirect() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1)
- throws IOException, ServletException {
+ public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
// nothing to do
}
};
@@ -86,9 +78,8 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1)
request.setSession(session);
this.filter.doFilter(request, response, filterChain);
- assertEquals(CAS_LOGIN_URL + "?service="
- + URLEncoder.encode(CAS_SERVICE_URL, "UTF-8"), response
- .getRedirectedUrl());
+ assertEquals(CAS_LOGIN_URL + "?service=" + URLEncoder.encode(CAS_SERVICE_URL, "UTF-8"),
+ response.getRedirectedUrl());
}
@Test
@@ -101,8 +92,7 @@ public void testRedirectWithQueryString() throws Exception {
request.setSecure(true);
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1)
- throws IOException, ServletException {
+ public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
// nothing to do
}
};
@@ -117,11 +107,12 @@ public void doFilter(ServletRequest arg0, ServletResponse arg1)
this.filter.doFilter(request, response, filterChain);
- assertEquals(CAS_LOGIN_URL
- + "?service="
- + URLEncoder.encode("https://localhost:8443"
- + request.getRequestURI() + "?" + request.getQueryString(),
- "UTF-8"), response.getRedirectedUrl());
+ assertEquals(
+ CAS_LOGIN_URL
+ + "?service="
+ + URLEncoder.encode(
+ "https://localhost:8443" + request.getRequestURI() + "?" + request.getQueryString(),
+ "UTF-8"), response.getRedirectedUrl());
}
@Test
@@ -131,15 +122,13 @@ public void testAssertion() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1)
- throws IOException, ServletException {
+ public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
// nothing to do
}
};
request.setSession(session);
- session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION,
- new AssertionImpl("test"));
+ session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION, new AssertionImpl("test"));
this.filter.doFilter(request, response, filterChain);
assertNull(response.getRedirectedUrl());
@@ -152,8 +141,7 @@ public void testRenew() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1)
- throws IOException, ServletException {
+ public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
// nothing to do
}
};
@@ -173,8 +161,7 @@ public void testGateway() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1)
- throws IOException, ServletException {
+ public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
// nothing to do
}
};
@@ -226,7 +213,8 @@ public void customRedirectStrategy() throws Exception {
final MockServletContext context = new MockServletContext();
context.addInitParameter("casServerLoginUrl", "https://cas.example.com/login");
context.addInitParameter("service", "https://localhost:8443/service");
- context.addInitParameter("authenticationRedirectStrategyClass", "org.jasig.cas.client.authentication.FacesCompatibleAuthenticationRedirectStrategy");
+ context.addInitParameter("authenticationRedirectStrategyClass",
+ "org.jasig.cas.client.authentication.FacesCompatibleAuthenticationRedirectStrategy");
f.init(new MockFilterConfig(context));
}
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
index 640b8c91a..920cf7fc5 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
@@ -1,11 +1,12 @@
package org.jasig.cas.client.authentication;
-import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
+import static org.junit.Assert.*;
+
public class FacesCompatibleAuthenticationRedirectStrategyTests {
private FacesCompatibleAuthenticationRedirectStrategy strategy;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index 042b2db22..884648795 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -18,12 +18,13 @@
*/
package org.jasig.cas.client.util;
-import java.util.ArrayList;
-import java.util.Collection;
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
+import java.util.ArrayList;
+import java.util.Collection;
+
/**
* Tests for the CommonUtils.
*
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
index de6e8562e..6b555bc36 100644
--- 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
@@ -18,12 +18,13 @@
*/
package org.jasig.cas.client.validation;
-import java.util.HashMap;
-import java.util.Map;
import junit.framework.TestCase;
import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Test cases for the {@link AssertionImpl}.
*
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
index 54afd7ca6..e15e7f2ce 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
@@ -18,12 +18,13 @@
*/
package org.jasig.cas.client.validation;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockServletContext;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
/**
* Unit test for {@link Cas10TicketValidationFilter}.
*
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
index e833deba4..cb64c6310 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
@@ -18,12 +18,13 @@
*/
package org.jasig.cas.client.validation;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockServletContext;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
/**
* Unit test for {@link Saml11TicketValidationFilter}.
*
diff --git a/cas-client-core/src/test/resources/cas20ProxyTicketValidator.xml b/cas-client-core/src/test/resources/cas20ProxyTicketValidator.xml
index 3a069da21..579ecba6e 100644
--- a/cas-client-core/src/test/resources/cas20ProxyTicketValidator.xml
+++ b/cas-client-core/src/test/resources/cas20ProxyTicketValidator.xml
@@ -23,23 +23,23 @@
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
-
-
-
-
- test test2 test3 test4 test5
- mytest mytest1 mytest2 mytest3
- proxy1 proxy2 proxy3
-
-
-
-
+
+
+
+
+ test test2 test3 test4 test5
+ mytest mytest1 mytest2 mytest3
+ proxy1 proxy2 proxy3
+
+
+
+
+
+
+
+
-
-
-
-
\ No newline at end of file
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
index 0740121bd..a006c81aa 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
@@ -23,15 +23,16 @@
import com.atlassian.confluence.user.ConfluenceAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
import com.atlassian.seraph.auth.LoginReason;
-import java.security.Principal;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.security.Principal;
+
/**
* Extension of ConfluenceAuthenticator to allow people to configure Confluence 3.5+ to authenticate
* via CAS.
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
index a705ede56..96cb20f91 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
@@ -20,15 +20,16 @@
import com.atlassian.confluence.user.ConfluenceAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
-import java.security.Principal;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.security.Principal;
+
/**
* Extension of ConfluenceAuthenticator to allow people to configure Confluence to authenticate
* via CAS.
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
index 999dc8f5f..823a109cf 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
@@ -21,15 +21,16 @@
import com.atlassian.jira.security.login.JiraSeraphAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
import com.atlassian.seraph.auth.LoginReason;
-import java.security.Principal;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.security.Principal;
+
/**
* Extension of JiraSeraphAuthenticator to allow people to configure
* JIRA 4.4 and above to authenticate via Jasig CAS
diff --git a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
index cb4c45a2b..b78825b8c 100644
--- a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
+++ b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
@@ -18,8 +18,11 @@
*/
package org.jasig.cas.client.jboss.authentication;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
+import org.jasig.cas.client.jaas.AssertionPrincipal;
+import org.jasig.cas.client.util.AbstractCasFilter;
+import org.jasig.cas.client.util.CommonUtils;
+import org.jboss.web.tomcat.security.login.WebAuthentication;
+
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
@@ -27,10 +30,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.jasig.cas.client.jaas.AssertionPrincipal;
-import org.jasig.cas.client.util.AbstractCasFilter;
-import org.jasig.cas.client.util.CommonUtils;
-import org.jboss.web.tomcat.security.login.WebAuthentication;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
/**
* This servlet filter performs a programmatic JAAS login using the JBoss
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
index 37af2182a..955b5c764 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
@@ -18,15 +18,16 @@
*/
package org.jasig.cas.client.tomcat;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
/**
* Base class for all logout handlers.
*
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
index f2cce310f..0f35f5d44 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
@@ -18,12 +18,13 @@
*/
package org.jasig.cas.client.tomcat;
+import org.jasig.cas.client.authentication.AttributePrincipal;
+import org.jasig.cas.client.util.CommonUtils;
+
import java.security.Principal;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import org.jasig.cas.client.authentication.AttributePrincipal;
-import org.jasig.cas.client.util.CommonUtils;
/**
* {@link CasRealm} implementation with prinicpal and role data backed by the {@link org.jasig.cas.client.validation.Assertion}.
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
index 3f92d32e5..77b30793b 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
@@ -18,11 +18,6 @@
*/
package org.jasig.cas.client.tomcat;
-import java.io.IOException;
-import java.security.Principal;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.Assertion;
@@ -31,6 +26,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.security.Principal;
+
/**
* Version-agnostic authenticator which encapsulates the core CAS workflow of
* redirecting to CAS for unauthenticated sessions and validating service tickets
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
index dab417dc7..3e0208a44 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
@@ -18,15 +18,16 @@
*/
package org.jasig.cas.client.tomcat;
+import org.jasig.cas.client.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.Principal;
import java.util.*;
-import org.jasig.cas.client.util.CommonUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* {@link CasRealm} implementation with users and roles defined by a properties
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
index f4a33b181..2cbf7ad94 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
@@ -18,10 +18,11 @@
*/
package org.jasig.cas.client.tomcat;
-import java.util.regex.Pattern;
-import javax.servlet.http.HttpServletRequest;
import org.jasig.cas.client.util.CommonUtils;
+import javax.servlet.http.HttpServletRequest;
+import java.util.regex.Pattern;
+
/**
* Performs CAS logout when the request URI matches a regular expression.
*
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
index 8f2a0f323..877441efe 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
@@ -18,9 +18,10 @@
*/
package org.jasig.cas.client.tomcat;
-import javax.servlet.http.HttpServletRequest;
import org.jasig.cas.client.util.CommonUtils;
+import javax.servlet.http.HttpServletRequest;
+
/**
* Performs CAS logout when the request URI matches a fixed context-relative
* URI.
diff --git a/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java b/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
index 9f0ae2dc2..219a4be4e 100644
--- a/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
+++ b/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
@@ -18,11 +18,12 @@
*/
package org.jasig.cas.client.tomcat;
+import junit.framework.TestCase;
+import org.jasig.cas.client.authentication.AttributePrincipalImpl;
+
import java.security.Principal;
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
-import org.jasig.cas.client.authentication.AttributePrincipalImpl;
/**
* Unit test for {@link PropertiesCasRealmDelegate} class.
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
index 083db69b2..355a44305 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
@@ -18,12 +18,13 @@
*/
package org.jasig.cas.client.tomcat.v6;
-import java.security.Principal;
import org.apache.catalina.realm.RealmBase;
import org.jasig.cas.client.tomcat.CasRealm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.security.Principal;
+
/**
* Base Realm implementation for all CAS realms.
*
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
index 1d95f43c3..1fd174814 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
@@ -18,8 +18,6 @@
*/
package org.jasig.cas.client.tomcat.v6;
-import java.io.IOException;
-import javax.servlet.ServletException;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Session;
import org.apache.catalina.SessionEvent;
@@ -29,6 +27,9 @@
import org.jasig.cas.client.session.SessionMappingStorage;
import org.jasig.cas.client.session.SingleSignOutHandler;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
/**
* Handles logout request messages sent from the CAS server by ending the current
* HTTP session.
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
index 96a56c888..2bd0d7ce2 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
@@ -18,9 +18,6 @@
*/
package org.jasig.cas.client.tomcat.v7;
-import java.io.IOException;
-import java.security.Principal;
-import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.*;
import org.apache.catalina.authenticator.AuthenticatorBase;
import org.apache.catalina.connector.Request;
@@ -32,6 +29,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.security.Principal;
+
/**
* Base authenticator for all authentication protocols supported by CAS.
*
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
index 3ffd729be..4f6c354f5 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
@@ -18,11 +18,12 @@
*/
package org.jasig.cas.client.tomcat.v7;
-import java.security.Principal;
import org.apache.catalina.Wrapper;
import org.apache.catalina.realm.RealmBase;
import org.jasig.cas.client.tomcat.CasRealm;
+import java.security.Principal;
+
/**
* Base Realm implementation for all CAS realms.
*
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
index c1bee5b10..8a18ac886 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
@@ -18,8 +18,6 @@
*/
package org.jasig.cas.client.tomcat.v7;
-import java.io.IOException;
-import javax.servlet.ServletException;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Session;
import org.apache.catalina.SessionEvent;
@@ -32,6 +30,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
/**
* Handles logout request messages sent from the CAS server by ending the current
* HTTP session.
diff --git a/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java b/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
index d77217266..190017db8 100644
--- a/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
@@ -18,6 +18,8 @@
*/
package org.jasig.cas.client.proxy;
+import net.spy.memcached.MemcachedClient;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -26,7 +28,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
-import net.spy.memcached.MemcachedClient;
/**
* Implementation of the {@link org.jasig.cas.client.proxy.ProxyGrantingTicketStorage} interface that is backed by
diff --git a/src/licensing/header-definitions.xml b/src/licensing/header-definitions.xml
index 39fb559bc..2792dcee7 100644
--- a/src/licensing/header-definitions.xml
+++ b/src/licensing/header-definitions.xml
@@ -1,12 +1,12 @@
-
- /*
- *
- */
- ( |\t)*/\*( |\t)*$
- ( |\t)*\*/( |\t)*$
- true
- true
-
+
+ /*
+ *
+ */
+ ( |\t)*/\*( |\t)*$
+ ( |\t)*\*/( |\t)*$
+ true
+ true
+
\ No newline at end of file
From 99494fe0b7244d94c3085b34f35d2d7fa1d2a0f1 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 19 Jun 2013 23:16:17 -0400
Subject: [PATCH 046/239] Fixed formatting again.
---
.../authentication/AttributePrincipalImpl.java | 5 ++---
.../AuthenticationRedirectStrategy.java | 2 +-
.../DefaultAuthenticationRedirectStrategy.java | 2 +-
...cesCompatibleAuthenticationRedirectStrategy.java | 7 +++----
...ractEncryptedProxyGrantingTicketStorageImpl.java | 6 +++---
.../AbstractCasProtocolUrlBasedTicketValidator.java | 3 +--
.../org/jasig/cas/client/validation/Assertion.java | 3 +--
.../jasig/cas/client/validation/AssertionImpl.java | 7 +++----
.../validation/Cas20ProxyTicketValidator.java | 3 +--
.../validation/Cas20ServiceTicketValidator.java | 9 ++++-----
.../cas/client/validation/ProxyListEditor.java | 3 +--
...mpatibleAuthenticationRedirectStrategyTests.java | 3 +--
.../org/jasig/cas/client/util/CommonUtilsTests.java | 5 ++---
.../cas/client/validation/AssertionImplTests.java | 5 ++---
.../Cas10TicketValidationFilterTests.java | 5 ++---
.../Saml11TicketValidationFilterTests.java | 5 ++---
.../atlassian/Confluence35CasAuthenticator.java | 9 ++++-----
.../atlassian/ConfluenceCasAuthenticator.java | 9 ++++-----
.../atlassian/Jira44CasAuthenticator.java | 9 ++++-----
.../authentication/WebAuthenticationFilter.java | 13 ++++++-------
.../cas/client/tomcat/AbstractLogoutHandler.java | 7 +++----
.../client/tomcat/AssertionCasRealmDelegate.java | 5 ++---
.../cas/client/tomcat/AuthenticatorDelegate.java | 11 +++++------
.../client/tomcat/PropertiesCasRealmDelegate.java | 7 +++----
.../cas/client/tomcat/RegexUriLogoutHandler.java | 5 ++---
.../cas/client/tomcat/StaticUriLogoutHandler.java | 3 +--
.../tomcat/PropertiesCasRealmDelegateTests.java | 5 ++---
.../cas/client/tomcat/v6/AbstractCasRealm.java | 3 +--
.../cas/client/tomcat/v6/SingleSignOutValve.java | 5 ++---
.../cas/client/tomcat/v7/AbstractAuthenticator.java | 7 +++----
.../cas/client/tomcat/v7/AbstractCasRealm.java | 3 +--
.../cas/client/tomcat/v7/SingleSignOutValve.java | 5 ++---
...mcachedBackedProxyGrantingTicketStorageImpl.java | 3 +--
33 files changed, 76 insertions(+), 106 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
index 6e5acbfe7..d4f7d61f1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AttributePrincipalImpl.java
@@ -18,14 +18,13 @@
*/
package org.jasig.cas.client.authentication;
+import java.util.Collections;
+import java.util.Map;
import org.jasig.cas.client.proxy.ProxyRetriever;
import org.jasig.cas.client.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Collections;
-import java.util.Map;
-
/**
* Concrete implementation of the AttributePrincipal interface.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
index 6c7cb8ee4..01219b2fe 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
@@ -1,8 +1,8 @@
package org.jasig.cas.client.authentication;
+import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
/**
* Interface to abstract the authentication strategy for redirecting. The traditional method was to always just redirect,
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
index 336cf8db8..994b0bc6b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
@@ -1,8 +1,8 @@
package org.jasig.cas.client.authentication;
+import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
/**
* Implementation of the {@link AuthenticationRedirectStrategy} class that preserves the original behavior that existed prior to 3.3.0.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
index a6d0acca5..4666bf196 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
@@ -1,11 +1,10 @@
package org.jasig.cas.client.authentication;
-import org.jasig.cas.client.util.CommonUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Implementation of the redirect strategy that can handle a Faces Ajax request in addition to the standard redirect style.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
index 81c0c96c5..69cc75dcf 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
@@ -18,13 +18,13 @@
*/
package org.jasig.cas.client.proxy;
-import javax.crypto.Cipher;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.DESedeKeySpec;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESedeKeySpec;
/**
* Provides encryption capabilities. Not entirely safe to configure since we have no way of controlling the
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
index c19ec9f0f..b5d5c2fac 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
@@ -18,9 +18,8 @@
*/
package org.jasig.cas.client.validation;
-import org.jasig.cas.client.util.CommonUtils;
-
import java.net.URL;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Abstract class that knows the protocol for validating a CAS ticket.
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
index 1ce9f0b01..06d98aa59 100644
--- 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
@@ -18,11 +18,10 @@
*/
package org.jasig.cas.client.validation;
-import org.jasig.cas.client.authentication.AttributePrincipal;
-
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
+import org.jasig.cas.client.authentication.AttributePrincipal;
/**
* Represents a response to a validation request.
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
index 1ab674fb5..86e286fd7 100644
--- 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
@@ -18,13 +18,12 @@
*/
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;
import java.util.Map;
+import org.jasig.cas.client.authentication.AttributePrincipal;
+import org.jasig.cas.client.authentication.AttributePrincipalImpl;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Concrete Implementation of the {@link Assertion}.
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
index c10528e33..592c33049 100644
--- 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
@@ -18,9 +18,8 @@
*/
package org.jasig.cas.client.validation;
-import org.jasig.cas.client.util.XmlUtils;
-
import java.util.List;
+import org.jasig.cas.client.util.XmlUtils;
/**
* Extension to the traditional Service Ticket validation that will validate service tickets and proxy tickets.
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
index 6d10eb751..4380348b2 100644
--- 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
@@ -18,6 +18,10 @@
*/
package org.jasig.cas.client.validation;
+import java.io.StringReader;
+import java.util.*;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
import org.jasig.cas.client.proxy.Cas20ProxyRetriever;
@@ -31,11 +35,6 @@
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import java.io.StringReader;
-import java.util.*;
-
/**
* Implementation of the TicketValidator that will validate Service Tickets in compliance with the CAS 2.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
index 41920d732..dd5ce68f4 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyListEditor.java
@@ -18,14 +18,13 @@
*/
package org.jasig.cas.client.validation;
-import org.jasig.cas.client.util.CommonUtils;
-
import java.beans.PropertyEditorSupport;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Convert a String-formatted list of acceptable proxies to an array.
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
index 920cf7fc5..640b8c91a 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
@@ -1,12 +1,11 @@
package org.jasig.cas.client.authentication;
+import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-import static org.junit.Assert.*;
-
public class FacesCompatibleAuthenticationRedirectStrategyTests {
private FacesCompatibleAuthenticationRedirectStrategy strategy;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index 884648795..042b2db22 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -18,13 +18,12 @@
*/
package org.jasig.cas.client.util;
+import java.util.ArrayList;
+import java.util.Collection;
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-import java.util.ArrayList;
-import java.util.Collection;
-
/**
* Tests for the CommonUtils.
*
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
index 6b555bc36..de6e8562e 100644
--- 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
@@ -18,13 +18,12 @@
*/
package org.jasig.cas.client.validation;
+import java.util.HashMap;
+import java.util.Map;
import junit.framework.TestCase;
import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* Test cases for the {@link AssertionImpl}.
*
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
index e15e7f2ce..54afd7ca6 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
@@ -18,13 +18,12 @@
*/
package org.jasig.cas.client.validation;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockServletContext;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
/**
* Unit test for {@link Cas10TicketValidationFilter}.
*
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
index cb64c6310..e833deba4 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
@@ -18,13 +18,12 @@
*/
package org.jasig.cas.client.validation;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockServletContext;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
/**
* Unit test for {@link Saml11TicketValidationFilter}.
*
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
index a006c81aa..0740121bd 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Confluence35CasAuthenticator.java
@@ -23,16 +23,15 @@
import com.atlassian.confluence.user.ConfluenceAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
import com.atlassian.seraph.auth.LoginReason;
+import java.security.Principal;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.security.Principal;
-
/**
* Extension of ConfluenceAuthenticator to allow people to configure Confluence 3.5+ to authenticate
* via CAS.
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
index 96cb20f91..a705ede56 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
@@ -20,16 +20,15 @@
import com.atlassian.confluence.user.ConfluenceAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
+import java.security.Principal;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.security.Principal;
-
/**
* Extension of ConfluenceAuthenticator to allow people to configure Confluence to authenticate
* via CAS.
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
index 823a109cf..999dc8f5f 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
@@ -21,16 +21,15 @@
import com.atlassian.jira.security.login.JiraSeraphAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
import com.atlassian.seraph.auth.LoginReason;
+import java.security.Principal;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.security.Principal;
-
/**
* Extension of JiraSeraphAuthenticator to allow people to configure
* JIRA 4.4 and above to authenticate via Jasig CAS
diff --git a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
index b78825b8c..cb4c45a2b 100644
--- a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
+++ b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
@@ -18,11 +18,8 @@
*/
package org.jasig.cas.client.jboss.authentication;
-import org.jasig.cas.client.jaas.AssertionPrincipal;
-import org.jasig.cas.client.util.AbstractCasFilter;
-import org.jasig.cas.client.util.CommonUtils;
-import org.jboss.web.tomcat.security.login.WebAuthentication;
-
+import java.io.IOException;
+import java.security.GeneralSecurityException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
@@ -30,8 +27,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
+import org.jasig.cas.client.jaas.AssertionPrincipal;
+import org.jasig.cas.client.util.AbstractCasFilter;
+import org.jasig.cas.client.util.CommonUtils;
+import org.jboss.web.tomcat.security.login.WebAuthentication;
/**
* This servlet filter performs a programmatic JAAS login using the JBoss
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
index 955b5c764..37af2182a 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AbstractLogoutHandler.java
@@ -18,16 +18,15 @@
*/
package org.jasig.cas.client.tomcat;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
/**
* Base class for all logout handlers.
*
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
index 0f35f5d44..f2cce310f 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AssertionCasRealmDelegate.java
@@ -18,13 +18,12 @@
*/
package org.jasig.cas.client.tomcat;
-import org.jasig.cas.client.authentication.AttributePrincipal;
-import org.jasig.cas.client.util.CommonUtils;
-
import java.security.Principal;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import org.jasig.cas.client.authentication.AttributePrincipal;
+import org.jasig.cas.client.util.CommonUtils;
/**
* {@link CasRealm} implementation with prinicpal and role data backed by the {@link org.jasig.cas.client.validation.Assertion}.
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
index 77b30793b..3f92d32e5 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
@@ -18,6 +18,11 @@
*/
package org.jasig.cas.client.tomcat;
+import java.io.IOException;
+import java.security.Principal;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.Assertion;
@@ -26,12 +31,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.IOException;
-import java.security.Principal;
-
/**
* Version-agnostic authenticator which encapsulates the core CAS workflow of
* redirecting to CAS for unauthenticated sessions and validating service tickets
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
index 3e0208a44..dab417dc7 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegate.java
@@ -18,16 +18,15 @@
*/
package org.jasig.cas.client.tomcat;
-import org.jasig.cas.client.util.CommonUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.Principal;
import java.util.*;
+import org.jasig.cas.client.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* {@link CasRealm} implementation with users and roles defined by a properties
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
index 2cbf7ad94..f4a33b181 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/RegexUriLogoutHandler.java
@@ -18,10 +18,9 @@
*/
package org.jasig.cas.client.tomcat;
-import org.jasig.cas.client.util.CommonUtils;
-
-import javax.servlet.http.HttpServletRequest;
import java.util.regex.Pattern;
+import javax.servlet.http.HttpServletRequest;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Performs CAS logout when the request URI matches a regular expression.
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
index 877441efe..8f2a0f323 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/StaticUriLogoutHandler.java
@@ -18,9 +18,8 @@
*/
package org.jasig.cas.client.tomcat;
-import org.jasig.cas.client.util.CommonUtils;
-
import javax.servlet.http.HttpServletRequest;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Performs CAS logout when the request URI matches a fixed context-relative
diff --git a/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java b/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
index 219a4be4e..9f0ae2dc2 100644
--- a/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
+++ b/cas-client-integration-tomcat-common/src/test/java/org/jasig/cas/client/tomcat/PropertiesCasRealmDelegateTests.java
@@ -18,12 +18,11 @@
*/
package org.jasig.cas.client.tomcat;
-import junit.framework.TestCase;
-import org.jasig.cas.client.authentication.AttributePrincipalImpl;
-
import java.security.Principal;
import java.util.Arrays;
import java.util.List;
+import junit.framework.TestCase;
+import org.jasig.cas.client.authentication.AttributePrincipalImpl;
/**
* Unit test for {@link PropertiesCasRealmDelegate} class.
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
index 355a44305..083db69b2 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/AbstractCasRealm.java
@@ -18,13 +18,12 @@
*/
package org.jasig.cas.client.tomcat.v6;
+import java.security.Principal;
import org.apache.catalina.realm.RealmBase;
import org.jasig.cas.client.tomcat.CasRealm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.security.Principal;
-
/**
* Base Realm implementation for all CAS realms.
*
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
index 1fd174814..1d95f43c3 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
@@ -18,6 +18,8 @@
*/
package org.jasig.cas.client.tomcat.v6;
+import java.io.IOException;
+import javax.servlet.ServletException;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Session;
import org.apache.catalina.SessionEvent;
@@ -27,9 +29,6 @@
import org.jasig.cas.client.session.SessionMappingStorage;
import org.jasig.cas.client.session.SingleSignOutHandler;
-import javax.servlet.ServletException;
-import java.io.IOException;
-
/**
* Handles logout request messages sent from the CAS server by ending the current
* HTTP session.
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
index 2bd0d7ce2..96a56c888 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractAuthenticator.java
@@ -18,6 +18,9 @@
*/
package org.jasig.cas.client.tomcat.v7;
+import java.io.IOException;
+import java.security.Principal;
+import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.*;
import org.apache.catalina.authenticator.AuthenticatorBase;
import org.apache.catalina.connector.Request;
@@ -29,10 +32,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.security.Principal;
-
/**
* Base authenticator for all authentication protocols supported by CAS.
*
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
index 4f6c354f5..3ffd729be 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/AbstractCasRealm.java
@@ -18,12 +18,11 @@
*/
package org.jasig.cas.client.tomcat.v7;
+import java.security.Principal;
import org.apache.catalina.Wrapper;
import org.apache.catalina.realm.RealmBase;
import org.jasig.cas.client.tomcat.CasRealm;
-import java.security.Principal;
-
/**
* Base Realm implementation for all CAS realms.
*
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
index 8a18ac886..c1bee5b10 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
@@ -18,6 +18,8 @@
*/
package org.jasig.cas.client.tomcat.v7;
+import java.io.IOException;
+import javax.servlet.ServletException;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Session;
import org.apache.catalina.SessionEvent;
@@ -30,9 +32,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.ServletException;
-import java.io.IOException;
-
/**
* Handles logout request messages sent from the CAS server by ending the current
* HTTP session.
diff --git a/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java b/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
index 190017db8..d77217266 100644
--- a/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
@@ -18,8 +18,6 @@
*/
package org.jasig.cas.client.proxy;
-import net.spy.memcached.MemcachedClient;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -28,6 +26,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
+import net.spy.memcached.MemcachedClient;
/**
* Implementation of the {@link org.jasig.cas.client.proxy.ProxyGrantingTicketStorage} interface that is backed by
From 4bcc71fa0db37f71b6819e121f82da28ac80b6a1 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Thu, 20 Jun 2013 00:15:53 -0400
Subject: [PATCH 047/239] Switched to SaxParserFactory directly. Unit tests
pass. CASC-212
---
.../main/java/org/jasig/cas/client/util/XmlUtils.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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
index 05ed7233a..f882b04c6 100644
--- 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
@@ -28,7 +28,8 @@
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.XMLReaderFactory;
+
+import javax.xml.parsers.SAXParserFactory;
/**
* Common utilities for easily parsing XML without duplicating logic.
@@ -51,10 +52,12 @@ public final class XmlUtils {
*/
public static XMLReader getXmlReader() {
try {
- final XMLReader reader = XMLReaderFactory.createXMLReader();
+ final XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
return reader;
- } catch (final SAXException e) {
+ } catch (final Exception e) {
throw new RuntimeException("Unable to create XMLReader", e);
}
}
From 9a4275ee55657a4b2af7759741a31d3c7a8214bd Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Thu, 20 Jun 2013 19:28:35 -0400
Subject: [PATCH 048/239] Renamed arguments
---
.../authentication/AuthenticationFilterTests.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index b9cc6e780..396c5365d 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -70,7 +70,7 @@ public void testRedirect() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
// nothing to do
}
};
@@ -92,7 +92,7 @@ public void testRedirectWithQueryString() throws Exception {
request.setSecure(true);
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
// nothing to do
}
};
@@ -122,7 +122,7 @@ public void testAssertion() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
// nothing to do
}
};
@@ -141,7 +141,7 @@ public void testRenew() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
// nothing to do
}
};
@@ -161,7 +161,7 @@ public void testGateway() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
// nothing to do
}
};
From 3ca44202e7cbfd68756858684a6ef90cadae24b9 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 26 Jun 2013 20:48:55 -0400
Subject: [PATCH 049/239] Latest Jasig pom file
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 9e4b805ff..b14e3f9ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.jasig.parentjasig-parent
- 31
+ 354.0.0org.jasig.cas.client
From 31564c692eb1ba9ee6d9a27b8b4e131680823898 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 1 Aug 2013 14:05:01 -0400
Subject: [PATCH 050/239] CASC-174 Provide facility for Servlet 3.0
programmatic JAAS login.
Servlet3AuthenticationFilter supersede the JBoss-specific
WebAuthenticationFilter for JBoss 7. It should also provide support for
programmatic JAAS login for any container that is Servlet 3.0/JEE6
compliant.
---
.../jaas/Servlet3AuthenticationFilter.java | 90 +++++++++++++++++++
pom.xml | 4 +-
2 files changed, 92 insertions(+), 2 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
new file mode 100644
index 000000000..b2dddf8a6
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.jaas;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+
+import javax.servlet.FilterChain;
+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 org.jasig.cas.client.util.AbstractCasFilter;
+import org.jasig.cas.client.util.CommonUtils;
+
+/**
+ * Servlet filter performs a programmatic JAAS login using the Servlet 3.0 HttpServletRequest#login() facility.
+ * This component should be compatible with any servlet container that supports the Servlet 3.0/JEE6 specification.
+ *
+ * The filter executes when it receives a CAS ticket and expects the
+ * {@link CasLoginModule} JAAS module to perform the CAS
+ * ticket validation in order to produce an {@link org.jasig.cas.client.jaas.AssertionPrincipal} from which
+ * the CAS assertion is obtained and inserted into the session to enable SSO.
+ *
+ * If a service init-param is specified for this filter, it supersedes
+ * the service defined for the {@link CasLoginModule}.
+ *
+ * @author Daniel Fisher
+ * @author Marvin S. Addison
+ * @version $Revision$
+ * @since 3.3
+ */
+public final class Servlet3AuthenticationFilter extends AbstractCasFilter {
+
+ public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
+ final FilterChain chain) throws IOException, ServletException {
+ final HttpServletRequest request = (HttpServletRequest) servletRequest;
+ final HttpServletResponse response = (HttpServletResponse) servletResponse;
+ final HttpSession session = request.getSession();
+ final String ticket = CommonUtils.safeGetParameter(request, getArtifactParameterName());
+
+ if (session != null && session.getAttribute(CONST_CAS_ASSERTION) == null && ticket != null) {
+ try {
+ final String service = constructServiceUrl(request, response);
+ logger.debug("Attempting CAS ticket validation with service={} and ticket={}", service, ticket);
+ request.login(service, ticket);
+ if (request.getUserPrincipal() instanceof AssertionPrincipal) {
+ final AssertionPrincipal principal = (AssertionPrincipal) request.getUserPrincipal();
+ logger.debug("Installing CAS assertion into session.");
+ request.getSession().setAttribute(CONST_CAS_ASSERTION, principal.getAssertion());
+ } else {
+ logger.debug("Aborting -- principal is not of type AssertionPrincipal");
+ throw new GeneralSecurityException(
+ "JBoss Web authentication did not produce CAS AssertionPrincipal.");
+ }
+ } catch (final ServletException e) {
+ logger.debug("JAAS authentication failed.");
+ response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
+ } catch (final GeneralSecurityException e) {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
+ }
+ } else if (session != null && request.getUserPrincipal() == null) {
+ // There is evidence that in some cases the principal can disappear
+ // in JBoss despite a valid session.
+ // This block forces consistency between principal and assertion.
+ logger.info("User principal not found. Removing CAS assertion from session to force re-authentication.");
+ session.removeAttribute(CONST_CAS_ASSERTION);
+ }
+ chain.doFilter(request, response);
+ }
+}
diff --git a/pom.xml b/pom.xml
index b14e3f9ab..363014586 100644
--- a/pom.xml
+++ b/pom.xml
@@ -183,8 +183,8 @@
javax.servlet
- servlet-api
- 2.4
+ javax.servlet-api
+ 3.0.1provided
From 0e3837e7652daa138bddf892ecdcdd17821b72ee Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 1 Aug 2013 14:10:38 -0400
Subject: [PATCH 051/239] CASC-174 Remove JBoss verbiage from error message.
---
.../jasig/cas/client/jaas/Servlet3AuthenticationFilter.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
index b2dddf8a6..dd0b89a4d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
@@ -69,8 +69,7 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
request.getSession().setAttribute(CONST_CAS_ASSERTION, principal.getAssertion());
} else {
logger.debug("Aborting -- principal is not of type AssertionPrincipal");
- throw new GeneralSecurityException(
- "JBoss Web authentication did not produce CAS AssertionPrincipal.");
+ throw new GeneralSecurityException("JAAS authentication did not produce CAS AssertionPrincipal.");
}
} catch (final ServletException e) {
logger.debug("JAAS authentication failed.");
From 8c8db860567e5bfc0c312198674fbabf474832b6 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 15 Aug 2013 11:05:32 -0400
Subject: [PATCH 052/239] CASC-174 Remove @version javadoc tag.
---
.../org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
index dd0b89a4d..d39027e84 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
@@ -46,7 +46,6 @@
*
* @author Daniel Fisher
* @author Marvin S. Addison
- * @version $Revision$
* @since 3.3
*/
public final class Servlet3AuthenticationFilter extends AbstractCasFilter {
From 65bcc5bd1b6756b1f2b53a5171510e2f6c1532a9 Mon Sep 17 00:00:00 2001
From: Hans-Joachim Kliemeck
Date: Sat, 17 Aug 2013 13:45:34 +0200
Subject: [PATCH 053/239] use interface instead of implementation
---
.../proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java b/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
index d77217266..42cd8664b 100644
--- a/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-support-distributed-memcached/src/main/java/org/jasig/cas/client/proxy/MemcachedBackedProxyGrantingTicketStorageImpl.java
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.concurrent.Future;
import net.spy.memcached.MemcachedClient;
+import net.spy.memcached.MemcachedClientIF;
/**
* Implementation of the {@link org.jasig.cas.client.proxy.ProxyGrantingTicketStorage} interface that is backed by
@@ -39,7 +40,7 @@
public final class MemcachedBackedProxyGrantingTicketStorageImpl extends
AbstractEncryptedProxyGrantingTicketStorageImpl {
- private final MemcachedClient client;
+ protected final MemcachedClientIF client;
/**
* Default constructor reads from the /casclient_memcached_hosts.txt in the classpath. Each line should be a host:port
From 24a3f7d4bcdd022ff4d7b0293763ee3ed430e602 Mon Sep 17 00:00:00 2001
From: Hans-Joachim Kliemeck
Date: Sat, 17 Aug 2013 14:19:42 +0200
Subject: [PATCH 054/239] updated memcached version
---
cas-client-support-distributed-memcached/pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index a95478db7..e9bef69eb 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -27,9 +27,9 @@
- spy
+ net.spyspymemcached
- 2.6
+ 2.9.1jarprovided
@@ -46,4 +46,4 @@
-
\ No newline at end of file
+
From a35109982de04d050c95b13ae3dd161821136688 Mon Sep 17 00:00:00 2001
From: Hans-Joachim Kliemeck
Date: Mon, 2 Sep 2013 19:37:46 +0200
Subject: [PATCH 055/239] changed from provided to compile
---
cas-client-support-distributed-memcached/pom.xml | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index e9bef69eb..1227efe6d 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -24,26 +24,11 @@
compilejar
-
-
net.spyspymemcached2.9.1jar
- provided
-
-
-
- spy
- Spy Repository
- default
- http://files.couchbase.com/maven2/
-
- false
-
-
-
From f7343e5cb277114688d9b438fc61c6638119c9aa Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 24 Oct 2013 12:57:25 -0400
Subject: [PATCH 056/239] Remove cached assertions on logout to prevent
credential replay attack.
---
.../jasig/cas/client/jaas/CasLoginModule.java | 8 +++
.../client/session/SingleSignOutHandler.java | 2 +
.../cas/client/jaas/CasLoginModuleTests.java | 60 +++++++++++++------
3 files changed, 53 insertions(+), 17 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
index d181dd97f..c76a58aec 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
@@ -446,6 +446,14 @@ public final boolean logout() throws LoginException {
return false;
}
+ // Remove cache entry if assertion caching is enabled
+ if (this.cacheAssertions) {
+ for (TicketCredential ticket : this.subject.getPrivateCredentials(TicketCredential.class)) {
+ logger.debug("Removing cached assertion for {}", ticket);
+ ASSERTION_CACHE.remove(ticket);
+ }
+ }
+
// Remove all CAS principals
removePrincipalsOfType(AssertionPrincipal.class);
removePrincipalsOfType(SimplePrincipal.class);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index ebd3323e0..fc530e927 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -23,6 +23,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.ReflectUtils;
import org.jasig.cas.client.util.XmlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -172,6 +173,7 @@ public void destroySession(final HttpServletRequest request) {
try {
session.invalidate();
+ // TODO: Add request.logout() upon bump to Servlet 3.0 API dependency
} catch (final IllegalStateException e) {
logger.debug("Error invalidating session.", e);
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/jaas/CasLoginModuleTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/jaas/CasLoginModuleTests.java
index 0952c9e1d..d255f3948 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/jaas/CasLoginModuleTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/jaas/CasLoginModuleTests.java
@@ -28,6 +28,7 @@
import javax.security.auth.login.LoginException;
import org.jasig.cas.client.PublicTestHttpServer;
import org.jasig.cas.client.validation.TicketValidationException;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -84,7 +85,10 @@ public void testLoginSuccess() throws Exception {
+ "";
server.content = RESPONSE.getBytes(server.encoding);
- module.initialize(subject, new ServiceAndTicketCallbackHandler(SERVICE, TICKET), new HashMap(),
+ module.initialize(
+ subject,
+ new ServiceAndTicketCallbackHandler(SERVICE, TICKET),
+ new HashMap(),
options);
module.login();
module.commit();
@@ -105,13 +109,16 @@ public void testLoginFailure() throws Exception {
final String TICKET = "ST-200000-aA5Yuvrxzpv8Tau1cYQ7-srv1";
final String RESPONSE = "Ticket ST-200000-aA5Yuvrxzpv8Tau1cYQ7-srv1 not recognized";
server.content = RESPONSE.getBytes(server.encoding);
- module.initialize(subject, new ServiceAndTicketCallbackHandler(SERVICE, TICKET), new HashMap(),
+ module.initialize(
+ subject,
+ new ServiceAndTicketCallbackHandler(SERVICE, TICKET),
+ new HashMap(),
options);
try {
module.login();
- fail("Login did not throw LoginException as expected.");
- } catch (Exception e) {
- assertTrue(e instanceof LoginException);
+ fail("Login did not throw FailedLoginException as expected.");
+ } catch (LoginException e) {
+ assertEquals(TicketValidationException.class, e.getCause().getClass());
}
module.commit();
assertNull(module.ticket);
@@ -131,7 +138,7 @@ public void testLogout() throws Exception {
}
/**
- * Test assertion cache allows successive logins with same ticket to succeed.
+ * Confirm that CasLoginModule#logout() destroys cached data and prevents subsequent login w/expired ticket.
* @throws Exception On errors.
*/
@Test
@@ -148,24 +155,37 @@ public void testAssertionCaching() throws Exception {
options.put("cacheTimeout", "1");
server.content = SUCCESS_RESPONSE.getBytes(server.encoding);
- module.initialize(subject, new ServiceAndTicketCallbackHandler(SERVICE, TICKET), new HashMap(),
+ module.initialize(
+ subject,
+ new ServiceAndTicketCallbackHandler(SERVICE, TICKET),
+ new HashMap(),
options);
module.login();
module.commit();
assertEquals(this.subject.getPrincipals().size(), 3);
assertEquals(TICKET, this.subject.getPrivateCredentials().iterator().next().toString());
- Thread.sleep(2000);
+ // Logout should destroy all authenticated state data including assertion cache entries
module.logout();
assertEquals(0, subject.getPrincipals().size());
assertEquals(0, subject.getPrivateCredentials().size());
server.content = FAILURE_RESPONSE.getBytes(server.encoding);
- module.initialize(subject, new ServiceAndTicketCallbackHandler(SERVICE, TICKET), new HashMap(),
+
+ // Verify we can't log in again with same ticket
+ module.initialize(
+ subject,
+ new ServiceAndTicketCallbackHandler(SERVICE, TICKET),
+ new HashMap(),
options);
- module.login();
- module.commit();
- assertEquals(this.subject.getPrincipals().size(), 3);
- assertEquals(TICKET, this.subject.getPrivateCredentials().iterator().next().toString());
+ try {
+ module.login();
+ module.commit();
+ Assert.fail("Login should have failed.");
+ } catch (LoginException e) {
+ assertEquals(TicketValidationException.class, e.getCause().getClass());
+ }
+ assertEquals(0, this.subject.getPrincipals().size());
+ assertEquals(0, this.subject.getPrivateCredentials().size());
}
/**
@@ -190,7 +210,10 @@ public void testAssertionCachingExpiration() throws Exception {
options.put("cacheTimeout", "1");
server.content = SUCCESS_RESPONSE.getBytes(server.encoding);
- module.initialize(subject, new ServiceAndTicketCallbackHandler(SERVICE, TICKET), new HashMap(),
+ module.initialize(
+ subject,
+ new ServiceAndTicketCallbackHandler(SERVICE, TICKET),
+ new HashMap(),
options);
assertTrue(module.login());
module.commit();
@@ -198,13 +221,16 @@ public void testAssertionCachingExpiration() throws Exception {
Thread.sleep(1100);
// Assertion should now be expired from cache
server.content = FAILURE_RESPONSE.getBytes(server.encoding);
- module.initialize(subject, new ServiceAndTicketCallbackHandler(SERVICE, TICKET), new HashMap(),
+ module.initialize(
+ subject,
+ new ServiceAndTicketCallbackHandler(SERVICE, TICKET),
+ new HashMap(),
options);
try {
module.login();
- fail("Should have thrown login exception.");
+ fail("Should have thrown FailedLoginException.");
} catch (LoginException e) {
- assertTrue(e.getCause() instanceof TicketValidationException);
+ assertEquals(TicketValidationException.class, e.getCause().getClass());
}
}
From e494ac5cf637c65c7fb25b1cac1dc936467e2136 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 28 Oct 2013 15:58:40 -0400
Subject: [PATCH 057/239] Respond to code review feedback.
1. Call HttpServletRequest#logout() on SLO callback since it is available.
2. Use final for local variables where possible.
---
.../main/java/org/jasig/cas/client/jaas/CasLoginModule.java | 2 +-
.../org/jasig/cas/client/session/SingleSignOutHandler.java | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
index c76a58aec..5deb87e81 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/CasLoginModule.java
@@ -448,7 +448,7 @@ public final boolean logout() throws LoginException {
// Remove cache entry if assertion caching is enabled
if (this.cacheAssertions) {
- for (TicketCredential ticket : this.subject.getPrivateCredentials(TicketCredential.class)) {
+ for (final TicketCredential ticket : this.subject.getPrivateCredentials(TicketCredential.class)) {
logger.debug("Removing cached assertion for {}", ticket);
ASSERTION_CACHE.remove(ticket);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index fc530e927..8434bc4bc 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -20,6 +20,8 @@
import java.util.Arrays;
import java.util.List;
+
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.CommonUtils;
@@ -173,7 +175,9 @@ public void destroySession(final HttpServletRequest request) {
try {
session.invalidate();
- // TODO: Add request.logout() upon bump to Servlet 3.0 API dependency
+ request.logout();
+ } catch (final ServletException e) {
+ logger.debug("Error performing request.logout.");
} catch (final IllegalStateException e) {
logger.debug("Error invalidating session.", e);
}
From 92fbf3fcc0569544e17a270012d8d822899b454a Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 28 Oct 2013 16:07:28 -0400
Subject: [PATCH 058/239] Put HttpServletRequest#logout() in separate try/catch
block.
---
.../org/jasig/cas/client/session/SingleSignOutHandler.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 8434bc4bc..943aa6b07 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -175,11 +175,13 @@ public void destroySession(final HttpServletRequest request) {
try {
session.invalidate();
+ } catch (final IllegalStateException e) {
+ logger.debug("Error invalidating session.", e);
+ }
+ try {
request.logout();
} catch (final ServletException e) {
logger.debug("Error performing request.logout.");
- } catch (final IllegalStateException e) {
- logger.debug("Error invalidating session.", e);
}
}
}
From bd2c35a38fc6c5f1282d13d5842df22ab66ee09e Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 17 Dec 2013 17:35:19 -0500
Subject: [PATCH 059/239] Updated pom.xml file to jasig-parent-36
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 363014586..179dd69c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.jasig.parentjasig-parent
- 35
+ 364.0.0org.jasig.cas.client
From 3e9d604499708ec0583af79874424ea6657e3dba Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 29 Dec 2013 17:17:26 -0500
Subject: [PATCH 060/239] Updated to Jasig Parent POM Version 37 and set up
correct release version.
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 179dd69c8..493c290c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,11 +4,11 @@
org.jasig.parentjasig-parent
- 36
+ 374.0.0org.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOTcas-clientpom
From 5e553c208c15721c2c166b2691cc21338c6ca3f6 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 5 Jan 2014 22:06:46 -0500
Subject: [PATCH 061/239] [maven-release-plugin] rollback the release of v3.3.0
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index ffea8c697..82d369896 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
org.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 74b9821ed..36a314b03 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
org.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index d3f1896b5..be4e72454 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
org.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index bd36974a8..0c7bf94d7 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -5,7 +5,7 @@
cas-clientorg.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 74d5d42d0..640d6c5f6 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -5,7 +5,7 @@
cas-clientorg.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index b319c5a65..2f55fcee9 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -5,7 +5,7 @@
cas-clientorg.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index bfa804fd1..49dc88977 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -5,7 +5,7 @@
cas-clientorg.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 1227efe6d..4dee9fa46 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -5,7 +5,7 @@
cas-clientorg.jasig.cas.client
- 3.3-SNAPSHOT
+ 3.3.0-SNAPSHOT4.0.0
From 2aa95bc6d860a4a3bbb81772cfee21be7c8db8a7 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 5 Jan 2014 22:36:38 -0500
Subject: [PATCH 062/239] Updated pom.xml to the latest jasig-parent pom (38)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 493c290c4..7d5ba3429 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.jasig.parentjasig-parent
- 37
+ 384.0.0org.jasig.cas.client
From f3106ed9a0bcc55a289b0173a70691b9760b582d Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 5 Jan 2014 22:52:15 -0500
Subject: [PATCH 063/239] Correct license header information.
---
pom.xml | 1 +
src/licensing/header-definitions.xml | 18 +++++++++---------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7d5ba3429..d2c3d7507 100644
--- a/pom.xml
+++ b/pom.xml
@@ -142,6 +142,7 @@
maven-license-pluginsrc/licensing/header.txt
+ truesrc/licensing/header-definitions.xml
diff --git a/src/licensing/header-definitions.xml b/src/licensing/header-definitions.xml
index 2792dcee7..39fb559bc 100644
--- a/src/licensing/header-definitions.xml
+++ b/src/licensing/header-definitions.xml
@@ -1,12 +1,12 @@
-
- /*
- *
- */
- ( |\t)*/\*( |\t)*$
- ( |\t)*\*/( |\t)*$
- true
- true
-
+
+ /*
+ *
+ */
+ ( |\t)*/\*( |\t)*$
+ ( |\t)*\*/( |\t)*$
+ true
+ true
+
\ No newline at end of file
From 427c2721e909eb28d700e0e6db79f10be83f2412 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 5 Jan 2014 22:53:17 -0500
Subject: [PATCH 064/239] Added missing license headers
---
.../AuthenticationRedirectStrategy.java | 18 ++++++++++++++++++
.../DefaultAuthenticationRedirectStrategy.java | 18 ++++++++++++++++++
...mpatibleAuthenticationRedirectStrategy.java | 18 ++++++++++++++++++
.../client/ssl/HttpsURLConnectionFactory.java | 18 ++++++++++++++++++
...ultAuthenticationRedirectStrategyTests.java | 18 ++++++++++++++++++
...bleAuthenticationRedirectStrategyTests.java | 18 ++++++++++++++++++
6 files changed, 108 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
index 01219b2fe..006458be5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationRedirectStrategy.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.authentication;
import java.io.IOException;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
index 994b0bc6b..d38daed81 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategy.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.authentication;
import java.io.IOException;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
index 4666bf196..29dce2f70 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategy.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.authentication;
import java.io.IOException;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
index 3b27c0ed2..d0b230874 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.ssl;
import java.io.FileInputStream;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategyTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategyTests.java
index 157ac109a..39c433586 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategyTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/DefaultAuthenticationRedirectStrategyTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.authentication;
import static org.junit.Assert.assertEquals;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
index 640b8c91a..90d148f42 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/FacesCompatibleAuthenticationRedirectStrategyTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.authentication;
import static org.junit.Assert.*;
From cb2957a1e2894acf26ee29868d00ab455fddaf4e Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 5 Jan 2014 23:04:03 -0500
Subject: [PATCH 065/239] Fixed license files
---
.../client/validation/Cas10TicketValidationFilterTests.java | 4 ++--
.../client/validation/Saml11TicketValidationFilterTests.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
index 54afd7ca6..e8daab4e3 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
@@ -6,9 +6,9 @@
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
- * *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- * *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
index e833deba4..804b46faa 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
@@ -6,9 +6,9 @@
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
- * *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- * *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
From c4deb270802efbc446978c82f0de8053e15ad45e Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Mon, 6 Jan 2014 23:51:09 -0500
Subject: [PATCH 066/239] Fixed licensing / exclusions.
---
cas-client-integration-atlassian/pom.xml | 1813 ++++++++++++++++------
cas-client-integration-jboss/pom.xml | 225 ++-
cas-client-integration-tomcat-v6/pom.xml | 16 +-
cas-client-integration-tomcat-v7/pom.xml | 24 +-
4 files changed, 1554 insertions(+), 524 deletions(-)
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 36a314b03..5a7f4614f 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -16,18 +16,37 @@
atlassian-seraphcom.atlassian.seraph
- 2.5.0
+ 2.5.1providedjar
-
- opensymphony
- propertyset
-
-
- true
-
-
+
+ commons-lang
+ commons-lang
+
+
+ log4j
+ log4j
+
+
+ javax.servlet
+ servlet-api
+
+
+ opensymphony
+ oscore
+
+
+ com.atlassian.security
+ atlassian-secure-random
+
+
+ com.atlassian.security
+ atlassian-cookie-tools
+
+
+ true
+
atlassian-osuser
@@ -37,10 +56,36 @@
jartrue
-
- commons-logging
- commons-logging
-
+
+ opensymphony
+ oscore
+
+
+ opensymphony
+ propertyset
+
+
+ commons-logging
+ commons-logging
+
+
+
+ ofbcore
+ ofbcore-jira-entity
+
+
+ ofbcore
+ ofbcore-jira-share
+
+
+ log4j
+ log4j
+
+
+
+ dom4j
+ dom4j
+
@@ -51,479 +96,562 @@
3.5provided
-
- com.atlassian.mail
- atlassian-mail
-
-
- com.atlassian.velocity
- atlassian-velocity
-
-
- com.atlassian.core
- atlassian-core
-
-
- com.atlassian.config
- atlassian-config
-
-
- com.atlassian.spring
- atlassian-spring
-
-
- com.atlassian.event
- atlassian-event
-
-
- com.atlassian.bucket
- atlassian-bucket
-
-
- com.atlassian.profiling
- atlassian-profiling
-
-
- atlassian-trackback
- atlassian-trackback
-
-
- com.atlassian.extras
- atlassian-extras
-
-
- com.atlassian.johnson
- atlassian-johnson
-
-
- atlassian-cache-servlet
- atlassian-cache-servlet
-
-
- com.atlassian.plugins
- atlassian-plugins
-
-
- atlassian-bandana
- atlassian-bandana
-
-
- atlassian-gregory
- atlassian-gregory
-
-
- com.atlassian.user
- atlassian-user
-
-
- com.atlassian.renderer
- atlassian-renderer
-
-
- com.atlassian.bonnie
- atlassian-bonnie
-
-
- joda-time
- joda-time
-
-
- backport-util-concurrent
- backport-util-concurrent
-
-
- com.atlassian.seraph
- atlassian-seraph
-
-
- javax.activation
- activation
-
-
- log4j
- log4j
-
-
- commons-lang
- commons-lang
-
-
- commons-io
- commons-io
-
-
- commons-beanutils
- commons-beanutils
-
-
- dwr
- dwr
-
-
- hibernate
- hibernate
-
-
- cglib
- cglib
-
-
- dom4j
- dom4j
-
-
- odmg
- odmg
-
-
- c3p0
- c3p0
-
-
- ant
- ant
-
-
- jta
- jta
-
-
- opensymphony
- webwork
-
-
- opensymphony
- xwork
-
-
- ognl
- ognl
-
-
- opensymphony
- oscore
-
-
- oscache
- oscache
-
-
- osuser
- osuser
-
-
- propertyset
- propertyset
-
-
- velocity
- velocity
-
-
- javax.servlet
- servlet-api
-
-
- aspectj
- aspectjweaver
-
-
- ldaptemplate
- ldaptemplate
-
-
- opensymphony
- sitemesh
-
-
-
- velocity-tools
- velocity-tools
-
-
- radeox
- radeox
-
-
- jython
- jython
-
-
- lucene
- lucene-core
-
-
- lucene
- lucene-analyzers
-
-
- commons-digester
- commons-digester
-
-
- tm-extractors
- tm-extractors
-
-
- pdfbox
- pdfbox
-
-
- bouncycastle
- bcprov-jdk14
-
-
- FontBox
- FontBox
-
-
- poi
- poi
-
-
- fop
- fop
-
-
- xmlgraphics-commons
- xmlgraphics-commons
-
-
- batik
- batik-all
-
-
- avalon-framework
- avalon-framework
-
-
- com.sun
- jai_core
-
-
- com.sun
- jai_codec
-
-
- css2parser
- ss_css2
-
-
- saxon
- saxon
-
-
- org.hibernate
- jtidy
-
-
- quartz
- quartz
-
-
- hsqldb
- hsqldb
-
-
- mockobjects
- mockobjects-core
-
-
- mockobjects
- mockobjects
-
-
- alt
- alt-0.07
-
-
- alt
- alt
-
-
- exml
- exml
-
-
- rome
- rome
-
-
- jdom
- jdom
-
-
- commons-jrcs
- commons-jrcs
-
-
- commons-httpclient
- commons-httpclient
-
-
- httpunit
- httpunit
-
-
- nekohtml
- nekohtml
-
-
- xerces
- xercesImpl
-
-
- xerces
- xmlParserAPIs
-
-
- xmlrpc
- xmlrpc
-
-
- glue
- glue
-
-
- axis
- axis
-
-
- axis
- axis-jaxrpc
-
-
- axis
- axis-saaj
-
-
- commons-discovery
- commons-discovery
-
-
- commons-codec
- commons-codec
-
-
- oro
- oro
-
-
- slide
- slide
-
-
- xstream
- xstream
-
-
- xpp3
- xpp3
-
-
- concurrent
- concurrent
-
-
- bsf
- bsf
-
-
- jfree
- jfreechart
-
-
- xalan
- xalan
-
-
- jcaptcha
- jcaptcha
-
-
- tangosol-coherence
- tangosol
-
-
- tangosol-coherence
- coherence
-
-
- net.sourceforge.jtds
- jtds
-
-
- net.java.dev.urlrewrite
- urlrewrite
-
-
- commons-collections
- commons-collections
-
-
- net.sf.ehcache
- ehcache
-
-
- stax
- stax-api
-
-
- woodstox
- wstx-asl
-
-
- org.codehaus.xfire
- xfire-all
-
-
- junit
- junit
-
-
- org.springframework
- spring-aop
-
-
- org.springframework
- spring-core
-
-
- org.springframework
- spring-web
-
-
- org.springframework
- spring-beans
-
-
- org.springframework
- spring-context
-
-
- org.springframework
- spring-support
-
-
- aopalliance
- aopalliance
-
-
- spring
- spring-aopalliance
-
-
- pell
- pell
-
-
- bouncycastle
- bcprov-jdk14
-
-
- commons-logging
- commons-logging
-
+
+ opensymphony
+ webwork
+
+
+ com.atlassian.crowd
+ embedded-crowd-api
+
+
+ com.atlassian.crowd
+ crowd-integration-api
+
+
+ com.atlassian.crowd
+ crowd-integration-seraph22
+
+
+ com.atlassian.crowd
+ embedded-crowd-spi
+
+
+ com.atlassian.crowd
+ crowd-password-encoders
+
+
+ com.atlassian.crowd
+ atlassian-embedded-crowd-atlassian-user
+
+
+ com.atlassian.crowd
+ atlassian-embedded-crowd-hibernate2
+
+
+ com.atlassian.crowd
+ embedded-crowd-core
+
+
+ com.atlassian.crowd
+ crowd-persistence
+
+
+ com.atlassian.crowd
+ crowd-ldap
+
+
+ org.springframework.ldap
+ spring-ldap-core
+
+
+ com.atlassian.confluence
+ confluence-upgrade
+
+
+ com.atlassian.gzipfilter
+ atlassian-gzipfilter
+
+
+ com.atlassian.applinks
+ applinks-api
+
+
+ com.atlassian.applinks
+ applinks-spi
+
+
+ com.atlassian.applinks
+ applinks-host
+
+
+ com.atlassian.util.concurrent
+ atlassian-util-concurrent
+
+
+ com.atlassian.modzdetector
+ modz-detector
+
+
+ com.atlassian.mail
+ atlassian-mail
+
+
+ com.atlassian.velocity
+ atlassian-velocity
+
+
+ com.atlassian.core
+ atlassian-core
+
+
+ com.atlassian.config
+ atlassian-config
+
+
+ com.atlassian.spring
+ atlassian-spring
+
+
+ com.atlassian.event
+ atlassian-event
+
+
+ com.atlassian.confluence
+ confluence-bucket
+
+
+ com.atlassian.xwork
+ atlassian-xwork-10
+
+
+ com.atlassian.xwork
+ atlassian-xwork-core
+
+
+ com.atlassian.profiling
+ atlassian-profiling
+
+
+ com.atlassian.trackback
+ atlassian-trackback
+
+
+ com.atlassian.extras
+ atlassian-extras
+
+
+ com.atlassian.johnson
+ atlassian-johnson
+
+
+ com.atlassian.plugins
+ atlassian-plugins-core
+
+
+ com.atlassian.plugins
+ atlassian-plugins-servlet
+
+
+ com.atlassian.plugins
+ atlassian-plugins-webfragment
+
+
+ com.atlassian.plugins
+ atlassian-plugins-webresource
+
+
+ com.atlassian.plugins
+ atlassian-plugins-osgi
+
+
+ com.atlassian.plugins
+ atlassian-plugins-spring
+
+
+ com.atlassian.bandana
+ atlassian-bandana
+
+
+ com.atlassian.user
+ atlassian-user
+
+
+ com.atlassian.renderer
+ atlassian-renderer
+
+
+ com.atlassian.bonnie
+ atlassian-bonnie
+
+
+ com.atlassian.jdk.utilities
+ atlassian-jdk-utilities
+
+
+ joda-time
+ joda-time
+
+
+ com.atlassian.seraph
+ atlassian-seraph
+
+
+ com.atlassian.security.auth.trustedapps
+ atlassian-trusted-apps-core
+
+
+ com.atlassian.security.auth.trustedapps
+ atlassian-trusted-apps-seraph-integration
+
+
+ javax.activation
+ activation
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ org.slf4j
+ jul-to-slf4j
+
+
+ commons-lang
+ commons-lang
+
+
+ commons-logging
+ commons-logging
+
+
+ commons-io
+ commons-io
+
+
+ commons-beanutils
+ commons-beanutils
+
+
+ commons-fileupload
+ commons-fileupload
+
+
+ org.directwebremoting
+ dwr
+
+
+ hibernate
+ hibernate
+
+
+ cglib
+ cglib
+
+
+ dom4j
+ dom4j
+
+
+ odmg
+ odmg
+
+
+ c3p0
+ c3p0
+
+
+ javax.transaction
+ jta
+
+
+ javax.media
+ jai-core
+
+
+ com.sun
+ jai_codec
+
+
+ opensymphony
+ webwork
+
+
+ opensymphony
+ xwork
+
+
+ ognl
+ ognl
+
+
+ opensymphony
+ oscore
+
+
+ oscache
+ oscache
+
+
+ osuser
+ osuser
+
+
+ opensymphony
+ propertyset
+
+
+ org.apache.velocity
+ velocity
+
+
+ javax.servlet
+ servlet-api
+
+
+ javax.mail
+ mail
+
+
+ org.springframework
+ spring-core
+
+
+ org.springframework
+ spring-web
+
+
+ org.springframework
+ spring-support
+
+
+ org.springframework
+ spring-aop
+
+
+ org.springframework
+ spring-hibernate2
+
+
+ org.springframework
+ spring-beans
+
+
+ org.springframework
+ spring-jdbc
+
+
+ org.springframework
+ spring-context
+
+
+ org.springframework
+ spring-dao
+
+
+ org.springframework
+ spring-jmx
+
+
+ com.atlassian.paddle
+ atlassian-paddle
+
+
+ org.aspectj
+ aspectjweaver
+
+
+ net.sf.ldaptemplate
+ ldaptemplate
+
+
+ opensymphony
+ sitemesh
+
+
+ velocity-tools
+ velocity-tools
+
+
+ radeox
+ radeox
+
+
+ org.apache.lucene
+ lucene-core
+
+
+ org.apache.lucene
+ lucene-analyzers
+
+
+ org.apache.lucene
+ lucene-misc
+
+
+ org.apache.lucene
+ lucene-highlighter
+
+
+ commons-digester
+ commons-digester
+
+
+ batik
+ batik-all
+
+
+ net.sourceforge.cssparser
+ cssparser
+
+
+ org.hibernate
+ jtidy
+
+
+ org.quartz-scheduler
+ quartz
+
+
+ org.hsqldb
+ hsqldb
+
+
+ mockobjects
+ mockobjects-core
+
+
+ org.mockito
+ mockito-all
+
+
+ org.springframework
+ spring-mock
+
+
+ rome
+ rome
+
+
+ jdom
+ jdom
+
+
+ commons-jrcs
+ commons-jrcs
+
+
+ commons-httpclient
+ commons-httpclient
+
+
+ xerces
+ xercesImpl
+
+
+ xmlrpc
+ xmlrpc
+
+
+ glue
+ glue
+
+
+ exml
+ exml
+
+
+ axis
+ axis
+
+
+ axis
+ axis-jaxrpc
+
+
+ axis
+ axis-saaj
+
+
+ commons-discovery
+ commons-discovery
+
+
+ commons-codec
+ commons-codec
+
+
+ oro
+ oro
+
+
+ slide
+ slide
+
+
+ com.thoughtworks.xstream
+ xstream
+
+
+ jfree
+ jfreechart
+
+
+ xalan
+ xalan
+
+
+ com.octo.captcha
+ jcaptcha-all
+
+
+ net.java.dev.urlrewrite
+ urlrewrite
+
+
+ commons-collections
+ commons-collections
+
+
+ javax.xml.stream
+ stax-api
+
+
+ org.codehaus.woodstox
+ wstx-asl
+
+
+ org.codehaus.xfire
+ xfire-core
+
+
+ org.codehaus.xfire
+ xfire-aegis
+
+
+ net.jcip
+ jcip-annotations
+
+
+ com.atlassian.cache
+ atlassian-cache-api
+
+
+ com.atlassian.sal
+ sal-spi
+
+
+ com.atlassian.sal
+ sal-spring
+
+
+ com.atlassian.sal
+ sal-api
+
+
+ com.atlassian.cache
+ atlassian-cache-memory
+
+
+ net.sourceforge.findbugs
+ jsr305
+
+
+ opensymphony
+ pell-multipart
+
+
+ ch.qos.logback
+ logback-classic
+
@@ -534,18 +662,707 @@
providedjar
-
- jta
- jta
-
-
- jndi
- jndi
-
-
- commons-logging
- commons-logging
-
+
+ com.atlassian.jira
+ jira-api
+
+
+ com.atlassian.multitenant
+ multitenant-core
+
+
+ com.atlassian.multitenant
+ multitenant-utils
+
+
+ com.atlassian.crowd
+ atlassian-embedded-crowd-ofbiz
+
+
+ com.atlassian.crowd
+ embedded-crowd-core
+
+
+ com.atlassian.crowd
+ embedded-crowd-spi
+
+
+ com.atlassian.crowd
+ crowd-api
+
+
+ com.atlassian.crowd
+ crowd-core
+
+
+ com.atlassian.crowd
+ crowd-integration-api
+
+
+ com.atlassian.crowd
+ crowd-integration-client-rest
+
+
+ com.atlassian.crowd
+ crowd-persistence
+
+
+ com.atlassian.crowd
+ crowd-events
+
+
+ com.atlassian.crowd
+ crowd-ldap
+
+
+ com.atlassian.crowd
+ crowd-remote
+
+
+ com.atlassian.crowd
+ crowd-server-common
+
+
+ com.atlassian.crowd
+ crowd-password-encoders
+
+
+ com.atlassian.security
+ atlassian-password-encoder
+
+
+ org.springframework.security
+ spring-security-core
+
+
+ org.springframework
+ spring-core
+
+
+ org.springframework
+ spring-beans
+
+
+ org.springframework.ldap
+ spring-ldap-core
+
+
+ org.springframework
+ spring-tx
+
+
+ com.atlassian.crowd
+ crowd-integration-client
+
+
+ wsdl4j
+ wsdl4j
+
+
+ org.codehaus.xfire
+ xfire-core
+
+
+ org.codehaus.xfire
+ xfire-aegis
+
+
+ sal-spi
+ com.atlassian.sal
+
+
+ com.atlassian.sal
+ sal-core
+
+
+ com.atlassian.gadgets
+ atlassian-gadgets-api
+
+
+ com.atlassian.gadgets
+ atlassian-gadgets-spi
+
+
+ com.atlassian.oauth
+ atlassian-oauth-api
+
+
+ com.atlassian.p4package
+ atlassian-p4package
+
+
+ com.atlassian.extras
+ atlassian-extras
+
+
+ com.atlassian.cache
+ atlassian-cache-api
+
+
+ com.atlassian.cache
+ atlassian-cache-memory
+
+
+ joda-time
+ joda-time
+
+
+ com.sun
+ jai_core
+
+
+ com.sun
+ jai_codec
+
+
+ commons-lang
+ commons-lang
+
+
+ commons-collections
+ commons-collections
+
+
+ commons-io
+ commons-io
+
+
+ com.atlassian.activeobjects
+ activeobjects-spi
+
+
+ log4j
+ log4j
+
+
+ dom4j
+ dom4j
+
+
+ oro
+ oro
+
+
+ com.atlassian.util.concurrent
+ atlassian-util-concurrent
+
+
+ com.atlassian.profiling
+ atlassian-profiling
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ org.slf4j
+ jul-to-slf4j
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+ com.atlassian.jdk.utilities
+ atlassian-jdk-utilities
+
+
+ com.atlassian.scheduler
+ atlassian-scheduler
+
+
+ com.atlassian.johnson
+ atlassian-johnson
+
+
+ com.atlassian.plugins
+ atlassian-plugins-core
+
+
+ com.atlassian.plugins
+ atlassian-plugins-servlet
+
+
+ com.atlassian.plugins
+ atlassian-plugins-webfragment
+
+
+ com.atlassian.plugins
+ atlassian-plugins-webresource
+
+
+ com.atlassian.plugins
+ atlassian-plugins-osgi
+
+
+ com.atlassian.plugins
+ atlassian-plugins-osgi-events
+
+
+ com.atlassian.seraph
+ atlassian-seraph
+
+
+ com.atlassian.security
+ atlassian-secure-random
+
+
+ com.atlassian.security.auth.trustedapps
+ atlassian-trusted-apps-core
+
+
+ com.atlassian.security.auth.trustedapps
+ atlassian-trusted-apps-seraph-integration
+
+
+ bouncycastle
+ bcprov-jdk15
+
+
+ com.atlassian.renderer
+ atlassian-renderer
+
+
+ com.atlassian.gzipfilter
+ atlassian-gzipfilter
+
+
+ com.atlassian.event
+ atlassian-event
+
+
+ opensymphony
+ oscore
+
+
+ opensymphony
+ sitemesh
+
+
+ commons-digester
+ commons-digester
+
+
+ commons-beanutils
+ commons-beanutils
+
+
+ commons-configuration
+ commons-configuration
+
+
+ org.apache.lucene
+ lucene-analyzers
+
+
+ velocity
+ velocity
+
+
+ org.apache.velocity
+ velocity-tools
+
+
+ javax.activation
+ activation
+
+
+ javax.mail
+ mail
+
+
+ glue
+ glue
+
+
+ bsf
+ bsf
+
+
+ bsh
+ bsh
+
+
+ com.atlassian.ofbiz
+ entityengine-share
+
+
+ com.atlassian.ofbiz
+ entityengine
+
+
+ csv
+ csv
+
+
+ quartz
+ quartz
+
+
+ picocontainer
+ picocontainer
+
+
+ jzlib
+ jzlib
+
+
+ jsch
+ jsch
+
+
+ com.octo.captcha
+ jcaptcha
+
+
+ com.octo.captcha
+ jcaptcha-api
+
+
+ com.jhlabs
+ filters
+
+
+ javacvs
+ javacvs
+
+
+ statcvs
+ statcvs
+
+
+ commons-dbcp
+ commons-dbcp
+
+
+ commons-pool
+ commons-pool
+
+
+ hsqldb
+ hsqldb
+
+
+ jndi
+ jndi
+
+
+ jta
+ jta
+
+
+ ots-jts
+ ots-jts
+
+
+ jotm
+ jotm
+
+
+ jotm
+ jotm-jrmp_stubs
+
+
+ jotm
+ jotm-iiop_stubs
+
+
+ jotm
+ jonas_timer
+
+
+ jotm
+ objectweb-datasource
+
+
+ carol
+ carol
+
+
+ carol
+ carol-properties
+
+
+ xapool
+ xapool
+
+
+ xml-apis
+ xml-apis
+
+
+ saxon
+ saxon-noaelfred
+
+
+ commons-jelly
+ commons-jelly
+
+
+ commons-jelly
+ commons-jelly-tags-junit
+
+
+ commons-jelly
+ commons-jelly-tags-util
+
+
+ commons-jelly
+ commons-jelly-tags-email
+
+
+ commons-jelly
+ commons-jelly-tags-log
+
+
+ commons-jelly
+ commons-jelly-tags-http
+
+
+ commons-jelly
+ commons-jelly-tags-soap
+
+
+ commons-jelly
+ commons-jelly-tags-sql
+
+
+ commons-jelly
+ commons-jelly-tags-regexp
+
+
+ commons-jexl
+ commons-jexl
+
+
+ commons-httpclient
+ commons-httpclient
+
+
+ commons-codec
+ commons-codec
+
+
+ xmlrpc
+ xmlrpc
+
+
+ axis
+ axis
+
+
+ axis
+ axis-jaxrpc
+
+
+ axis
+ axis-saaj
+
+
+ commons-discovery
+ commons-discovery
+
+
+ xerces
+ xercesImpl
+
+
+ xalan
+ xalan
+
+
+ xml-security
+ xmlsec
+
+
+ datafile
+ datafile
+
+
+ xpp3
+ xpp3
+
+
+ com.thoughtworks.xstream
+ xstream
+
+
+ jfree
+ jfreechart
+
+
+ jfree
+ jcommon
+
+
+ net.java.dev.urlrewrite
+ urlrewrite
+
+
+ radeox
+ radeox
+
+
+ jtidy
+ jtidy
+
+
+ jdom
+ jdom
+
+
+ net.sf.ehcache
+ ehcache
+
+
+ org.codehaus.woodstox
+ wstx-asl
+
+
+ javax.servlet
+ servlet-api
+
+
+ javax.servlet
+ jsp-api
+
+
+ com.atlassian.modzdetector
+ modz-detector
+
+
+ org.antlr
+ antlr-runtime
+
+
+ commons-jrcs
+ commons-jrcs
+
+
+ com.google.collections
+ google-collections
+
+
+ com.atlassian.jira
+ jira-lang-ca_ES
+
+
+ com.atlassian.jira
+ jira-lang-cs_CZ
+
+
+ com.atlassian.jira
+ jira-lang-da_DK
+
+
+ com.atlassian.jira
+ jira-lang-de_CH
+
+
+ com.atlassian.jira
+ jira-lang-de_DE
+
+
+ com.atlassian.jira
+ jira-lang-en_UK
+
+
+ com.atlassian.jira
+ jira-lang-en_US
+
+
+ com.atlassian.jira
+ jira-lang-es_ES
+
+
+ com.atlassian.jira
+ jira-lang-fr_FR
+
+
+ com.atlassian.jira
+ jira-lang-hu_HU
+
+
+ com.atlassian.jira
+ jira-lang-it_IT
+
+
+ com.atlassian.jira
+ jira-lang-ja_JP
+
+
+ com.atlassian.jira
+ jira-lang-nl_BE
+
+
+ com.atlassian.jira
+ jira-lang-no_NO
+
+
+ com.atlassian.jira
+ jira-lang-pl_PL
+
+
+ com.atlassian.jira
+ jira-lang-pt_BR
+
+
+ com.atlassian.jira
+ jira-lang-ru_RU
+
+
+ com.atlassian.jira
+ jira-lang-sk_SK
+
+
+ com.atlassian.jira
+ jira-lang-tr_TR
+
+
+ com.atlassian.jira
+ jira-lang-zh_CN
+
+
+ com.atlassian.jira
+ jira-lang-zh_TW
+
+
+ com.google.code.findbugs
+ jsr305
+
+
+ com.google.code.findbugs
+ annotations
+
+
+ cglib
+ cglib-nodep
+
+
+ com.atlassian.sal
+ sal-api
+
+
+ com.atlassian.applinks
+ applinks-api
+
+
+ com.atlassian.applinks
+ applinks-spi
+
+
+ com.atlassian.applinks
+ applinks-host
+
+
+ rhino
+ js
+
+
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index be4e72454..97b606412 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -27,30 +27,207 @@
${jboss.version}provided
-
- trove
- trove
-
-
- apache-log4j
- log4j
-
-
- jpl-pattern
- jpl-pattern
-
-
- jpl-util
- jpl-util
-
-
- javax.security
- jacc
-
-
- commons-logging
- commons-logging
-
+
+ xml-apis
+ xml-apis
+
+
+ org.jboss.spec.javax.servlet.jstl
+ jboss-jstl-api_1.2_spec
+
+
+ jacorb
+ jacorb
+
+
+ org.jboss.logging
+ jboss-logging
+
+
+ org.picketbox
+ jboss-security-spi
+
+
+ jboss
+ jboss-serialization
+
+
+ org.jboss.integration
+ jboss-deployment-spi
+
+
+ org.picketbox
+ jbosssx-client
+
+
+ org.jboss.web
+ jbossweb
+
+
+ org.jboss.web
+ jasper-jdt
+
+
+ junit
+ junit
+
+
+ log4j
+ log4j
+
+
+ org.jboss
+ jboss-common-core
+
+
+ org.jboss.metadata
+ jboss-metadata-common
+
+
+ org.jboss.metadata
+ jboss-metadata-war
+
+
+ org.jboss
+ jboss-vfs
+
+
+ org.jboss.ws
+ jbossws-spi
+
+
+ org.jboss
+ jbossxb
+
+
+ org.jboss.aop
+ jboss-aop
+
+
+ org.jboss.spec.javax.security.auth.message
+ jboss-jaspi-api_1.0_spec
+
+
+ org.jboss.jbossas
+ jboss-as-connector
+
+
+ org.jboss.jbossas
+ jboss-as-ejb3
+
+
+ org.jboss.ejb3
+ jboss-ejb3-core
+
+
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.0-api
+
+
+ org.jboss.cluster
+ jboss-ha-server-cache-spi
+
+
+ org.jboss.jbossas
+ jboss-as-iiop
+
+
+ org.jboss.jbossas
+ jboss-as-security
+
+
+ org.jboss.spec.javax.security.jacc
+ jboss-jacc-api_1.4_spec
+
+
+ org.jboss.spec.javax.resource
+ jboss-connector-api_1.5_spec
+
+
+ org.jboss.spec.javax.ejb
+ jboss-ejb-api_3.1_spec
+
+
+ org.jboss.spec.javax.servlet
+ jboss-servlet-api_3.0_spec
+
+
+ org.jboss.spec.javax.servlet.jsp
+ jboss-jsp-api_2.2_spec
+
+
+ org.jboss.spec.javax.el
+ jboss-el-api_2.2_spec
+
+
+ org.jboss.spec.javax.xml.ws
+ jboss-jaxws-api_2.2_spec
+
+
+ org.jboss.mx
+ jboss-j2se
+
+
+ org.jboss.jbossas
+ jboss-as-server
+
+
+ org.jboss.jbossas
+ jboss-as-system-jmx
+
+
+ org.jboss.cl
+ jboss-classloader
+
+
+ org.jboss.deployers
+ jboss-deployers-core-spi
+
+
+ org.jboss.deployers
+ jboss-deployers-impl
+
+
+ org.jboss.deployers
+ jboss-deployers-spi
+
+
+ org.jboss.deployers
+ jboss-deployers-structure-spi
+
+
+ org.jboss.deployers
+ jboss-deployers-vfs
+
+
+ org.jboss.deployers
+ jboss-deployers-vfs-spi
+
+
+ oswego-concurrent
+ concurrent
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+ net.jcip
+ jcip-annotations
+
+
+ javax.validation
+ validation-api
+
+
+ org.jboss.mc-int
+ jboss-mc-int-servlet
+
+
+ org.jboss.mod_cluster
+ mod_cluster
+
+
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 640d6c5f6..af679777a 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -27,7 +27,21 @@
catalina6.0.29jar
- compile
+ provided
+
+
+ org.apache.tomcat
+ servlet-api
+
+
+ org.apache.tomcat
+ juli
+
+
+ org.apache.tomcat
+ annotations-api
+
+
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 2f55fcee9..50ae1711b 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -27,7 +27,29 @@
tomcat-catalina7.0.8jar
- compile
+ provided
+
+
+ org.apache.tomcat
+ tomcat-servlet-api
+
+
+ org.apache.tomcat
+ tomcat-juli
+
+
+ org.apache.tomcat
+ tomcat-annotations-api
+
+
+ org.apache.tomcat
+ tomcat-api
+
+
+ org.apache.tomcat
+ tomcat-util
+
+
From e2aefd72b16b3c89bcb05f57ea2c042cb6ff4d0d Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 7 Jan 2014 20:00:30 -0500
Subject: [PATCH 067/239] Added generated notice files
---
NOTICE | 77 +++++++++++++++++++
cas-client-core/NOTICE | 58 ++++++++++++++
cas-client-integration-atlassian/NOTICE | 51 ++++++++++++
cas-client-integration-jboss/NOTICE | 48 ++++++++++++
cas-client-integration-tomcat-common/NOTICE | 47 +++++++++++
cas-client-integration-tomcat-v6/NOTICE | 49 ++++++++++++
cas-client-integration-tomcat-v7/NOTICE | 49 ++++++++++++
cas-client-support-distributed-ehcache/NOTICE | 48 ++++++++++++
.../NOTICE | 49 ++++++++++++
9 files changed, 476 insertions(+)
create mode 100644 NOTICE
create mode 100644 cas-client-core/NOTICE
create mode 100644 cas-client-integration-atlassian/NOTICE
create mode 100644 cas-client-integration-jboss/NOTICE
create mode 100644 cas-client-integration-tomcat-common/NOTICE
create mode 100644 cas-client-integration-tomcat-v6/NOTICE
create mode 100644 cas-client-integration-tomcat-v7/NOTICE
create mode 100644 cas-client-support-distributed-ehcache/NOTICE
create mode 100644 cas-client-support-distributed-memcached/NOTICE
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 000000000..87c88aefc
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,77 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ AOP alliance under Public Domain
+ Apache Log4j under The Apache Software License, Version 2.0
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Apache XML Security under The Apache Software License, Version 2.0
+ Atlassian JIRA - Code - Core under Atlassian End User License
+ Atlassian Seraph under BSD License
+ atlassian-osuser under BSD License
+ Bouncy Castle Provider under Bouncy Castle Licence
+ catalina under Apache License, Version 2.0
+ Codec under The Apache Software License, Version 2.0
+ Commons Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ Confluence Core under Atlassian End User License
+ Ehcache Core under The Apache Software License, Version 2.0
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java under Apache License Version 2.0
+ Jasig CAS Client for Java - Atlassian Integration under Apache License Version 2.0
+ Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - Distributed Proxy Storage Support:
+ Memcached under Apache License Version 2.0
+ Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache under Apache License Version 2.0
+ Jasig CAS Client for Java - JBoss Integration under Apache License Version 2.0
+ Jasig CAS Client for Java - Tomcat 6.x Integration under Apache License Version 2.0
+ Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
+ JavaMail API under Common Development and Distribution License (CDDL) v1.0
+ JBoss Application Server Tomcat under lgpl
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ spring-aop under The Apache Software License, Version 2.0
+ spring-asm under The Apache Software License, Version 2.0
+ spring-beans under The Apache Software License, Version 2.0
+ spring-context under The Apache Software License, Version 2.0
+ spring-core under The Apache Software License, Version 2.0
+ spring-expression under The Apache Software License, Version 2.0
+ spring-test under The Apache Software License, Version 2.0
+ Spymemcached under The Apache Software License, Version 2.0
+ tomcat-catalina under Apache License, Version 2.0
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
diff --git a/cas-client-core/NOTICE b/cas-client-core/NOTICE
new file mode 100644
index 000000000..68fc9d2f9
--- /dev/null
+++ b/cas-client-core/NOTICE
@@ -0,0 +1,58 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ AOP alliance under Public Domain
+ Apache Log4j under The Apache Software License, Version 2.0
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Apache XML Security under The Apache Software License, Version 2.0
+ Bouncy Castle Provider under Bouncy Castle Licence
+ Commons Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
+ JavaMail API under Common Development and Distribution License (CDDL) v1.0
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ spring-aop under The Apache Software License, Version 2.0
+ spring-asm under The Apache Software License, Version 2.0
+ spring-beans under The Apache Software License, Version 2.0
+ spring-context under The Apache Software License, Version 2.0
+ spring-core under The Apache Software License, Version 2.0
+ spring-expression under The Apache Software License, Version 2.0
+ spring-test under The Apache Software License, Version 2.0
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
diff --git a/cas-client-integration-atlassian/NOTICE b/cas-client-integration-atlassian/NOTICE
new file mode 100644
index 000000000..a7b98fb7c
--- /dev/null
+++ b/cas-client-integration-atlassian/NOTICE
@@ -0,0 +1,51 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Atlassian JIRA - Code - Core under Atlassian End User License
+ Atlassian Seraph under BSD License
+ atlassian-osuser under BSD License
+ Bouncy Castle Provider under Bouncy Castle Licence
+ Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ Confluence Core under Atlassian End User License
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java - Atlassian Integration under Apache License Version 2.0
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
diff --git a/cas-client-integration-jboss/NOTICE b/cas-client-integration-jboss/NOTICE
new file mode 100644
index 000000000..2feec282a
--- /dev/null
+++ b/cas-client-integration-jboss/NOTICE
@@ -0,0 +1,48 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Bouncy Castle Provider under Bouncy Castle Licence
+ Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - JBoss Integration under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ JBoss Application Server Tomcat under lgpl
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
diff --git a/cas-client-integration-tomcat-common/NOTICE b/cas-client-integration-tomcat-common/NOTICE
new file mode 100644
index 000000000..434c58a51
--- /dev/null
+++ b/cas-client-integration-tomcat-common/NOTICE
@@ -0,0 +1,47 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Bouncy Castle Provider under Bouncy Castle Licence
+ Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
diff --git a/cas-client-integration-tomcat-v6/NOTICE b/cas-client-integration-tomcat-v6/NOTICE
new file mode 100644
index 000000000..bc8673158
--- /dev/null
+++ b/cas-client-integration-tomcat-v6/NOTICE
@@ -0,0 +1,49 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Bouncy Castle Provider under Bouncy Castle Licence
+ catalina under Apache License, Version 2.0
+ Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - Tomcat 6.x Integration under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
diff --git a/cas-client-integration-tomcat-v7/NOTICE b/cas-client-integration-tomcat-v7/NOTICE
new file mode 100644
index 000000000..0fe413fe8
--- /dev/null
+++ b/cas-client-integration-tomcat-v7/NOTICE
@@ -0,0 +1,49 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Bouncy Castle Provider under Bouncy Castle Licence
+ Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ tomcat-catalina under Apache License, Version 2.0
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
diff --git a/cas-client-support-distributed-ehcache/NOTICE b/cas-client-support-distributed-ehcache/NOTICE
new file mode 100644
index 000000000..cef121ad9
--- /dev/null
+++ b/cas-client-support-distributed-ehcache/NOTICE
@@ -0,0 +1,48 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Bouncy Castle Provider under Bouncy Castle Licence
+ Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ Ehcache Core under The Apache Software License, Version 2.0
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
diff --git a/cas-client-support-distributed-memcached/NOTICE b/cas-client-support-distributed-memcached/NOTICE
new file mode 100644
index 000000000..ba796115f
--- /dev/null
+++ b/cas-client-support-distributed-memcached/NOTICE
@@ -0,0 +1,49 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Apache Santuario under The Apache Software License, Version 2.0
+ Apache Velocity under The Apache Software License, Version 2.0
+ Bouncy Castle Provider under Bouncy Castle Licence
+ Codec under The Apache Software License, Version 2.0
+ commons-collections under Apache License, Version 2.0
+ ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ HttpClient under Apache License
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - Distributed Proxy Storage Support:
+ Memcached under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ jcip-annotations under Creative Commons Attribution License
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda time under Apache 2
+ JUL to SLF4J bridge under MIT License
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j Implemented Over SLF4J under Apache Software Licenses
+ Not Yet Commons SSL under Apache License v2
+ OpenSAML-J under Apache 2
+ OpenWS under Apache 2
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ Spymemcached under The Apache Software License, Version 2.0
+ Xalan Java under The Apache Software License, Version 2.0
+ Xalan Java Serializer under The Apache Software License, Version 2.0
+ Xerces2-j under The Apache Software License, Version 2.0
+ XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
+ XML Commons Resolver Component under The Apache Software License, Version 2.0
+ XMLTooling-J under Apache 2
+
From b046dc51dc1bbf6ebd9a2b1ddf0fefe065af6dbb Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 7 Jan 2014 20:04:57 -0500
Subject: [PATCH 068/239] Updated Atlassian Maven Repository location
---
cas-client-integration-atlassian/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 5a7f4614f..468f5f9d5 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1377,7 +1377,7 @@
atlassianAtlassian Repository
- http://repository.atlassian.com/maven2/
+ https://maven.atlassian.com/repository/public
From 5cb106709357c06abfb4eb8fd45443b40738b792 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 7 Jan 2014 20:31:24 -0500
Subject: [PATCH 069/239] Updated notice file
---
NOTICE | 3 +++
1 file changed, 3 insertions(+)
diff --git a/NOTICE b/NOTICE
index 87c88aefc..5de596cdc 100644
--- a/NOTICE
+++ b/NOTICE
@@ -27,11 +27,13 @@ This project includes:
Bouncy Castle Provider under Bouncy Castle Licence
catalina under Apache License, Version 2.0
Codec under The Apache Software License, Version 2.0
+ com.atlassian.event:atlassian-event under Atlassian End User License
Commons Codec under The Apache Software License, Version 2.0
commons-collections under Apache License, Version 2.0
Confluence Core under Atlassian End User License
Ehcache Core under The Apache Software License, Version 2.0
ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ Google Collections Library under The Apache Software License, Version 2.0
HttpClient under Apache License
Jasig CAS Client for Java under Apache License Version 2.0
Jasig CAS Client for Java - Atlassian Integration under Apache License Version 2.0
@@ -59,6 +61,7 @@ This project includes:
OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
+ Spring Framework: Context under The Apache Software License, Version 2.0
spring-aop under The Apache Software License, Version 2.0
spring-asm under The Apache Software License, Version 2.0
spring-beans under The Apache Software License, Version 2.0
From f135c5e5c13469fff80fb3d8f1bfd574bef94399 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 7 Jan 2014 20:31:34 -0500
Subject: [PATCH 070/239] Updated notice and pom
---
cas-client-integration-atlassian/NOTICE | 4 ++++
cas-client-integration-atlassian/pom.xml | 8 --------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/cas-client-integration-atlassian/NOTICE b/cas-client-integration-atlassian/NOTICE
index a7b98fb7c..5d2091c53 100644
--- a/cas-client-integration-atlassian/NOTICE
+++ b/cas-client-integration-atlassian/NOTICE
@@ -16,8 +16,10 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ AOP alliance under Public Domain
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
+ Atlassian Event under Atlassian End User License
Atlassian JIRA - Code - Core under Atlassian End User License
Atlassian Seraph under BSD License
atlassian-osuser under BSD License
@@ -26,6 +28,7 @@ This project includes:
commons-collections under Apache License, Version 2.0
Confluence Core under Atlassian End User License
ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
+ Google Collections Library under The Apache Software License, Version 2.0
HttpClient under Apache License
Jasig CAS Client for Java - Atlassian Integration under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
@@ -42,6 +45,7 @@ This project includes:
OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
+ Spring Framework: Context under The Apache Software License, Version 2.0
Xalan Java under The Apache Software License, Version 2.0
Xalan Java Serializer under The Apache Software License, Version 2.0
Xerces2-j under The Apache Software License, Version 2.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 468f5f9d5..b83e3c866 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -192,10 +192,6 @@
com.atlassian.springatlassian-spring
-
- com.atlassian.event
- atlassian-event
- com.atlassian.confluenceconfluence-bucket
@@ -428,10 +424,6 @@
org.springframeworkspring-jdbc
-
- org.springframework
- spring-context
- org.springframeworkspring-dao
From 2bf3129d047bea380a4dbd3bb5fd1e98fe6258bf Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 7 Jan 2014 20:37:19 -0500
Subject: [PATCH 071/239] [maven-release-plugin] prepare release v3.3.0
---
cas-client-core/pom.xml | 6 ++----
cas-client-integration-atlassian/pom.xml | 6 ++----
cas-client-integration-jboss/pom.xml | 6 ++----
cas-client-integration-tomcat-common/pom.xml | 6 ++----
cas-client-integration-tomcat-v6/pom.xml | 6 ++----
cas-client-integration-tomcat-v7/pom.xml | 6 ++----
cas-client-support-distributed-ehcache/pom.xml | 6 ++----
cas-client-support-distributed-memcached/pom.xml | 6 ++----
pom.xml | 6 ++----
9 files changed, 18 insertions(+), 36 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 82d369896..6599f56bd 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,9 +1,7 @@
-
+org.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.0cas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index b83e3c866..01e30c538 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,9 +1,7 @@
-
+org.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.0cas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 97b606412..e47debfc2 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,9 +1,7 @@
-
+org.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.0cas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 0c7bf94d7..7d6897bfd 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -1,11 +1,9 @@
-
+cas-clientorg.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.04.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index af679777a..f7cbc824d 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -1,11 +1,9 @@
-
+cas-clientorg.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.04.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 50ae1711b..81cb98796 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -1,11 +1,9 @@
-
+cas-clientorg.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.04.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 49dc88977..df9c0dfe2 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -1,11 +1,9 @@
-
+cas-clientorg.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.04.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 4dee9fa46..a3b485537 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -1,11 +1,9 @@
-
+cas-clientorg.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.04.0.0
diff --git a/pom.xml b/pom.xml
index d2c3d7507..f2f803730 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,4 @@
-
+org.jasig.parentjasig-parent
@@ -8,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.0-SNAPSHOT
+ 3.3.0cas-clientpom
From 1e89580a6f58a526289ce04b7f9608bc6ca23e78 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 7 Jan 2014 21:15:06 -0500
Subject: [PATCH 072/239] [maven-release-plugin] prepare for next development
iteration
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
pom.xml | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 6599f56bd..1e6be56b3 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 01e30c538..bb6761ce2 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index e47debfc2..e0eb03075 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 7d6897bfd..d3c45aefc 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index f7cbc824d..fa147c717 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 81cb98796..0c6b4f1a6 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index df9c0dfe2..493656bc2 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index a3b485537..369878a8f 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOT4.0.0
diff --git a/pom.xml b/pom.xml
index f2f803730..09cd1fdbf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.0
+ 3.3.1-SNAPSHOTcas-clientpom
From ce852a19a482dd26234672f8fbb2b5455f9a315d Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Mon, 17 Feb 2014 23:09:32 -0500
Subject: [PATCH 073/239] CASC-203 Properly Parse Response to Keep Line Breaks
Problem: The CAS Client uses a buffer reader which strips out the returned line breaks.
Solution: Switch to a normal input stream reader and add appropriate test.
---
.../jasig/cas/client/util/CommonUtils.java | 21 +++++++++----------
.../cas/client/util/CommonUtilsTests.java | 13 ++++++++++++
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 594239ac9..c767c5673 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -328,29 +328,28 @@ public static String getResponseFromServer(final URL constructedUrl, final HttpU
final String encoding) {
HttpURLConnection conn = null;
+ InputStreamReader in = null;
try {
conn = factory.buildHttpURLConnection(constructedUrl.openConnection());
- final BufferedReader in;
-
if (CommonUtils.isEmpty(encoding)) {
- in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ in = new InputStreamReader(conn.getInputStream());
} else {
- in = new BufferedReader(new InputStreamReader(conn.getInputStream(), encoding));
+ in = new InputStreamReader(conn.getInputStream(), encoding);
}
- String line;
- final StringBuilder stringBuffer = new StringBuilder(255);
-
- while ((line = in.readLine()) != null) {
- stringBuffer.append(line);
- stringBuffer.append("\n");
+ final StringBuilder builder = new StringBuilder(255);
+ int byteRead;
+ while ((byteRead = in.read()) != -1) {
+ builder.append((char) byteRead);
}
- return stringBuffer.toString();
+
+ return builder.toString();
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
+ closeQuietly(in);
if (conn != null) {
conn.disconnect();
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index 042b2db22..f6e686cf7 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -18,9 +18,12 @@
*/
package org.jasig.cas.client.util;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import junit.framework.TestCase;
+import org.jasig.cas.client.PublicTestHttpServer;
+import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -33,6 +36,8 @@
*/
public final class CommonUtilsTests extends TestCase {
+ private static final PublicTestHttpServer server = PublicTestHttpServer.instance(8090);
+
public void testRedirectUrlWithParam() {
final String loginUrl = "http://localhost:8080/login?myName=foo";
final String fullyConstructedUrl = CommonUtils.constructRedirectUrl(loginUrl, "foo", "foo", false, false);
@@ -154,4 +159,12 @@ public void testConstructURlWithMultipleHostsAndPorts() {
"http://www.amazon.com https://www.bestbuy.com https://www.myserver.com", "ticket", false);
assertEquals(CONST_MY_URL, constructedUrl);
}
+
+ public void testGetResponseFromServer() throws Exception {
+ final String RESPONSE = "test1\r\ntest2";
+ server.content = RESPONSE.getBytes(server.encoding);
+
+ final String responsedContent = CommonUtils.getResponseFromServer(new URL("http://localhost:8090"), new HttpsURLConnectionFactory(), null);
+ assertEquals(RESPONSE, responsedContent);
+ }
}
From 8b3ac7922d2d8a6d184141cd8526d0d22d482fba Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Thu, 27 Feb 2014 22:02:19 -0700
Subject: [PATCH 074/239] CAS-219: Provide support for certain urls to be
excluded from CAS filters.
---
.../authentication/AuthenticationFilter.java | 8 ++++
.../cas/client/util/AbstractCasFilter.java | 33 +++++++++++++
.../AbstractTicketValidationFilter.java | 14 ++++--
.../AuthenticationFilterTests.java | 42 +++++++++++++----
.../Cas10TicketValidationFilterTests.java | 46 +++++++++++++++++++
.../Saml11TicketValidationFilterTests.java | 46 +++++++++++++++++++
.../Saml11TicketValidatorTests.java | 15 +++++-
7 files changed, 191 insertions(+), 13 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 2e7355655..c00be681a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -98,8 +98,16 @@ public void init() {
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;
+
+ if (isRequestUrlExcluded(request)) {
+ logger.debug("Request is ignored.");
+ filterChain.doFilter(request, response);
+ return;
+ }
+
final HttpSession session = request.getSession(false);
final Assertion assertion = session != null ? (Assertion) session.getAttribute(CONST_CAS_ASSERTION) : null;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index 78f5f7bae..7b4d5cffb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -18,6 +18,10 @@
*/
package org.jasig.cas.client.util;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -48,6 +52,9 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
/** Defines the parameter to look for for the service. */
private String serviceParameterName = "service";
+ /** Url pattern for this filter to exclude and ignore. **/
+ private Pattern ignorePattern = null;
+
/** Sets where response.encodeUrl should be called on service urls when constructed. */
private boolean encodeServiceUrl = true;
@@ -72,6 +79,12 @@ public final void init(final FilterConfig filterConfig) throws ServletException
setEncodeServiceUrl(parseBoolean(getPropertyFromInitParams(filterConfig, "encodeServiceUrl", "true")));
logger.trace("Loading encodeServiceUrl property: {}", this.encodeServiceUrl);
+ final String ignorePattern = getPropertyFromInitParams(filterConfig, "ignorePattern", null);
+ if (ignorePattern != null) {
+ setIgnorePattern(Pattern.compile(ignorePattern));
+ logger.trace("Loading ignorePattern property: {}", this.ignorePattern.pattern());
+ }
+
initInternal(filterConfig);
}
init();
@@ -148,6 +161,10 @@ public final String getServiceParameterName() {
return this.serviceParameterName;
}
+ public final void setIgnorePattern(final Pattern patternToIgnore) {
+ this.ignorePattern = patternToIgnore;
+ }
+
/**
* Template method to allow you to change how you retrieve the ticket.
*
@@ -157,4 +174,20 @@ public final String getServiceParameterName() {
protected String retrieveTicketFromRequest(final HttpServletRequest request) {
return CommonUtils.safeGetParameter(request, getArtifactParameterName());
}
+
+ protected boolean isRequestUrlExcluded(final HttpServletRequest request) {
+ boolean result = false;
+ if (this.ignorePattern != null) {
+ final StringBuffer urlBuffer = request.getRequestURL();
+ if (request.getQueryString() != null) {
+ urlBuffer.append("?").append(request.getQueryString());
+ }
+ final String requestUri = urlBuffer.toString();
+ logger.debug("Checking [{}] against pattern [{}]", requestUri, this.ignorePattern.pattern());
+ result = this.ignorePattern.matcher(requestUri).find();
+ } else {
+ logger.debug("Ignore pattern is not defined");
+ }
+ return result;
+ }
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index 58f57c462..836b63a91 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -190,13 +190,19 @@ protected void onFailedValidation(final HttpServletRequest request, final HttpSe
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;
+
+ if (isRequestUrlExcluded(request)) {
+ logger.debug("Request is ignored.");
+ filterChain.doFilter(request, response);
+ return;
+ }
+
if (!preFilter(servletRequest, servletResponse, filterChain)) {
return;
}
-
- final HttpServletRequest request = (HttpServletRequest) servletRequest;
- final HttpServletResponse response = (HttpServletResponse) servletResponse;
+
final String ticket = retrieveTicketFromRequest(request);
if (CommonUtils.isNotBlank(ticket)) {
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index 396c5365d..34d66868f 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -37,7 +37,6 @@
* Tests for the AuthenticationFilter.
*
* @author Scott Battaglia
- * @version $Revision: 11753 $ $Date: 2007-01-03 13:37:26 -0500 (Wed, 03 Jan 2007) $
* @since 3.0
*/
public final class AuthenticationFilterTests {
@@ -50,11 +49,10 @@ public final class AuthenticationFilterTests {
@Before
public void setUp() throws Exception {
- // TODO CAS_SERVICE_URL, false, CAS_LOGIN_URL
this.filter = new AuthenticationFilter();
final MockFilterConfig config = new MockFilterConfig();
config.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
- config.addInitParameter("service", "https://localhost:8443/service");
+ config.addInitParameter("service", CAS_SERVICE_URL);
this.filter.init(config);
}
@@ -184,7 +182,7 @@ public void testRenewInitParamThrows() throws Exception {
final AuthenticationFilter f = new AuthenticationFilter();
final MockFilterConfig config = new MockFilterConfig();
config.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
- config.addInitParameter("service", "https://localhost:8443/service");
+ config.addInitParameter("service", CAS_SERVICE_URL);
config.addInitParameter("renew", "true");
try {
f.init(config);
@@ -198,8 +196,8 @@ public void testRenewInitParamThrows() throws Exception {
public void testAllowsRenewContextParam() throws Exception {
final AuthenticationFilter f = new AuthenticationFilter();
final MockServletContext context = new MockServletContext();
- context.addInitParameter("casServerLoginUrl", "https://cas.example.com/login");
- context.addInitParameter("service", "https://localhost:8443/service");
+ context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
+ context.addInitParameter("service", CAS_SERVICE_URL);
context.addInitParameter("renew", "true");
f.init(new MockFilterConfig(context));
final Field renewField = AuthenticationFilter.class.getDeclaredField("renew");
@@ -211,10 +209,38 @@ public void testAllowsRenewContextParam() throws Exception {
public void customRedirectStrategy() throws Exception {
final AuthenticationFilter f = new AuthenticationFilter();
final MockServletContext context = new MockServletContext();
- context.addInitParameter("casServerLoginUrl", "https://cas.example.com/login");
- context.addInitParameter("service", "https://localhost:8443/service");
+ context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
+ context.addInitParameter("service", CAS_SERVICE_URL);
context.addInitParameter("authenticationRedirectStrategyClass",
"org.jasig.cas.client.authentication.FacesCompatibleAuthenticationRedirectStrategy");
f.init(new MockFilterConfig(context));
}
+
+ @Test
+ public void testIgnorePatterns() throws Exception {
+ final AuthenticationFilter f = new AuthenticationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
+
+ context.addInitParameter("ignorePattern", "=valueTo(\\w+)");
+ context.addInitParameter("service", CAS_SERVICE_URL);
+ f.init(new MockFilterConfig(context));
+
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final String URL = CAS_SERVICE_URL + "?param=valueToIgnore";
+ request.setRequestURI(URL);
+
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ final FilterChain filterChain = new FilterChain() {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ }
+ };
+
+ f.doFilter(request, response, filterChain);
+ assertNull(response.getRedirectedUrl());
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
index e8daab4e3..174b9f763 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
@@ -20,8 +20,19 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockHttpSession;
import org.springframework.mock.web.MockServletContext;
/**
@@ -54,4 +65,39 @@ public void testAllowsRenewContextParam() throws Exception {
assertTrue(validator instanceof Cas10TicketValidator);
assertTrue(((Cas10TicketValidator) validator).isRenew());
}
+
+ @Test
+ public void testIgnorePatterns() throws Exception {
+ final Cas10TicketValidationFilter f = new Cas10TicketValidationFilter();
+
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
+ context.addInitParameter("serverName", "https://localhost:8443");
+
+ context.addInitParameter("ignorePattern", "=valueTo(\\w+)");
+ f.init(new MockFilterConfig(context));
+
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final String URL = "https://localhost:8443/?param=valueToIgnore";
+ request.setRequestURI(URL);
+ request.setQueryString("ticket=ST-1234");
+ request.setParameter("ticket", "ST-1234");
+
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ final FilterChain filterChain = new FilterChain() {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ }
+ };
+
+ try {
+ f.doFilter(request, response, filterChain);
+ } catch (final Exception e) {
+ fail("The validation request should have been ignored");
+ }
+
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
index 804b46faa..c0e267ebf 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
@@ -20,8 +20,19 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockHttpSession;
import org.springframework.mock.web.MockServletContext;
/**
@@ -54,4 +65,39 @@ public void testAllowsRenewContextParam() throws Exception {
assertTrue(validator instanceof Saml11TicketValidator);
assertTrue(((Saml11TicketValidator) validator).isRenew());
}
+
+ @Test
+ public void testIgnorePatterns() throws Exception {
+ final Saml11TicketValidationFilter f = new Saml11TicketValidationFilter();
+
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
+ context.addInitParameter("serverName", "https://localhost:8443");
+
+ context.addInitParameter("ignorePattern", "=valueTo(\\w+)");
+ f.init(new MockFilterConfig(context));
+
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final String URL = "https://localhost:8443/?param=valueToIgnore";
+ request.setRequestURI(URL);
+ request.setQueryString("SAMLart=ST-1234");
+ request.setParameter("SAMLart", "ST-1234");
+
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ final FilterChain filterChain = new FilterChain() {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ }
+ };
+
+ try {
+ f.doFilter(request, response, filterChain);
+ } catch (final Exception e) {
+ fail("The validation request should have been ignored");
+ }
+
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
index 951e61022..9e907498e 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
@@ -20,8 +20,16 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+
+import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Date;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
import org.jasig.cas.client.PublicTestHttpServer;
import org.jasig.cas.client.util.CommonUtils;
import org.joda.time.DateTime;
@@ -30,6 +38,11 @@
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.mock.web.MockFilterConfig;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockHttpSession;
+import org.springframework.mock.web.MockServletContext;
/**
* @author Scott Battaglia
@@ -137,7 +150,7 @@ public void openSaml2GeneratedResponse() throws UnsupportedEncodingException {
fail(e.toString());
}
}
-
+
private Interval currentTimeRangeInterval() {
return new Interval(new DateTime(DateTimeZone.UTC).minus(5000), new DateTime(DateTimeZone.UTC).plus(200000000));
}
From 1b4af19d7003caaf8a1a8f9ad2acc9e9c6f0768c Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 2 Mar 2014 03:03:24 -0700
Subject: [PATCH 075/239] CAS-219: Provide support for certain urls to be
excluded from CAS filters.
---
.../org/jasig/cas/client/util/AbstractCasFilter.java | 2 --
.../client/validation/Saml11TicketValidatorTests.java | 11 -----------
2 files changed, 13 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index 7b4d5cffb..558cefb5a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -185,8 +185,6 @@ protected boolean isRequestUrlExcluded(final HttpServletRequest request) {
final String requestUri = urlBuffer.toString();
logger.debug("Checking [{}] against pattern [{}]", requestUri, this.ignorePattern.pattern());
result = this.ignorePattern.matcher(requestUri).find();
- } else {
- logger.debug("Ignore pattern is not defined");
}
return result;
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
index 9e907498e..41b58ec49 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
@@ -21,15 +21,9 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Date;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
import org.jasig.cas.client.PublicTestHttpServer;
import org.jasig.cas.client.util.CommonUtils;
import org.joda.time.DateTime;
@@ -38,11 +32,6 @@
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-import org.springframework.mock.web.MockFilterConfig;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.mock.web.MockHttpSession;
-import org.springframework.mock.web.MockServletContext;
/**
* @author Scott Battaglia
From 5d97bb0ac9d181f0800b9c78140aef2f577e2702 Mon Sep 17 00:00:00 2001
From: John Gasper
Date: Wed, 5 Mar 2014 10:17:59 -0800
Subject: [PATCH 076/239] Added support for having regex expressions in the
proxy (chaining) list.
---
.../cas/client/validation/ProxyList.java | 19 +++++++++++
.../Cas20ProxyTicketValidatorTests.java | 32 +++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
index 3585d5b37..7baaa5633 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
@@ -27,6 +27,7 @@
* Holding class for the proxy list to make Spring configuration easier.
*
* @author Scott Battaglia
+ * @author John Gasper
* @version $Revision$ $Date$
* @since 3.1.3
*/
@@ -47,6 +48,24 @@ public boolean contains(String[] proxiedList) {
for (final String[] list : this.proxyChains) {
if (Arrays.equals(proxiedList, list)) {
return true;
+ } else {
+ //strings might be regex, so check for each string
+ if (list.length == proxiedList.length) {
+ boolean passed = false;
+
+ for (int i=0; i list = new ArrayList();
+ list.add(new String[] { "proxy1", "proxy2", "^proxy3/[a-z]*/" });
+ this.ticketValidator.setAllowedProxyChains(new ProxyList(list));
+
+ final String USERNAME = "username";
+ final String RESPONSE = "usernamePGTIOU-84678-8a9d...proxy1proxy2proxy3/abc/";
+ server.content = RESPONSE.getBytes(server.encoding);
+
+ final Assertion assertion = this.ticketValidator.validate("test", "test");
+ assertEquals(USERNAME, assertion.getPrincipal().getName());
+ }
+
+ @Test
+ public void testRegexProxyChainWithInvalidProxy() throws TicketValidationException, UnsupportedEncodingException {
+ final List list = new ArrayList();
+ list.add(new String[] { "proxy1", "proxy2", "^proxy3/[a-z]*/" });
+ this.ticketValidator.setAllowedProxyChains(new ProxyList(list));
+
+ final String RESPONSE = "usernamePGTIOU-84678-8a9d...proxy/ABC/proxy2proxy3";
+ server.content = RESPONSE.getBytes(server.encoding);
+
+ try {
+ this.ticketValidator.validate("test", "test");
+ fail("Invalid proxy chain");
+ } catch (InvalidProxyChainTicketValidationException e) {
+ // expected
+ }
+ }
+
@Test
public void testConstructionFromSpringBean() throws TicketValidationException, UnsupportedEncodingException {
final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
From 815948ce000446652928bf14b24695eb1523e88b Mon Sep 17 00:00:00 2001
From: John Gasper
Date: Wed, 5 Mar 2014 10:45:35 -0800
Subject: [PATCH 077/239] Minor corrections.
---
.../main/java/org/jasig/cas/client/validation/ProxyList.java | 2 +-
.../cas/client/validation/Cas20ProxyTicketValidatorTests.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
index 7baaa5633..aef87d0d6 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
@@ -27,7 +27,6 @@
* Holding class for the proxy list to make Spring configuration easier.
*
* @author Scott Battaglia
- * @author John Gasper
* @version $Revision$ $Date$
* @since 3.1.3
*/
@@ -59,6 +58,7 @@ public boolean contains(String[] proxiedList) {
|| pattern.equals(proxiedList[i])) {
passed = true;
} else {
+ passed = false;
break;
}
}
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
index 234bb9d0b..44c2f41da 100644
--- 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
@@ -126,7 +126,7 @@ public void testRegexProxyChainWithInvalidProxy() throws TicketValidationExcepti
list.add(new String[] { "proxy1", "proxy2", "^proxy3/[a-z]*/" });
this.ticketValidator.setAllowedProxyChains(new ProxyList(list));
- final String RESPONSE = "usernamePGTIOU-84678-8a9d...proxy/ABC/proxy2proxy3";
+ final String RESPONSE = "usernamePGTIOU-84678-8a9d...proxy1proxy2proxy3/ABC/";
server.content = RESPONSE.getBytes(server.encoding);
try {
From 02d38e61eac4f4c85b252dbf7759691a07b42d5d Mon Sep 17 00:00:00 2001
From: John Gasper
Date: Wed, 5 Mar 2014 10:54:34 -0800
Subject: [PATCH 078/239] no message
---
.../cas/client/validation/Cas20ProxyTicketValidatorTests.java | 1 -
1 file changed, 1 deletion(-)
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
index 44c2f41da..b0db574ca 100644
--- 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
@@ -35,7 +35,6 @@
* Test cases for the {@link Cas20ProxyTicketValidator}.
*
* @author Scott Battaglia
- * @author John Gasper
* @version $Revision: 11737 $ $Date: 2007-10-03 09:14:02 -0400 (Tue, 03 Oct 2007) $
* @since 3.0
*/
From f55bae3b89ed48ea4e215190a3df034e015fe70a Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Fri, 7 Mar 2014 01:52:50 -0700
Subject: [PATCH 079/239] CASC-219: Provide support for certain urls to be
excluded from CAS filters.
---
.../cas/client/util/AbstractCasFilter.java | 53 +++++++++++++++----
.../AbstractTicketValidationFilter.java | 8 +--
.../AuthenticationFilterTests.java | 29 ++++++++++
.../Cas10TicketValidationFilterTests.java | 35 ------------
.../Saml11TicketValidationFilterTests.java | 34 ------------
5 files changed, 73 insertions(+), 86 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index 558cefb5a..70a5a43b8 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -18,8 +18,6 @@
*/
package org.jasig.cas.client.util;
-import java.util.Collections;
-import java.util.List;
import java.util.regex.Pattern;
import javax.servlet.FilterConfig;
@@ -38,11 +36,20 @@
*
Please note that one of the two above parameters must be set.
*
* @author Scott Battaglia
- * @version $Revision$ $Date$
+ * @author Misagh Moayyed
* @since 3.1
*/
public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
+ /**
+ * Enumeration that defines pattern types.
+ * @since 3.3.1
+ */
+ public enum IgnorePatternTypes {
+ NONE,
+ REGEX;
+ }
+
/** Represents the constant for where the assertion will be located in memory. */
public static final String CONST_CAS_ASSERTION = "_const_cas_assertion_";
@@ -52,8 +59,15 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
/** Defines the parameter to look for for the service. */
private String serviceParameterName = "service";
- /** Url pattern for this filter to exclude and ignore. **/
- private Pattern ignorePattern = null;
+ /** Url pattern for this filter to exclude and ignore.
+ * @since 3.3.1
+ **/
+ private String ignorePattern = null;
+
+ /** Denotes the pattern type.
+ * @since 3.3.1
+ */
+ private IgnorePatternTypes ignorePatternType = null;
/** Sets where response.encodeUrl should be called on service urls when constructed. */
private boolean encodeServiceUrl = true;
@@ -81,15 +95,20 @@ public final void init(final FilterConfig filterConfig) throws ServletException
final String ignorePattern = getPropertyFromInitParams(filterConfig, "ignorePattern", null);
if (ignorePattern != null) {
- setIgnorePattern(Pattern.compile(ignorePattern));
- logger.trace("Loading ignorePattern property: {}", this.ignorePattern.pattern());
+ setIgnorePattern(ignorePattern);
+ logger.trace("Loading ignorePattern property: {}", ignorePattern);
}
+ setIgnorePatternType(Enum.valueOf(IgnorePatternTypes.class, getPropertyFromInitParams(filterConfig, "ignorePatternType",
+ IgnorePatternTypes.REGEX.name())));
+ logger.trace("Loading ignorePatternType property: {}", ignorePatternType);
+
initInternal(filterConfig);
}
init();
}
+
/** Controls the ordering of filter initialization and checking by defining a method that runs before the init.
* @param filterConfig the original filter configuration.
* @throws ServletException if there is a problem.
@@ -161,10 +180,14 @@ public final String getServiceParameterName() {
return this.serviceParameterName;
}
- public final void setIgnorePattern(final Pattern patternToIgnore) {
+ public final void setIgnorePattern(final String patternToIgnore) {
this.ignorePattern = patternToIgnore;
}
+ public final void setIgnorePatternType(final IgnorePatternTypes patternType) {
+ this.ignorePatternType = patternType;
+ }
+
/**
* Template method to allow you to change how you retrieve the ticket.
*
@@ -183,8 +206,18 @@ protected boolean isRequestUrlExcluded(final HttpServletRequest request) {
urlBuffer.append("?").append(request.getQueryString());
}
final String requestUri = urlBuffer.toString();
- logger.debug("Checking [{}] against pattern [{}]", requestUri, this.ignorePattern.pattern());
- result = this.ignorePattern.matcher(requestUri).find();
+ logger.debug("Checking [{}] against pattern [{}]", requestUri, this.ignorePattern);
+
+
+ switch (this.ignorePatternType) {
+ case NONE:
+ result = requestUri.contains(this.ignorePattern);
+ break;
+ case REGEX:
+ result = Pattern.compile(this.ignorePattern).matcher(requestUri).find();
+ break;
+ }
+
}
return result;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index 836b63a91..ac5c7af7b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -192,13 +192,7 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
final FilterChain filterChain) throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
-
- if (isRequestUrlExcluded(request)) {
- logger.debug("Request is ignored.");
- filterChain.doFilter(request, response);
- return;
- }
-
+
if (!preFilter(servletRequest, servletResponse, filterChain)) {
return;
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index 34d66868f..b8c1bfe98 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -243,4 +243,33 @@ public void doFilter(ServletRequest request, ServletResponse response) throws IO
f.doFilter(request, response, filterChain);
assertNull(response.getRedirectedUrl());
}
+
+ @Test
+ public void testIgnorePatternsWithNoRegex() throws Exception {
+ final AuthenticationFilter f = new AuthenticationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
+
+ context.addInitParameter("ignorePattern", "=valueToIgnore");
+ context.addInitParameter("ignorePatternType", "NONE");
+ context.addInitParameter("service", CAS_SERVICE_URL);
+ f.init(new MockFilterConfig(context));
+
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final String URL = CAS_SERVICE_URL + "?param=valueToIgnore";
+ request.setRequestURI(URL);
+
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ final FilterChain filterChain = new FilterChain() {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ }
+ };
+
+ f.doFilter(request, response, filterChain);
+ assertNull(response.getRedirectedUrl());
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
index 174b9f763..74e6d7a35 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
@@ -65,39 +65,4 @@ public void testAllowsRenewContextParam() throws Exception {
assertTrue(validator instanceof Cas10TicketValidator);
assertTrue(((Cas10TicketValidator) validator).isRenew());
}
-
- @Test
- public void testIgnorePatterns() throws Exception {
- final Cas10TicketValidationFilter f = new Cas10TicketValidationFilter();
-
- final MockServletContext context = new MockServletContext();
- context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
- context.addInitParameter("serverName", "https://localhost:8443");
-
- context.addInitParameter("ignorePattern", "=valueTo(\\w+)");
- f.init(new MockFilterConfig(context));
-
- final MockHttpServletRequest request = new MockHttpServletRequest();
- final String URL = "https://localhost:8443/?param=valueToIgnore";
- request.setRequestURI(URL);
- request.setQueryString("ticket=ST-1234");
- request.setParameter("ticket", "ST-1234");
-
- final MockHttpSession session = new MockHttpSession();
- request.setSession(session);
-
- final MockHttpServletResponse response = new MockHttpServletResponse();
-
- final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
- }
- };
-
- try {
- f.doFilter(request, response, filterChain);
- } catch (final Exception e) {
- fail("The validation request should have been ignored");
- }
-
- }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
index c0e267ebf..4ba6a36cf 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
@@ -66,38 +66,4 @@ public void testAllowsRenewContextParam() throws Exception {
assertTrue(((Saml11TicketValidator) validator).isRenew());
}
- @Test
- public void testIgnorePatterns() throws Exception {
- final Saml11TicketValidationFilter f = new Saml11TicketValidationFilter();
-
- final MockServletContext context = new MockServletContext();
- context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
- context.addInitParameter("serverName", "https://localhost:8443");
-
- context.addInitParameter("ignorePattern", "=valueTo(\\w+)");
- f.init(new MockFilterConfig(context));
-
- final MockHttpServletRequest request = new MockHttpServletRequest();
- final String URL = "https://localhost:8443/?param=valueToIgnore";
- request.setRequestURI(URL);
- request.setQueryString("SAMLart=ST-1234");
- request.setParameter("SAMLart", "ST-1234");
-
- final MockHttpSession session = new MockHttpSession();
- request.setSession(session);
-
- final MockHttpServletResponse response = new MockHttpServletResponse();
-
- final FilterChain filterChain = new FilterChain() {
- public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
- }
- };
-
- try {
- f.doFilter(request, response, filterChain);
- } catch (final Exception e) {
- fail("The validation request should have been ignored");
- }
-
- }
}
From d62bf68eee9b3ea6ef0c49c003473ae759b1a5db Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Fri, 7 Mar 2014 11:17:14 -0700
Subject: [PATCH 080/239] CASC-219: Provide support for certain urls to be
excluded from CAS filters.
---
.../authentication/AuthenticationFilter.java | 39 +++++++++++-
.../ExactUrlPatternMatcherStrategy.java | 38 +++++++++++
.../RegexUrlPatternMatcherStrategy.java | 41 ++++++++++++
.../UrlPatternMatcherStrategy.java | 39 ++++++++++++
.../cas/client/util/AbstractCasFilter.java | 63 -------------------
.../AbstractTicketValidationFilter.java | 10 +--
.../AuthenticationFilterTests.java | 2 +-
.../Cas10TicketValidationFilterTests.java | 13 +---
.../Saml11TicketValidationFilterTests.java | 14 +----
.../Saml11TicketValidatorTests.java | 6 +-
10 files changed, 164 insertions(+), 101 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index c00be681a..c175442cd 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -19,10 +19,12 @@
package org.jasig.cas.client.authentication;
import java.io.IOException;
+
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
@@ -42,11 +44,11 @@
*
Please see AbstractCasFilter for additional properties.
*
* @author Scott Battaglia
- * @version $Revision: 11768 $ $Date: 2007-02-07 15:44:16 -0500 (Wed, 07 Feb 2007) $
+ * @author Misagh Moayyed
* @since 3.0
*/
public class AuthenticationFilter extends AbstractCasFilter {
-
+
/**
* The URL to the CAS Server login.
*/
@@ -64,6 +66,8 @@ public class AuthenticationFilter extends AbstractCasFilter {
private GatewayResolver gatewayStorage = new DefaultGatewayResolverImpl();
+ private UrlPatternMatcherStrategy ignoreUrlPatternMatcherStrategyClass = null;
+
private AuthenticationRedirectStrategy authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
@@ -75,7 +79,22 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
logger.trace("Loaded renew parameter: {}", this.renew);
setGateway(parseBoolean(getPropertyFromInitParams(filterConfig, "gateway", "false")));
logger.trace("Loaded gateway parameter: {}", this.gateway);
-
+
+ final String ignorePattern = getPropertyFromInitParams(filterConfig, "ignorePattern", null);
+ logger.trace("Loaded ignorePattern parameter: {}", ignorePattern);
+
+ final String ignoreUrlMatcherClass = getPropertyFromInitParams(filterConfig, "ignoreUrlPatternMatcherStrategyClass", null);
+ logger.trace("Loaded ignoreUrlPatternMatcherStrategyClass parameter: {}", ignoreUrlMatcherClass);
+
+ if (ignorePattern != null ) {
+ if (ignoreUrlMatcherClass != null) {
+ this.ignoreUrlPatternMatcherStrategyClass = ReflectUtils.newInstance(ignoreUrlMatcherClass);
+ } else {
+ this.ignoreUrlPatternMatcherStrategyClass = new RegexUrlPatternMatcherStrategy();
+ }
+ this.ignoreUrlPatternMatcherStrategyClass.setPattern(ignorePattern);
+ }
+
final String gatewayStorageClass = getPropertyFromInitParams(filterConfig, "gatewayStorageClass", null);
if (gatewayStorageClass != null) {
@@ -159,4 +178,18 @@ public final void setCasServerLoginUrl(final String casServerLoginUrl) {
public final void setGatewayStorage(final GatewayResolver gatewayStorage) {
this.gatewayStorage = gatewayStorage;
}
+
+ private boolean isRequestUrlExcluded(final HttpServletRequest request) {
+
+ if (this.ignoreUrlPatternMatcherStrategyClass == null) {
+ return false;
+ }
+
+ final StringBuffer urlBuffer = request.getRequestURL();
+ if (request.getQueryString() != null) {
+ urlBuffer.append("?").append(request.getQueryString());
+ }
+ final String requestUri = urlBuffer.toString();
+ return this.ignoreUrlPatternMatcherStrategyClass.matches(requestUri);
+ }
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
new file mode 100644
index 000000000..befe6ee0d
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.authentication;
+
+/**
+ * A pattern matcher that looks inside the url to find the exact pattern specified.
+ *
+ * @author Misagh Moayyed
+ * @since 3.3.1
+ */
+public class ExactUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
+
+ private String pattern;
+
+ public boolean matches(final String url) {
+ return url.contains(this.pattern);
+ }
+
+ public void setPattern(final String pattern) {
+ this.pattern = pattern;
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
new file mode 100644
index 000000000..7bb54e841
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.authentication;
+
+import java.util.regex.Pattern;
+
+/**
+ * A pattern matcher that looks inside the url to find the pattern,. that
+ * is assumed to have been specified via regular expressions syntax.
+ *
+ * @author Misagh Moayyed
+ * @since 3.3.1
+ */
+public class RegexUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
+
+ private Pattern pattern;
+
+ public boolean matches(final String url) {
+ return this.pattern.matcher(url).find();
+ }
+
+ public void setPattern(final String pattern) {
+ this.pattern = Pattern.compile(pattern);
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
new file mode 100644
index 000000000..e72470e6b
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.authentication;
+/**
+ * Defines an abstraction by which request urls can be matches against a given pattern.
+ *
+ * @author Misagh Moayyed
+ * @since 3.3.1
+ */
+public interface UrlPatternMatcherStrategy {
+ /**
+ * Execute the match between the given pattern and the url
+ * @param url the request url typically with query strings included
+ * @return true if match is successful
+ */
+ boolean matches(final String url);
+
+ /**
+ * The pattern against which the url is compared
+ * @param pattern
+ */
+ void setPattern(final String pattern);
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index 70a5a43b8..8cf47ef3a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -18,8 +18,6 @@
*/
package org.jasig.cas.client.util;
-import java.util.regex.Pattern;
-
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -40,15 +38,6 @@
* @since 3.1
*/
public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
-
- /**
- * Enumeration that defines pattern types.
- * @since 3.3.1
- */
- public enum IgnorePatternTypes {
- NONE,
- REGEX;
- }
/** Represents the constant for where the assertion will be located in memory. */
public static final String CONST_CAS_ASSERTION = "_const_cas_assertion_";
@@ -58,16 +47,6 @@ public enum IgnorePatternTypes {
/** Defines the parameter to look for for the service. */
private String serviceParameterName = "service";
-
- /** Url pattern for this filter to exclude and ignore.
- * @since 3.3.1
- **/
- private String ignorePattern = null;
-
- /** Denotes the pattern type.
- * @since 3.3.1
- */
- private IgnorePatternTypes ignorePatternType = null;
/** Sets where response.encodeUrl should be called on service urls when constructed. */
private boolean encodeServiceUrl = true;
@@ -92,16 +71,6 @@ public final void init(final FilterConfig filterConfig) throws ServletException
logger.trace("Loading serviceParameterName property: {} ", this.serviceParameterName);
setEncodeServiceUrl(parseBoolean(getPropertyFromInitParams(filterConfig, "encodeServiceUrl", "true")));
logger.trace("Loading encodeServiceUrl property: {}", this.encodeServiceUrl);
-
- final String ignorePattern = getPropertyFromInitParams(filterConfig, "ignorePattern", null);
- if (ignorePattern != null) {
- setIgnorePattern(ignorePattern);
- logger.trace("Loading ignorePattern property: {}", ignorePattern);
- }
-
- setIgnorePatternType(Enum.valueOf(IgnorePatternTypes.class, getPropertyFromInitParams(filterConfig, "ignorePatternType",
- IgnorePatternTypes.REGEX.name())));
- logger.trace("Loading ignorePatternType property: {}", ignorePatternType);
initInternal(filterConfig);
}
@@ -179,14 +148,6 @@ public final String getArtifactParameterName() {
public final String getServiceParameterName() {
return this.serviceParameterName;
}
-
- public final void setIgnorePattern(final String patternToIgnore) {
- this.ignorePattern = patternToIgnore;
- }
-
- public final void setIgnorePatternType(final IgnorePatternTypes patternType) {
- this.ignorePatternType = patternType;
- }
/**
* Template method to allow you to change how you retrieve the ticket.
@@ -197,28 +158,4 @@ public final void setIgnorePatternType(final IgnorePatternTypes patternType) {
protected String retrieveTicketFromRequest(final HttpServletRequest request) {
return CommonUtils.safeGetParameter(request, getArtifactParameterName());
}
-
- protected boolean isRequestUrlExcluded(final HttpServletRequest request) {
- boolean result = false;
- if (this.ignorePattern != null) {
- final StringBuffer urlBuffer = request.getRequestURL();
- if (request.getQueryString() != null) {
- urlBuffer.append("?").append(request.getQueryString());
- }
- final String requestUri = urlBuffer.toString();
- logger.debug("Checking [{}] against pattern [{}]", requestUri, this.ignorePattern);
-
-
- switch (this.ignorePatternType) {
- case NONE:
- result = requestUri.contains(this.ignorePattern);
- break;
- case REGEX:
- result = Pattern.compile(this.ignorePattern).matcher(requestUri).find();
- break;
- }
-
- }
- return result;
- }
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index ac5c7af7b..1d27314b9 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -190,13 +190,13 @@ protected void onFailedValidation(final HttpServletRequest request, final HttpSe
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;
-
+
if (!preFilter(servletRequest, servletResponse, filterChain)) {
return;
}
-
+
+ final HttpServletRequest request = (HttpServletRequest) servletRequest;
+ final HttpServletResponse response = (HttpServletResponse) servletResponse;
final String ticket = retrieveTicketFromRequest(request);
if (CommonUtils.isNotBlank(ticket)) {
@@ -254,4 +254,4 @@ public final void setExceptionOnValidationFailure(final boolean exceptionOnValid
public final void setUseSession(final boolean useSession) {
this.useSession = useSession;
}
-}
+}
\ No newline at end of file
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index b8c1bfe98..f9b8b8fea 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -251,7 +251,7 @@ public void testIgnorePatternsWithNoRegex() throws Exception {
context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
context.addInitParameter("ignorePattern", "=valueToIgnore");
- context.addInitParameter("ignorePatternType", "NONE");
+ context.addInitParameter("ignoreUrlPatternMatcherStrategyClass", ExactUrlPatternMatcherStrategy.class.getName());
context.addInitParameter("service", CAS_SERVICE_URL);
f.init(new MockFilterConfig(context));
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
index 74e6d7a35..8ccdb2f4f 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
@@ -20,19 +20,8 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.mock.web.MockHttpSession;
import org.springframework.mock.web.MockServletContext;
/**
@@ -65,4 +54,4 @@ public void testAllowsRenewContextParam() throws Exception {
assertTrue(validator instanceof Cas10TicketValidator);
assertTrue(((Cas10TicketValidator) validator).isRenew());
}
-}
+}
\ No newline at end of file
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
index 4ba6a36cf..53d18756d 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
@@ -20,19 +20,8 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.mock.web.MockHttpSession;
import org.springframework.mock.web.MockServletContext;
/**
@@ -65,5 +54,4 @@ public void testAllowsRenewContextParam() throws Exception {
assertTrue(validator instanceof Saml11TicketValidator);
assertTrue(((Saml11TicketValidator) validator).isRenew());
}
-
-}
+}
\ No newline at end of file
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
index 41b58ec49..417db57a6 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
@@ -20,10 +20,8 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-
import java.io.UnsupportedEncodingException;
import java.util.Date;
-
import org.jasig.cas.client.PublicTestHttpServer;
import org.jasig.cas.client.util.CommonUtils;
import org.joda.time.DateTime;
@@ -139,8 +137,8 @@ public void openSaml2GeneratedResponse() throws UnsupportedEncodingException {
fail(e.toString());
}
}
-
+
private Interval currentTimeRangeInterval() {
return new Interval(new DateTime(DateTimeZone.UTC).minus(5000), new DateTime(DateTimeZone.UTC).plus(200000000));
}
-}
+}
\ No newline at end of file
From 726cba9f4776c7d5dba44dbdc4d21fdf68dc5ae3 Mon Sep 17 00:00:00 2001
From: John Gasper
Date: Fri, 7 Mar 2014 16:11:00 -0800
Subject: [PATCH 081/239] Refactored the match logic and cache the regex
patterns.
---
.../cas/client/validation/ProxyList.java | 48 +++++++++++--------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
index aef87d0d6..3a6846c24 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
@@ -19,8 +19,9 @@
package org.jasig.cas.client.validation;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.regex.Pattern;
import org.jasig.cas.client.util.CommonUtils;
/**
@@ -33,10 +34,20 @@
public final class ProxyList {
private final List proxyChains;
+ private final HashMap proxyChainRegexCache;
public ProxyList(final List proxyChains) {
CommonUtils.assertNotNull(proxyChains, "List of proxy chains cannot be null.");
this.proxyChains = proxyChains;
+
+ this.proxyChainRegexCache = new HashMap();
+ for (final String[] list : this.proxyChains) {
+ for (final String item : list) {
+ if (item.startsWith("^")) {
+ this.proxyChainRegexCache.put(item, Pattern.compile(item));
+ }
+ }
+ }
}
public ProxyList() {
@@ -44,26 +55,23 @@ public ProxyList() {
}
public boolean contains(String[] proxiedList) {
- for (final String[] list : this.proxyChains) {
- if (Arrays.equals(proxiedList, list)) {
- return true;
- } else {
- //strings might be regex, so check for each string
- if (list.length == proxiedList.length) {
- boolean passed = false;
-
- for (int i=0; i
Date: Sun, 9 Mar 2014 23:13:04 -0400
Subject: [PATCH 082/239] CASC-214 Improve Service Url Construction to Add
Non-Standard Ports if Missing from Configuration
Problem: sometimes the port is missing from the configuration. This generates the wrong service url.
Solution: Add the server port if the server configuration does not have one.
QA Notes: Added unit tests to confirm behavior (and old unit tests still pass)
---
.../jasig/cas/client/util/CommonUtils.java | 28 +++++++++++++++++++
.../cas/client/util/CommonUtilsTests.java | 21 ++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index c767c5673..2b0d38094 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -225,6 +225,21 @@ protected static String findMatchingServerName(final HttpServletRequest request,
return serverNames[0];
}
+ private static boolean serverNameContainsPort(final boolean containsScheme, final String serverName) {
+ if (!containsScheme && serverName.contains(":")) {
+ return true;
+ }
+
+ final int schemeIndex = serverName.indexOf(":");
+ final int portIndex = serverName.lastIndexOf(":");
+ return schemeIndex != portIndex;
+ }
+
+ private static boolean requestIsOnStandardPort(final HttpServletRequest request) {
+ final int serverPort = request.getServerPort();
+ return serverPort == 80 || serverPort == 443;
+ }
+
/**
* Constructs a service url from the HttpServletRequest or from the given
* serviceUrl. Prefers the serviceUrl provided if both a serviceUrl and a
@@ -250,11 +265,24 @@ public static String constructServiceUrl(final HttpServletRequest request, final
final String serverName = findMatchingServerName(request, serverNames);
+ boolean containsScheme = true;
if (!serverName.startsWith("https://") && !serverName.startsWith("http://")) {
buffer.append(request.isSecure() ? "https://" : "http://");
+ containsScheme = false;
}
buffer.append(serverName);
+
+ final boolean serverNameContainsPort = serverNameContainsPort(containsScheme, serverName);
+ System.out.println("serverNameContainsPort " + serverNameContainsPort);
+ final boolean requestIsOnStandardPort = requestIsOnStandardPort(request);
+ System.out.println("requestIsOnStandardPort " + requestIsOnStandardPort);
+
+ if (!serverNameContainsPort(containsScheme, serverName) && !requestIsOnStandardPort(request)) {
+ buffer.append(":");
+ buffer.append(request.getServerPort());
+ }
+
buffer.append(request.getRequestURI());
if (CommonUtils.isNotBlank(request.getQueryString())) {
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index f6e686cf7..43967ab3e 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -136,6 +136,27 @@ public void testConstructServiceUrlWithTrailingSlash() {
assertEquals(CONST_MY_URL, constructedUrl);
}
+ private void constructUrlNonStandardPortAndNoPortInConfigTest(final String serverNameList) {
+ final String CONST_MY_URL = "https://www.myserver.com:555/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.addHeader("Host", "www.myserver.com");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setServerPort(555);
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null,
+ serverNameList, "ticket", false);
+ assertEquals(CONST_MY_URL, constructedUrl);
+ }
+
+ public void testConstructUrlNonStandardPortAndNoScheme() {
+ constructUrlNonStandardPortAndNoPortInConfigTest("www.myserver.com");
+ }
+
+ public void testConstructUrlNonStandardPortAndScheme() {
+ constructUrlNonStandardPortAndNoPortInConfigTest("https://www.myserver.com");
+ }
+
public void testConstructUrlWithMultipleHostsNoPortsOrProtocol() {
final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
From eec2d4ec51e0005c622c6533963155e0a7c8846c Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 9 Mar 2014 23:18:14 -0400
Subject: [PATCH 083/239] Removed debug statements used to confirm private
methods worked.
---
.../src/main/java/org/jasig/cas/client/util/CommonUtils.java | 5 -----
1 file changed, 5 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 2b0d38094..8fb90c74d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -273,11 +273,6 @@ public static String constructServiceUrl(final HttpServletRequest request, final
buffer.append(serverName);
- final boolean serverNameContainsPort = serverNameContainsPort(containsScheme, serverName);
- System.out.println("serverNameContainsPort " + serverNameContainsPort);
- final boolean requestIsOnStandardPort = requestIsOnStandardPort(request);
- System.out.println("requestIsOnStandardPort " + requestIsOnStandardPort);
-
if (!serverNameContainsPort(containsScheme, serverName) && !requestIsOnStandardPort(request)) {
buffer.append(":");
buffer.append(request.getServerPort());
From 8e256219da5775fc009403c05b296aa747bfd267 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Mon, 10 Mar 2014 05:22:44 -0700
Subject: [PATCH 084/239] CASC-219: Cleaned up formatting issues
---
.../jasig/cas/client/authentication/AuthenticationFilter.java | 1 -
.../cas/client/authentication/UrlPatternMatcherStrategy.java | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index c175442cd..9a6f08408 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -180,7 +180,6 @@ public final void setGatewayStorage(final GatewayResolver gatewayStorage) {
}
private boolean isRequestUrlExcluded(final HttpServletRequest request) {
-
if (this.ignoreUrlPatternMatcherStrategyClass == null) {
return false;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
index e72470e6b..2117a2aa5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
@@ -29,11 +29,11 @@ public interface UrlPatternMatcherStrategy {
* @param url the request url typically with query strings included
* @return true if match is successful
*/
- boolean matches(final String url);
+ boolean matches(String url);
/**
* The pattern against which the url is compared
* @param pattern
*/
- void setPattern(final String pattern);
+ void setPattern(String pattern);
}
From 0fd2dbd6599934872e2e9c2bcdeab30d8c40a1a5 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Tue, 11 Mar 2014 04:24:27 -0700
Subject: [PATCH 085/239] CASC-219: updated javadocs and added map to keep
track of pattern matchers
---
.../authentication/AuthenticationFilter.java | 32 +++++++++++--------
.../UrlPatternMatcherStrategy.java | 5 ++-
.../AuthenticationFilterTests.java | 4 +--
3 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 9a6f08408..900342c98 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -19,6 +19,8 @@
package org.jasig.cas.client.authentication;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
@@ -66,10 +68,18 @@ public class AuthenticationFilter extends AbstractCasFilter {
private GatewayResolver gatewayStorage = new DefaultGatewayResolverImpl();
+ private AuthenticationRedirectStrategy authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
+
private UrlPatternMatcherStrategy ignoreUrlPatternMatcherStrategyClass = null;
- private AuthenticationRedirectStrategy authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
-
+ private final Map> PATTERN_MATCHER_TYPES =
+ new HashMap>();
+
+ public AuthenticationFilter() {
+ this.PATTERN_MATCHER_TYPES.put("EXACT", ExactUrlPatternMatcherStrategy.class);
+ this.PATTERN_MATCHER_TYPES.put("REGEX", RegexUrlPatternMatcherStrategy.class);
+ }
+
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
super.initInternal(filterConfig);
@@ -83,16 +93,17 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
final String ignorePattern = getPropertyFromInitParams(filterConfig, "ignorePattern", null);
logger.trace("Loaded ignorePattern parameter: {}", ignorePattern);
- final String ignoreUrlMatcherClass = getPropertyFromInitParams(filterConfig, "ignoreUrlPatternMatcherStrategyClass", null);
- logger.trace("Loaded ignoreUrlPatternMatcherStrategyClass parameter: {}", ignoreUrlMatcherClass);
+ final String ignoreUrlPatternType = getPropertyFromInitParams(filterConfig, "ignoreUrlPatternType", "REGEX");
+ logger.trace("Loaded ignoreUrlPatternType parameter: {}", ignoreUrlPatternType);
if (ignorePattern != null ) {
+ final Class extends UrlPatternMatcherStrategy> ignoreUrlMatcherClass = this.PATTERN_MATCHER_TYPES.get(ignoreUrlPatternType);
if (ignoreUrlMatcherClass != null) {
- this.ignoreUrlPatternMatcherStrategyClass = ReflectUtils.newInstance(ignoreUrlMatcherClass);
+ this.ignoreUrlPatternMatcherStrategyClass = ReflectUtils.newInstance(ignoreUrlMatcherClass.getName());
+ this.ignoreUrlPatternMatcherStrategyClass.setPattern(ignorePattern);
} else {
- this.ignoreUrlPatternMatcherStrategyClass = new RegexUrlPatternMatcherStrategy();
+ logger.trace("Could not find and load: {}", ignoreUrlMatcherClass);
}
- this.ignoreUrlPatternMatcherStrategyClass.setPattern(ignorePattern);
}
final String gatewayStorageClass = getPropertyFromInitParams(filterConfig, "gatewayStorageClass", null);
@@ -100,13 +111,6 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
if (gatewayStorageClass != null) {
this.gatewayStorage = ReflectUtils.newInstance(gatewayStorageClass);
}
-
- final String authenticationRedirectStrategyClass = getPropertyFromInitParams(filterConfig,
- "authenticationRedirectStrategyClass", null);
-
- if (authenticationRedirectStrategyClass != null) {
- this.authenticationRedirectStrategy = ReflectUtils.newInstance(authenticationRedirectStrategyClass);
- }
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
index 2117a2aa5..a2e70e900 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/UrlPatternMatcherStrategy.java
@@ -19,7 +19,10 @@
package org.jasig.cas.client.authentication;
/**
* Defines an abstraction by which request urls can be matches against a given pattern.
- *
+ * New instances for all extensions for this strategy interface will be created per
+ * each request. The client will ultimately invoke the {@link #matches(String)} method
+ * having already applied and set the pattern via the {@link #setPattern(String)} method.
+ * The pattern itself will be retrieved via the client configuration.
* @author Misagh Moayyed
* @since 3.3.1
*/
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index f9b8b8fea..d52e18e51 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -245,13 +245,13 @@ public void doFilter(ServletRequest request, ServletResponse response) throws IO
}
@Test
- public void testIgnorePatternsWithNoRegex() throws Exception {
+ public void testIgnorePatternsWithExactMatching() throws Exception {
final AuthenticationFilter f = new AuthenticationFilter();
final MockServletContext context = new MockServletContext();
context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
context.addInitParameter("ignorePattern", "=valueToIgnore");
- context.addInitParameter("ignoreUrlPatternMatcherStrategyClass", ExactUrlPatternMatcherStrategy.class.getName());
+ context.addInitParameter("ignoreUrlPatternType", "EXACT");
context.addInitParameter("service", CAS_SERVICE_URL);
f.init(new MockFilterConfig(context));
From 1089e3de8917da9961ae7d7dc923af9f8b2f7f40 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Tue, 11 Mar 2014 05:04:59 -0700
Subject: [PATCH 086/239] CASC-219: allowed extensions for ignoring urls
---
.../authentication/AuthenticationFilter.java | 20 ++++++-
.../AuthenticationFilterTests.java | 58 +++++++++++++++++++
2 files changed, 75 insertions(+), 3 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 900342c98..d2fa5ef76 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -96,13 +96,20 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
final String ignoreUrlPatternType = getPropertyFromInitParams(filterConfig, "ignoreUrlPatternType", "REGEX");
logger.trace("Loaded ignoreUrlPatternType parameter: {}", ignoreUrlPatternType);
- if (ignorePattern != null ) {
+ if (ignorePattern != null) {
final Class extends UrlPatternMatcherStrategy> ignoreUrlMatcherClass = this.PATTERN_MATCHER_TYPES.get(ignoreUrlPatternType);
if (ignoreUrlMatcherClass != null) {
this.ignoreUrlPatternMatcherStrategyClass = ReflectUtils.newInstance(ignoreUrlMatcherClass.getName());
- this.ignoreUrlPatternMatcherStrategyClass.setPattern(ignorePattern);
} else {
- logger.trace("Could not find and load: {}", ignoreUrlMatcherClass);
+ try {
+ logger.trace("Assuming {} is a qualfiied class name...", ignoreUrlPatternType);
+ this.ignoreUrlPatternMatcherStrategyClass = ReflectUtils.newInstance(ignoreUrlPatternType);
+ } catch (final IllegalArgumentException e) {
+ logger.warn("Could not instantiate class [{}]: [{}]", ignoreUrlPatternType, e.getMessage());
+ }
+ }
+ if (this.ignoreUrlPatternMatcherStrategyClass != null) {
+ this.ignoreUrlPatternMatcherStrategyClass.setPattern(ignorePattern);
}
}
@@ -111,6 +118,13 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
if (gatewayStorageClass != null) {
this.gatewayStorage = ReflectUtils.newInstance(gatewayStorageClass);
}
+
+ final String authenticationRedirectStrategyClass = getPropertyFromInitParams(filterConfig,
+ "authenticationRedirectStrategyClass", null);
+
+ if (authenticationRedirectStrategyClass != null) {
+ this.authenticationRedirectStrategy = ReflectUtils.newInstance(authenticationRedirectStrategyClass);
+ }
}
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index d52e18e51..d0061884a 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -272,4 +272,62 @@ public void doFilter(ServletRequest request, ServletResponse response) throws IO
f.doFilter(request, response, filterChain);
assertNull(response.getRedirectedUrl());
}
+
+ @Test
+ public void testIgnorePatternsWithExactClassname() throws Exception {
+ final AuthenticationFilter f = new AuthenticationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
+
+ context.addInitParameter("ignorePattern", "=valueToIgnore");
+ context.addInitParameter("ignoreUrlPatternType", ExactUrlPatternMatcherStrategy.class.getName());
+ context.addInitParameter("service", CAS_SERVICE_URL);
+ f.init(new MockFilterConfig(context));
+
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final String URL = CAS_SERVICE_URL + "?param=valueToIgnore";
+ request.setRequestURI(URL);
+
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ final FilterChain filterChain = new FilterChain() {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ }
+ };
+
+ f.doFilter(request, response, filterChain);
+ assertNull(response.getRedirectedUrl());
+ }
+
+ @Test
+ public void testIgnorePatternsWithInvalidClassname() throws Exception {
+ final AuthenticationFilter f = new AuthenticationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
+
+ context.addInitParameter("ignorePattern", "=valueToIgnore");
+ context.addInitParameter("ignoreUrlPatternType", "unknown.class.name");
+ context.addInitParameter("service", CAS_SERVICE_URL);
+ f.init(new MockFilterConfig(context));
+
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final String URL = CAS_SERVICE_URL + "?param=valueToIgnore";
+ request.setRequestURI(URL);
+
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ final FilterChain filterChain = new FilterChain() {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ }
+ };
+
+ f.doFilter(request, response, filterChain);
+ System.out.println(response.getRedirectedUrl());
+ }
}
From 2aa02e253fdbab53e01280835854488ce7650203 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Tue, 11 Mar 2014 07:11:53 -0700
Subject: [PATCH 087/239] CASC-219: updated internal map to be a static ref
instead
---
.../cas/client/authentication/AuthenticationFilter.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index d2fa5ef76..25d525bba 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -72,12 +72,12 @@ public class AuthenticationFilter extends AbstractCasFilter {
private UrlPatternMatcherStrategy ignoreUrlPatternMatcherStrategyClass = null;
- private final Map> PATTERN_MATCHER_TYPES =
+ private static final Map> PATTERN_MATCHER_TYPES =
new HashMap>();
- public AuthenticationFilter() {
- this.PATTERN_MATCHER_TYPES.put("EXACT", ExactUrlPatternMatcherStrategy.class);
- this.PATTERN_MATCHER_TYPES.put("REGEX", RegexUrlPatternMatcherStrategy.class);
+ static {
+ PATTERN_MATCHER_TYPES.put("EXACT", ExactUrlPatternMatcherStrategy.class);
+ PATTERN_MATCHER_TYPES.put("REGEX", RegexUrlPatternMatcherStrategy.class);
}
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
From df336da4de98d7d5dbf593d276c85d4a7e70469c Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Tue, 11 Mar 2014 08:46:00 -0700
Subject: [PATCH 088/239] CASC-219: switched warn to error, fixed typo and this
refs
---
.../cas/client/authentication/AuthenticationFilter.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 25d525bba..c7e225d77 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -50,7 +50,6 @@
* @since 3.0
*/
public class AuthenticationFilter extends AbstractCasFilter {
-
/**
* The URL to the CAS Server login.
*/
@@ -97,15 +96,15 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
logger.trace("Loaded ignoreUrlPatternType parameter: {}", ignoreUrlPatternType);
if (ignorePattern != null) {
- final Class extends UrlPatternMatcherStrategy> ignoreUrlMatcherClass = this.PATTERN_MATCHER_TYPES.get(ignoreUrlPatternType);
+ final Class extends UrlPatternMatcherStrategy> ignoreUrlMatcherClass = PATTERN_MATCHER_TYPES.get(ignoreUrlPatternType);
if (ignoreUrlMatcherClass != null) {
this.ignoreUrlPatternMatcherStrategyClass = ReflectUtils.newInstance(ignoreUrlMatcherClass.getName());
} else {
try {
- logger.trace("Assuming {} is a qualfiied class name...", ignoreUrlPatternType);
+ logger.trace("Assuming {} is a qualified class name...", ignoreUrlPatternType);
this.ignoreUrlPatternMatcherStrategyClass = ReflectUtils.newInstance(ignoreUrlPatternType);
} catch (final IllegalArgumentException e) {
- logger.warn("Could not instantiate class [{}]: [{}]", ignoreUrlPatternType, e.getMessage());
+ logger.error("Could not instantiate class [{}]", ignoreUrlPatternType, e);
}
}
if (this.ignoreUrlPatternMatcherStrategyClass != null) {
From e18232e2386c348b5c558b7704f87f238be39d7b Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 12 Mar 2014 07:37:59 -0700
Subject: [PATCH 089/239] CASC-219: renamed matcher class to match behavior
---
.../jasig/cas/client/authentication/AuthenticationFilter.java | 2 +-
...ategy.java => ContainsPatternUrlPatternMatcherStrategy.java} | 2 +-
.../cas/client/authentication/AuthenticationFilterTests.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename cas-client-core/src/main/java/org/jasig/cas/client/authentication/{ExactUrlPatternMatcherStrategy.java => ContainsPatternUrlPatternMatcherStrategy.java} (92%)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index c7e225d77..8ab5d816e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -75,7 +75,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
new HashMap>();
static {
- PATTERN_MATCHER_TYPES.put("EXACT", ExactUrlPatternMatcherStrategy.class);
+ PATTERN_MATCHER_TYPES.put("EXACT", ContainsPatternUrlPatternMatcherStrategy.class);
PATTERN_MATCHER_TYPES.put("REGEX", RegexUrlPatternMatcherStrategy.class);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ContainsPatternUrlPatternMatcherStrategy.java
similarity index 92%
rename from cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
rename to cas-client-core/src/main/java/org/jasig/cas/client/authentication/ContainsPatternUrlPatternMatcherStrategy.java
index befe6ee0d..153248146 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ContainsPatternUrlPatternMatcherStrategy.java
@@ -24,7 +24,7 @@
* @author Misagh Moayyed
* @since 3.3.1
*/
-public class ExactUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
+public class ContainsPatternUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
private String pattern;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index d0061884a..d5cffe679 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -280,7 +280,7 @@ public void testIgnorePatternsWithExactClassname() throws Exception {
context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
context.addInitParameter("ignorePattern", "=valueToIgnore");
- context.addInitParameter("ignoreUrlPatternType", ExactUrlPatternMatcherStrategy.class.getName());
+ context.addInitParameter("ignoreUrlPatternType", ContainsPatternUrlPatternMatcherStrategy.class.getName());
context.addInitParameter("service", CAS_SERVICE_URL);
f.init(new MockFilterConfig(context));
From 05570e4d187bb30d25cd56e81da08921f816077d Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Thu, 13 Mar 2014 03:20:39 -0700
Subject: [PATCH 090/239] CASC-219: changed exact to contains
---
.../jasig/cas/client/authentication/AuthenticationFilter.java | 2 +-
.../cas/client/authentication/AuthenticationFilterTests.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 8ab5d816e..42b6817e5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -75,7 +75,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
new HashMap>();
static {
- PATTERN_MATCHER_TYPES.put("EXACT", ContainsPatternUrlPatternMatcherStrategy.class);
+ PATTERN_MATCHER_TYPES.put("CONTAINS", ContainsPatternUrlPatternMatcherStrategy.class);
PATTERN_MATCHER_TYPES.put("REGEX", RegexUrlPatternMatcherStrategy.class);
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index d5cffe679..3320a0d05 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -251,7 +251,7 @@ public void testIgnorePatternsWithExactMatching() throws Exception {
context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
context.addInitParameter("ignorePattern", "=valueToIgnore");
- context.addInitParameter("ignoreUrlPatternType", "EXACT");
+ context.addInitParameter("ignoreUrlPatternType", "CONTAINS");
context.addInitParameter("service", CAS_SERVICE_URL);
f.init(new MockFilterConfig(context));
From 4237e24bc0c79b408f0839894e139256850d4c6c Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Thu, 13 Mar 2014 08:26:22 -0700
Subject: [PATCH 091/239] CASC-219: added exact-matcher strategy
---
.../authentication/AuthenticationFilter.java | 1 +
.../ExactUrlPatternMatcherStrategy.java | 22 ++++++++++
.../AuthenticationFilterTests.java | 40 ++++++++++++++++++-
3 files changed, 62 insertions(+), 1 deletion(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index 42b6817e5..b77c64c45 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -77,6 +77,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
static {
PATTERN_MATCHER_TYPES.put("CONTAINS", ContainsPatternUrlPatternMatcherStrategy.class);
PATTERN_MATCHER_TYPES.put("REGEX", RegexUrlPatternMatcherStrategy.class);
+ PATTERN_MATCHER_TYPES.put("EXACT", ExactUrlPatternMatcherStrategy.class);
}
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
new file mode 100644
index 000000000..0a5b42f4b
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
@@ -0,0 +1,22 @@
+package org.jasig.cas.client.authentication;
+
+/**
+ * A pattern matcher that produces a successful match if the pattern
+ * specified matches the given url exactly and equally.
+ *
+ * @author Misagh Moayyed
+ * @since 3.3.1
+ */
+public class ExactUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
+
+ private String pattern;
+
+ public boolean matches(final String url) {
+ return url.equals(this.pattern);
+ }
+
+ public void setPattern(final String pattern) {
+ this.pattern = pattern;
+ }
+
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
index 3320a0d05..48479a5dd 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/authentication/AuthenticationFilterTests.java
@@ -19,13 +19,17 @@
package org.jasig.cas.client.authentication;
import static org.junit.Assert.*;
+
import java.io.IOException;
import java.lang.reflect.Field;
+import java.net.URL;
import java.net.URLEncoder;
+
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.AssertionImpl;
import org.junit.After;
@@ -245,7 +249,7 @@ public void doFilter(ServletRequest request, ServletResponse response) throws IO
}
@Test
- public void testIgnorePatternsWithExactMatching() throws Exception {
+ public void testIgnorePatternsWithContainsMatching() throws Exception {
final AuthenticationFilter f = new AuthenticationFilter();
final MockServletContext context = new MockServletContext();
context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
@@ -273,6 +277,40 @@ public void doFilter(ServletRequest request, ServletResponse response) throws IO
assertNull(response.getRedirectedUrl());
}
+ @Test
+ public void testIgnorePatternsWithExactMatching() throws Exception {
+ final AuthenticationFilter f = new AuthenticationFilter();
+ final MockServletContext context = new MockServletContext();
+ context.addInitParameter("casServerLoginUrl", CAS_LOGIN_URL);
+
+ final URL url = new URL(CAS_SERVICE_URL + "?param=valueToIgnore");
+
+ context.addInitParameter("ignorePattern", url.toExternalForm());
+ context.addInitParameter("ignoreUrlPatternType", "EXACT");
+ context.addInitParameter("service", CAS_SERVICE_URL);
+ f.init(new MockFilterConfig(context));
+
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ request.setScheme(url.getProtocol());
+ request.setServerName(url.getHost());
+ request.setServerPort(url.getPort());
+ request.setQueryString(url.getQuery());
+ request.setRequestURI(url.getPath());
+
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ final FilterChain filterChain = new FilterChain() {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ }
+ };
+
+ f.doFilter(request, response, filterChain);
+ assertNull(response.getRedirectedUrl());
+ }
+
@Test
public void testIgnorePatternsWithExactClassname() throws Exception {
final AuthenticationFilter f = new AuthenticationFilter();
From 23a4abe3cb347efa2167d965187db43d080d29cd Mon Sep 17 00:00:00 2001
From: LELEU Jerome
Date: Thu, 13 Mar 2014 19:03:41 +0100
Subject: [PATCH 092/239] CASC-220: Support front channel SLO logout
First commit
---
.../client/session/SingleSignOutFilter.java | 51 +++++-
.../client/session/SingleSignOutHandler.java | 76 ++++++++-
.../jasig/cas/client/util/CommonUtils.java | 15 +-
.../session/LogoutMessageGenerator.java | 37 ++++
.../session/SingleSignOutFilterTests.java | 118 +++++++++++++
.../session/SingleSignOutHandlerTests.java | 160 ++++++++++++++++++
.../session/SingleSignoutHandlerTests.java | 68 --------
.../cas/client/util/CommonUtilsTests.java | 4 +
8 files changed, 449 insertions(+), 80 deletions(-)
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
delete mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignoutHandlerTests.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index 109791d2b..1126218ca 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -21,7 +21,11 @@
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
import org.jasig.cas.client.util.AbstractConfigurationFilter;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Implements the Single Sign Out protocol. It handles registering the session and destroying the session.
@@ -34,15 +38,25 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
private static final SingleSignOutHandler handler = new SingleSignOutHandler();
+ /** The prefix url of the CAS server */
+ private String casServerUrlPrefix;
+
+ /** Parameter name that stores the state of the CAS server webflow for the callback */
+ private String relayStateParameterName = SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME;
+
public void init(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
- handler.setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName", "ticket"));
+ handler.setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName",
+ SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME));
handler.setLogoutParameterName(getPropertyFromInitParams(filterConfig, "logoutParameterName",
- "logoutRequest"));
+ SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME));
+ setRelayStateParameterName(getPropertyFromInitParams(filterConfig, "relayStateParameterName",
+ SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME));
handler.setArtifactParameterOverPost(parseBoolean(getPropertyFromInitParams(filterConfig,
"artifactParameterOverPost", "false")));
handler.setEagerlyCreateSessions(parseBoolean(getPropertyFromInitParams(filterConfig,
"eagerlyCreateSessions", "true")));
+ setCasServerUrlPrefix(getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null));
}
handler.init();
}
@@ -55,20 +69,51 @@ public void setLogoutParameterName(final String name) {
handler.setLogoutParameterName(name);
}
+ public void setRelayStateParameterName(final String name) {
+ this.relayStateParameterName = name;
+ handler.setRelayStateParameterName(name);
+ }
+
public void setSessionMappingStorage(final SessionMappingStorage storage) {
handler.setSessionMappingStorage(storage);
}
+ public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
+ CommonUtils.assertNotNull(casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
+ this.casServerUrlPrefix = casServerUrlPrefix;
+ }
+
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
final FilterChain filterChain) throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) servletRequest;
+ final HttpServletResponse response = (HttpServletResponse) servletResponse;
if (handler.isTokenRequest(request)) {
handler.recordSession(request);
- } else if (handler.isLogoutRequest(request)) {
+ } else if (handler.isBackChannelLogoutRequest(request)) {
handler.destroySession(request);
// Do not continue up filter chain
return;
+ } else if (handler.isFrontChannelLogoutRequest(request)) {
+ handler.destroySession(request);
+ // relay state value
+ final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName);
+ // if we have a state value -> redirect to the CAS server to continue the logout process
+ if (StringUtils.isNotBlank(relayStateValue)) {
+ final StringBuffer buffer = new StringBuffer();
+ buffer.append(casServerUrlPrefix);
+ if (!this.casServerUrlPrefix.endsWith("/")) {
+ buffer.append("/");
+ }
+ buffer.append("logout?_eventId=next&");
+ buffer.append(this.relayStateParameterName);
+ buffer.append("=");
+ buffer.append(CommonUtils.urlEncode(relayStateValue));
+ final String redirectUrl = buffer.toString();
+ logger.debug("Redirecting back to the CAS server: {}", redirectUrl);
+ CommonUtils.sendRedirect(response, redirectUrl);
+ }
+ return;
} else {
logger.trace("Ignoring URI {}", request.getRequestURI());
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 943aa6b07..873d322da 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -18,14 +18,18 @@
*/
package org.jasig.cas.client.session;
+import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.List;
+import java.util.zip.DataFormatException;
+import java.util.zip.Inflater;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+
+import org.apache.commons.codec.binary.Base64;
import org.jasig.cas.client.util.CommonUtils;
-import org.jasig.cas.client.util.ReflectUtils;
import org.jasig.cas.client.util.XmlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,6 +44,10 @@
*/
public final class SingleSignOutHandler {
+ public final static String DEFAULT_ARTIFACT_PARAMETER_NAME = "ticket";
+ public final static String DEFAULT_LOGOUT_PARAMETER_NAME = "logoutRequest";
+ public final static String DEFAULT_RELAY_STATE_PARAMETER_NAME = "RelayState";
+
/** Logger instance */
private final Logger logger = LoggerFactory.getLogger(getClass());
@@ -47,11 +55,14 @@ public final class SingleSignOutHandler {
private SessionMappingStorage sessionMappingStorage = new HashMapBackedSessionMappingStorage();
/** The name of the artifact parameter. This is used to capture the session identifier. */
- private String artifactParameterName = "ticket";
+ private String artifactParameterName = DEFAULT_ARTIFACT_PARAMETER_NAME;
/** Parameter name that stores logout request */
- private String logoutParameterName = "logoutRequest";
+ private String logoutParameterName = DEFAULT_LOGOUT_PARAMETER_NAME;
+ /** Parameter name that stores the state of the CAS server webflow for the callback */
+ private String relayStateParameterName = DEFAULT_RELAY_STATE_PARAMETER_NAME;
+
private boolean artifactParameterOverPost = false;
private boolean eagerlyCreateSessions = true;
@@ -84,6 +95,13 @@ public void setLogoutParameterName(final String name) {
this.logoutParameterName = name;
}
+ /**
+ * @param name Name of parameter containing the state of the CAS server webflow.
+ */
+ public void setRelayStateParameterName(final String name) {
+ this.relayStateParameterName = name;
+ }
+
public void setEagerlyCreateSessions(final boolean eagerlyCreateSessions) {
this.eagerlyCreateSessions = eagerlyCreateSessions;
}
@@ -95,6 +113,7 @@ public void init() {
CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null.");
CommonUtils.assertNotNull(this.logoutParameterName, "logoutParameterName cannot be null.");
CommonUtils.assertNotNull(this.sessionMappingStorage, "sessionMappingStorage cannot be null.");
+ CommonUtils.assertNotNull(this.relayStateParameterName, "relayStateParameterName cannot be null.");
if (this.artifactParameterOverPost) {
this.safeParameters = Arrays.asList(this.logoutParameterName, this.artifactParameterName);
@@ -116,19 +135,31 @@ public boolean isTokenRequest(final HttpServletRequest request) {
}
/**
- * Determines whether the given request is a CAS logout request.
+ * Determines whether the given request is a CAS back channel logout request.
*
* @param request HTTP request.
*
* @return True if request is logout request, false otherwise.
*/
- public boolean isLogoutRequest(final HttpServletRequest request) {
+ public boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
return "POST".equals(request.getMethod())
&& !isMultipartRequest(request)
&& CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName,
this.safeParameters));
}
+ /**
+ * Determines whether the given request is a CAS front channel logout request.
+ *
+ * @param request HTTP request.
+ *
+ * @return True if request is logout request, false otherwise.
+ */
+ public boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
+ return "GET".equals(request.getMethod())
+ && CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName));
+ }
+
/**
* Associates a token request with the current HTTP session by recording the mapping
* in the the configured {@link SessionMappingStorage} container.
@@ -154,14 +185,47 @@ public void recordSession(final HttpServletRequest request) {
sessionMappingStorage.addSessionById(token, session);
}
+ /**
+ * Uncompress a logout message (base64 + deflate).
+ *
+ * @param originalMessage the original logout message.
+ * @return the uncompressed logout message.
+ */
+ private String uncompressLogoutMessage(final String originalMessage) {
+ // base64 decode
+ final byte[] binaryMessage = Base64.decodeBase64(originalMessage);
+
+ try {
+ // decompress the bytes
+ final Inflater decompresser = new Inflater();
+ decompresser.setInput(binaryMessage);
+ byte[] result = new byte[binaryMessage.length * 10];
+ int resultLength = decompresser.inflate(result);
+ decompresser.end();
+
+ // decode the bytes into a String
+ return new String(result, 0, resultLength, "UTF-8");
+ } catch (DataFormatException e) {
+ logger.error("Unable to decompress logout message", e);
+ throw new RuntimeException(e);
+ } catch (UnsupportedEncodingException e) {
+ logger.error("Unable to decompress logout message", e);
+ throw new RuntimeException(e);
+ }
+ }
+
/**
* Destroys the current HTTP session for the given CAS logout request.
*
* @param request HTTP request containing a CAS logout message.
*/
public void destroySession(final HttpServletRequest request) {
- final String logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName,
+ String logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName,
this.safeParameters);
+ // front channel request -> the message needs to be base64 decoded + decompressed
+ if ("GET".equals(request.getMethod())) {
+ logoutMessage = uncompressLogoutMessage(logoutMessage);
+ }
logger.trace("Logout request:\n{}", logoutMessage);
final String token = XmlUtils.getTextForElement(logoutMessage, "SessionIndex");
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index c767c5673..be705f4ab 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -160,10 +160,19 @@ public static boolean isNotBlank(final String string) {
*/
public static String constructRedirectUrl(final String casServerLoginUrl, final String serviceParameterName,
final String serviceUrl, final boolean renew, final boolean gateway) {
+ return casServerLoginUrl + (casServerLoginUrl.contains("?") ? "&" : "?") + serviceParameterName + "="
+ + urlEncode(serviceUrl) + (renew ? "&renew=true" : "") + (gateway ? "&gateway=true" : "");
+ }
+
+ /**
+ * Url encode a value using UTF-8 encoding.
+ *
+ * @param value the value to encode.
+ * @return the encoded value.
+ */
+ public static String urlEncode(String value) {
try {
- return casServerLoginUrl + (casServerLoginUrl.contains("?") ? "&" : "?") + serviceParameterName + "="
- + URLEncoder.encode(serviceUrl, "UTF-8") + (renew ? "&renew=true" : "")
- + (gateway ? "&gateway=true" : "");
+ return URLEncoder.encode(value, "UTF-8");
} catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
new file mode 100644
index 000000000..e30254dda
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
@@ -0,0 +1,37 @@
+package org.jasig.cas.client.session;
+
+import java.nio.charset.Charset;
+import java.util.zip.Deflater;
+
+import org.apache.commons.codec.binary.Base64;
+
+/**
+ * Logout message generator to perform tests on Single Sign Out feature.
+ * Greatly inspired by the source code in the CAS server itself.
+ *
+ * @author Jerome Leleu
+ * @since 3.3.1
+ */
+public final class LogoutMessageGenerator {
+
+ private static final String LOGOUT_REQUEST_TEMPLATE =
+ "@NOT_USED@"
+ + "%s";
+
+ public static String generateLogoutMessage(String sessionIndex) {
+ return String.format(LOGOUT_REQUEST_TEMPLATE, sessionIndex);
+ }
+
+ public static String generateCompressedLogoutMessage(String sessionIndex) {
+ final String logoutMessage = generateLogoutMessage(sessionIndex);
+ final Deflater deflater = new Deflater();
+ deflater.setInput(logoutMessage.getBytes(Charset.forName("ASCII")));
+ deflater.finish();
+ final byte[] buffer = new byte[logoutMessage.length()];
+ final int resultSize = deflater.deflate(buffer);
+ final byte[] output = new byte[resultSize];
+ System.arraycopy(buffer, 0, output, 0, resultSize);
+ return Base64.encodeBase64String(output);
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
new file mode 100644
index 000000000..82ecd52a7
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.session;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockFilterChain;
+import org.springframework.mock.web.MockFilterConfig;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockHttpSession;
+
+/**
+ * Tests {@link SingleSignOutFilter}.
+ *
+ * @author Jerome Leleu
+ * @since 3.3.1
+ */
+public class SingleSignOutFilterTests {
+
+ private final static String CAS_SERVER_URL_PREFIX = "http://myhost.com/mycasserver";
+ private final static String TICKET = "ST-yyyyy";
+ private final static String RELAY_STATE = "e1s1";
+
+ private SingleSignOutFilter filter = new SingleSignOutFilter();
+ private MockHttpServletRequest request;
+ private MockHttpServletResponse response;
+ private MockFilterChain filterChain;
+
+ @Before
+ public void setUp() throws Exception {
+ filter = new SingleSignOutFilter();
+ filter.setCasServerUrlPrefix(CAS_SERVER_URL_PREFIX);
+ filter.setIgnoreInitConfiguration(true);
+ filter.init(new MockFilterConfig());
+ request = new MockHttpServletRequest();
+ response = new MockHttpServletResponse();
+ filterChain = new MockFilterChain();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void initWithoutCasServerUrlPrefix() throws ServletException {
+ filter = new SingleSignOutFilter();
+ filter.init(new MockFilterConfig());
+ }
+
+ @Test
+ public void tokenRequest() throws IOException, ServletException {
+ request.setParameter(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME, TICKET);
+ request.setQueryString(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME + "=" + TICKET);
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+ filter.doFilter(request, response, filterChain);
+ assertEquals(session, SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
+ }
+
+ @Test
+ public void backChannelRequest() throws IOException, ServletException {
+ request.setParameter(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME, LogoutMessageGenerator.generateLogoutMessage(TICKET));
+ request.setMethod("POST");
+ final MockHttpSession session = new MockHttpSession();
+ SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
+ filter.doFilter(request, response, filterChain);
+ assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
+ }
+
+ @Test
+ public void frontChannelRequest() throws IOException, ServletException {
+ final String logoutMessage = LogoutMessageGenerator.generateCompressedLogoutMessage(TICKET);
+ request.setParameter(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setQueryString(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
+ request.setMethod("GET");
+ final MockHttpSession session = new MockHttpSession();
+ SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
+ filter.doFilter(request, response, filterChain);
+ assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
+ assertNull(response.getRedirectedUrl());
+ }
+
+ @Test
+ public void frontChannelRequestRelayState() throws IOException, ServletException {
+ final String logoutMessage = LogoutMessageGenerator.generateCompressedLogoutMessage(TICKET);
+ request.setParameter(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setParameter(SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME, RELAY_STATE);
+ request.setQueryString(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage + "&" +
+ SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME + "=" + RELAY_STATE);
+ request.setMethod("GET");
+ final MockHttpSession session = new MockHttpSession();
+ SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
+ filter.doFilter(request, response, filterChain);
+ assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
+ assertEquals(CAS_SERVER_URL_PREFIX + "/logout?_eventId=next&" +
+ SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME + "=" + RELAY_STATE, response.getRedirectedUrl());
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
new file mode 100644
index 000000000..14795369d
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.session;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpSession;
+
+/**
+ * @author Matt Brown
+ * @version $Revision$ $Date$
+ * @since 3.2.1
+ */
+public final class SingleSignOutHandlerTests {
+
+ private final static String ANOTHER_PARAMETER = "anotherParameter";
+ private final static String TICKET = "ST-xxxxxxxx";
+
+ private SingleSignOutHandler handler;
+ private MockHttpServletRequest request;
+ private final static String logoutParameterName = "logoutRequest";
+
+ @Before
+ public void setUp() throws Exception {
+ handler = new SingleSignOutHandler();
+ handler.setLogoutParameterName(logoutParameterName);
+ handler.init();
+ request = new MockHttpServletRequest();
+ }
+
+ @Test
+ public void isBackChannelLogoutRequest() throws Exception {
+ request.setParameter(logoutParameterName, TICKET);
+ request.setMethod("POST");
+
+ assertTrue(handler.isBackChannelLogoutRequest(request));
+ }
+
+ /**
+ * Tests that a multipart request is not considered logoutRequest. Verifies issue CASC-147.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void isBackChannelLogoutRequestMultipart() throws Exception {
+ request.setParameter(logoutParameterName, TICKET);
+ request.setMethod("POST");
+ request.setContentType("multipart/form-data");
+
+ assertFalse(handler.isBackChannelLogoutRequest(request));
+ }
+
+ @Test
+ public void isFrontChannelLogoutRequest() {
+ request.setParameter(logoutParameterName, TICKET);
+ request.setMethod("GET");
+ request.setQueryString(logoutParameterName + "=" + TICKET);
+
+ assertTrue(handler.isFrontChannelLogoutRequest(request));
+ }
+
+ @Test
+ public void isFrontChannelLogoutRequestKO() {
+ request.setParameter(ANOTHER_PARAMETER, TICKET);
+ request.setMethod("GET");
+ request.setQueryString(ANOTHER_PARAMETER + "=" + TICKET);
+
+ assertFalse(handler.isFrontChannelLogoutRequest(request));
+ }
+
+ @Test
+ public void recordSessionKOIfNoSession() {
+ handler.setEagerlyCreateSessions(false);
+ request.setSession(null);
+ request.setParameter(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME, TICKET);
+ request.setQueryString(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME + "=" + TICKET);
+ handler.recordSession(request);
+ final SessionMappingStorage storage = handler.getSessionMappingStorage();
+ assertNull(storage.removeSessionByMappingId(TICKET));
+ }
+
+ @Test
+ public void recordSessionOK() {
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
+ request.setParameter(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME, TICKET);
+ request.setQueryString(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME + "=" + TICKET);
+ handler.recordSession(request);
+ final SessionMappingStorage storage = handler.getSessionMappingStorage();
+ assertEquals(session, storage.removeSessionByMappingId(TICKET));
+ }
+
+ @Test
+ public void destorySessionPOSTKONoSessionIndex() {
+ final String logoutMessage = LogoutMessageGenerator.generateLogoutMessage("");
+ request.setParameter(logoutParameterName, logoutMessage);
+ request.setMethod("POST");
+ final MockHttpSession session = new MockHttpSession();
+ handler.getSessionMappingStorage().addSessionById(TICKET, session);
+ handler.destroySession(request);
+ assertFalse(session.isInvalid());
+ }
+
+ @Test
+ public void destorySessionPOST() {
+ final String logoutMessage = LogoutMessageGenerator.generateLogoutMessage(TICKET);
+ request.setParameter(logoutParameterName, logoutMessage);
+ request.setMethod("POST");
+ final MockHttpSession session = new MockHttpSession();
+ handler.getSessionMappingStorage().addSessionById(TICKET, session);
+ handler.destroySession(request);
+ assertTrue(session.isInvalid());
+ }
+
+ @Test
+ public void destorySessionGETNoSessionIndex() {
+ final String logoutMessage = LogoutMessageGenerator.generateCompressedLogoutMessage("");
+ request.setParameter(logoutParameterName, logoutMessage);
+ request.setQueryString(logoutParameterName + "=" + logoutMessage);
+ request.setMethod("GET");
+ final MockHttpSession session = new MockHttpSession();
+ handler.getSessionMappingStorage().addSessionById(TICKET, session);
+ handler.destroySession(request);
+ assertFalse(session.isInvalid());
+ }
+
+ @Test
+ public void destorySessionGET() {
+ final String logoutMessage = LogoutMessageGenerator.generateCompressedLogoutMessage(TICKET);
+ request.setParameter(logoutParameterName, logoutMessage);
+ request.setQueryString(logoutParameterName + "=" + logoutMessage);
+ request.setMethod("GET");
+ final MockHttpSession session = new MockHttpSession();
+ handler.getSessionMappingStorage().addSessionById(TICKET, session);
+ handler.destroySession(request);
+ assertTrue(session.isInvalid());
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignoutHandlerTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignoutHandlerTests.java
deleted file mode 100644
index 0e4283001..000000000
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignoutHandlerTests.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to Jasig under one or more contributor license
- * agreements. See the NOTICE file distributed with this work
- * for additional information regarding copyright ownership.
- * Jasig licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a
- * copy of the License at the following location:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jasig.cas.client.session;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.mock.web.MockHttpServletRequest;
-
-/**
- * @author Matt Brown
- * @version $Revision$ $Date$
- * @since 3.2.1
- */
-public final class SingleSignoutHandlerTests {
-
- private SingleSignOutHandler handler;
- private MockHttpServletRequest request;
- private final static String logoutParameterName = "logoutRequest";
-
- @Before
- public void setUp() throws Exception {
- handler = new SingleSignOutHandler();
- handler.setLogoutParameterName(logoutParameterName);
- handler.init();
- request = new MockHttpServletRequest();
- }
-
- @Test
- public void isLogoutRequest() throws Exception {
- request.setParameter(logoutParameterName, "true");
- request.setMethod("POST");
-
- assertTrue(handler.isLogoutRequest(request));
- }
-
- /**
- * Tests that a multipart request is not considered logoutRequest. Verifies issue CASC-147.
- *
- * @throws Exception
- */
- @Test
- public void isLogoutRequestMultipart() throws Exception {
- request.setParameter(logoutParameterName, "true");
- request.setMethod("POST");
- request.setContentType("multipart/form-data");
-
- assertFalse(handler.isLogoutRequest(request));
- }
-
-}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index f6e686cf7..66d49f195 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -167,4 +167,8 @@ public void testGetResponseFromServer() throws Exception {
final String responsedContent = CommonUtils.getResponseFromServer(new URL("http://localhost:8090"), new HttpsURLConnectionFactory(), null);
assertEquals(RESPONSE, responsedContent);
}
+
+ public void testUrlEncode() {
+ assertEquals("this+is+a+very+special+parameter+with+%3D%25%2F", CommonUtils.urlEncode("this is a very special parameter with =%/"));
+ }
}
From 8d43caa0c993debb905ea452656976ca89a4cfe1 Mon Sep 17 00:00:00 2001
From: LELEU Jerome
Date: Fri, 14 Mar 2014 10:52:42 +0100
Subject: [PATCH 093/239] CASC-220: Support front channel SLO logout
specific front logout parameter + Tomcat valves update
---
.../client/session/SingleSignOutFilter.java | 47 +++++--------
.../client/session/SingleSignOutHandler.java | 68 +++++++++++++++++--
.../session/LogoutMessageGenerator.java | 6 +-
.../session/SingleSignOutFilterTests.java | 15 ++--
.../session/SingleSignOutHandlerTests.java | 51 ++++++++++----
.../client/tomcat/v6/SingleSignOutValve.java | 23 ++++++-
.../client/tomcat/v7/SingleSignOutValve.java | 23 ++++++-
7 files changed, 168 insertions(+), 65 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index 1126218ca..92235dc46 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -23,7 +23,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.lang.StringUtils;
import org.jasig.cas.client.util.AbstractConfigurationFilter;
import org.jasig.cas.client.util.CommonUtils;
@@ -38,25 +37,21 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
private static final SingleSignOutHandler handler = new SingleSignOutHandler();
- /** The prefix url of the CAS server */
- private String casServerUrlPrefix;
-
- /** Parameter name that stores the state of the CAS server webflow for the callback */
- private String relayStateParameterName = SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME;
-
public void init(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
handler.setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName",
SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME));
handler.setLogoutParameterName(getPropertyFromInitParams(filterConfig, "logoutParameterName",
SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME));
- setRelayStateParameterName(getPropertyFromInitParams(filterConfig, "relayStateParameterName",
+ handler.setFrontLogoutParameterName(getPropertyFromInitParams(filterConfig, "frontLogoutParameterName",
+ SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME));
+ handler.setRelayStateParameterName(getPropertyFromInitParams(filterConfig, "relayStateParameterName",
SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME));
+ handler.setCasServerUrlPrefix(getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null));
handler.setArtifactParameterOverPost(parseBoolean(getPropertyFromInitParams(filterConfig,
"artifactParameterOverPost", "false")));
handler.setEagerlyCreateSessions(parseBoolean(getPropertyFromInitParams(filterConfig,
"eagerlyCreateSessions", "true")));
- setCasServerUrlPrefix(getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null));
}
handler.init();
}
@@ -69,18 +64,20 @@ public void setLogoutParameterName(final String name) {
handler.setLogoutParameterName(name);
}
+ public void setFrontLogoutParameterName(final String name) {
+ handler.setFrontLogoutParameterName(name);
+ }
+
public void setRelayStateParameterName(final String name) {
- this.relayStateParameterName = name;
handler.setRelayStateParameterName(name);
}
- public void setSessionMappingStorage(final SessionMappingStorage storage) {
- handler.setSessionMappingStorage(storage);
+ public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
+ handler.setCasServerUrlPrefix(casServerUrlPrefix);
}
- public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
- CommonUtils.assertNotNull(casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
- this.casServerUrlPrefix = casServerUrlPrefix;
+ public void setSessionMappingStorage(final SessionMappingStorage storage) {
+ handler.setSessionMappingStorage(storage);
}
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
@@ -96,22 +93,10 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
return;
} else if (handler.isFrontChannelLogoutRequest(request)) {
handler.destroySession(request);
- // relay state value
- final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName);
- // if we have a state value -> redirect to the CAS server to continue the logout process
- if (StringUtils.isNotBlank(relayStateValue)) {
- final StringBuffer buffer = new StringBuffer();
- buffer.append(casServerUrlPrefix);
- if (!this.casServerUrlPrefix.endsWith("/")) {
- buffer.append("/");
- }
- buffer.append("logout?_eventId=next&");
- buffer.append(this.relayStateParameterName);
- buffer.append("=");
- buffer.append(CommonUtils.urlEncode(relayStateValue));
- final String redirectUrl = buffer.toString();
- logger.debug("Redirecting back to the CAS server: {}", redirectUrl);
- CommonUtils.sendRedirect(response, redirectUrl);
+ // redirection url to the CAS server
+ final String redirectionUrl = handler.computeRedirectionToServer(request);
+ if (redirectionUrl != null) {
+ CommonUtils.sendRedirect(response, redirectionUrl);
}
return;
} else {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 873d322da..1b40afda1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -29,6 +29,7 @@
import javax.servlet.http.HttpSession;
import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang.StringUtils;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.XmlUtils;
import org.slf4j.Logger;
@@ -46,6 +47,7 @@ public final class SingleSignOutHandler {
public final static String DEFAULT_ARTIFACT_PARAMETER_NAME = "ticket";
public final static String DEFAULT_LOGOUT_PARAMETER_NAME = "logoutRequest";
+ public final static String DEFAULT_FRONT_LOGOUT_PARAMETER_NAME = "SAMLRequest";
public final static String DEFAULT_RELAY_STATE_PARAMETER_NAME = "RelayState";
/** Logger instance */
@@ -57,12 +59,18 @@ public final class SingleSignOutHandler {
/** The name of the artifact parameter. This is used to capture the session identifier. */
private String artifactParameterName = DEFAULT_ARTIFACT_PARAMETER_NAME;
- /** Parameter name that stores logout request */
+ /** Parameter name that stores logout request for back channel SLO */
private String logoutParameterName = DEFAULT_LOGOUT_PARAMETER_NAME;
+ /** Parameter name that stores logout request for front channel SLO */
+ private String frontLogoutParameterName = DEFAULT_FRONT_LOGOUT_PARAMETER_NAME;
+
/** Parameter name that stores the state of the CAS server webflow for the callback */
private String relayStateParameterName = DEFAULT_RELAY_STATE_PARAMETER_NAME;
+ /** The prefix url of the CAS server */
+ private String casServerUrlPrefix;
+
private boolean artifactParameterOverPost = false;
private boolean eagerlyCreateSessions = true;
@@ -89,12 +97,26 @@ public void setArtifactParameterName(final String name) {
}
/**
- * @param name Name of parameter containing CAS logout request message.
+ * @param name Name of parameter containing CAS logout request message for back channel SLO.
*/
public void setLogoutParameterName(final String name) {
this.logoutParameterName = name;
}
+ /**
+ * @param casServerUrlPrefix The prefix url of the CAS server.
+ */
+ public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
+ this.casServerUrlPrefix = casServerUrlPrefix;
+ }
+
+ /**
+ * @param name Name of parameter containing CAS logout request message for front channel SLO.
+ */
+ public void setFrontLogoutParameterName(final String name) {
+ this.frontLogoutParameterName = name;
+ }
+
/**
* @param name Name of parameter containing the state of the CAS server webflow.
*/
@@ -112,8 +134,10 @@ public void setEagerlyCreateSessions(final boolean eagerlyCreateSessions) {
public void init() {
CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null.");
CommonUtils.assertNotNull(this.logoutParameterName, "logoutParameterName cannot be null.");
+ CommonUtils.assertNotNull(this.frontLogoutParameterName, "frontLogoutParameterName cannot be null.");
CommonUtils.assertNotNull(this.sessionMappingStorage, "sessionMappingStorage cannot be null.");
CommonUtils.assertNotNull(this.relayStateParameterName, "relayStateParameterName cannot be null.");
+ CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
if (this.artifactParameterOverPost) {
this.safeParameters = Arrays.asList(this.logoutParameterName, this.artifactParameterName);
@@ -157,7 +181,7 @@ public boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
*/
public boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
return "GET".equals(request.getMethod())
- && CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName));
+ && CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.frontLogoutParameterName));
}
/**
@@ -220,11 +244,13 @@ private String uncompressLogoutMessage(final String originalMessage) {
* @param request HTTP request containing a CAS logout message.
*/
public void destroySession(final HttpServletRequest request) {
- String logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName,
- this.safeParameters);
- // front channel request -> the message needs to be base64 decoded + decompressed
+ String logoutMessage;
+ // front channel logout -> the message needs to be base64 decoded + decompressed
if ("GET".equals(request.getMethod())) {
- logoutMessage = uncompressLogoutMessage(logoutMessage);
+ logoutMessage = uncompressLogoutMessage(CommonUtils.safeGetParameter(request,
+ this.frontLogoutParameterName));
+ } else {
+ logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName, this.safeParameters);
}
logger.trace("Logout request:\n{}", logoutMessage);
@@ -251,6 +277,34 @@ public void destroySession(final HttpServletRequest request) {
}
}
+ /**
+ * Compute the redirection url to the CAS server when it's a front channel SLO
+ * (depending on the relay state parameter).
+ *
+ * @param request The HTTP request.
+ * @return the redirection url to the CAS server.
+ */
+ public String computeRedirectionToServer(final HttpServletRequest request) {
+ // relay state value
+ final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName);
+ // if we have a state value -> redirect to the CAS server to continue the logout process
+ if (StringUtils.isNotBlank(relayStateValue)) {
+ final StringBuffer buffer = new StringBuffer();
+ buffer.append(casServerUrlPrefix);
+ if (!this.casServerUrlPrefix.endsWith("/")) {
+ buffer.append("/");
+ }
+ buffer.append("logout?_eventId=next&");
+ buffer.append(this.relayStateParameterName);
+ buffer.append("=");
+ buffer.append(CommonUtils.urlEncode(relayStateValue));
+ final String redirectUrl = buffer.toString();
+ logger.debug("Redirection url to the CAS server: {}", redirectUrl);
+ return redirectUrl;
+ }
+ return null;
+ }
+
private boolean isMultipartRequest(final HttpServletRequest request) {
return request.getContentType() != null && request.getContentType().toLowerCase().startsWith("multipart");
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
index e30254dda..b43ea6541 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
@@ -19,12 +19,12 @@ public final class LogoutMessageGenerator {
+ "IssueInstant=\"\">@NOT_USED@"
+ "%s";
- public static String generateLogoutMessage(String sessionIndex) {
+ public static String generateBackChannelLogoutMessage(String sessionIndex) {
return String.format(LOGOUT_REQUEST_TEMPLATE, sessionIndex);
}
- public static String generateCompressedLogoutMessage(String sessionIndex) {
- final String logoutMessage = generateLogoutMessage(sessionIndex);
+ public static String generateFrontChannelLogoutMessage(String sessionIndex) {
+ final String logoutMessage = generateBackChannelLogoutMessage(sessionIndex);
final Deflater deflater = new Deflater();
deflater.setInput(logoutMessage.getBytes(Charset.forName("ASCII")));
deflater.finish();
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
index 82ecd52a7..64114f9b9 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
@@ -79,7 +79,8 @@ public void tokenRequest() throws IOException, ServletException {
@Test
public void backChannelRequest() throws IOException, ServletException {
- request.setParameter(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME, LogoutMessageGenerator.generateLogoutMessage(TICKET));
+ request.setParameter(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME,
+ LogoutMessageGenerator.generateBackChannelLogoutMessage(TICKET));
request.setMethod("POST");
final MockHttpSession session = new MockHttpSession();
SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
@@ -89,9 +90,9 @@ public void backChannelRequest() throws IOException, ServletException {
@Test
public void frontChannelRequest() throws IOException, ServletException {
- final String logoutMessage = LogoutMessageGenerator.generateCompressedLogoutMessage(TICKET);
- request.setParameter(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME, logoutMessage);
- request.setQueryString(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+ request.setParameter(SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setQueryString(SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
@@ -102,10 +103,10 @@ public void frontChannelRequest() throws IOException, ServletException {
@Test
public void frontChannelRequestRelayState() throws IOException, ServletException {
- final String logoutMessage = LogoutMessageGenerator.generateCompressedLogoutMessage(TICKET);
- request.setParameter(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME, logoutMessage);
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+ request.setParameter(SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
request.setParameter(SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME, RELAY_STATE);
- request.setQueryString(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage + "&" +
+ request.setQueryString(SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage + "&" +
SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME + "=" + RELAY_STATE);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
index 14795369d..c7670e5c8 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
@@ -37,15 +37,23 @@ public final class SingleSignOutHandlerTests {
private final static String ANOTHER_PARAMETER = "anotherParameter";
private final static String TICKET = "ST-xxxxxxxx";
+ private final static String URL = "http://mycasserver";
private SingleSignOutHandler handler;
private MockHttpServletRequest request;
- private final static String logoutParameterName = "logoutRequest";
+ private final static String logoutParameterName = "logoutRequest2";
+ private final static String frontLogoutParameterName = "SAMLRequest2";
+ private final static String relayStateParameterName = "RelayState2";
+ private final static String artifactParameterName = "ticket2";
@Before
public void setUp() throws Exception {
handler = new SingleSignOutHandler();
handler.setLogoutParameterName(logoutParameterName);
+ handler.setFrontLogoutParameterName(frontLogoutParameterName);
+ handler.setRelayStateParameterName(relayStateParameterName);
+ handler.setArtifactParameterName(artifactParameterName);
+ handler.setCasServerUrlPrefix(URL);
handler.init();
request = new MockHttpServletRequest();
}
@@ -74,9 +82,9 @@ public void isBackChannelLogoutRequestMultipart() throws Exception {
@Test
public void isFrontChannelLogoutRequest() {
- request.setParameter(logoutParameterName, TICKET);
+ request.setParameter(frontLogoutParameterName, TICKET);
request.setMethod("GET");
- request.setQueryString(logoutParameterName + "=" + TICKET);
+ request.setQueryString(frontLogoutParameterName + "=" + TICKET);
assertTrue(handler.isFrontChannelLogoutRequest(request));
}
@@ -94,8 +102,8 @@ public void isFrontChannelLogoutRequestKO() {
public void recordSessionKOIfNoSession() {
handler.setEagerlyCreateSessions(false);
request.setSession(null);
- request.setParameter(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME, TICKET);
- request.setQueryString(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME + "=" + TICKET);
+ request.setParameter(artifactParameterName, TICKET);
+ request.setQueryString(artifactParameterName + "=" + TICKET);
handler.recordSession(request);
final SessionMappingStorage storage = handler.getSessionMappingStorage();
assertNull(storage.removeSessionByMappingId(TICKET));
@@ -105,8 +113,8 @@ public void recordSessionKOIfNoSession() {
public void recordSessionOK() {
final MockHttpSession session = new MockHttpSession();
request.setSession(session);
- request.setParameter(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME, TICKET);
- request.setQueryString(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME + "=" + TICKET);
+ request.setParameter(artifactParameterName, TICKET);
+ request.setQueryString(artifactParameterName + "=" + TICKET);
handler.recordSession(request);
final SessionMappingStorage storage = handler.getSessionMappingStorage();
assertEquals(session, storage.removeSessionByMappingId(TICKET));
@@ -114,7 +122,7 @@ public void recordSessionOK() {
@Test
public void destorySessionPOSTKONoSessionIndex() {
- final String logoutMessage = LogoutMessageGenerator.generateLogoutMessage("");
+ final String logoutMessage = LogoutMessageGenerator.generateBackChannelLogoutMessage("");
request.setParameter(logoutParameterName, logoutMessage);
request.setMethod("POST");
final MockHttpSession session = new MockHttpSession();
@@ -125,7 +133,7 @@ public void destorySessionPOSTKONoSessionIndex() {
@Test
public void destorySessionPOST() {
- final String logoutMessage = LogoutMessageGenerator.generateLogoutMessage(TICKET);
+ final String logoutMessage = LogoutMessageGenerator.generateBackChannelLogoutMessage(TICKET);
request.setParameter(logoutParameterName, logoutMessage);
request.setMethod("POST");
final MockHttpSession session = new MockHttpSession();
@@ -136,9 +144,9 @@ public void destorySessionPOST() {
@Test
public void destorySessionGETNoSessionIndex() {
- final String logoutMessage = LogoutMessageGenerator.generateCompressedLogoutMessage("");
- request.setParameter(logoutParameterName, logoutMessage);
- request.setQueryString(logoutParameterName + "=" + logoutMessage);
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage("");
+ request.setParameter(frontLogoutParameterName, logoutMessage);
+ request.setQueryString(frontLogoutParameterName + "=" + logoutMessage);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
@@ -148,13 +156,26 @@ public void destorySessionGETNoSessionIndex() {
@Test
public void destorySessionGET() {
- final String logoutMessage = LogoutMessageGenerator.generateCompressedLogoutMessage(TICKET);
- request.setParameter(logoutParameterName, logoutMessage);
- request.setQueryString(logoutParameterName + "=" + logoutMessage);
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+ request.setParameter(frontLogoutParameterName, logoutMessage);
+ request.setQueryString(frontLogoutParameterName + "=" + logoutMessage);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
handler.destroySession(request);
assertTrue(session.isInvalid());
}
+
+ @Test
+ public void computeRedirectionNoRelayState() {
+ assertNull(handler.computeRedirectionToServer(request));
+ }
+
+ @Test
+ public void computeRedirection() {
+ request.setParameter(relayStateParameterName, TICKET);
+ request.setQueryString(relayStateParameterName + "=" + TICKET);
+ assertEquals(URL + "/logout?_eventId=next&" + relayStateParameterName + "=" + TICKET,
+ handler.computeRedirectionToServer(request));
+ }
}
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
index 1d95f43c3..d483e41c6 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
@@ -28,6 +28,7 @@
import org.apache.catalina.connector.Response;
import org.jasig.cas.client.session.SessionMappingStorage;
import org.jasig.cas.client.session.SingleSignOutHandler;
+import org.jasig.cas.client.util.CommonUtils;
/**
* Handles logout request messages sent from the CAS server by ending the current
@@ -52,6 +53,18 @@ public void setLogoutParameterName(final String name) {
handler.setLogoutParameterName(name);
}
+ public void setFrontLogoutParameterName(final String name) {
+ handler.setFrontLogoutParameterName(name);
+ }
+
+ public void setRelayStateParameterName(final String name) {
+ handler.setRelayStateParameterName(name);
+ }
+
+ public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
+ handler.setCasServerUrlPrefix(casServerUrlPrefix);
+ }
+
public void setSessionMappingStorage(final SessionMappingStorage storage) {
handler.setSessionMappingStorage(storage);
}
@@ -68,10 +81,18 @@ public void invoke(final Request request, final Response response) throws IOExce
if (this.handler.isTokenRequest(request)) {
this.handler.recordSession(request);
request.getSessionInternal(true).addSessionListener(this);
- } else if (this.handler.isLogoutRequest(request)) {
+ } else if (this.handler.isBackChannelLogoutRequest(request)) {
this.handler.destroySession(request);
// Do not proceed up valve chain
return;
+ } else if (this.handler.isFrontChannelLogoutRequest(request)) {
+ this.handler.destroySession(request);
+ // redirection url to the CAS server
+ final String redirectionUrl = handler.computeRedirectionToServer(request);
+ if (redirectionUrl != null) {
+ CommonUtils.sendRedirect(response, redirectionUrl);
+ }
+ return;
} else {
logger.debug("Ignoring URI {}", request.getRequestURI());
}
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
index c1bee5b10..8ecc86519 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
@@ -29,6 +29,7 @@
import org.apache.catalina.valves.ValveBase;
import org.jasig.cas.client.session.SessionMappingStorage;
import org.jasig.cas.client.session.SingleSignOutHandler;
+import org.jasig.cas.client.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,6 +57,18 @@ public void setLogoutParameterName(final String name) {
handler.setLogoutParameterName(name);
}
+ public void setFrontLogoutParameterName(final String name) {
+ handler.setFrontLogoutParameterName(name);
+ }
+
+ public void setRelayStateParameterName(final String name) {
+ handler.setRelayStateParameterName(name);
+ }
+
+ public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
+ handler.setCasServerUrlPrefix(casServerUrlPrefix);
+ }
+
public void setSessionMappingStorage(final SessionMappingStorage storage) {
handler.setSessionMappingStorage(storage);
}
@@ -65,10 +78,18 @@ public void invoke(final Request request, final Response response) throws IOExce
if (this.handler.isTokenRequest(request)) {
this.handler.recordSession(request);
request.getSessionInternal(true).addSessionListener(this);
- } else if (this.handler.isLogoutRequest(request)) {
+ } else if (this.handler.isBackChannelLogoutRequest(request)) {
this.handler.destroySession(request);
// Do not proceed up valve chain
return;
+ } else if (this.handler.isFrontChannelLogoutRequest(request)) {
+ this.handler.destroySession(request);
+ // redirection url to the CAS server
+ final String redirectionUrl = handler.computeRedirectionToServer(request);
+ if (redirectionUrl != null) {
+ CommonUtils.sendRedirect(response, redirectionUrl);
+ }
+ return;
} else {
logger.debug("Ignoring URI {}", request.getRequestURI());
}
From fde7858ccafa20543e2bb55c636ff6fd79f29a94 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Mon, 17 Mar 2014 00:18:56 -0700
Subject: [PATCH 094/239] CASC-219: added final
---
.../ContainsPatternUrlPatternMatcherStrategy.java | 2 +-
.../client/authentication/ExactUrlPatternMatcherStrategy.java | 2 +-
.../client/authentication/RegexUrlPatternMatcherStrategy.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ContainsPatternUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ContainsPatternUrlPatternMatcherStrategy.java
index 153248146..48c9f5ff9 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ContainsPatternUrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ContainsPatternUrlPatternMatcherStrategy.java
@@ -24,7 +24,7 @@
* @author Misagh Moayyed
* @since 3.3.1
*/
-public class ContainsPatternUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
+public final class ContainsPatternUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
private String pattern;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
index 0a5b42f4b..b476a3045 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
@@ -7,7 +7,7 @@
* @author Misagh Moayyed
* @since 3.3.1
*/
-public class ExactUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
+public final class ExactUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
private String pattern;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
index 7bb54e841..a9414598e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
@@ -27,7 +27,7 @@
* @author Misagh Moayyed
* @since 3.3.1
*/
-public class RegexUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
+public final class RegexUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
private Pattern pattern;
From da00f51d3905c1040598e5571808b849d3d46b7c Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 18 Mar 2014 19:26:45 -0400
Subject: [PATCH 095/239] Added in missing license header.
---
.../ExactUrlPatternMatcherStrategy.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
index b476a3045..64f20ebe8 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.authentication;
/**
From 2ef3223faabd0b1bb1ddb7bd2d458a70e7fb3882 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 19 Mar 2014 20:50:45 -0400
Subject: [PATCH 096/239] Updated to parent pom 39
---
pom.xml | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/pom.xml b/pom.xml
index 09cd1fdbf..4272a5137 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
org.jasig.parentjasig-parent
- 38
+ 394.0.0org.jasig.cas.client
@@ -12,7 +12,7 @@
Jasig CAS Client for Java
- Jasig CAS Client for Java is the integration point forapplications that want to speak with a CAS
+ Jasig CAS Client for Java is the integration point for applications that want to speak with a CAS
server, either via the CAS 1.0 or CAS 2.0 protocol.
http://www.jasig.org/cas
@@ -103,15 +103,6 @@
-
- org.apache.maven.plugins
- maven-release-plugin
- 2.2.1
-
- forked-path
- v@{project.version}
-
- org.apache.maven.pluginsmaven-enforcer-plugin
From 6c34fa929f78a4c9f8d97988ac6a704d74c27ba5 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 19 Mar 2014 20:55:38 -0400
Subject: [PATCH 097/239] [maven-release-plugin] prepare release
cas-client-3.3.1
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
pom.xml | 5 +++--
9 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 1e6be56b3..dcb19415d 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.1cas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index bb6761ce2..7747e227c 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.1cas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index e0eb03075..d42ee84c3 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.1cas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index d3c45aefc..43282a13d 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.14.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index fa147c717..4b92c49b3 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.14.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 0c6b4f1a6..80af72155 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.14.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 493656bc2..818949da7 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.14.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 369878a8f..1b9f65c45 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.14.0.0
diff --git a/pom.xml b/pom.xml
index 4272a5137..2246a74a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.1-SNAPSHOT
+ 3.3.1cas-clientpom
@@ -26,7 +26,8 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
-
+ cas-client-3.3.1
+
2006
From 53130b9c34195301f7373d6724b72273360f97df Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 19 Mar 2014 20:55:47 -0400
Subject: [PATCH 098/239] [maven-release-plugin] prepare for next development
iteration
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
pom.xml | 4 ++--
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index dcb19415d..1482cc65c 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 7747e227c..83c039b29 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index d42ee84c3..6c5c96bf8 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 43282a13d..72be09340 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 4b92c49b3..3ce7551df 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 80af72155..486d93227 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 818949da7..e6ee05f7a 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 1b9f65c45..e20df1383 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOT4.0.0
diff --git a/pom.xml b/pom.xml
index 2246a74a6..8b08eb492 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.1
+ 3.3.2-SNAPSHOTcas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- cas-client-3.3.1
+ HEAD2006
From f5c47b857b097da09d67acd465b297578526cfe7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Fri, 21 Mar 2014 14:10:33 +0100
Subject: [PATCH 099/239] CASC-220: Support front channel SLO logout
Updates after Misagh's code review
---
.../client/session/SingleSignOutFilter.java | 21 +-----
.../client/session/SingleSignOutHandler.java | 75 ++++++++++++++++---
.../session/LogoutMessageGenerator.java | 7 +-
.../client/tomcat/v6/SingleSignOutValve.java | 36 +++------
.../client/tomcat/v7/SingleSignOutValve.java | 35 +++------
5 files changed, 90 insertions(+), 84 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index 92235dc46..33b2094eb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -24,7 +24,6 @@
import javax.servlet.http.HttpServletResponse;
import org.jasig.cas.client.util.AbstractConfigurationFilter;
-import org.jasig.cas.client.util.CommonUtils;
/**
* Implements the Single Sign Out protocol. It handles registering the session and destroying the session.
@@ -85,25 +84,9 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
- if (handler.isTokenRequest(request)) {
- handler.recordSession(request);
- } else if (handler.isBackChannelLogoutRequest(request)) {
- handler.destroySession(request);
- // Do not continue up filter chain
- return;
- } else if (handler.isFrontChannelLogoutRequest(request)) {
- handler.destroySession(request);
- // redirection url to the CAS server
- final String redirectionUrl = handler.computeRedirectionToServer(request);
- if (redirectionUrl != null) {
- CommonUtils.sendRedirect(response, redirectionUrl);
- }
- return;
- } else {
- logger.trace("Ignoring URI {}", request.getRequestURI());
+ if (handler.process(request, response)) {
+ filterChain.doFilter(servletRequest, servletResponse);
}
-
- filterChain.doFilter(servletRequest, servletResponse);
}
public void destroy() {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 1b40afda1..11e43c375 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -26,6 +26,7 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.codec.binary.Base64;
@@ -153,7 +154,7 @@ public void init() {
*
* @return True if request contains authentication token, false otherwise.
*/
- public boolean isTokenRequest(final HttpServletRequest request) {
+ protected boolean isTokenRequest(final HttpServletRequest request) {
return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.artifactParameterName,
this.safeParameters));
}
@@ -165,7 +166,7 @@ public boolean isTokenRequest(final HttpServletRequest request) {
*
* @return True if request is logout request, false otherwise.
*/
- public boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
+ protected boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
return "POST".equals(request.getMethod())
&& !isMultipartRequest(request)
&& CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName,
@@ -179,18 +180,46 @@ public boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
*
* @return True if request is logout request, false otherwise.
*/
- public boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
+ protected boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
return "GET".equals(request.getMethod())
&& CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.frontLogoutParameterName));
}
+ /**
+ * Process a request regarding the SLO process: record the session or destroy it.
+ *
+ * @param request the incoming HTTP request.
+ * @param response the HTTP response.
+ * @return if the request should continue to be processed.
+ */
+ public boolean process(final HttpServletRequest request, final HttpServletResponse response) {
+ if (isTokenRequest(request)) {
+ recordSession(request);
+ } else if (isBackChannelLogoutRequest(request)) {
+ destroySession(request);
+ // Do not continue up filter chain
+ return false;
+ } else if (isFrontChannelLogoutRequest(request)) {
+ destroySession(request);
+ // redirection url to the CAS server
+ final String redirectionUrl = computeRedirectionToServer(request);
+ if (redirectionUrl != null) {
+ CommonUtils.sendRedirect(response, redirectionUrl);
+ }
+ return false;
+ } else {
+ logger.trace("Ignoring URI {}", request.getRequestURI());
+ }
+ return true;
+ }
+
/**
* Associates a token request with the current HTTP session by recording the mapping
* in the the configured {@link SessionMappingStorage} container.
*
* @param request HTTP request containing an authentication token.
*/
- public void recordSession(final HttpServletRequest request) {
+ protected void recordSession(final HttpServletRequest request) {
final HttpSession session = request.getSession(this.eagerlyCreateSessions);
if (session == null) {
@@ -215,17 +244,41 @@ public void recordSession(final HttpServletRequest request) {
* @param originalMessage the original logout message.
* @return the uncompressed logout message.
*/
- private String uncompressLogoutMessage(final String originalMessage) {
+ protected String uncompressLogoutMessage(final String originalMessage) {
// base64 decode
final byte[] binaryMessage = Base64.decodeBase64(originalMessage);
+ Inflater decompresser = null;
try {
// decompress the bytes
- final Inflater decompresser = new Inflater();
+ decompresser = new Inflater();
decompresser.setInput(binaryMessage);
+
+ /* The received logout message is compressed, so this number (10) is the multiplier of the original size
+ * of the logout message (binaryMessage.length) to compute the size of the buffer where the logout message
+ * will be decompressed.
+ * It's somehow the decompression factor.
+ *
+ * For the buffer, we could also have a fixed size for the buffer (like 10k), but I thought that ten times
+ * would be a sufficient multiplier...
+ *
+ * A real test:
+ * String sessionIndex = "ST-45-fs45646r84ffs1d31f554f5d4f64fg6r8eq5s4d6f4fddsf46-cas";
+ * String bm = LogoutMessageGenerator.generateBackChannelLogoutMessage(sessionIndex);
+ * System.out.println("bm.size = " + bm.length());
+ * String fm = new String(Base64.decodeBase64(LogoutMessageGenerator.
+ * generateFrontChannelLogoutMessage(sessionIndex)));
+ * System.out.println("fm.size = " + fm.length());
+ *
+ * And the result:
+ * bm.size = 354
+ * fm.size = 224
+ *
+ * So ten times is enough, it's even too much...
+ */
byte[] result = new byte[binaryMessage.length * 10];
+
int resultLength = decompresser.inflate(result);
- decompresser.end();
// decode the bytes into a String
return new String(result, 0, resultLength, "UTF-8");
@@ -235,6 +288,10 @@ private String uncompressLogoutMessage(final String originalMessage) {
} catch (UnsupportedEncodingException e) {
logger.error("Unable to decompress logout message", e);
throw new RuntimeException(e);
+ } finally {
+ if (decompresser != null) {
+ decompresser.end();
+ }
}
}
@@ -243,7 +300,7 @@ private String uncompressLogoutMessage(final String originalMessage) {
*
* @param request HTTP request containing a CAS logout message.
*/
- public void destroySession(final HttpServletRequest request) {
+ protected void destroySession(final HttpServletRequest request) {
String logoutMessage;
// front channel logout -> the message needs to be base64 decoded + decompressed
if ("GET".equals(request.getMethod())) {
@@ -284,7 +341,7 @@ public void destroySession(final HttpServletRequest request) {
* @param request The HTTP request.
* @return the redirection url to the CAS server.
*/
- public String computeRedirectionToServer(final HttpServletRequest request) {
+ protected String computeRedirectionToServer(final HttpServletRequest request) {
// relay state value
final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName);
// if we have a state value -> redirect to the CAS server to continue the logout process
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
index b43ea6541..30ee25384 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
@@ -1,6 +1,7 @@
package org.jasig.cas.client.session;
import java.nio.charset.Charset;
+import java.util.Date;
import java.util.zip.Deflater;
import org.apache.commons.codec.binary.Base64;
@@ -16,13 +17,13 @@ public final class LogoutMessageGenerator {
private static final String LOGOUT_REQUEST_TEMPLATE =
"@NOT_USED@"
+ + "IssueInstant=\"%s\">@NOT_USED@"
+ "%s";
public static String generateBackChannelLogoutMessage(String sessionIndex) {
- return String.format(LOGOUT_REQUEST_TEMPLATE, sessionIndex);
+ return String.format(LOGOUT_REQUEST_TEMPLATE, new Date(), sessionIndex);
}
-
+
public static String generateFrontChannelLogoutMessage(String sessionIndex) {
final String logoutMessage = generateBackChannelLogoutMessage(sessionIndex);
final Deflater deflater = new Deflater();
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
index d483e41c6..9941651a8 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
@@ -28,7 +28,6 @@
import org.apache.catalina.connector.Response;
import org.jasig.cas.client.session.SessionMappingStorage;
import org.jasig.cas.client.session.SingleSignOutHandler;
-import org.jasig.cas.client.util.CommonUtils;
/**
* Handles logout request messages sent from the CAS server by ending the current
@@ -46,57 +45,41 @@ public class SingleSignOutValve extends AbstractLifecycleValve implements Sessio
private final SingleSignOutHandler handler = new SingleSignOutHandler();
public void setArtifactParameterName(final String name) {
- handler.setArtifactParameterName(name);
+ this.handler.setArtifactParameterName(name);
}
public void setLogoutParameterName(final String name) {
- handler.setLogoutParameterName(name);
+ this.handler.setLogoutParameterName(name);
}
public void setFrontLogoutParameterName(final String name) {
- handler.setFrontLogoutParameterName(name);
+ this.handler.setFrontLogoutParameterName(name);
}
public void setRelayStateParameterName(final String name) {
- handler.setRelayStateParameterName(name);
+ this.handler.setRelayStateParameterName(name);
}
public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
- handler.setCasServerUrlPrefix(casServerUrlPrefix);
+ this.handler.setCasServerUrlPrefix(casServerUrlPrefix);
}
public void setSessionMappingStorage(final SessionMappingStorage storage) {
- handler.setSessionMappingStorage(storage);
+ this.handler.setSessionMappingStorage(storage);
}
/** {@inheritDoc} */
public void start() throws LifecycleException {
super.start();
- handler.init();
+ this.handler.init();
logger.info("Startup completed.");
}
/** {@inheritDoc} */
public void invoke(final Request request, final Response response) throws IOException, ServletException {
- if (this.handler.isTokenRequest(request)) {
- this.handler.recordSession(request);
- request.getSessionInternal(true).addSessionListener(this);
- } else if (this.handler.isBackChannelLogoutRequest(request)) {
- this.handler.destroySession(request);
- // Do not proceed up valve chain
- return;
- } else if (this.handler.isFrontChannelLogoutRequest(request)) {
- this.handler.destroySession(request);
- // redirection url to the CAS server
- final String redirectionUrl = handler.computeRedirectionToServer(request);
- if (redirectionUrl != null) {
- CommonUtils.sendRedirect(response, redirectionUrl);
- }
- return;
- } else {
- logger.debug("Ignoring URI {}", request.getRequestURI());
+ if (this.handler.process(request, response)) {
+ getNext().invoke(request, response);
}
- getNext().invoke(request, response);
}
/** {@inheritDoc} */
@@ -111,5 +94,4 @@ public void sessionEvent(final SessionEvent event) {
protected String getName() {
return NAME;
}
-
}
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
index 8ecc86519..62ac2149b 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
@@ -29,7 +29,6 @@
import org.apache.catalina.valves.ValveBase;
import org.jasig.cas.client.session.SessionMappingStorage;
import org.jasig.cas.client.session.SingleSignOutHandler;
-import org.jasig.cas.client.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,50 +49,34 @@ public class SingleSignOutValve extends ValveBase implements SessionListener {
private final SingleSignOutHandler handler = new SingleSignOutHandler();
public void setArtifactParameterName(final String name) {
- handler.setArtifactParameterName(name);
+ this.handler.setArtifactParameterName(name);
}
public void setLogoutParameterName(final String name) {
- handler.setLogoutParameterName(name);
+ this.handler.setLogoutParameterName(name);
}
public void setFrontLogoutParameterName(final String name) {
- handler.setFrontLogoutParameterName(name);
+ this.handler.setFrontLogoutParameterName(name);
}
public void setRelayStateParameterName(final String name) {
- handler.setRelayStateParameterName(name);
+ this.handler.setRelayStateParameterName(name);
}
public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
- handler.setCasServerUrlPrefix(casServerUrlPrefix);
+ this.handler.setCasServerUrlPrefix(casServerUrlPrefix);
}
public void setSessionMappingStorage(final SessionMappingStorage storage) {
- handler.setSessionMappingStorage(storage);
+ this.handler.setSessionMappingStorage(storage);
}
/** {@inheritDoc} */
public void invoke(final Request request, final Response response) throws IOException, ServletException {
- if (this.handler.isTokenRequest(request)) {
- this.handler.recordSession(request);
- request.getSessionInternal(true).addSessionListener(this);
- } else if (this.handler.isBackChannelLogoutRequest(request)) {
- this.handler.destroySession(request);
- // Do not proceed up valve chain
- return;
- } else if (this.handler.isFrontChannelLogoutRequest(request)) {
- this.handler.destroySession(request);
- // redirection url to the CAS server
- final String redirectionUrl = handler.computeRedirectionToServer(request);
- if (redirectionUrl != null) {
- CommonUtils.sendRedirect(response, redirectionUrl);
- }
- return;
- } else {
- logger.debug("Ignoring URI {}", request.getRequestURI());
+ if (this.handler.process(request, response)) {
+ getNext().invoke(request, response);
}
- getNext().invoke(request, response);
}
/** {@inheritDoc} */
@@ -108,7 +91,7 @@ public void sessionEvent(final SessionEvent event) {
protected void startInternal() throws LifecycleException {
super.startInternal();
logger.info("Starting...");
- handler.init();
+ this.handler.init();
logger.info("Startup completed.");
}
}
From e3cd32cd25120cab5546320d6c207212af789edd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Thu, 27 Mar 2014 21:02:30 +0100
Subject: [PATCH 100/239] CASC-220: Support front channel SLO logout
Update after Scott's code review
---
.../client/session/SingleSignOutHandler.java | 68 +++-----
.../session/LogoutMessageGenerator.java | 6 +-
.../session/SingleSignOutHandlerTests.java | 157 +++++++++---------
3 files changed, 105 insertions(+), 126 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 11e43c375..8026ed1f6 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -18,10 +18,8 @@
*/
package org.jasig.cas.client.session;
-import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.List;
-import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
import javax.servlet.ServletException;
@@ -50,7 +48,9 @@ public final class SingleSignOutHandler {
public final static String DEFAULT_LOGOUT_PARAMETER_NAME = "logoutRequest";
public final static String DEFAULT_FRONT_LOGOUT_PARAMETER_NAME = "SAMLRequest";
public final static String DEFAULT_RELAY_STATE_PARAMETER_NAME = "RelayState";
-
+
+ private final static int DECOMPRESSION_FACTOR = 10;
+
/** Logger instance */
private final Logger logger = LoggerFactory.getLogger(getClass());
@@ -154,7 +154,7 @@ public void init() {
*
* @return True if request contains authentication token, false otherwise.
*/
- protected boolean isTokenRequest(final HttpServletRequest request) {
+ private boolean isTokenRequest(final HttpServletRequest request) {
return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.artifactParameterName,
this.safeParameters));
}
@@ -166,7 +166,7 @@ protected boolean isTokenRequest(final HttpServletRequest request) {
*
* @return True if request is logout request, false otherwise.
*/
- protected boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
+ private boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
return "POST".equals(request.getMethod())
&& !isMultipartRequest(request)
&& CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName,
@@ -180,7 +180,7 @@ protected boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
*
* @return True if request is logout request, false otherwise.
*/
- protected boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
+ private boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
return "GET".equals(request.getMethod())
&& CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.frontLogoutParameterName));
}
@@ -194,12 +194,17 @@ protected boolean isFrontChannelLogoutRequest(final HttpServletRequest request)
*/
public boolean process(final HttpServletRequest request, final HttpServletResponse response) {
if (isTokenRequest(request)) {
+ logger.trace("Received a token request");
recordSession(request);
+ return true;
+
} else if (isBackChannelLogoutRequest(request)) {
+ logger.trace("Received a back channel logout request");
destroySession(request);
- // Do not continue up filter chain
return false;
+
} else if (isFrontChannelLogoutRequest(request)) {
+ logger.trace("Received a front channel logout request");
destroySession(request);
// redirection url to the CAS server
final String redirectionUrl = computeRedirectionToServer(request);
@@ -207,10 +212,11 @@ public boolean process(final HttpServletRequest request, final HttpServletRespon
CommonUtils.sendRedirect(response, redirectionUrl);
}
return false;
+
} else {
logger.trace("Ignoring URI {}", request.getRequestURI());
+ return true;
}
- return true;
}
/**
@@ -219,7 +225,7 @@ public boolean process(final HttpServletRequest request, final HttpServletRespon
*
* @param request HTTP request containing an authentication token.
*/
- protected void recordSession(final HttpServletRequest request) {
+ private void recordSession(final HttpServletRequest request) {
final HttpSession session = request.getSession(this.eagerlyCreateSessions);
if (session == null) {
@@ -244,8 +250,7 @@ protected void recordSession(final HttpServletRequest request) {
* @param originalMessage the original logout message.
* @return the uncompressed logout message.
*/
- protected String uncompressLogoutMessage(final String originalMessage) {
- // base64 decode
+ private String uncompressLogoutMessage(final String originalMessage) {
final byte[] binaryMessage = Base64.decodeBase64(originalMessage);
Inflater decompresser = null;
@@ -253,39 +258,13 @@ protected String uncompressLogoutMessage(final String originalMessage) {
// decompress the bytes
decompresser = new Inflater();
decompresser.setInput(binaryMessage);
+ final byte[] result = new byte[binaryMessage.length * DECOMPRESSION_FACTOR];
- /* The received logout message is compressed, so this number (10) is the multiplier of the original size
- * of the logout message (binaryMessage.length) to compute the size of the buffer where the logout message
- * will be decompressed.
- * It's somehow the decompression factor.
- *
- * For the buffer, we could also have a fixed size for the buffer (like 10k), but I thought that ten times
- * would be a sufficient multiplier...
- *
- * A real test:
- * String sessionIndex = "ST-45-fs45646r84ffs1d31f554f5d4f64fg6r8eq5s4d6f4fddsf46-cas";
- * String bm = LogoutMessageGenerator.generateBackChannelLogoutMessage(sessionIndex);
- * System.out.println("bm.size = " + bm.length());
- * String fm = new String(Base64.decodeBase64(LogoutMessageGenerator.
- * generateFrontChannelLogoutMessage(sessionIndex)));
- * System.out.println("fm.size = " + fm.length());
- *
- * And the result:
- * bm.size = 354
- * fm.size = 224
- *
- * So ten times is enough, it's even too much...
- */
- byte[] result = new byte[binaryMessage.length * 10];
-
- int resultLength = decompresser.inflate(result);
+ final int resultLength = decompresser.inflate(result);
// decode the bytes into a String
return new String(result, 0, resultLength, "UTF-8");
- } catch (DataFormatException e) {
- logger.error("Unable to decompress logout message", e);
- throw new RuntimeException(e);
- } catch (UnsupportedEncodingException e) {
+ } catch (Exception e) {
logger.error("Unable to decompress logout message", e);
throw new RuntimeException(e);
} finally {
@@ -300,8 +279,8 @@ protected String uncompressLogoutMessage(final String originalMessage) {
*
* @param request HTTP request containing a CAS logout message.
*/
- protected void destroySession(final HttpServletRequest request) {
- String logoutMessage;
+ private void destroySession(final HttpServletRequest request) {
+ final String logoutMessage;
// front channel logout -> the message needs to be base64 decoded + decompressed
if ("GET".equals(request.getMethod())) {
logoutMessage = uncompressLogoutMessage(CommonUtils.safeGetParameter(request,
@@ -341,12 +320,11 @@ protected void destroySession(final HttpServletRequest request) {
* @param request The HTTP request.
* @return the redirection url to the CAS server.
*/
- protected String computeRedirectionToServer(final HttpServletRequest request) {
- // relay state value
+ private String computeRedirectionToServer(final HttpServletRequest request) {
final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName);
// if we have a state value -> redirect to the CAS server to continue the logout process
if (StringUtils.isNotBlank(relayStateValue)) {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append(casServerUrlPrefix);
if (!this.casServerUrlPrefix.endsWith("/")) {
buffer.append("/");
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
index 30ee25384..1ebc862d2 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
@@ -11,7 +11,7 @@
* Greatly inspired by the source code in the CAS server itself.
*
* @author Jerome Leleu
- * @since 3.3.1
+ * @since 3.4.0
*/
public final class LogoutMessageGenerator {
@@ -20,11 +20,11 @@ public final class LogoutMessageGenerator {
+ "IssueInstant=\"%s\">@NOT_USED@"
+ "%s";
- public static String generateBackChannelLogoutMessage(String sessionIndex) {
+ public static String generateBackChannelLogoutMessage(final String sessionIndex) {
return String.format(LOGOUT_REQUEST_TEMPLATE, new Date(), sessionIndex);
}
- public static String generateFrontChannelLogoutMessage(String sessionIndex) {
+ public static String generateFrontChannelLogoutMessage(final String sessionIndex) {
final String logoutMessage = generateBackChannelLogoutMessage(sessionIndex);
final Deflater deflater = new Deflater();
deflater.setInput(logoutMessage.getBytes(Charset.forName("ASCII")));
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
index c7670e5c8..afdf7bdc6 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
@@ -26,6 +26,7 @@
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockHttpSession;
/**
@@ -38,144 +39,144 @@ public final class SingleSignOutHandlerTests {
private final static String ANOTHER_PARAMETER = "anotherParameter";
private final static String TICKET = "ST-xxxxxxxx";
private final static String URL = "http://mycasserver";
+ private final static String LOGOUT_PARAMETER_NAME = "logoutRequest2";
+ private final static String FRONT_LOGOUT_PARAMETER_NAME = "SAMLRequest2";
+ private final static String RELAY_STATE_PARAMETER_NAME = "RelayState2";
+ private final static String ARTIFACT_PARAMETER_NAME = "ticket2";
private SingleSignOutHandler handler;
private MockHttpServletRequest request;
- private final static String logoutParameterName = "logoutRequest2";
- private final static String frontLogoutParameterName = "SAMLRequest2";
- private final static String relayStateParameterName = "RelayState2";
- private final static String artifactParameterName = "ticket2";
+ private MockHttpServletResponse response;
@Before
public void setUp() throws Exception {
handler = new SingleSignOutHandler();
- handler.setLogoutParameterName(logoutParameterName);
- handler.setFrontLogoutParameterName(frontLogoutParameterName);
- handler.setRelayStateParameterName(relayStateParameterName);
- handler.setArtifactParameterName(artifactParameterName);
+ handler.setLogoutParameterName(LOGOUT_PARAMETER_NAME);
+ handler.setFrontLogoutParameterName(FRONT_LOGOUT_PARAMETER_NAME);
+ handler.setRelayStateParameterName(RELAY_STATE_PARAMETER_NAME);
+ handler.setArtifactParameterName(ARTIFACT_PARAMETER_NAME);
handler.setCasServerUrlPrefix(URL);
handler.init();
request = new MockHttpServletRequest();
+ response = new MockHttpServletResponse();
}
@Test
- public void isBackChannelLogoutRequest() throws Exception {
- request.setParameter(logoutParameterName, TICKET);
- request.setMethod("POST");
-
- assertTrue(handler.isBackChannelLogoutRequest(request));
- }
-
- /**
- * Tests that a multipart request is not considered logoutRequest. Verifies issue CASC-147.
- *
- * @throws Exception
- */
- @Test
- public void isBackChannelLogoutRequestMultipart() throws Exception {
- request.setParameter(logoutParameterName, TICKET);
- request.setMethod("POST");
- request.setContentType("multipart/form-data");
-
- assertFalse(handler.isBackChannelLogoutRequest(request));
- }
-
- @Test
- public void isFrontChannelLogoutRequest() {
- request.setParameter(frontLogoutParameterName, TICKET);
- request.setMethod("GET");
- request.setQueryString(frontLogoutParameterName + "=" + TICKET);
-
- assertTrue(handler.isFrontChannelLogoutRequest(request));
+ public void tokenRequestKOIfNoSession() {
+ handler.setEagerlyCreateSessions(false);
+ request.setSession(null);
+ request.setParameter(ARTIFACT_PARAMETER_NAME, TICKET);
+ request.setQueryString(ARTIFACT_PARAMETER_NAME + "=" + TICKET);
+ assertTrue(handler.process(request, response));
+ final SessionMappingStorage storage = handler.getSessionMappingStorage();
+ assertNull(storage.removeSessionByMappingId(TICKET));
}
@Test
- public void isFrontChannelLogoutRequestKO() {
+ public void tokenRequestKOBadParameter() {
+ final MockHttpSession session = new MockHttpSession();
+ request.setSession(session);
request.setParameter(ANOTHER_PARAMETER, TICKET);
- request.setMethod("GET");
request.setQueryString(ANOTHER_PARAMETER + "=" + TICKET);
-
- assertFalse(handler.isFrontChannelLogoutRequest(request));
- }
-
- @Test
- public void recordSessionKOIfNoSession() {
- handler.setEagerlyCreateSessions(false);
- request.setSession(null);
- request.setParameter(artifactParameterName, TICKET);
- request.setQueryString(artifactParameterName + "=" + TICKET);
- handler.recordSession(request);
+ assertTrue(handler.process(request, response));
final SessionMappingStorage storage = handler.getSessionMappingStorage();
assertNull(storage.removeSessionByMappingId(TICKET));
}
@Test
- public void recordSessionOK() {
+ public void tokenRequestOK() {
final MockHttpSession session = new MockHttpSession();
request.setSession(session);
- request.setParameter(artifactParameterName, TICKET);
- request.setQueryString(artifactParameterName + "=" + TICKET);
- handler.recordSession(request);
+ request.setParameter(ARTIFACT_PARAMETER_NAME, TICKET);
+ request.setQueryString(ARTIFACT_PARAMETER_NAME + "=" + TICKET);
+ assertTrue(handler.process(request, response));
final SessionMappingStorage storage = handler.getSessionMappingStorage();
assertEquals(session, storage.removeSessionByMappingId(TICKET));
}
-
+
@Test
- public void destorySessionPOSTKONoSessionIndex() {
+ public void backChannelLogoutKOMultipart() {
+ final String logoutMessage = LogoutMessageGenerator.generateBackChannelLogoutMessage(TICKET);
+ request.setParameter(LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setMethod("POST");
+ request.setContentType("multipart/form-data");
+ final MockHttpSession session = new MockHttpSession();
+ handler.getSessionMappingStorage().addSessionById(TICKET, session);
+ assertTrue(handler.process(request, response));
+ assertFalse(session.isInvalid());
+ }
+
+ @Test
+ public void backChannelLogoutKONoSessionIndex() {
final String logoutMessage = LogoutMessageGenerator.generateBackChannelLogoutMessage("");
- request.setParameter(logoutParameterName, logoutMessage);
+ request.setParameter(LOGOUT_PARAMETER_NAME, logoutMessage);
request.setMethod("POST");
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
- handler.destroySession(request);
+ assertFalse(handler.process(request, response));
assertFalse(session.isInvalid());
}
@Test
- public void destorySessionPOST() {
+ public void backChannelLogoutOK() {
final String logoutMessage = LogoutMessageGenerator.generateBackChannelLogoutMessage(TICKET);
- request.setParameter(logoutParameterName, logoutMessage);
+ request.setParameter(LOGOUT_PARAMETER_NAME, logoutMessage);
request.setMethod("POST");
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
- handler.destroySession(request);
+ assertFalse(handler.process(request, response));
assertTrue(session.isInvalid());
}
@Test
- public void destorySessionGETNoSessionIndex() {
- final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage("");
- request.setParameter(frontLogoutParameterName, logoutMessage);
- request.setQueryString(frontLogoutParameterName + "=" + logoutMessage);
+ public void frontChannelLogoutKOBadParameter() {
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+ request.setParameter(ANOTHER_PARAMETER, logoutMessage);
request.setMethod("GET");
+ request.setQueryString(ANOTHER_PARAMETER + "=" + logoutMessage);
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
- handler.destroySession(request);
+ assertTrue(handler.process(request, response));
assertFalse(session.isInvalid());
}
@Test
- public void destorySessionGET() {
- final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
- request.setParameter(frontLogoutParameterName, logoutMessage);
- request.setQueryString(frontLogoutParameterName + "=" + logoutMessage);
+ public void frontChannelLogoutKONoSessionIndex() {
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage("");
+ request.setParameter(FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setQueryString(FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
- handler.destroySession(request);
- assertTrue(session.isInvalid());
+ assertFalse(handler.process(request, response));
+ assertFalse(session.isInvalid());
}
@Test
- public void computeRedirectionNoRelayState() {
- assertNull(handler.computeRedirectionToServer(request));
+ public void frontChannelLogoutOK() {
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+ request.setParameter(FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setQueryString(FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
+ request.setMethod("GET");
+ final MockHttpSession session = new MockHttpSession();
+ handler.getSessionMappingStorage().addSessionById(TICKET, session);
+ assertFalse(handler.process(request, response));
+ assertTrue(session.isInvalid());
+ assertNull(response.getRedirectedUrl());
}
@Test
- public void computeRedirection() {
- request.setParameter(relayStateParameterName, TICKET);
- request.setQueryString(relayStateParameterName + "=" + TICKET);
- assertEquals(URL + "/logout?_eventId=next&" + relayStateParameterName + "=" + TICKET,
- handler.computeRedirectionToServer(request));
+ public void frontChannelLogoutRelayStateOK() {
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+ request.setParameter(FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setParameter(RELAY_STATE_PARAMETER_NAME, TICKET);
+ request.setQueryString(FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage + "&" + RELAY_STATE_PARAMETER_NAME + "=" + TICKET);
+ request.setMethod("GET");
+ final MockHttpSession session = new MockHttpSession();
+ handler.getSessionMappingStorage().addSessionById(TICKET, session);
+ assertFalse(handler.process(request, response));
+ assertTrue(session.isInvalid());
+ assertEquals(URL + "/logout?_eventId=next&" + RELAY_STATE_PARAMETER_NAME + "=" + TICKET,
+ response.getRedirectedUrl());
}
}
From c3ee8b07c9bbb839261c980788b3d157c0b4a222 Mon Sep 17 00:00:00 2001
From: LELEU Jerome
Date: Tue, 1 Apr 2014 16:46:19 +0200
Subject: [PATCH 101/239] CASC-220: Support front channel SLO logout
Updates after Marvin's code review
---
.../client/session/SingleSignOutHandlerTests.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
index afdf7bdc6..365a25ea5 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
@@ -62,7 +62,7 @@ public void setUp() throws Exception {
}
@Test
- public void tokenRequestKOIfNoSession() {
+ public void tokenRequestFailsIfNoSession() {
handler.setEagerlyCreateSessions(false);
request.setSession(null);
request.setParameter(ARTIFACT_PARAMETER_NAME, TICKET);
@@ -73,7 +73,7 @@ public void tokenRequestKOIfNoSession() {
}
@Test
- public void tokenRequestKOBadParameter() {
+ public void tokenRequestFailsIfBadParameter() {
final MockHttpSession session = new MockHttpSession();
request.setSession(session);
request.setParameter(ANOTHER_PARAMETER, TICKET);
@@ -95,7 +95,7 @@ public void tokenRequestOK() {
}
@Test
- public void backChannelLogoutKOMultipart() {
+ public void backChannelLogoutFailsIfMultipart() {
final String logoutMessage = LogoutMessageGenerator.generateBackChannelLogoutMessage(TICKET);
request.setParameter(LOGOUT_PARAMETER_NAME, logoutMessage);
request.setMethod("POST");
@@ -107,7 +107,7 @@ public void backChannelLogoutKOMultipart() {
}
@Test
- public void backChannelLogoutKONoSessionIndex() {
+ public void backChannelLogoutFailsIfNoSessionIndex() {
final String logoutMessage = LogoutMessageGenerator.generateBackChannelLogoutMessage("");
request.setParameter(LOGOUT_PARAMETER_NAME, logoutMessage);
request.setMethod("POST");
@@ -129,7 +129,7 @@ public void backChannelLogoutOK() {
}
@Test
- public void frontChannelLogoutKOBadParameter() {
+ public void frontChannelLogoutFailsIfBadParameter() {
final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
request.setParameter(ANOTHER_PARAMETER, logoutMessage);
request.setMethod("GET");
@@ -141,7 +141,7 @@ public void frontChannelLogoutKOBadParameter() {
}
@Test
- public void frontChannelLogoutKONoSessionIndex() {
+ public void frontChannelLogoutFailsIfNoSessionIndex() {
final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage("");
request.setParameter(FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
request.setQueryString(FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
From a838bb6c5d619f1d29e71b3c6fb6c39a3940e25b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Mon, 7 Apr 2014 18:54:40 +0200
Subject: [PATCH 102/239] CASC-220: Support front channel SLO logout
Update after new Misagh's comments
---
.../org/jasig/cas/client/session/SingleSignOutHandler.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 8026ed1f6..c93d9b30d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -214,7 +214,7 @@ public boolean process(final HttpServletRequest request, final HttpServletRespon
return false;
} else {
- logger.trace("Ignoring URI {}", request.getRequestURI());
+ logger.trace("Ignoring URI for logout: {}", request.getRequestURI());
return true;
}
}
@@ -264,7 +264,7 @@ private String uncompressLogoutMessage(final String originalMessage) {
// decode the bytes into a String
return new String(result, 0, resultLength, "UTF-8");
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("Unable to decompress logout message", e);
throw new RuntimeException(e);
} finally {
@@ -282,7 +282,7 @@ private String uncompressLogoutMessage(final String originalMessage) {
private void destroySession(final HttpServletRequest request) {
final String logoutMessage;
// front channel logout -> the message needs to be base64 decoded + decompressed
- if ("GET".equals(request.getMethod())) {
+ if (isFrontChannelLogoutRequest(request)) {
logoutMessage = uncompressLogoutMessage(CommonUtils.safeGetParameter(request,
this.frontLogoutParameterName));
} else {
From 18d3647a040c5c2a8eddd88ca184bf5f17ad441b Mon Sep 17 00:00:00 2001
From: John Gasper
Date: Mon, 14 Apr 2014 08:45:21 -0700
Subject: [PATCH 103/239] Using Misagh's PatternMatcherStrategy to optimize
proxy chain checks
---
.../ExactUrlPatternMatcherStrategy.java | 8 +++-
.../RegexUrlPatternMatcherStrategy.java | 6 +++
.../cas/client/validation/ProxyList.java | 48 ++++++++++++-------
3 files changed, 45 insertions(+), 17 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
index 64f20ebe8..9fd0ddf4e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/ExactUrlPatternMatcherStrategy.java
@@ -28,7 +28,13 @@
public final class ExactUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
private String pattern;
-
+
+ public ExactUrlPatternMatcherStrategy() {}
+
+ public ExactUrlPatternMatcherStrategy(final String pattern) {
+ this.setPattern(pattern);
+ }
+
public boolean matches(final String url) {
return url.equals(this.pattern);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
index a9414598e..e5665cdf7 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/RegexUrlPatternMatcherStrategy.java
@@ -30,6 +30,12 @@
public final class RegexUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
private Pattern pattern;
+
+ public RegexUrlPatternMatcherStrategy() {}
+
+ public RegexUrlPatternMatcherStrategy(final String pattern) {
+ this.setPattern(pattern);
+ }
public boolean matches(final String url) {
return this.pattern.matcher(url).find();
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
index 3a6846c24..606923c33 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
@@ -19,10 +19,13 @@
package org.jasig.cas.client.validation;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.regex.Pattern;
+import org.jasig.cas.client.authentication.ExactUrlPatternMatcherStrategy;
+import org.jasig.cas.client.authentication.RegexUrlPatternMatcherStrategy;
+import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
import org.jasig.cas.client.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Holding class for the proxy list to make Spring configuration easier.
@@ -33,20 +36,28 @@
*/
public final class ProxyList {
- private final List proxyChains;
- private final HashMap proxyChainRegexCache;
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private final List> proxyChains;
public ProxyList(final List proxyChains) {
CommonUtils.assertNotNull(proxyChains, "List of proxy chains cannot be null.");
- this.proxyChains = proxyChains;
- this.proxyChainRegexCache = new HashMap();
- for (final String[] list : this.proxyChains) {
+ this.proxyChains = new ArrayList>();
+
+ for (final String[] list : proxyChains) {
+ final List chain = new ArrayList();
+
for (final String item : list) {
if (item.startsWith("^")) {
- this.proxyChainRegexCache.put(item, Pattern.compile(item));
+ chain.add(new RegexUrlPatternMatcherStrategy(item));
+ }
+ else {
+ chain.add(new ExactUrlPatternMatcherStrategy(item));
}
}
+
+ this.proxyChains.add(chain);
}
}
@@ -55,28 +66,33 @@ public ProxyList() {
}
public boolean contains(String[] proxiedList) {
- for (final String[] proxyChain : this.proxyChains) {
-
- if (proxyChain.length == proxiedList.length) {
+ StringBuilder loggingOutput;
- for (int linkIndex = 0; linkIndex < proxyChain.length; linkIndex++) {
- String link = proxyChain[linkIndex];
+ for (final List proxyChain : this.proxyChains) {
+ loggingOutput = new StringBuilder();
- if (link.equals(proxiedList[linkIndex])
- || (link.startsWith("^") && proxyChainRegexCache.get(link).matcher(proxiedList[linkIndex]).matches())) {
+ if (proxyChain.size() == proxiedList.length) {
+ for (int linkIndex = 0; linkIndex < proxyChain.size(); linkIndex++) {
+ final String linkToTest = proxiedList[linkIndex];
+ loggingOutput.append(linkToTest);
+ if (proxyChain.get(linkIndex).matches(linkToTest)) {
//If we are at the last link, we found a good proxyChain.
- if (linkIndex == proxyChain.length-1) {
+ if (linkIndex == proxyChain.size()-1) {
+ logger.info("Proxy chain matched: {}", loggingOutput.toString());
return true;
}
} else {
+ logger.warn("Proxy chain did not match at {}. Skipping to next allowedProxyChain", loggingOutput.toString());
break;
}
+ loggingOutput.append("->");
}
}
}
+ logger.warn("No proxy chain matched the allowedProxyChains list.");
return false;
}
From 9d4ee3356f988e3034f45571f8722e6b5cc78d7b Mon Sep 17 00:00:00 2001
From: John Gasper
Date: Tue, 15 Apr 2014 12:56:46 -0700
Subject: [PATCH 104/239] Formatting clean-up
---
.../main/java/org/jasig/cas/client/validation/ProxyList.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
index 606923c33..a15a62b78 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
@@ -51,8 +51,7 @@ public ProxyList(final List proxyChains) {
for (final String item : list) {
if (item.startsWith("^")) {
chain.add(new RegexUrlPatternMatcherStrategy(item));
- }
- else {
+ } else {
chain.add(new ExactUrlPatternMatcherStrategy(item));
}
}
@@ -78,7 +77,7 @@ public boolean contains(String[] proxiedList) {
if (proxyChain.get(linkIndex).matches(linkToTest)) {
//If we are at the last link, we found a good proxyChain.
- if (linkIndex == proxyChain.size()-1) {
+ if (linkIndex == proxyChain.size() - 1) {
logger.info("Proxy chain matched: {}", loggingOutput.toString());
return true;
}
From b59df9a6614c1ba122dc99f1309b3f341ff5d835 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 6 May 2014 22:12:59 -0400
Subject: [PATCH 105/239] CASC-224 Public API Method Removed without
Deprecation
Problem: Previous versions of the CAS Client remove a public API method without sufficient deprecation time resulting in
problems for clients who want to upgrade.
Solution: Add Method back and mark it as deprecated.
---
.../org/jasig/cas/client/util/CommonUtils.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index b483c56c0..2e962839f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -29,6 +29,7 @@
import javax.servlet.http.HttpServletResponse;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
+import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
import org.jasig.cas.client.validation.ProxyList;
import org.jasig.cas.client.validation.ProxyListEditor;
import org.slf4j.Logger;
@@ -55,6 +56,8 @@ public final class CommonUtils {
*/
private static final String PARAM_PROXY_GRANTING_TICKET = "pgtId";
+ private static final HttpURLConnectionFactory DEFAULT_URL_CONNECTION_FACTORY = new HttpsURLConnectionFactory();
+
private CommonUtils() {
// nothing to do
}
@@ -348,6 +351,19 @@ public static String safeGetParameter(final HttpServletRequest request, final St
return safeGetParameter(request, parameter, Arrays.asList("logoutRequest"));
}
+
+ /**
+ * Contacts the remote URL and returns the response.
+ *
+ * @param constructedUrl the url to contact.
+ * @param encoding the encoding to use.
+ * @return the response.
+ */
+ @Deprecated
+ public static String getResponseFromServer(final URL constructedUrl, final String encoding) {
+ return getResponseFromServer(constructedUrl, DEFAULT_URL_CONNECTION_FACTORY, encoding);
+ }
+
/**
* Contacts the remote URL and returns the response.
*
From db4057815a8a738f1238274fdd95351b572e04b0 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 6 May 2014 22:35:55 -0400
Subject: [PATCH 106/239] CASC-223 SingleSignOutFilter requires init method to
be called which changes the contract with previous versions
Problem: Some clients such as Spring Security configure the filter via Spring configuration, meaning the handler's init method
is not called vai the Filter#init method.
Solution: For now, have an atomic boolean to determine if init was called or not and call it if necessary as part of the flow.
---
.../client/session/SingleSignOutFilter.java | 46 ++++++++++++-------
1 file changed, 29 insertions(+), 17 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index 33b2094eb..c9243e95b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -19,6 +19,7 @@
package org.jasig.cas.client.session;
import java.io.IOException;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -34,49 +35,52 @@
*/
public final class SingleSignOutFilter extends AbstractConfigurationFilter {
- private static final SingleSignOutHandler handler = new SingleSignOutHandler();
+ private static final SingleSignOutHandler HANDLER = new SingleSignOutHandler();
+
+ private AtomicBoolean handlerInitialized = new AtomicBoolean(false);
public void init(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
- handler.setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName",
+ HANDLER.setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName",
SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME));
- handler.setLogoutParameterName(getPropertyFromInitParams(filterConfig, "logoutParameterName",
+ HANDLER.setLogoutParameterName(getPropertyFromInitParams(filterConfig, "logoutParameterName",
SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME));
- handler.setFrontLogoutParameterName(getPropertyFromInitParams(filterConfig, "frontLogoutParameterName",
+ HANDLER.setFrontLogoutParameterName(getPropertyFromInitParams(filterConfig, "frontLogoutParameterName",
SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME));
- handler.setRelayStateParameterName(getPropertyFromInitParams(filterConfig, "relayStateParameterName",
+ HANDLER.setRelayStateParameterName(getPropertyFromInitParams(filterConfig, "relayStateParameterName",
SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME));
- handler.setCasServerUrlPrefix(getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null));
- handler.setArtifactParameterOverPost(parseBoolean(getPropertyFromInitParams(filterConfig,
+ HANDLER.setCasServerUrlPrefix(getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null));
+ HANDLER.setArtifactParameterOverPost(parseBoolean(getPropertyFromInitParams(filterConfig,
"artifactParameterOverPost", "false")));
- handler.setEagerlyCreateSessions(parseBoolean(getPropertyFromInitParams(filterConfig,
+ HANDLER.setEagerlyCreateSessions(parseBoolean(getPropertyFromInitParams(filterConfig,
"eagerlyCreateSessions", "true")));
}
- handler.init();
+ HANDLER.init();
+ handlerInitialized.set(true);
}
public void setArtifactParameterName(final String name) {
- handler.setArtifactParameterName(name);
+ HANDLER.setArtifactParameterName(name);
}
public void setLogoutParameterName(final String name) {
- handler.setLogoutParameterName(name);
+ HANDLER.setLogoutParameterName(name);
}
public void setFrontLogoutParameterName(final String name) {
- handler.setFrontLogoutParameterName(name);
+ HANDLER.setFrontLogoutParameterName(name);
}
public void setRelayStateParameterName(final String name) {
- handler.setRelayStateParameterName(name);
+ HANDLER.setRelayStateParameterName(name);
}
public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
- handler.setCasServerUrlPrefix(casServerUrlPrefix);
+ HANDLER.setCasServerUrlPrefix(casServerUrlPrefix);
}
public void setSessionMappingStorage(final SessionMappingStorage storage) {
- handler.setSessionMappingStorage(storage);
+ HANDLER.setSessionMappingStorage(storage);
}
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
@@ -84,7 +88,15 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
- if (handler.process(request, response)) {
+ /**
+ *
Workaround for now for the fact that Spring Security will fail since it doesn't call {@link #init(javax.servlet.FilterConfig)}.
+ *
Ultimately we need to allow deployers to actually inject their fully-initialized {@link org.jasig.cas.client.session.SingleSignOutHandler}.
+ */
+ if (!this.handlerInitialized.getAndSet(true)) {
+ HANDLER.init();
+ }
+
+ if (HANDLER.process(request, response)) {
filterChain.doFilter(servletRequest, servletResponse);
}
}
@@ -94,6 +106,6 @@ public void destroy() {
}
protected static SingleSignOutHandler getSingleSignOutHandler() {
- return handler;
+ return HANDLER;
}
}
From cacc85c513da21ebdfb3857ab9c45a0e3b771fab Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 6 May 2014 22:53:05 -0400
Subject: [PATCH 107/239] Synchronize the init method in case we have multiple
concurrent requests at the same time.
---
.../client/session/SingleSignOutHandler.java | 26 ++++++++++---------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index c93d9b30d..5f8b46c5d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -132,18 +132,20 @@ public void setEagerlyCreateSessions(final boolean eagerlyCreateSessions) {
/**
* Initializes the component for use.
*/
- public void init() {
- CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null.");
- CommonUtils.assertNotNull(this.logoutParameterName, "logoutParameterName cannot be null.");
- CommonUtils.assertNotNull(this.frontLogoutParameterName, "frontLogoutParameterName cannot be null.");
- CommonUtils.assertNotNull(this.sessionMappingStorage, "sessionMappingStorage cannot be null.");
- CommonUtils.assertNotNull(this.relayStateParameterName, "relayStateParameterName cannot be null.");
- CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
-
- if (this.artifactParameterOverPost) {
- this.safeParameters = Arrays.asList(this.logoutParameterName, this.artifactParameterName);
- } else {
- this.safeParameters = Arrays.asList(this.logoutParameterName);
+ public synchronized void init() {
+ if (this.safeParameters == null) {
+ CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null.");
+ CommonUtils.assertNotNull(this.logoutParameterName, "logoutParameterName cannot be null.");
+ CommonUtils.assertNotNull(this.frontLogoutParameterName, "frontLogoutParameterName cannot be null.");
+ CommonUtils.assertNotNull(this.sessionMappingStorage, "sessionMappingStorage cannot be null.");
+ CommonUtils.assertNotNull(this.relayStateParameterName, "relayStateParameterName cannot be null.");
+ CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
+
+ if (this.artifactParameterOverPost) {
+ this.safeParameters = Arrays.asList(this.logoutParameterName, this.artifactParameterName);
+ } else {
+ this.safeParameters = Arrays.asList(this.logoutParameterName);
+ }
}
}
From 795506f22b32bb676bddc9cc6d3b995192151592 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 6 May 2014 23:17:32 -0400
Subject: [PATCH 108/239] Removed no-longer valid test.
---
.../jasig/cas/client/session/SingleSignOutFilterTests.java | 6 ------
1 file changed, 6 deletions(-)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
index 64114f9b9..7c91f8f10 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
@@ -60,12 +60,6 @@ public void setUp() throws Exception {
response = new MockHttpServletResponse();
filterChain = new MockFilterChain();
}
-
- @Test(expected = IllegalArgumentException.class)
- public void initWithoutCasServerUrlPrefix() throws ServletException {
- filter = new SingleSignOutFilter();
- filter.init(new MockFilterConfig());
- }
@Test
public void tokenRequest() throws IOException, ServletException {
From ae37092100c8eaec610dab6d83e5e05a8ee58814 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Tue, 24 Jun 2014 18:44:45 -0400
Subject: [PATCH 109/239] CASC-228 URL Encode Paramaters Passed to Server via
Validate
Problem: We currently don't pass encoded values to the server, possibly resolving in parsing/extraction errors.
Solution: URL Encode all values instead of just the service url.
QA Notes: Added unit test.
---
.../AbstractUrlBasedTicketValidator.java | 5 +++--
.../validation/Cas20ServiceTicketValidator.java | 2 +-
.../validation/Cas10TicketValidatorTests.java | 14 ++++++++++++--
3 files changed, 16 insertions(+), 5 deletions(-)
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
index 3ea31bdd0..fab058150 100644
--- 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
@@ -110,7 +110,7 @@ protected final String constructValidationUrl(final String ticket, final String
logger.debug("Placing URL parameters in map.");
urlParameters.put("ticket", ticket);
- urlParameters.put("service", encodeUrl(serviceUrl));
+ urlParameters.put("service", serviceUrl);
if (this.renew) {
urlParameters.put("renew", "true");
@@ -144,7 +144,8 @@ protected final String constructValidationUrl(final String ticket, final String
buffer.append(i++ == 0 ? "?" : "&");
buffer.append(key);
buffer.append("=");
- buffer.append(value);
+ final String encodedValue = encodeUrl(value);
+ buffer.append(encodedValue);
}
}
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
index 4380348b2..9ecc5b850 100644
--- 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
@@ -70,7 +70,7 @@ public Cas20ServiceTicketValidator(final String casServerUrlPrefix) {
* @param urlParameters the Map containing the existing parameters to send to the server.
*/
protected final void populateUrlAttributeMap(final Map urlParameters) {
- urlParameters.put("pgtUrl", encodeUrl(this.proxyCallbackUrl));
+ urlParameters.put("pgtUrl", this.proxyCallbackUrl);
}
protected String getUrlSuffix() {
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
index 7d072884f..280e0eb20 100644
--- 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
@@ -18,8 +18,7 @@
*/
package org.jasig.cas.client.validation;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.io.UnsupportedEncodingException;
import org.jasig.cas.client.PublicTestHttpServer;
import org.junit.Before;
@@ -80,4 +79,15 @@ public void testBadResponse() throws UnsupportedEncodingException {
// expected
}
}
+
+ @Test
+ public void urlEncodedValues() {
+ final String ticket = "ST-1-owKEOtYJjg77iHcCQpkl-cas01.example.org%26%73%65%72%76%69%63%65%3d%68%74%74%70%25%33%41%25%32%46%25%32%46%31%32%37%2e%30%2e%30%2e%31%25%32%46%62%6f%72%69%6e%67%25%32%46%23";
+ final String service = "foobar";
+ final String url = this.ticketValidator.constructValidationUrl(ticket, service);
+
+ final String encodedValue = this.ticketValidator.encodeUrl(ticket);
+ assertTrue(url.contains(encodedValue));
+ assertFalse(url.contains(ticket));
+ }
}
From d2d7af065dc086d3959848bd7ed4168cf63fb283 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 20 Jul 2014 20:31:35 -0400
Subject: [PATCH 110/239] CASC-224 Replace URL with String to remain compatible
with Spring Security
---
.../main/java/org/jasig/cas/client/util/CommonUtils.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 2e962839f..3d991717d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -360,8 +360,12 @@ public static String safeGetParameter(final HttpServletRequest request, final St
* @return the response.
*/
@Deprecated
- public static String getResponseFromServer(final URL constructedUrl, final String encoding) {
- return getResponseFromServer(constructedUrl, DEFAULT_URL_CONNECTION_FACTORY, encoding);
+ public static String getResponseFromServer(final String constructedUrl, final String encoding) {
+ try {
+ return getResponseFromServer(new URL(constructedUrl), DEFAULT_URL_CONNECTION_FACTORY, encoding);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
}
/**
From e4d925c4ae5469be22b66b7c8173d9d8a2f408b6 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 3 Aug 2014 00:03:25 -0400
Subject: [PATCH 111/239] Added missing license header.
---
.../client/session/LogoutMessageGenerator.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
index 1ebc862d2..861fffc4f 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.session;
import java.nio.charset.Charset;
From 3263202762e93331648c9c1d064698117123bad8 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 3 Aug 2014 00:22:14 -0400
Subject: [PATCH 112/239] [maven-release-plugin] prepare release
cas-client-3.3.2
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
pom.xml | 4 ++--
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 1482cc65c..fb94ce28a 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.2cas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 83c039b29..193ce9d01 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.2cas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 6c5c96bf8..034f14f99 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.2cas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 72be09340..e2995f8f6 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.24.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 3ce7551df..f209e9e3e 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.24.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 486d93227..9dd454b37 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.24.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index e6ee05f7a..9a9e6d659 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.24.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index e20df1383..7cd81322f 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.24.0.0
diff --git a/pom.xml b/pom.xml
index 8b08eb492..2201dd53a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.2-SNAPSHOT
+ 3.3.2cas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- HEAD
+ cas-client-3.3.22006
From e8c78b8dd3e665912f635fe3dacad6a6a2edd29a Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 3 Aug 2014 00:22:49 -0400
Subject: [PATCH 113/239] [maven-release-plugin] prepare for next development
iteration
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
pom.xml | 4 ++--
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index fb94ce28a..f37b0844b 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 193ce9d01..d94bbd5c5 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 034f14f99..f2de056dd 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index e2995f8f6..e72e95360 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index f209e9e3e..067fa1b0e 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 9dd454b37..413988009 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 9a9e6d659..d55655742 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 7cd81322f..3143fdb64 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOT4.0.0
diff --git a/pom.xml b/pom.xml
index 2201dd53a..c51b43eac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.2
+ 3.3.3-SNAPSHOTcas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- cas-client-3.3.2
+ HEAD2006
From 5fd3d11c406877e21a30a51a9efdb2ffd820fa02 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Mon, 11 Aug 2014 22:09:27 -0400
Subject: [PATCH 114/239] CASC-225 Restore Removed Constructor for Backwards
Compatibility
Problem: We removed the two string constructor which breaks Spring Security compatibility.
Solution: Add it back as deprecated so that Spring Security can upgrade.
---
.../cas/client/proxy/Cas20ProxyRetriever.java | 13 ++++++++++++-
.../org/jasig/cas/client/util/CommonUtils.java | 15 ++++++++++-----
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index 1146b48c2..e80304a29 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -55,6 +55,11 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
/** Url connection factory to use when communicating with the server **/
private final HttpURLConnectionFactory urlConnectionFactory;
+ @Deprecated
+ public Cas20ProxyRetriever(final String casServerUrl, final String encoding) {
+ this(casServerUrl, encoding, null);
+ }
+
/**
* Main Constructor.
*
@@ -75,7 +80,13 @@ public String getProxyTicketIdFor(final String proxyGrantingTicketId, final Stri
CommonUtils.assertNotNull(targetService, "targetService cannot be null.");
final URL url = constructUrl(proxyGrantingTicketId, targetService);
- final String response = CommonUtils.getResponseFromServer(url, this.urlConnectionFactory, this.encoding);
+ final String response;
+
+ if (this.urlConnectionFactory != null) {
+ response = CommonUtils.getResponseFromServer(url, this.urlConnectionFactory, this.encoding);
+ } else {
+ response = CommonUtils.getResponseFromServer(url, this.encoding);
+ }
final String error = XmlUtils.getTextForElement(response, "proxyFailure");
if (CommonUtils.isNotEmpty(error)) {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 3d991717d..555e601db 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -361,11 +361,16 @@ public static String safeGetParameter(final HttpServletRequest request, final St
*/
@Deprecated
public static String getResponseFromServer(final String constructedUrl, final String encoding) {
- try {
- return getResponseFromServer(new URL(constructedUrl), DEFAULT_URL_CONNECTION_FACTORY, encoding);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
+ try {
+ return getResponseFromServer(new URL(constructedUrl), DEFAULT_URL_CONNECTION_FACTORY, encoding);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Deprecated
+ public static String getResponseFromServer(final URL constructedUrl, final String encoding) {
+ return getResponseFromServer(constructedUrl, DEFAULT_URL_CONNECTION_FACTORY, encoding);
}
/**
From e70a7a0e7ccf7fee9792bb38ad5c0eee82e7bffc Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Mon, 11 Aug 2014 22:36:27 -0400
Subject: [PATCH 115/239] CASC-229 Make Front Channel SSO Optional so that
backwards compatibility is maintained.
Problem: Spring Security adopters will fail to be able to drop in a new version of CAS Client for Java if this feature is enabled by default/required.
Solution: Force a fail-safe optional mode if the value is not provided.
---
.../jasig/cas/client/session/SingleSignOutFilter.java | 2 +-
.../cas/client/session/SingleSignOutHandler.java | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index c9243e95b..bf91bf8ed 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -49,7 +49,7 @@ public void init(final FilterConfig filterConfig) throws ServletException {
SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME));
HANDLER.setRelayStateParameterName(getPropertyFromInitParams(filterConfig, "relayStateParameterName",
SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME));
- HANDLER.setCasServerUrlPrefix(getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null));
+ HANDLER.setCasServerUrlPrefix(getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", ""));
HANDLER.setArtifactParameterOverPost(parseBoolean(getPropertyFromInitParams(filterConfig,
"artifactParameterOverPost", "false")));
HANDLER.setEagerlyCreateSessions(parseBoolean(getPropertyFromInitParams(filterConfig,
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 5f8b46c5d..ee737d7d3 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -70,7 +70,7 @@ public final class SingleSignOutHandler {
private String relayStateParameterName = DEFAULT_RELAY_STATE_PARAMETER_NAME;
/** The prefix url of the CAS server */
- private String casServerUrlPrefix;
+ private String casServerUrlPrefix = "";
private boolean artifactParameterOverPost = false;
@@ -141,6 +141,10 @@ public synchronized void init() {
CommonUtils.assertNotNull(this.relayStateParameterName, "relayStateParameterName cannot be null.");
CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
+ if (CommonUtils.isBlank(this.casServerUrlPrefix)) {
+ logger.warn("Front Channel single sign out redirects are disabled when the 'casServerUrlPrefix' value is not set.");
+ }
+
if (this.artifactParameterOverPost) {
this.safeParameters = Arrays.asList(this.logoutParameterName, this.artifactParameterName);
} else {
@@ -176,14 +180,15 @@ private boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
}
/**
- * Determines whether the given request is a CAS front channel logout request.
+ * Determines whether the given request is a CAS front channel logout request. Front Channel log out requests are only supported
+ * when the 'casServerUrlPrefix' value is set.
*
* @param request HTTP request.
*
* @return True if request is logout request, false otherwise.
*/
private boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
- return "GET".equals(request.getMethod())
+ return "GET".equals(request.getMethod()) && CommonUtils.isNotBlank(this.casServerUrlPrefix)
&& CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.frontLogoutParameterName));
}
From a02cf851c5ab44ff312ef832ca7389063aaa7ec5 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Mon, 11 Aug 2014 22:50:23 -0400
Subject: [PATCH 116/239] CASC-230 Call HttpServletRequest#logout() via
Reflection to Improve Backwards Compatibility with Spring Security
---
.../client/session/SingleSignOutHandler.java | 28 +++++++++++++++----
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 5f8b46c5d..07264c323 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -18,11 +18,11 @@
*/
package org.jasig.cas.client.session;
+import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
import java.util.zip.Inflater;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@@ -78,6 +78,8 @@ public final class SingleSignOutHandler {
private List safeParameters;
+ private Method httpRequestLogoutMethod = retrieveHttpRequestLogoutMethod();
+
public void setSessionMappingStorage(final SessionMappingStorage storage) {
this.sessionMappingStorage = storage;
}
@@ -306,11 +308,7 @@ private void destroySession(final HttpServletRequest request) {
} catch (final IllegalStateException e) {
logger.debug("Error invalidating session.", e);
}
- try {
- request.logout();
- } catch (final ServletException e) {
- logger.debug("Error performing request.logout.");
- }
+ executeHttpServletRequestLogoutIfPossible(request);
}
}
}
@@ -345,4 +343,22 @@ private String computeRedirectionToServer(final HttpServletRequest request) {
private boolean isMultipartRequest(final HttpServletRequest request) {
return request.getContentType() != null && request.getContentType().toLowerCase().startsWith("multipart");
}
+
+ private void executeHttpServletRequestLogoutIfPossible(final HttpServletRequest request) {
+ if (this.httpRequestLogoutMethod != null) {
+ try {
+ this.httpRequestLogoutMethod.invoke(request);
+ } catch (final Exception e) {
+ logger.debug("Error performing request.logout.");
+ }
+ }
+ }
+
+ private static Method retrieveHttpRequestLogoutMethod() {
+ try {
+ return HttpServletRequest.class.getMethod("logout");
+ } catch (final NoSuchMethodException e) {
+ return null;
+ }
+ }
}
From 58ead5b9a8c859dc5ecf52f7c359a88984e0028b Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Mon, 11 Aug 2014 23:04:24 -0400
Subject: [PATCH 117/239] Updated code to abstract the reflection logic a bit
more behind a strategy interface.
---
.../client/session/SingleSignOutHandler.java | 47 +++++++++++++------
1 file changed, 32 insertions(+), 15 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 07264c323..fe4bbc190 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -18,11 +18,11 @@
*/
package org.jasig.cas.client.session;
-import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
import java.util.zip.Inflater;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@@ -78,7 +78,7 @@ public final class SingleSignOutHandler {
private List safeParameters;
- private Method httpRequestLogoutMethod = retrieveHttpRequestLogoutMethod();
+ private LogoutStrategy logoutStrategy = isServlet30() ? new Servlet30LogoutStrategy() : new Servlet25LogoutStrategy();
public void setSessionMappingStorage(final SessionMappingStorage storage) {
this.sessionMappingStorage = storage;
@@ -308,7 +308,7 @@ private void destroySession(final HttpServletRequest request) {
} catch (final IllegalStateException e) {
logger.debug("Error invalidating session.", e);
}
- executeHttpServletRequestLogoutIfPossible(request);
+ this.logoutStrategy.logout(request);
}
}
}
@@ -344,21 +344,38 @@ private boolean isMultipartRequest(final HttpServletRequest request) {
return request.getContentType() != null && request.getContentType().toLowerCase().startsWith("multipart");
}
- private void executeHttpServletRequestLogoutIfPossible(final HttpServletRequest request) {
- if (this.httpRequestLogoutMethod != null) {
- try {
- this.httpRequestLogoutMethod.invoke(request);
- } catch (final Exception e) {
- logger.debug("Error performing request.logout.");
- }
+ private static boolean isServlet30() {
+ try {
+ return HttpServletRequest.class.getMethod("logout") != null;
+ } catch (final NoSuchMethodException e) {
+ return false;
}
}
- private static Method retrieveHttpRequestLogoutMethod() {
- try {
- return HttpServletRequest.class.getMethod("logout");
- } catch (final NoSuchMethodException e) {
- return null;
+
+ /**
+ * Abstracts the ways we can force logout with the Servlet spec.
+ */
+ private interface LogoutStrategy {
+
+ void logout(HttpServletRequest request);
+ }
+
+ private class Servlet25LogoutStrategy implements LogoutStrategy {
+
+ public void logout(final HttpServletRequest request) {
+ // nothing additional to do here
+ }
+ }
+
+ private class Servlet30LogoutStrategy implements LogoutStrategy {
+
+ public void logout(final HttpServletRequest request) {
+ try {
+ request.logout();
+ } catch (final ServletException e) {
+ logger.debug("Error performing request.logout.");
+ }
}
}
}
From 88af0917415addfd326b72030a6d9c2598ac2822 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 15 Aug 2014 08:48:05 -0400
Subject: [PATCH 118/239] Update notice files.
---
NOTICE | 10 +++++-----
cas-client-core/NOTICE | 2 +-
cas-client-integration-atlassian/NOTICE | 6 +++---
cas-client-integration-jboss/NOTICE | 2 +-
cas-client-integration-tomcat-common/NOTICE | 2 +-
cas-client-integration-tomcat-v6/NOTICE | 2 +-
cas-client-integration-tomcat-v7/NOTICE | 2 +-
cas-client-support-distributed-ehcache/NOTICE | 2 +-
cas-client-support-distributed-memcached/NOTICE | 2 +-
9 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/NOTICE b/NOTICE
index 5de596cdc..44db3d1e4 100644
--- a/NOTICE
+++ b/NOTICE
@@ -16,21 +16,22 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
Apache Log4j under The Apache Software License, Version 2.0
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Apache XML Security under The Apache Software License, Version 2.0
- Atlassian JIRA - Code - Core under Atlassian End User License
- Atlassian Seraph under BSD License
- atlassian-osuser under BSD License
Bouncy Castle Provider under Bouncy Castle Licence
catalina under Apache License, Version 2.0
Codec under The Apache Software License, Version 2.0
+ com.atlassian.confluence:confluence under Atlassian End User License
com.atlassian.event:atlassian-event under Atlassian End User License
+ com.atlassian.jira:jira-core under Atlassian End User License
+ com.atlassian.osuser:atlassian-osuser under Atlassian End User License
+ com.atlassian.seraph:atlassian-seraph under Atlassian End User License
Commons Codec under The Apache Software License, Version 2.0
commons-collections under Apache License, Version 2.0
- Confluence Core under Atlassian End User License
Ehcache Core under The Apache Software License, Version 2.0
ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
Google Collections Library under The Apache Software License, Version 2.0
@@ -49,7 +50,6 @@ This project includes:
JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
JavaMail API under Common Development and Distribution License (CDDL) v1.0
JBoss Application Server Tomcat under lgpl
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
diff --git a/cas-client-core/NOTICE b/cas-client-core/NOTICE
index 68fc9d2f9..2297c6f78 100644
--- a/cas-client-core/NOTICE
+++ b/cas-client-core/NOTICE
@@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
Apache Log4j under The Apache Software License, Version 2.0
Apache Santuario under The Apache Software License, Version 2.0
@@ -30,7 +31,6 @@ This project includes:
Java Servlet API under CDDL + GPLv2 with classpath exception
JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
JavaMail API under Common Development and Distribution License (CDDL) v1.0
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
diff --git a/cas-client-integration-atlassian/NOTICE b/cas-client-integration-atlassian/NOTICE
index 5d2091c53..502f17217 100644
--- a/cas-client-integration-atlassian/NOTICE
+++ b/cas-client-integration-atlassian/NOTICE
@@ -16,13 +16,14 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Atlassian Event under Atlassian End User License
Atlassian JIRA - Code - Core under Atlassian End User License
- Atlassian Seraph under BSD License
- atlassian-osuser under BSD License
+ Atlassian Seraph under Atlassian End User License
+ atlassian-osuser under Atlassian End User License
Bouncy Castle Provider under Bouncy Castle Licence
Codec under The Apache Software License, Version 2.0
commons-collections under Apache License, Version 2.0
@@ -33,7 +34,6 @@ This project includes:
Jasig CAS Client for Java - Atlassian Integration under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
diff --git a/cas-client-integration-jboss/NOTICE b/cas-client-integration-jboss/NOTICE
index 2feec282a..d37370841 100644
--- a/cas-client-integration-jboss/NOTICE
+++ b/cas-client-integration-jboss/NOTICE
@@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@@ -27,7 +28,6 @@ This project includes:
Jasig CAS Client for Java - JBoss Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JBoss Application Server Tomcat under lgpl
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
diff --git a/cas-client-integration-tomcat-common/NOTICE b/cas-client-integration-tomcat-common/NOTICE
index 434c58a51..7c109fcb9 100644
--- a/cas-client-integration-tomcat-common/NOTICE
+++ b/cas-client-integration-tomcat-common/NOTICE
@@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@@ -26,7 +27,6 @@ This project includes:
Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
diff --git a/cas-client-integration-tomcat-v6/NOTICE b/cas-client-integration-tomcat-v6/NOTICE
index bc8673158..05565bb8d 100644
--- a/cas-client-integration-tomcat-v6/NOTICE
+++ b/cas-client-integration-tomcat-v6/NOTICE
@@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@@ -28,7 +29,6 @@ This project includes:
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 6.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
diff --git a/cas-client-integration-tomcat-v7/NOTICE b/cas-client-integration-tomcat-v7/NOTICE
index 0fe413fe8..c129bf42d 100644
--- a/cas-client-integration-tomcat-v7/NOTICE
+++ b/cas-client-integration-tomcat-v7/NOTICE
@@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@@ -27,7 +28,6 @@ This project includes:
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
diff --git a/cas-client-support-distributed-ehcache/NOTICE b/cas-client-support-distributed-ehcache/NOTICE
index cef121ad9..e355d62bb 100644
--- a/cas-client-support-distributed-ehcache/NOTICE
+++ b/cas-client-support-distributed-ehcache/NOTICE
@@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@@ -27,7 +28,6 @@ This project includes:
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
diff --git a/cas-client-support-distributed-memcached/NOTICE b/cas-client-support-distributed-memcached/NOTICE
index ba796115f..2fe29a890 100644
--- a/cas-client-support-distributed-memcached/NOTICE
+++ b/cas-client-support-distributed-memcached/NOTICE
@@ -16,6 +16,7 @@ specific language governing permissions and limitations
under the License.
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
Apache Santuario under The Apache Software License, Version 2.0
Apache Velocity under The Apache Software License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
@@ -27,7 +28,6 @@ This project includes:
Jasig CAS Client for Java - Distributed Proxy Storage Support:
Memcached under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
- jcip-annotations under Creative Commons Attribution License
JCL 1.1.1 implemented over SLF4J under MIT License
Joda time under Apache 2
JUL to SLF4J bridge under MIT License
From 32b0d7c8820f7569a2f9c1fe6b1cd21ce58aa30f Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 15 Aug 2014 08:51:04 -0400
Subject: [PATCH 119/239] [maven-release-plugin] prepare release
cas-client-3.3.3
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
pom.xml | 4 ++--
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index f37b0844b..b852eb27b 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.3cas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index d94bbd5c5..2803e7e4f 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.3cas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index f2de056dd..ce5904b71 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.3cas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index e72e95360..5fe5a4768 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.34.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 067fa1b0e..798357846 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.34.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 413988009..bfa4957a4 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.34.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index d55655742..605a6df21 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.34.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 3143fdb64..97b62def3 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.34.0.0
diff --git a/pom.xml b/pom.xml
index c51b43eac..b0ce184a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.3-SNAPSHOT
+ 3.3.3cas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- HEAD
+ cas-client-3.3.32006
From 51f6a82a40fbc32a847e8f0064e1fbc2a774784e Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 15 Aug 2014 08:52:01 -0400
Subject: [PATCH 120/239] [maven-release-plugin] prepare for next development
iteration
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
pom.xml | 4 ++--
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index b852eb27b..b0de44b4b 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 2803e7e4f..96895e919 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index ce5904b71..5a118eab1 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 5fe5a4768..06a1c3386 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 798357846..5d40ce408 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index bfa4957a4..5bc817def 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 605a6df21..1e1f71241 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 97b62def3..52a86404a 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOT4.0.0
diff --git a/pom.xml b/pom.xml
index b0ce184a8..70befaee2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.3
+ 3.3.4-SNAPSHOTcas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- cas-client-3.3.3
+ HEAD2006
From 603beabefcacb7b852631e89f7c5b7bda6778027 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 9 Apr 2014 22:12:26 -0400
Subject: [PATCH 121/239] CASC-200 Create a ConfigurationStrategy to allow for
pluggable configurations.
Problem: The lookup strategy for configuration is hard-coded into the filter, making it impossible to replace or expand.
Solution: Pull the strategies into their own classees and make it configurable. Default to the previous strategy.
QA Notes: The current unit tests work. New unit tests for the configuration will have to be added once the design is approved.
---
cas-client-core/pom.xml | 7 +
.../java/org/jasig/cas/client/Protocol.java | 28 ++++
.../authentication/AuthenticationFilter.java | 35 ++---
.../Saml11AuthenticationFilter.java | 17 +--
.../BaseConfigurationStrategy.java | 95 +++++++++++++
.../configuration/ConfigurationKey.java | 42 ++++++
.../configuration/ConfigurationKeys.java | 58 ++++++++
.../configuration/ConfigurationStrategy.java | 62 +++++++++
.../ConfigurationStrategyName.java | 51 +++++++
.../JndiConfigurationStrategyImpl.java | 75 ++++++++++
.../LegacyConfigurationStrategyImpl.java | 35 +++++
.../WebXmlConfigurationStrategyImpl.java | 42 ++++++
.../jaas/Servlet3AuthenticationFilter.java | 7 +-
...cryptedProxyGrantingTicketStorageImpl.java | 6 +-
.../client/session/SingleSignOutFilter.java | 22 ++-
.../client/session/SingleSignOutHandler.java | 15 +-
.../cas/client/util/AbstractCasFilter.java | 49 +++----
.../util/AbstractConfigurationFilter.java | 102 ++++----------
.../jasig/cas/client/util/CommonUtils.java | 16 ++-
.../util/HttpServletRequestWrapperFilter.java | 6 +-
.../AbstractTicketValidationFilter.java | 32 ++---
.../Cas10TicketValidationFilter.java | 21 ++-
...0ProxyReceivingTicketValidationFilter.java | 69 +++++-----
.../Saml11TicketValidationFilter.java | 37 ++---
.../configuration/ConfigurationKeyTests.java | 27 ++++
.../ConfigurationStrategyNameTests.java | 16 +++
.../WebXmlConfigurationStrategyImplTests.java | 128 ++++++++++++++++++
.../session/SingleSignOutFilterTests.java | 30 ++--
.../jasig/cas/client/util/CasFilterTests.java | 6 +
.../Cas10TicketValidationFilterTests.java | 5 +-
...yReceivingTicketValidationFilterTests.java | 30 ++--
.../Saml11TicketValidationFilterTests.java | 6 +-
...mpatibleJndiConfigurationStrategyImpl.java | 16 +++
.../WebAuthenticationFilter.java | 8 +-
34 files changed, 926 insertions(+), 275 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/JndiConfigurationStrategyImpl.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/LegacyConfigurationStrategyImpl.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImpl.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationKeyTests.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
create mode 100644 cas-client-integration-jboss/src/main/java/org/jasig/cas/client/configuration/JBossCompatibleJndiConfigurationStrategyImpl.java
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index f37b0844b..3cecc14c4 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -75,6 +75,13 @@
test
+
+ org.mockito
+ mockito-all
+ 1.10.8
+ test
+
+
log4jlog4j
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java b/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
new file mode 100644
index 000000000..184104f6e
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
@@ -0,0 +1,28 @@
+package org.jasig.cas.client;
+
+/**
+ * Created by battags on 10/14/14.
+ */
+public enum Protocol {
+
+
+
+ CAS1("ticket", "service"), CAS2(CAS1.getArtifactParameterName(), CAS1.getServiceParameterName()), SAML11("SAMLart", "TARGET");
+
+ private final String artifactParameterName;
+
+ private final String serviceParameterName;
+
+ private Protocol(final String artifactParameterName, final String serviceParameterName) {
+ this.artifactParameterName = artifactParameterName;
+ this.serviceParameterName = serviceParameterName;
+ }
+
+ public String getArtifactParameterName() {
+ return this.artifactParameterName;
+ }
+
+ public String getServiceParameterName() {
+ return this.serviceParameterName;
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index b77c64c45..d5e7fe452 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -27,6 +27,8 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
@@ -79,22 +81,24 @@ public class AuthenticationFilter extends AbstractCasFilter {
PATTERN_MATCHER_TYPES.put("REGEX", RegexUrlPatternMatcherStrategy.class);
PATTERN_MATCHER_TYPES.put("EXACT", ExactUrlPatternMatcherStrategy.class);
}
+
+ public AuthenticationFilter() {
+ this(Protocol.CAS2);
+ }
+
+ protected AuthenticationFilter(final Protocol protocol) {
+ super(protocol);
+ }
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
super.initInternal(filterConfig);
- setCasServerLoginUrl(getPropertyFromInitParams(filterConfig, "casServerLoginUrl", null));
- logger.trace("Loaded CasServerLoginUrl parameter: {}", this.casServerLoginUrl);
- setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
- logger.trace("Loaded renew parameter: {}", this.renew);
- setGateway(parseBoolean(getPropertyFromInitParams(filterConfig, "gateway", "false")));
- logger.trace("Loaded gateway parameter: {}", this.gateway);
+ setCasServerLoginUrl(getString(ConfigurationKeys.CAS_SERVER_LOGIN_URL));
+ setRenew(getBoolean(ConfigurationKeys.RENEW));
+ setGateway(getBoolean(ConfigurationKeys.GATEWAY));
- final String ignorePattern = getPropertyFromInitParams(filterConfig, "ignorePattern", null);
- logger.trace("Loaded ignorePattern parameter: {}", ignorePattern);
-
- final String ignoreUrlPatternType = getPropertyFromInitParams(filterConfig, "ignoreUrlPatternType", "REGEX");
- logger.trace("Loaded ignoreUrlPatternType parameter: {}", ignoreUrlPatternType);
+ final String ignorePattern = getString(ConfigurationKeys.IGNORE_PATTERN);
+ final String ignoreUrlPatternType = getString(ConfigurationKeys.IGNORE_URL_PATTERN_TYPE);
if (ignorePattern != null) {
final Class extends UrlPatternMatcherStrategy> ignoreUrlMatcherClass = PATTERN_MATCHER_TYPES.get(ignoreUrlPatternType);
@@ -113,14 +117,13 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
}
}
- final String gatewayStorageClass = getPropertyFromInitParams(filterConfig, "gatewayStorageClass", null);
+ final Class extends GatewayResolver> gatewayStorageClass = getClass(ConfigurationKeys.GATEWAY_STORAGE_CLASS);
if (gatewayStorageClass != null) {
- this.gatewayStorage = ReflectUtils.newInstance(gatewayStorageClass);
+ setGatewayStorage(ReflectUtils.newInstance(gatewayStorageClass));
}
- final String authenticationRedirectStrategyClass = getPropertyFromInitParams(filterConfig,
- "authenticationRedirectStrategyClass", null);
+ final Class extends AuthenticationRedirectStrategy> authenticationRedirectStrategyClass = getClass(ConfigurationKeys.AUTHENTICATION_REDIRECT_STRATEGY_CLASS);
if (authenticationRedirectStrategyClass != null) {
this.authenticationRedirectStrategy = ReflectUtils.newInstance(authenticationRedirectStrategyClass);
@@ -175,7 +178,7 @@ public final void doFilter(final ServletRequest servletRequest, final ServletRes
logger.debug("Constructed service url: {}", modifiedServiceUrl);
final String urlToRedirectTo = CommonUtils.constructRedirectUrl(this.casServerLoginUrl,
- getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway);
+ getProtocol().getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway);
logger.debug("redirecting to \"{}\"", urlToRedirectTo);
this.authenticationRedirectStrategy.redirect(request, response, urlToRedirectTo);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
index 6c853ec6a..63483b2e3 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
@@ -18,13 +18,12 @@
*/
package org.jasig.cas.client.authentication;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
+import org.jasig.cas.client.Protocol;
/**
- * Extension to the default Authentication filter that sets the required SAML1.1 artifact parameter name and service parameter name.
+ * Extension to the default Authentication filter that sets the required SAML11.1 artifact parameter name and service parameter name.
*
- * Note, as of 3.3, the final keyword was removed to allow you to override the method to retrieve tickets, per CASC-154s
+ * Note, as of 3.3, the final keyword was removed to allow you to override the method to retrieve tickets, per CASC-154
*
* @author Scott Battaglia
* @since 3.1.12
@@ -32,13 +31,7 @@
*/
public class Saml11AuthenticationFilter extends AuthenticationFilter {
- protected final void initInternal(final FilterConfig filterConfig) throws ServletException {
- super.initInternal(filterConfig);
-
- logger.warn("SAML1.1 compliance requires the [artifactParameterName] and [serviceParameterName] to be set to specified values.");
- logger.warn("This filter will overwrite any user-provided values (if any are provided)");
-
- setArtifactParameterName("SAMLart");
- setServiceParameterName("TARGET");
+ private Saml11AuthenticationFilter() {
+ super(Protocol.SAML11);
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
new file mode 100644
index 000000000..384f89db4
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
@@ -0,0 +1,95 @@
+package org.jasig.cas.client.configuration;
+
+import org.apache.commons.lang.BooleanUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.ReflectUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base class to provide most of the boiler-plate code (i.e. checking for proper values, returning defaults, etc.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public abstract class BaseConfigurationStrategy implements ConfigurationStrategy {
+
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+ public final boolean getBoolean(final ConfigurationKey configurationKey) {
+ return getValue(configurationKey, new Parser() {
+ public Boolean parse(final String value) {
+ return BooleanUtils.toBoolean(value);
+ }
+ });
+ }
+
+ public final long getLong(final ConfigurationKey configurationKey) {
+ return getValue(configurationKey, new Parser() {
+ public Long parse(final String value) {
+ return NumberUtils.toLong(value, configurationKey.getDefaultValue());
+ }
+ });
+ }
+
+ public final int getInt(final ConfigurationKey configurationKey) {
+ return getValue(configurationKey, new Parser() {
+ public Integer parse(final String value) {
+ return NumberUtils.toInt(value, configurationKey.getDefaultValue());
+ }
+ });
+ }
+
+ public final String getString(final ConfigurationKey configurationKey) {
+ return getValue(configurationKey, new Parser() {
+ public String parse(final String value) {
+ return value;
+ }
+ });
+ }
+
+ public Class extends T> getClass(final ConfigurationKey> configurationKey) {
+ return getValue(configurationKey, new Parser>() {
+ public Class extends T> parse(final String value) {
+ try {
+ return ReflectUtils.loadClass(value);
+ } catch (final IllegalArgumentException e) {
+ return configurationKey.getDefaultValue();
+ }
+ }
+ });
+ }
+
+ private T getValue(final ConfigurationKey configurationKey, final Parser parser) {
+ final String value = getWithCheck(configurationKey);
+
+ if (CommonUtils.isBlank(value)) {
+ logger.trace("No value found for property {}, returning default {}", configurationKey.getName(), configurationKey.getDefaultValue());
+ return configurationKey.getDefaultValue();
+ } else {
+ logger.trace("Loaded property {} with value {}", configurationKey.getName(), configurationKey.getDefaultValue());
+ }
+
+ return parser.parse(value);
+ }
+
+ private String getWithCheck(final ConfigurationKey configurationKey) {
+ CommonUtils.assertNotNull(configurationKey, "configurationKey cannot be null");
+
+ return get(configurationKey);
+ }
+
+ /**
+ * Retrieve the String value for this key. Returns null if there is no value.
+ *
+ * @param configurationKey the key to retrieve. MUST NOT BE NULL.
+ * @return the String if its found, null otherwise.
+ */
+ protected abstract String get(ConfigurationKey configurationKey);
+
+ private interface Parser {
+
+ T parse(String value);
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
new file mode 100644
index 000000000..f6c0df7d7
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
@@ -0,0 +1,42 @@
+package org.jasig.cas.client.configuration;
+
+/**
+ * Holder class to represent a particular configuration key and its optional default value.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public final class ConfigurationKey {
+
+ private final String name;
+
+ private final E defaultValue;
+
+ public ConfigurationKey(final String name) {
+ this(name, null);
+ }
+
+ public ConfigurationKey(final String name, final E defaultValue) {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * The referencing name of the configuration key (i.e. what you would use to look it up in your configuration strategy)
+ *
+ * @return the name. MUST NOT BE NULL.
+ */
+ public String getName() {
+ return this.name;
+ }
+
+
+ /**
+ * The (optional) default value to use when this configuration key is not set. If a value is provided it should be used. A null value indicates that there is no default.
+ *
+ * @return the default value or null.
+ */
+ public E getDefaultValue() {
+ return this.defaultValue;
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
new file mode 100644
index 000000000..138c459f7
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
@@ -0,0 +1,58 @@
+package org.jasig.cas.client.configuration;
+
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.authentication.AuthenticationRedirectStrategy;
+import org.jasig.cas.client.authentication.DefaultGatewayResolverImpl;
+import org.jasig.cas.client.authentication.GatewayResolver;
+import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
+import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
+import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
+
+import javax.net.ssl.HostnameVerifier;
+
+/**
+ * Holder interface for all known configuration keys.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public interface ConfigurationKeys {
+
+ ConfigurationKey ARTIFACT_PARAMETER_NAME = new ConfigurationKey("artifactParameterName", Protocol.CAS2.getArtifactParameterName());
+ ConfigurationKey SERVER_NAME = new ConfigurationKey("serverName", null);
+ ConfigurationKey SERVICE = new ConfigurationKey("service");
+ ConfigurationKey RENEW = new ConfigurationKey("renew", Boolean.FALSE);
+ ConfigurationKey LOGOUT_PARAMETER_NAME = new ConfigurationKey("logoutParameterName", "logoutRequest");
+ ConfigurationKey ARTIFACT_PARAMETER_OVER_POST = new ConfigurationKey("artifactParameterOverPost", Boolean.FALSE);
+ ConfigurationKey EAGERLY_CREATE_SESSIONS = new ConfigurationKey("eagerlyCreateSessions", Boolean.TRUE);
+ ConfigurationKey ENCODE_SERVICE_URL = new ConfigurationKey("encodeServiceUrl", Boolean.TRUE);
+ ConfigurationKey SSL_CONFIG_FILE = new ConfigurationKey("sslConfigFile", null);
+ ConfigurationKey ROLE_ATTRIBUTE = new ConfigurationKey("roleAttribute", null);
+ ConfigurationKey IGNORE_CASE = new ConfigurationKey("ignoreCase", Boolean.FALSE);
+ ConfigurationKey CAS_SERVER_LOGIN_URL = new ConfigurationKey("casServerLoginUrl", null);
+ ConfigurationKey GATEWAY = new ConfigurationKey("gateway", Boolean.FALSE);
+ ConfigurationKey> AUTHENTICATION_REDIRECT_STRATEGY_CLASS = new ConfigurationKey>("authenticationRedirectStrategyClass", null);
+ ConfigurationKey> GATEWAY_STORAGE_CLASS = new ConfigurationKey>("gatewayStorageClass", DefaultGatewayResolverImpl.class);
+ ConfigurationKey CAS_SERVER_URL_PREFIX = new ConfigurationKey("casServerUrlPrefix", null);
+ ConfigurationKey ENCODING = new ConfigurationKey("encoding", null);
+ ConfigurationKey TOLERANCE = new ConfigurationKey("tolerance", 1000L);
+ ConfigurationKey DISABLE_XML_SCHEMA_VALIDATION = new ConfigurationKey("disableXmlSchemaValidation", Boolean.FALSE);
+ ConfigurationKey IGNORE_PATTERN = new ConfigurationKey("ignorePattern", null);
+ ConfigurationKey IGNORE_URL_PATTERN_TYPE = new ConfigurationKey("ignoreUrlPatternType", "REGEX");
+ ConfigurationKey> HOSTNAME_VERIFIER = new ConfigurationKey>("hostnameVerifier", null);
+ ConfigurationKey HOSTNAME_VERIFIER_CONFIG = new ConfigurationKey("hostnameVerifierConfig", null);
+ ConfigurationKey EXCEPTION_ON_VALIDATION_FAILURE = new ConfigurationKey("exceptionOnValidationFailure", Boolean.TRUE);
+ ConfigurationKey REDIRECT_AFTER_VALIDATION = new ConfigurationKey("redirectAfterValidation", Boolean.TRUE);
+ ConfigurationKey USE_SESSION = new ConfigurationKey("useSession", Boolean.TRUE);
+ ConfigurationKey SECRET_KEY = new ConfigurationKey("secretKey", null);
+ ConfigurationKey CIPHER_ALGORITHM = new ConfigurationKey("cipherAlgorithm", "DESede");
+ ConfigurationKey PROXY_RECEPTOR_URL = new ConfigurationKey("proxyReceptorUrl", null);
+ ConfigurationKey> PROXY_GRANTING_TICKET_STORAGE_CLASS = new ConfigurationKey>("proxyGrantingTicketStorageClass", ProxyGrantingTicketStorageImpl.class);
+ ConfigurationKey MILLIS_BETWEEN_CLEAN_UPS = new ConfigurationKey("millisBetweenCleanUps", 60000);
+ ConfigurationKey ACCEPT_ANY_PROXY = new ConfigurationKey("acceptAnyProxy", Boolean.FALSE);
+ ConfigurationKey ALLOWED_PROXY_CHAINS = new ConfigurationKey("allowedProxyChains", null);
+ ConfigurationKey> TICKET_VALIDATOR_CLASS = new ConfigurationKey>("ticketValidatorClass", null);
+ ConfigurationKey PROXY_CALLBACK_URL = new ConfigurationKey("proxyCallbackUrl", null);
+ ConfigurationKey FRONT_LOGOUT_PARAMETER_NAME = new ConfigurationKey("frontLogoutParameterName", "SAMLRequest");
+ ConfigurationKey RELAY_STATE_PARAMETER_NAME = new ConfigurationKey("relayStateParameterName", "RelayState");
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
new file mode 100644
index 000000000..cd1b9dd8a
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
@@ -0,0 +1,62 @@
+package org.jasig.cas.client.configuration;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+
+/**
+ * Abstraction to allow for pluggable methods for retrieving filter configuration.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public interface ConfigurationStrategy {
+
+
+ /**
+ * Retrieves the value for the provided {@param configurationKey}, falling back to the {@param configurationKey}'s {@link ConfigurationKey#getDefaultValue()} if nothing can be found.
+ *
+ * @param configurationKey the configuration key. MUST NOT BE NULL.
+ * @return the configured value, or the default value.
+ */
+ boolean getBoolean(ConfigurationKey configurationKey);
+
+ /**
+ * Retrieves the value for the provided {@param configurationKey}, falling back to the {@param configurationKey}'s {@link ConfigurationKey#getDefaultValue()} if nothing can be found.
+ *
+ * @param configurationKey the configuration key. MUST NOT BE NULL.
+ * @return the configured value, or the default value.
+ */
+ String getString(ConfigurationKey configurationKey);
+
+ /**
+ * Retrieves the value for the provided {@param configurationKey}, falling back to the {@param configurationKey}'s {@link ConfigurationKey#getDefaultValue()} if nothing can be found.
+ *
+ * @param configurationKey the configuration key. MUST NOT BE NULL.
+ * @return the configured value, or the default value.
+ */
+ long getLong(ConfigurationKey configurationKey);
+
+ /**
+ * Retrieves the value for the provided {@param configurationKey}, falling back to the {@param configurationKey}'s {@link ConfigurationKey#getDefaultValue()} if nothing can be found.
+ *
+ * @param configurationKey the configuration key. MUST NOT BE NULL.
+ * @return the configured value, or the default value.
+ */
+ int getInt(ConfigurationKey configurationKey);
+
+ /**
+ * Retrieves the value for the provided {@param configurationKey}, falling back to the {@param configurationKey}'s {@link ConfigurationKey#getDefaultValue()} if nothing can be found.
+ *
+ * @param configurationKey the configuration key. MUST NOT BE NULL.
+ * @return the configured value, or the default value.
+ */
+ Class extends T> getClass(ConfigurationKey> configurationKey);
+
+ /**
+ * Initializes the strategy. This must be called before calling any of the "get" methods.
+ *
+ * @param filterConfig the filter configuration object.
+ * @param filterClazz the filter
+ */
+ void init(FilterConfig filterConfig, Class extends Filter> filterClazz);
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
new file mode 100644
index 000000000..ea089fe7a
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
@@ -0,0 +1,51 @@
+package org.jasig.cas.client.configuration;
+
+import org.jasig.cas.client.util.CommonUtils;
+
+/**
+ * Enumeration to map simple names to the underlying classes so that deployers can reference the simple name in the
+ * web.xml instead of the fully qualified class name.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public enum ConfigurationStrategyName {
+
+ DEFAULT(LegacyConfigurationStrategyImpl.class), JNDI(JndiConfigurationStrategyImpl.class), WEB_XML(WebXmlConfigurationStrategyImpl.class);
+
+ private final Class extends ConfigurationStrategy> configurationStrategyClass;
+
+ private ConfigurationStrategyName(final Class extends ConfigurationStrategy> configurationStrategyClass) {
+ this.configurationStrategyClass = configurationStrategyClass;
+ }
+
+ /**
+ * Static helper method that will resolve a simple string to either an enum value or a {@link org.jasig.cas.client.configuration.ConfigurationStrategy} class.
+ *
+ * @param value the value to attempt to resolve.
+ * @return the underlying class that this maps to (either via simple name or fully qualified class name).
+ */
+ public static Class extends ConfigurationStrategy> resolveToConfigurationStrategy(final String value) {
+ if (CommonUtils.isBlank(value)) {
+ return DEFAULT.configurationStrategyClass;
+ }
+
+ for (final ConfigurationStrategyName csn : values()) {
+ if (csn.name().equalsIgnoreCase(value)) {
+ return csn.configurationStrategyClass;
+ }
+ }
+
+ try {
+ final Class> clazz = Class.forName(value);
+
+ if (clazz.isAssignableFrom(ConfigurationStrategy.class)) {
+ return (Class extends ConfigurationStrategy>) clazz;
+ }
+ } catch (final ClassNotFoundException e) {
+ // nothing we can do here
+ }
+
+ return DEFAULT.configurationStrategyClass;
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/JndiConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/JndiConfigurationStrategyImpl.java
new file mode 100644
index 000000000..b81f1eedf
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/JndiConfigurationStrategyImpl.java
@@ -0,0 +1,75 @@
+package org.jasig.cas.client.configuration;
+
+import org.jasig.cas.client.util.CommonUtils;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+
+/**
+ * Loads configuration information from JNDI, using the defaultValue if it can't.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public class JndiConfigurationStrategyImpl extends BaseConfigurationStrategy {
+
+ private static final String ENVIRONMENT_PREFIX = "java:comp/env/cas/";
+
+ private final String environmentPrefix;
+
+ private InitialContext context;
+
+ private String simpleFilterName;
+
+ public JndiConfigurationStrategyImpl() {
+ this(ENVIRONMENT_PREFIX);
+ }
+
+ public JndiConfigurationStrategyImpl(final String environmentPrefix) {
+ this.environmentPrefix = environmentPrefix;
+ }
+
+ @Override
+ protected final String get(final ConfigurationKey configurationKey) {
+ if (context == null) {
+ return null;
+ }
+
+ final String propertyName = configurationKey.getName();
+ final String filterValue = loadFromContext(context, this.environmentPrefix + this.simpleFilterName + "/" + propertyName);
+
+ if (CommonUtils.isNotBlank(filterValue)) {
+ logger.info("Property [{}] loaded from JNDI Filter Specific Property with value [{}]", propertyName, filterValue);
+ return filterValue;
+ }
+
+ final String rootValue = loadFromContext(context, this.environmentPrefix + propertyName);
+
+ if (CommonUtils.isNotBlank(rootValue)) {
+ logger.info("Property [{}] loaded from JNDI with value [{}]", propertyName, rootValue);
+ return rootValue;
+ }
+
+ return null;
+ }
+
+ private String loadFromContext(final InitialContext context, final String path) {
+ try {
+ return (String) context.lookup(path);
+ } catch (final NamingException e) {
+ return null;
+ }
+ }
+
+
+ public final void init(final FilterConfig filterConfig, final Class extends Filter> clazz) {
+ this.simpleFilterName = clazz.getSimpleName();
+ try {
+ this.context = new InitialContext();
+ } catch (final NamingException e) {
+ logger.error("Unable to create InitialContext. No properties can be loaded via JNDI.", e);
+ }
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/LegacyConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/LegacyConfigurationStrategyImpl.java
new file mode 100644
index 000000000..d1f47c3c5
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/LegacyConfigurationStrategyImpl.java
@@ -0,0 +1,35 @@
+package org.jasig.cas.client.configuration;
+
+import org.jasig.cas.client.util.CommonUtils;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+
+/**
+ * Replicates the original behavior by checking the {@link org.jasig.cas.client.configuration.WebXmlConfigurationStrategyImpl} first, and then
+ * the {@link org.jasig.cas.client.configuration.JndiConfigurationStrategyImpl} before using the defaultValue.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public final class LegacyConfigurationStrategyImpl extends BaseConfigurationStrategy {
+
+ private final WebXmlConfigurationStrategyImpl webXmlConfigurationStrategy = new WebXmlConfigurationStrategyImpl();
+
+ private final JndiConfigurationStrategyImpl jndiConfigurationStrategy = new JndiConfigurationStrategyImpl();
+
+ public void init(FilterConfig filterConfig, Class extends Filter> filterClazz) {
+ this.webXmlConfigurationStrategy.init(filterConfig, filterClazz);
+ this.jndiConfigurationStrategy.init(filterConfig, filterClazz);
+ }
+
+ protected String get(final ConfigurationKey key) {
+ final String value1 = this.webXmlConfigurationStrategy.get(key);
+
+ if (CommonUtils.isNotBlank(value1)) {
+ return value1;
+ }
+
+ return this.jndiConfigurationStrategy.get(key);
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImpl.java
new file mode 100644
index 000000000..1c05b0b8a
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImpl.java
@@ -0,0 +1,42 @@
+package org.jasig.cas.client.configuration;
+
+import org.jasig.cas.client.util.CommonUtils;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+
+/**
+ * Implementation of the {@link org.jasig.cas.client.configuration.ConfigurationStrategy} that first checks the {@link javax.servlet.FilterConfig} and
+ * then checks the {@link javax.servlet.ServletContext}, ultimately falling back to the defaultValue.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public final class WebXmlConfigurationStrategyImpl extends BaseConfigurationStrategy {
+
+ private FilterConfig filterConfig;
+
+ protected String get(final ConfigurationKey configurationKey) {
+ final String value = this.filterConfig.getInitParameter(configurationKey.getName());
+
+ if (CommonUtils.isNotBlank(value)) {
+ CommonUtils.assertFalse(ConfigurationKeys.RENEW.equals(configurationKey), "Renew MUST be specified via context parameter or JNDI environment to avoid misconfiguration.");
+ logger.info("Property [{}] loaded from FilterConfig.getInitParameter with value [{}]", configurationKey, value);
+ return value;
+ }
+
+ final String value2 = filterConfig.getServletContext().getInitParameter(configurationKey.getName());
+
+ if (CommonUtils.isNotBlank(value2)) {
+ logger.info("Property [{}] loaded from ServletContext.getInitParameter with value [{}]", configurationKey,
+ value2);
+ return value2;
+ }
+
+ return null;
+ }
+
+ public void init(final FilterConfig filterConfig, final Class extends Filter> clazz) {
+ this.filterConfig = filterConfig;
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
index d39027e84..e64b57897 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/jaas/Servlet3AuthenticationFilter.java
@@ -29,6 +29,7 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import org.jasig.cas.client.Protocol;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
@@ -50,12 +51,16 @@
*/
public final class Servlet3AuthenticationFilter extends AbstractCasFilter {
+ public Servlet3AuthenticationFilter() {
+ super(Protocol.CAS2);
+ }
+
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
final FilterChain chain) throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
final HttpSession session = request.getSession();
- final String ticket = CommonUtils.safeGetParameter(request, getArtifactParameterName());
+ final String ticket = CommonUtils.safeGetParameter(request, getProtocol().getArtifactParameterName());
if (session != null && session.getAttribute(CONST_CAS_ASSERTION) == null && ticket != null) {
try {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
index 69cc75dcf..24826cfc3 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/AbstractEncryptedProxyGrantingTicketStorageImpl.java
@@ -18,6 +18,8 @@
*/
package org.jasig.cas.client.proxy;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
+
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
@@ -36,11 +38,9 @@
*/
public abstract class AbstractEncryptedProxyGrantingTicketStorageImpl implements ProxyGrantingTicketStorage {
- public static final String DEFAULT_ENCRYPTION_ALGORITHM = "DESede";
-
private Key key;
- private String cipherAlgorithm = DEFAULT_ENCRYPTION_ALGORITHM;
+ private String cipherAlgorithm = ConfigurationKeys.CIPHER_ALGORITHM.getDefaultValue();
public final void setSecretKey(final String key) throws NoSuchAlgorithmException, InvalidKeyException,
InvalidKeySpecException {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index c9243e95b..da533cf44 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -22,8 +22,10 @@
import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
+
import javax.servlet.http.HttpServletResponse;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.util.AbstractConfigurationFilter;
/**
@@ -41,19 +43,13 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
public void init(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
- HANDLER.setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName",
- SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME));
- HANDLER.setLogoutParameterName(getPropertyFromInitParams(filterConfig, "logoutParameterName",
- SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME));
- HANDLER.setFrontLogoutParameterName(getPropertyFromInitParams(filterConfig, "frontLogoutParameterName",
- SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME));
- HANDLER.setRelayStateParameterName(getPropertyFromInitParams(filterConfig, "relayStateParameterName",
- SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME));
- HANDLER.setCasServerUrlPrefix(getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null));
- HANDLER.setArtifactParameterOverPost(parseBoolean(getPropertyFromInitParams(filterConfig,
- "artifactParameterOverPost", "false")));
- HANDLER.setEagerlyCreateSessions(parseBoolean(getPropertyFromInitParams(filterConfig,
- "eagerlyCreateSessions", "true")));
+ setArtifactParameterName(getString(ConfigurationKeys.ARTIFACT_PARAMETER_NAME));
+ setLogoutParameterName(getString(ConfigurationKeys.LOGOUT_PARAMETER_NAME));
+ setFrontLogoutParameterName(getString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME));
+ setRelayStateParameterName(getString(ConfigurationKeys.RELAY_STATE_PARAMETER_NAME));
+ setCasServerUrlPrefix(getString(ConfigurationKeys.CAS_SERVER_URL_PREFIX));
+ HANDLER.setArtifactParameterOverPost(getBoolean(ConfigurationKeys.ARTIFACT_PARAMETER_OVER_POST));
+ HANDLER.setEagerlyCreateSessions(getBoolean(ConfigurationKeys.EAGERLY_CREATE_SESSIONS));
}
HANDLER.init();
handlerInitialized.set(true);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 5f8b46c5d..cc049f713 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -29,6 +29,8 @@
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.XmlUtils;
import org.slf4j.Logger;
@@ -44,11 +46,6 @@
*/
public final class SingleSignOutHandler {
- public final static String DEFAULT_ARTIFACT_PARAMETER_NAME = "ticket";
- public final static String DEFAULT_LOGOUT_PARAMETER_NAME = "logoutRequest";
- public final static String DEFAULT_FRONT_LOGOUT_PARAMETER_NAME = "SAMLRequest";
- public final static String DEFAULT_RELAY_STATE_PARAMETER_NAME = "RelayState";
-
private final static int DECOMPRESSION_FACTOR = 10;
/** Logger instance */
@@ -58,16 +55,16 @@ public final class SingleSignOutHandler {
private SessionMappingStorage sessionMappingStorage = new HashMapBackedSessionMappingStorage();
/** The name of the artifact parameter. This is used to capture the session identifier. */
- private String artifactParameterName = DEFAULT_ARTIFACT_PARAMETER_NAME;
+ private String artifactParameterName = Protocol.CAS2.getArtifactParameterName();
/** Parameter name that stores logout request for back channel SLO */
- private String logoutParameterName = DEFAULT_LOGOUT_PARAMETER_NAME;
+ private String logoutParameterName = ConfigurationKeys.LOGOUT_PARAMETER_NAME.getDefaultValue();
/** Parameter name that stores logout request for front channel SLO */
- private String frontLogoutParameterName = DEFAULT_FRONT_LOGOUT_PARAMETER_NAME;
+ private String frontLogoutParameterName = ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue();
/** Parameter name that stores the state of the CAS server webflow for the callback */
- private String relayStateParameterName = DEFAULT_RELAY_STATE_PARAMETER_NAME;
+ private String relayStateParameterName = ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue();
/** The prefix url of the CAS server */
private String casServerUrlPrefix;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index 8cf47ef3a..6e0df5fc5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -18,6 +18,9 @@
*/
package org.jasig.cas.client.util;
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
+
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -42,12 +45,8 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
/** Represents the constant for where the assertion will be located in memory. */
public static final String CONST_CAS_ASSERTION = "_const_cas_assertion_";
- /** Defines the parameter to look for for the artifact. */
- private String artifactParameterName = "ticket";
+ private Protocol protocol;
- /** Defines the parameter to look for for the service. */
- private String serviceParameterName = "service";
-
/** Sets where response.encodeUrl should be called on service urls when constructed. */
private boolean encodeServiceUrl = true;
@@ -59,18 +58,16 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
/** The exact url of the service. */
private String service;
+ protected AbstractCasFilter(final Protocol protocol) {
+ this.protocol = protocol;
+ }
+
public final void init(final FilterConfig filterConfig) throws ServletException {
+ super.init(filterConfig);
if (!isIgnoreInitConfiguration()) {
- setServerName(getPropertyFromInitParams(filterConfig, "serverName", null));
- logger.trace("Loading serverName property: {}", this.serverName);
- setService(getPropertyFromInitParams(filterConfig, "service", null));
- logger.trace("Loading service property: {}", this.service);
- setArtifactParameterName(getPropertyFromInitParams(filterConfig, "artifactParameterName", "ticket"));
- logger.trace("Loading artifact parameter name property: {}", this.artifactParameterName);
- setServiceParameterName(getPropertyFromInitParams(filterConfig, "serviceParameterName", "service"));
- logger.trace("Loading serviceParameterName property: {} ", this.serviceParameterName);
- setEncodeServiceUrl(parseBoolean(getPropertyFromInitParams(filterConfig, "encodeServiceUrl", "true")));
- logger.trace("Loading encodeServiceUrl property: {}", this.encodeServiceUrl);
+ setServerName(getString(ConfigurationKeys.SERVER_NAME));
+ setService(getString(ConfigurationKeys.SERVICE));
+ setEncodeServiceUrl(getBoolean(ConfigurationKeys.ENCODE_SERVICE_URL));
initInternal(filterConfig);
}
@@ -92,8 +89,6 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
* afterPropertiesSet();
*/
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.");
CommonUtils.assertTrue(CommonUtils.isBlank(this.serverName) || CommonUtils.isBlank(this.service),
@@ -107,7 +102,7 @@ public void destroy() {
protected final String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response) {
return CommonUtils.constructServiceUrl(request, response, this.service, this.serverName,
- this.artifactParameterName, this.encodeServiceUrl);
+ this.protocol.getArtifactParameterName(), this.encodeServiceUrl);
}
/**
@@ -129,26 +124,14 @@ public final void setService(final String service) {
this.service = service;
}
- public final void setArtifactParameterName(final String artifactParameterName) {
- this.artifactParameterName = artifactParameterName;
- }
-
- public final void setServiceParameterName(final String serviceParameterName) {
- this.serviceParameterName = serviceParameterName;
- }
-
public final void setEncodeServiceUrl(final boolean encodeServiceUrl) {
this.encodeServiceUrl = encodeServiceUrl;
}
- public final String getArtifactParameterName() {
- return this.artifactParameterName;
+ protected Protocol getProtocol() {
+ return this.protocol;
}
- public final String getServiceParameterName() {
- return this.serviceParameterName;
- }
-
/**
* Template method to allow you to change how you retrieve the ticket.
*
@@ -156,6 +139,6 @@ public final String getServiceParameterName() {
* @return the ticket if its found, null otherwise.
*/
protected String retrieveTicketFromRequest(final HttpServletRequest request) {
- return CommonUtils.safeGetParameter(request, getArtifactParameterName());
+ return CommonUtils.safeGetParameter(request, this.protocol.getArtifactParameterName());
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
index 708b7bf63..9d3e54293 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractConfigurationFilter.java
@@ -18,10 +18,13 @@
*/
package org.jasig.cas.client.util;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+
+import org.jasig.cas.client.configuration.ConfigurationKey;
+import org.jasig.cas.client.configuration.ConfigurationStrategy;
+import org.jasig.cas.client.configuration.ConfigurationStrategyName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,94 +37,41 @@
*/
public abstract class AbstractConfigurationFilter implements Filter {
+ private static final String CONFIGURATION_STRATEGY_KEY = "configurationStrategy";
+
protected final Logger logger = LoggerFactory.getLogger(getClass());
private boolean ignoreInitConfiguration = false;
- /**
- * Retrieves the property from the FilterConfig. First it checks the FilterConfig's initParameters to see if it
- * has a value.
- * If it does, it returns that, otherwise it retrieves the ServletContext's initParameters and returns that value if any.
- *
- * Finally, it will check JNDI if all other methods fail. All the JNDI properties should be stored under either java:comp/env/cas/SHORTFILTERNAME/{propertyName}
- * or java:comp/env/cas/{propertyName}
- *
- * Essentially the documented order is:
- *
- *
FilterConfig.getInitParameter
- *
ServletContext.getInitParameter
- *
java:comp/env/cas/SHORTFILTERNAME/{propertyName}
- *
java:comp/env/cas/{propertyName}
- *
Default Value
- *
- *
- *
- * @param filterConfig the Filter Configuration.
- * @param propertyName the property to retrieve.
- * @param defaultValue the default value if the property is not found.
- * @return the property value, following the above conventions. It will always return the more specific value (i.e.
- * filter vs. context).
- */
- protected final String getPropertyFromInitParams(final FilterConfig filterConfig, final String propertyName,
- final String defaultValue) {
- final String value = filterConfig.getInitParameter(propertyName);
-
- if (CommonUtils.isNotBlank(value)) {
- if ("renew".equals(propertyName)) {
- throw new IllegalArgumentException(
- "Renew MUST be specified via context parameter or JNDI environment to avoid misconfiguration.");
- }
- logger.info("Property [{}] loaded from FilterConfig.getInitParameter with value [{}]", propertyName, value);
- return value;
- }
-
- final String value2 = filterConfig.getServletContext().getInitParameter(propertyName);
-
- if (CommonUtils.isNotBlank(value2)) {
- logger.info("Property [{}] loaded from ServletContext.getInitParameter with value [{}]", propertyName,
- value2);
- return value2;
- }
- InitialContext context;
- try {
- context = new InitialContext();
- } catch (final NamingException e) {
- logger.warn(e.getMessage(), e);
- return defaultValue;
- }
+ private ConfigurationStrategy configurationStrategy;
- final String shortName = this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".") + 1);
- final String value3 = loadFromContext(context, "java:comp/env/cas/" + shortName + "/" + propertyName);
-
- if (CommonUtils.isNotBlank(value3)) {
- logger.info("Property [{}] loaded from JNDI Filter Specific Property with value [{}]", propertyName, value3);
- return value3;
- }
+ public void init(FilterConfig filterConfig) throws ServletException {
+ final String configurationStrategyName = filterConfig.getServletContext().getInitParameter(CONFIGURATION_STRATEGY_KEY);
+ this.configurationStrategy = ReflectUtils.newInstance(ConfigurationStrategyName.resolveToConfigurationStrategy(configurationStrategyName));
+ this.configurationStrategy.init(filterConfig, getClass());
+ }
- final String value4 = loadFromContext(context, "java:comp/env/cas/" + propertyName);
+ protected final boolean getBoolean(final ConfigurationKey configurationKey) {
+ return this.configurationStrategy.getBoolean(configurationKey);
+ }
- if (CommonUtils.isNotBlank(value4)) {
- logger.info("Property [{}] loaded from JNDI with value [{}]", propertyName, value4);
- return value4;
- }
+ protected final String getString(final ConfigurationKey configurationKey) {
+ return this.configurationStrategy.getString(configurationKey);
+ }
- logger.info("Property [{}] not found. Using default value [{}]", propertyName, defaultValue);
- return defaultValue;
+ protected final long getLong(final ConfigurationKey configurationKey) {
+ return this.configurationStrategy.getLong(configurationKey);
}
- protected final boolean parseBoolean(final String value) {
- return ((value != null) && value.equalsIgnoreCase("true"));
+ protected final int getInt(final ConfigurationKey configurationKey) {
+ return this.configurationStrategy.getInt(configurationKey);
}
- protected final String loadFromContext(final InitialContext context, final String path) {
- try {
- return (String) context.lookup(path);
- } catch (final NamingException e) {
- return null;
- }
+ protected final Class extends T> getClass(final ConfigurationKey> configurationKey) {
+ return this.configurationStrategy.getClass(configurationKey);
}
- public final void setIgnoreInitConfiguration(boolean ignoreInitConfiguration) {
+ public final void setIgnoreInitConfiguration(final boolean ignoreInitConfiguration) {
this.ignoreInitConfiguration = ignoreInitConfiguration;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 3d991717d..ac0ca80d0 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -99,7 +99,7 @@ public static void assertNotEmpty(final Collection> c, final String message) {
* Assert that the statement is true, otherwise throw an exception with the
* provided message.
*
- * @param cond the codition to assert is true.
+ * @param cond the condition 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) {
@@ -108,6 +108,20 @@ public static void assertTrue(final boolean cond, final String message) {
}
}
+
+ /**
+ * Assert that the statement is true, otherwise throw an exception with the
+ * provided message.
+ *
+ * @param cond the condition to assert is false.
+ * @param message the message to display if the condition is not false.
+ */
+ public static void assertFalse(final boolean cond, final String message) {
+ if (cond) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
/**
* Determines whether the String is null or of length 0.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
index 3512f48f3..a474a83ac 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/HttpServletRequestWrapperFilter.java
@@ -26,6 +26,7 @@
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpSession;
import org.jasig.cas.client.authentication.AttributePrincipal;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.validation.Assertion;
/**
@@ -82,8 +83,9 @@ protected AttributePrincipal retrievePrincipalFromSessionOrRequest(final Servlet
}
public void init(final FilterConfig filterConfig) throws ServletException {
- this.roleAttribute = getPropertyFromInitParams(filterConfig, "roleAttribute", null);
- this.ignoreCase = Boolean.parseBoolean(getPropertyFromInitParams(filterConfig, "ignoreCase", "false"));
+ super.init(filterConfig);
+ this.roleAttribute = getString(ConfigurationKeys.ROLE_ATTRIBUTE);
+ this.ignoreCase = getBoolean(ConfigurationKeys.IGNORE_CASE);
}
final class CasHttpServletRequestWrapper extends HttpServletRequestWrapper {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
index 1d27314b9..51df207b1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractTicketValidationFilter.java
@@ -25,6 +25,9 @@
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
@@ -68,6 +71,10 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
*/
private boolean useSession = true;
+ protected AbstractTicketValidationFilter(final Protocol protocol) {
+ super(protocol);
+ }
+
/**
* Template method to return the appropriate validator.
*
@@ -81,12 +88,11 @@ protected TicketValidator getTicketValidator(final FilterConfig filterConfig) {
/**
* Gets the ssl config to use for HTTPS connections
* if one is configured for this filter.
- * @param filterConfig Servlet filter configuration.
* @return Properties that can contains key/trust info for Client Side Certificates
*/
- protected Properties getSSLConfig(final FilterConfig filterConfig) {
+ protected Properties getSSLConfig() {
final Properties properties = new Properties();
- final String fileName = getPropertyFromInitParams(filterConfig, "sslConfigFile", null);
+ final String fileName = getString(ConfigurationKeys.SSL_CONFIG_FILE);
if (fileName != null) {
FileInputStream fis = null;
@@ -106,14 +112,11 @@ protected Properties getSSLConfig(final FilterConfig filterConfig) {
/**
* Gets the configured {@link HostnameVerifier} to use for HTTPS connections
* if one is configured for this filter.
- * @param filterConfig Servlet filter configuration.
* @return Instance of specified host name verifier or null if none specified.
*/
- protected HostnameVerifier getHostnameVerifier(final FilterConfig filterConfig) {
- final String className = getPropertyFromInitParams(filterConfig, "hostnameVerifier", null);
- logger.trace("Using hostnameVerifier parameter: {}", className);
- final String config = getPropertyFromInitParams(filterConfig, "hostnameVerifierConfig", null);
- logger.trace("Using hostnameVerifierConfig parameter: {}", config);
+ protected HostnameVerifier getHostnameVerifier() {
+ final Class extends HostnameVerifier> className = getClass(ConfigurationKeys.HOSTNAME_VERIFIER);
+ final String config = getString(ConfigurationKeys.HOSTNAME_VERIFIER_CONFIG);
if (className != null) {
if (config != null) {
return ReflectUtils.newInstance(className, config);
@@ -125,14 +128,9 @@ protected HostnameVerifier getHostnameVerifier(final FilterConfig filterConfig)
}
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
- setExceptionOnValidationFailure(parseBoolean(getPropertyFromInitParams(filterConfig,
- "exceptionOnValidationFailure", "false")));
- logger.trace("Setting exceptionOnValidationFailure parameter: {}", this.exceptionOnValidationFailure);
- setRedirectAfterValidation(parseBoolean(getPropertyFromInitParams(filterConfig, "redirectAfterValidation",
- "true")));
- logger.trace("Setting redirectAfterValidation parameter: {}", this.redirectAfterValidation);
- setUseSession(parseBoolean(getPropertyFromInitParams(filterConfig, "useSession", "true")));
- logger.trace("Setting useSession parameter: {}", this.useSession);
+ setExceptionOnValidationFailure(getBoolean(ConfigurationKeys.EXCEPTION_ON_VALIDATION_FAILURE));
+ setRedirectAfterValidation(getBoolean(ConfigurationKeys.REDIRECT_AFTER_VALIDATION));
+ setUseSession(getBoolean(ConfigurationKeys.USE_SESSION));
if (!this.useSession && this.redirectAfterValidation) {
logger.warn("redirectAfterValidation parameter may not be true when useSession parameter is false. Resetting it to false in order to prevent infinite redirects.");
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
index 6e142c921..aca0dee44 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas10TicketValidationFilter.java
@@ -19,29 +19,36 @@
package org.jasig.cas.client.validation;
import javax.servlet.FilterConfig;
+
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
/**
- * Implementation of AbstractTicketValidatorFilter that instanciates a Cas10TicketValidator.
+ * Implementation of AbstractTicketValidatorFilter that creates a Cas10TicketValidator.
*
Deployers can provide the "casServerPrefix" and the "renew" attributes via the standard context or filter init
* parameters.
- *
+ *
* @author Scott Battaglia
* @version $Revision$ $Date$
* @since 3.1
*/
public class Cas10TicketValidationFilter extends AbstractTicketValidationFilter {
+ public Cas10TicketValidationFilter() {
+ super(Protocol.CAS1);
+ }
+
protected final TicketValidator getTicketValidator(final FilterConfig filterConfig) {
- final String casServerUrlPrefix = getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null);
+ final String casServerUrlPrefix = getString(ConfigurationKeys.CAS_SERVER_URL_PREFIX);
final Cas10TicketValidator validator = new Cas10TicketValidator(casServerUrlPrefix);
- validator.setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
+ validator.setRenew(getBoolean(ConfigurationKeys.RENEW));
- final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig),
- getSSLConfig(filterConfig));
+ final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(),
+ getSSLConfig());
validator.setURLConnectionFactory(factory);
- validator.setEncoding(getPropertyFromInitParams(filterConfig, "encoding", null));
+ validator.setEncoding(getString(ConfigurationKeys.ENCODING));
return validator;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index e256755f5..cfea9e7c5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -23,6 +23,9 @@
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.proxy.*;
import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
@@ -32,7 +35,7 @@
/**
* Creates either a CAS20ProxyTicketValidator or a CAS20ServiceTicketValidator depending on whether any of the
* proxy parameters are set.
- *
+ *
* This filter can also pass additional parameters to the ticket validator. Any init parameter not included in the
* reserved list {@link org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter#RESERVED_INIT_PARAMS}.
*
@@ -40,20 +43,17 @@
* @author Brad Cupit (brad [at] lsu {dot} edu)
* @version $Revision$ $Date$
* @since 3.1
- *
*/
public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketValidationFilter {
- private static final String[] RESERVED_INIT_PARAMS = new String[] { "proxyGrantingTicketStorageClass",
+ private static final String[] RESERVED_INIT_PARAMS = new String[]{"proxyGrantingTicketStorageClass",
"proxyReceptorUrl", "acceptAnyProxy", "allowedProxyChains", "casServerUrlPrefix", "proxyCallbackUrl",
"renew", "exceptionOnValidationFailure", "redirectAfterValidation", "useSession", "serverName", "service",
"artifactParameterName", "serviceParameterName", "encodeServiceUrl", "millisBetweenCleanUps",
- "hostnameVerifier", "encoding", "config", "ticketValidatorClass" };
-
- private static final int DEFAULT_MILLIS_BETWEEN_CLEANUPS = 60 * 1000;
+ "hostnameVerifier", "encoding", "config", "ticketValidatorClass"};
/**
- * The URL to send to the CAS server as the URL that will process proxying requests on the CAS client.
+ * The URL to send to the CAS server as the URL that will process proxying requests on the CAS client.
*/
private String proxyReceptorUrl;
@@ -68,20 +68,22 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
*/
private ProxyGrantingTicketStorage proxyGrantingTicketStorage = new ProxyGrantingTicketStorageImpl();
+ public Cas20ProxyReceivingTicketValidationFilter() {
+ super(Protocol.CAS2);
+ }
+
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
- setProxyReceptorUrl(getPropertyFromInitParams(filterConfig, "proxyReceptorUrl", null));
+ setProxyReceptorUrl(getString(ConfigurationKeys.PROXY_RECEPTOR_URL));
- final String proxyGrantingTicketStorageClass = getPropertyFromInitParams(filterConfig,
- "proxyGrantingTicketStorageClass", null);
+ final Class extends ProxyGrantingTicketStorage> proxyGrantingTicketStorageClass = getClass(ConfigurationKeys.PROXY_GRANTING_TICKET_STORAGE_CLASS);
if (proxyGrantingTicketStorageClass != null) {
this.proxyGrantingTicketStorage = ReflectUtils.newInstance(proxyGrantingTicketStorageClass);
if (this.proxyGrantingTicketStorage instanceof AbstractEncryptedProxyGrantingTicketStorageImpl) {
final AbstractEncryptedProxyGrantingTicketStorageImpl p = (AbstractEncryptedProxyGrantingTicketStorageImpl) this.proxyGrantingTicketStorage;
- final String cipherAlgorithm = getPropertyFromInitParams(filterConfig, "cipherAlgorithm",
- AbstractEncryptedProxyGrantingTicketStorageImpl.DEFAULT_ENCRYPTION_ALGORITHM);
- final String secretKey = getPropertyFromInitParams(filterConfig, "secretKey", null);
+ final String cipherAlgorithm = getString(ConfigurationKeys.CIPHER_ALGORITHM);
+ final String secretKey = getString(ConfigurationKeys.SECRET_KEY);
p.setCipherAlgorithm(cipherAlgorithm);
@@ -95,9 +97,7 @@ protected void initInternal(final FilterConfig filterConfig) throws ServletExcep
}
}
- logger.trace("Setting proxyReceptorUrl parameter: {}", this.proxyReceptorUrl);
- this.millisBetweenCleanUps = Integer.parseInt(getPropertyFromInitParams(filterConfig, "millisBetweenCleanUps",
- Integer.toString(DEFAULT_MILLIS_BETWEEN_CLEANUPS)));
+ this.millisBetweenCleanUps = getInt(ConfigurationKeys.MILLIS_BETWEEN_CLEAN_UPS);
super.initInternal(filterConfig);
}
@@ -115,13 +115,13 @@ public void init() {
this.timer.schedule(this.timerTask, this.millisBetweenCleanUps, this.millisBetweenCleanUps);
}
- private T createNewTicketValidator(final String ticketValidatorClass, final String casServerUrlPrefix,
- final Class clazz) {
- if (CommonUtils.isBlank(ticketValidatorClass)) {
+ private T createNewTicketValidator(final Class extends Cas20ServiceTicketValidator> ticketValidatorClass, final String casServerUrlPrefix,
+ final Class clazz) {
+ if (ticketValidatorClass == null) {
return ReflectUtils.newInstance(clazz, casServerUrlPrefix);
}
- return ReflectUtils.newInstance(ticketValidatorClass, casServerUrlPrefix);
+ return (T) ReflectUtils.newInstance(ticketValidatorClass, casServerUrlPrefix);
}
/**
@@ -131,38 +131,37 @@ private T createNewTicketValidator(final String ticketValidatorClass, final
* @return a fully constructed TicketValidator.
*/
protected final TicketValidator getTicketValidator(final FilterConfig filterConfig) {
- final String allowAnyProxy = getPropertyFromInitParams(filterConfig, "acceptAnyProxy", null);
- final String allowedProxyChains = getPropertyFromInitParams(filterConfig, "allowedProxyChains", null);
- final String casServerUrlPrefix = getPropertyFromInitParams(filterConfig, "casServerUrlPrefix", null);
- final String ticketValidatorClass = getPropertyFromInitParams(filterConfig, "ticketValidatorClass", null);
+ final boolean allowAnyProxy = getBoolean(ConfigurationKeys.ACCEPT_ANY_PROXY);
+ final String allowedProxyChains = getString(ConfigurationKeys.ALLOWED_PROXY_CHAINS);
+ final String casServerUrlPrefix = getString(ConfigurationKeys.CAS_SERVER_URL_PREFIX);
+ final Class extends Cas20ServiceTicketValidator> ticketValidatorClass = getClass(ConfigurationKeys.TICKET_VALIDATOR_CLASS);
final Cas20ServiceTicketValidator validator;
- if (CommonUtils.isNotBlank(allowAnyProxy) || CommonUtils.isNotBlank(allowedProxyChains)) {
+ if (allowAnyProxy || CommonUtils.isNotBlank(allowedProxyChains)) {
final Cas20ProxyTicketValidator v = createNewTicketValidator(ticketValidatorClass, casServerUrlPrefix,
Cas20ProxyTicketValidator.class);
- v.setAcceptAnyProxy(parseBoolean(allowAnyProxy));
+ v.setAcceptAnyProxy(allowAnyProxy);
v.setAllowedProxyChains(CommonUtils.createProxyList(allowedProxyChains));
validator = v;
} else {
validator = createNewTicketValidator(ticketValidatorClass, casServerUrlPrefix,
Cas20ServiceTicketValidator.class);
}
- validator.setProxyCallbackUrl(getPropertyFromInitParams(filterConfig, "proxyCallbackUrl", null));
+ validator.setProxyCallbackUrl(getString(ConfigurationKeys.PROXY_CALLBACK_URL));
validator.setProxyGrantingTicketStorage(this.proxyGrantingTicketStorage);
- final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig),
- getSSLConfig(filterConfig));
+ final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(),
+ getSSLConfig());
validator.setURLConnectionFactory(factory);
- validator.setProxyRetriever(new Cas20ProxyRetriever(casServerUrlPrefix, getPropertyFromInitParams(filterConfig,
- "encoding", null), factory));
- validator.setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
- validator.setEncoding(getPropertyFromInitParams(filterConfig, "encoding", null));
+ validator.setProxyRetriever(new Cas20ProxyRetriever(casServerUrlPrefix, getString(ConfigurationKeys.ENCODING), factory));
+ validator.setRenew(getBoolean(ConfigurationKeys.RENEW));
+ validator.setEncoding(getString(ConfigurationKeys.ENCODING));
final Map additionalParameters = new HashMap();
final List params = Arrays.asList(RESERVED_INIT_PARAMS);
- for (final Enumeration> e = filterConfig.getInitParameterNames(); e.hasMoreElements();) {
+ for (final Enumeration> e = filterConfig.getInitParameterNames(); e.hasMoreElements(); ) {
final String s = (String) e.nextElement();
if (!params.contains(s)) {
@@ -183,7 +182,7 @@ public void destroy() {
* 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 {
+ final FilterChain filterChain) throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
final String requestUri = request.getRequestURI();
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
index 14711ab12..73aede03c 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
@@ -19,13 +19,15 @@
package org.jasig.cas.client.validation;
import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
+
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
/**
* Implementation of TicketValidationFilter that can instanciate a SAML 1.1 Ticket Validator.
- *
+ *
* Deployers can provide the "casServerUrlPrefix" and "tolerance" properties of the Saml11TicketValidator via the
* context or filter init parameters.
*
@@ -36,34 +38,21 @@
public class Saml11TicketValidationFilter extends AbstractTicketValidationFilter {
public Saml11TicketValidationFilter() {
- setArtifactParameterName("SAMLart");
- setServiceParameterName("TARGET");
- }
-
- protected final void initInternal(final FilterConfig filterConfig) throws ServletException {
- super.initInternal(filterConfig);
-
- logger.warn("SAML1.1 compliance requires the [artifactParameterName] and [serviceParameterName] to be set to specified values.");
- logger.warn("This filter will overwrite any user-provided values (if any are provided)");
-
- setArtifactParameterName("SAMLart");
- setServiceParameterName("TARGET");
+ super(Protocol.SAML11);
}
protected final TicketValidator getTicketValidator(final FilterConfig filterConfig) {
- final Saml11TicketValidator validator = new Saml11TicketValidator(getPropertyFromInitParams(filterConfig,
- "casServerUrlPrefix", null));
- final String tolerance = getPropertyFromInitParams(filterConfig, "tolerance", "1000");
- validator.setTolerance(Long.parseLong(tolerance));
- validator.setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
+ final Saml11TicketValidator validator = new Saml11TicketValidator(getString(ConfigurationKeys.CAS_SERVER_URL_PREFIX));
+ final long tolerance = getLong(ConfigurationKeys.TOLERANCE);
+ validator.setTolerance(tolerance);
+ validator.setRenew(getBoolean(ConfigurationKeys.RENEW));
- final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(filterConfig),
- getSSLConfig(filterConfig));
+ final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(),
+ getSSLConfig());
validator.setURLConnectionFactory(factory);
- validator.setEncoding(getPropertyFromInitParams(filterConfig, "encoding", null));
- validator.setDisableXmlSchemaValidation(parseBoolean(getPropertyFromInitParams(filterConfig,
- "disableXmlSchemaValidation", "false")));
+ validator.setEncoding(getString(ConfigurationKeys.ENCODING));
+ validator.setDisableXmlSchemaValidation(getBoolean(ConfigurationKeys.DISABLE_XML_SCHEMA_VALIDATION));
return validator;
}
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationKeyTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationKeyTests.java
new file mode 100644
index 000000000..add5b3fd3
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationKeyTests.java
@@ -0,0 +1,27 @@
+package org.jasig.cas.client.configuration;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public final class ConfigurationKeyTests {
+
+
+ @Test
+ public void gettersWithNoDefaultValue() {
+ final String name = "name";
+ final ConfigurationKey configurationKey = new ConfigurationKey(name);
+ assertEquals(name, configurationKey.getName());
+ assertNull(configurationKey.getDefaultValue());
+ }
+
+
+ @Test
+ public void gettersWithDefaultValue() {
+ final String name = "name";
+ final Boolean defaultValue = Boolean.TRUE;
+ final ConfigurationKey configurationKey = new ConfigurationKey(name, defaultValue);
+ assertEquals(name, configurationKey.getName());
+ assertEquals(defaultValue, configurationKey.getDefaultValue());
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
new file mode 100644
index 000000000..534ecbc77
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
@@ -0,0 +1,16 @@
+package org.jasig.cas.client.configuration;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public final class ConfigurationStrategyNameTests {
+
+ @Test
+ public void stringToClass() {
+ assertEquals(JndiConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.JNDI.name()));
+ assertEquals(WebXmlConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.WEB_XML.name()));
+ assertEquals(LegacyConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.DEFAULT.name()));
+ assertEquals(LegacyConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy("bleh!"));
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
new file mode 100644
index 000000000..9ec94dcc5
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
@@ -0,0 +1,128 @@
+package org.jasig.cas.client.configuration;
+
+import org.jasig.cas.client.util.AbstractCasFilter;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockFilterConfig;
+import org.springframework.mock.web.MockServletContext;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+public final class WebXmlConfigurationStrategyImplTests {
+
+ private WebXmlConfigurationStrategyImpl impl;
+
+ private MockFilterConfig filterConfig;
+
+ @Before
+ public void setUp() throws Exception {
+ this.filterConfig = new MockFilterConfig();
+ this.impl = new WebXmlConfigurationStrategyImpl();
+ this.impl.init(this.filterConfig, AbstractCasFilter.class);
+ }
+
+
+ @Test
+ public void noKeyFoundGetDefaultForBoolean() {
+ final ConfigurationKey key = ConfigurationKeys.ACCEPT_ANY_PROXY;
+ assertEquals(key.getDefaultValue(), this.impl.getBoolean(key));
+ }
+
+
+ @Test
+ public void noKeyFoundGetDefaultForString() {
+ final ConfigurationKey key = ConfigurationKeys.ARTIFACT_PARAMETER_NAME;
+ assertEquals(key.getDefaultValue(), this.impl.getString(key));
+ }
+
+
+ @Test
+ public void noKeyFoundGetDefaultForLong() {
+ final ConfigurationKey key = ConfigurationKeys.TOLERANCE;
+ assertEquals(key.getDefaultValue().longValue(), this.impl.getLong(key));
+ }
+
+
+ @Test
+ public void noKeyFoundGetDefaultForInt() {
+ final ConfigurationKey key = ConfigurationKeys.MILLIS_BETWEEN_CLEAN_UPS;
+ assertEquals(key.getDefaultValue().intValue(), this.impl.getInt(key));
+ }
+
+ @Test
+ public void filterConfigValueForBoolean() {
+ final ConfigurationKey key = ConfigurationKeys.ACCEPT_ANY_PROXY;
+ final Boolean value = Boolean.TRUE;
+ this.filterConfig.addInitParameter(key.getName(), value.toString());
+ assertEquals(value, this.impl.getBoolean(key));
+ }
+
+
+ @Test
+ public void filterConfigValueForString() {
+ final ConfigurationKey key = ConfigurationKeys.ARTIFACT_PARAMETER_NAME;
+ final String value = "foobar";
+ this.filterConfig.addInitParameter(key.getName(), value);
+ assertEquals(value, this.impl.getString(key));
+ }
+
+
+ @Test
+ public void filterConfigValueForLong() {
+ final ConfigurationKey key = ConfigurationKeys.TOLERANCE;
+ final long value = 1500;
+ this.filterConfig.addInitParameter(key.getName(), Long.toString(value));
+ assertEquals(value, this.impl.getLong(key));
+ }
+
+
+ @Test
+ public void filterConfigValueForInt() {
+ final ConfigurationKey key = ConfigurationKeys.MILLIS_BETWEEN_CLEAN_UPS;
+ final int value = 1500;
+ this.filterConfig.addInitParameter(key.getName(), Integer.toString(value));
+ assertEquals(value, this.impl.getInt(key));
+ }
+
+
+ @Test
+ public void servletConfigValueForBoolean() {
+ final ConfigurationKey key = ConfigurationKeys.ACCEPT_ANY_PROXY;
+ final Boolean value = Boolean.TRUE;
+ final MockServletContext context = (MockServletContext) this.filterConfig.getServletContext();
+ context.addInitParameter(key.getName(), value.toString());
+ assertEquals(value, this.impl.getBoolean(key));
+ }
+
+
+ @Test
+ public void servletConfigValueForString() {
+ final ConfigurationKey key = ConfigurationKeys.ARTIFACT_PARAMETER_NAME;
+ final String value = "foobar";
+ final MockServletContext context = (MockServletContext) this.filterConfig.getServletContext();
+ context.addInitParameter(key.getName(), value);
+ assertEquals(value, this.impl.getString(key));
+ }
+
+
+ @Test
+ public void servletConfigValueForLong() {
+ final ConfigurationKey key = ConfigurationKeys.TOLERANCE;
+ final long value = 1500;
+ final MockServletContext context = (MockServletContext) this.filterConfig.getServletContext();
+ context.addInitParameter(key.getName(), Long.toString(value));
+ assertEquals(value, this.impl.getLong(key));
+ }
+
+
+ @Test
+ public void servletConfigValueForInt() {
+ final ConfigurationKey key = ConfigurationKeys.MILLIS_BETWEEN_CLEAN_UPS;
+ final int value = 1500;
+ final MockServletContext context = (MockServletContext) this.filterConfig.getServletContext();
+ context.addInitParameter(key.getName(), Integer.toString(value));
+ assertEquals(value, this.impl.getInt(key));
+ }
+
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
index 7c91f8f10..93fd66515 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
@@ -25,6 +25,8 @@
import javax.servlet.ServletException;
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockFilterChain;
@@ -35,12 +37,12 @@
/**
* Tests {@link SingleSignOutFilter}.
- *
+ *
* @author Jerome Leleu
* @since 3.3.1
*/
public class SingleSignOutFilterTests {
-
+
private final static String CAS_SERVER_URL_PREFIX = "http://myhost.com/mycasserver";
private final static String TICKET = "ST-yyyyy";
private final static String RELAY_STATE = "e1s1";
@@ -49,7 +51,7 @@ public class SingleSignOutFilterTests {
private MockHttpServletRequest request;
private MockHttpServletResponse response;
private MockFilterChain filterChain;
-
+
@Before
public void setUp() throws Exception {
filter = new SingleSignOutFilter();
@@ -60,11 +62,11 @@ public void setUp() throws Exception {
response = new MockHttpServletResponse();
filterChain = new MockFilterChain();
}
-
+
@Test
public void tokenRequest() throws IOException, ServletException {
- request.setParameter(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME, TICKET);
- request.setQueryString(SingleSignOutHandler.DEFAULT_ARTIFACT_PARAMETER_NAME + "=" + TICKET);
+ request.setParameter(Protocol.CAS2.getArtifactParameterName(), TICKET);
+ request.setQueryString(Protocol.CAS2.getArtifactParameterName() + "=" + TICKET);
final MockHttpSession session = new MockHttpSession();
request.setSession(session);
filter.doFilter(request, response, filterChain);
@@ -73,7 +75,7 @@ public void tokenRequest() throws IOException, ServletException {
@Test
public void backChannelRequest() throws IOException, ServletException {
- request.setParameter(SingleSignOutHandler.DEFAULT_LOGOUT_PARAMETER_NAME,
+ request.setParameter(ConfigurationKeys.LOGOUT_PARAMETER_NAME.getDefaultValue(),
LogoutMessageGenerator.generateBackChannelLogoutMessage(TICKET));
request.setMethod("POST");
final MockHttpSession session = new MockHttpSession();
@@ -85,8 +87,8 @@ public void backChannelRequest() throws IOException, ServletException {
@Test
public void frontChannelRequest() throws IOException, ServletException {
final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
- request.setParameter(SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
- request.setQueryString(SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
+ request.setParameter(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
+ request.setQueryString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
@@ -98,16 +100,16 @@ public void frontChannelRequest() throws IOException, ServletException {
@Test
public void frontChannelRequestRelayState() throws IOException, ServletException {
final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
- request.setParameter(SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
- request.setParameter(SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME, RELAY_STATE);
- request.setQueryString(SingleSignOutHandler.DEFAULT_FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage + "&" +
- SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME + "=" + RELAY_STATE);
+ request.setParameter(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
+ request.setParameter(ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue(), RELAY_STATE);
+ request.setQueryString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage + "&" +
+ ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
filter.doFilter(request, response, filterChain);
assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
assertEquals(CAS_SERVER_URL_PREFIX + "/logout?_eventId=next&" +
- SingleSignOutHandler.DEFAULT_RELAY_STATE_PARAMETER_NAME + "=" + RELAY_STATE, response.getRedirectedUrl());
+ ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE, response.getRedirectedUrl());
}
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CasFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CasFilterTests.java
index 758dc9dd6..89608700b 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CasFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CasFilterTests.java
@@ -24,6 +24,8 @@
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+
+import org.jasig.cas.client.Protocol;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -55,6 +57,10 @@ public void serverName() {
}
private static class TestCasFilter extends AbstractCasFilter {
+
+ public TestCasFilter() {
+ super(Protocol.CAS2);
+ }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException {
// nothing to do
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
index 8ccdb2f4f..f2da17388 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas10TicketValidationFilterTests.java
@@ -50,7 +50,10 @@ public void testAllowsRenewContextParam() throws Exception {
final MockServletContext context = new MockServletContext();
context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
context.addInitParameter("renew", "true");
- final TicketValidator validator = f.getTicketValidator(new MockFilterConfig(context));
+ context.addInitParameter("service", "http://www.jasig.org");
+ final MockFilterConfig config = new MockFilterConfig(context);
+ f.init(config);
+ final TicketValidator validator = f.getTicketValidator(config);
assertTrue(validator instanceof Cas10TicketValidator);
assertTrue(((Cas10TicketValidator) validator).isRenew());
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
index 89e900a7f..7c11042c1 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTests.java
@@ -25,6 +25,7 @@
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
import org.jasig.cas.client.util.MethodFlag;
+import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockServletContext;
@@ -148,32 +149,40 @@ public void testThrowsForNullStorage() throws Exception {
public void testGetTicketValidator() throws Exception {
Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
- filter.setProxyGrantingTicketStorage(storage);
- filter.setMillisBetweenCleanUps(250);
- filter.setTimer(defaultTimer);
- filter.setTimerTask(new TimerTask() {
- public void run() {
- }
- });
- filter.init();
// Test case #1
final MockFilterConfig config1 = new MockFilterConfig();
config1.addInitParameter("allowedProxyChains", "https://a.example.com");
config1.addInitParameter("casServerUrlPrefix", "https://cas.jasig.org/");
+ config1.addInitParameter("service", "http://www.jasig.org");
+ filter.init(config1);
assertNotNull(filter.getTicketValidator(config1));
+ }
+ @Test
+ public void getTicketValidatorWithProxyChains() throws Exception {
+ Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
// Test case #2
final MockFilterConfig config2 = new MockFilterConfig();
config2.addInitParameter("allowedProxyChains", "https://a.example.com https://b.example.com");
config2.addInitParameter("casServerUrlPrefix", "https://cas.jasig.org/");
+ config2.addInitParameter("service", "http://www.jasig.org");
+ filter.init(config2);
assertNotNull(filter.getTicketValidator(config2));
+ }
+
+
+ @Test
+ public void getTIcketValidatorWithProxyChainsAndLineBreak() throws Exception {
+ Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
// Test case #3
final MockFilterConfig config3 = new MockFilterConfig();
config3.addInitParameter("allowedProxyChains",
"https://a.example.com https://b.example.com\nhttps://c.example.com");
config3.addInitParameter("casServerUrlPrefix", "https://cas.jasig.org/");
+ config3.addInitParameter("service", "http://www.jasig.org");
+ filter.init(config3);
assertNotNull(filter.getTicketValidator(config3));
}
@@ -195,7 +204,10 @@ public void testAllowsRenewContextParam() throws Exception {
final MockServletContext context = new MockServletContext();
context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
context.addInitParameter("renew", "true");
- final TicketValidator validator = f.getTicketValidator(new MockFilterConfig(context));
+ context.addInitParameter("service", "http://www.jasig.org");
+ final MockFilterConfig config = new MockFilterConfig(context);
+ f.init(config);
+ final TicketValidator validator = f.getTicketValidator(config);
assertTrue(validator instanceof AbstractUrlBasedTicketValidator);
assertTrue(((AbstractUrlBasedTicketValidator) validator).isRenew());
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
index 53d18756d..e4db12858 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
@@ -20,6 +20,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockServletContext;
@@ -50,7 +51,10 @@ public void testAllowsRenewContextParam() throws Exception {
final MockServletContext context = new MockServletContext();
context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
context.addInitParameter("renew", "true");
- final TicketValidator validator = f.getTicketValidator(new MockFilterConfig(context));
+ context.addInitParameter("service", "http://www.jasig.org");
+ final MockFilterConfig config = new MockFilterConfig(context);
+ f.init(config);
+ final TicketValidator validator = f.getTicketValidator(config);
assertTrue(validator instanceof Saml11TicketValidator);
assertTrue(((Saml11TicketValidator) validator).isRenew());
}
diff --git a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/configuration/JBossCompatibleJndiConfigurationStrategyImpl.java b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/configuration/JBossCompatibleJndiConfigurationStrategyImpl.java
new file mode 100644
index 000000000..99e2a0c70
--- /dev/null
+++ b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/configuration/JBossCompatibleJndiConfigurationStrategyImpl.java
@@ -0,0 +1,16 @@
+package org.jasig.cas.client.configuration;
+
+/**
+ * Simple extension to the {@link org.jasig.cas.client.configuration.JndiConfigurationStrategyImpl} to provide a JBoss 7 compatible prefix.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public final class JBossCompatibleJndiConfigurationStrategyImpl extends JndiConfigurationStrategyImpl {
+
+ private static final String ENVIRONMENT_PREFIX = "java:/comp/env/cas/";
+
+ public JBossCompatibleJndiConfigurationStrategyImpl() {
+ super(ENVIRONMENT_PREFIX);
+ }
+}
diff --git a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
index cb4c45a2b..597d4950d 100644
--- a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
+++ b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/jboss/authentication/WebAuthenticationFilter.java
@@ -27,6 +27,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+
+import org.jasig.cas.client.Protocol;
import org.jasig.cas.client.jaas.AssertionPrincipal;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.util.CommonUtils;
@@ -50,12 +52,16 @@
*/
public final class WebAuthenticationFilter extends AbstractCasFilter {
+ public WebAuthenticationFilter() {
+ super(Protocol.CAS2);
+ }
+
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
final FilterChain chain) throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
final HttpSession session = request.getSession();
- final String ticket = CommonUtils.safeGetParameter(request, getArtifactParameterName());
+ final String ticket = CommonUtils.safeGetParameter(request, getProtocol().getArtifactParameterName());
if (session != null && session.getAttribute(CONST_CAS_ASSERTION) == null && ticket != null) {
try {
From a997b25f35b3d0d56cb604bf79a24c5c71bee6bb Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 9 Apr 2014 22:33:57 -0400
Subject: [PATCH 122/239] Added additional keys that were new from the single
signout refactor.
---
.../java/org/jasig/cas/client/session/SingleSignOutFilter.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index da533cf44..5720a6907 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -42,6 +42,7 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
private AtomicBoolean handlerInitialized = new AtomicBoolean(false);
public void init(final FilterConfig filterConfig) throws ServletException {
+ super.init(filterConfig);
if (!isIgnoreInitConfiguration()) {
setArtifactParameterName(getString(ConfigurationKeys.ARTIFACT_PARAMETER_NAME));
setLogoutParameterName(getString(ConfigurationKeys.LOGOUT_PARAMETER_NAME));
From 035a63fe8fdea347ec0aeed122f477b42b81b809 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Thu, 20 Nov 2014 15:58:52 -0500
Subject: [PATCH 123/239] Added missing javadoc for Protocol enumeration
---
.../main/java/org/jasig/cas/client/Protocol.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java b/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
index 184104f6e..b484d112a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
@@ -1,13 +1,14 @@
package org.jasig.cas.client;
/**
- * Created by battags on 10/14/14.
+ * Simple enumeration to hold/capture some of the standard request parameters used by the various protocols.
+ *
+ * @author Scott Battaglia
+ * @since 3.4.0
*/
public enum Protocol {
-
-
- CAS1("ticket", "service"), CAS2(CAS1.getArtifactParameterName(), CAS1.getServiceParameterName()), SAML11("SAMLart", "TARGET");
+ CAS1("ticket", "service"), CAS2(CAS1), SAML11("SAMLart", "TARGET");
private final String artifactParameterName;
@@ -18,6 +19,10 @@ private Protocol(final String artifactParameterName, final String serviceParamet
this.serviceParameterName = serviceParameterName;
}
+ private Protocol(final Protocol protocol) {
+ this(protocol.getArtifactParameterName(), protocol.getServiceParameterName());
+ }
+
public String getArtifactParameterName() {
return this.artifactParameterName;
}
From 31d73371244b7e576461678d491b71cf12883609 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Thu, 20 Nov 2014 16:01:02 -0500
Subject: [PATCH 124/239] Removed unused mockito dependency
---
cas-client-core/pom.xml | 7 -------
1 file changed, 7 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 3cecc14c4..f37b0844b 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -75,13 +75,6 @@
test
-
- org.mockito
- mockito-all
- 1.10.8
- test
-
-
log4jlog4j
From bca2c5e52d28f35b90dff53aa7cd4dd53fe7525e Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Thu, 20 Nov 2014 16:03:19 -0500
Subject: [PATCH 125/239] Unused reference to Mockito
---
.../configuration/WebXmlConfigurationStrategyImplTests.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
index 9ec94dcc5..503713324 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
@@ -7,7 +7,6 @@
import org.springframework.mock.web.MockServletContext;
import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
public final class WebXmlConfigurationStrategyImplTests {
From 3ea2c3a47e49d298731e26a89581865207446a4b Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Thu, 20 Nov 2014 16:29:29 -0500
Subject: [PATCH 126/239] CASC-233 ErrorRedirectFilter Can throw Null Pointer
Exception
Problem: the ErrorRedirectFilter assumes there is a root cause and will null pointer if there is not.
Solution: Only use the root cause if there is one, otherwise use the original exception.
QA Notes: Added unit test to confirm non-root cause error.
---
.../cas/client/util/ErrorRedirectFilter.java | 28 ++++++++---
.../client/util/ErrorRedirectFilterTests.java | 48 +++++++++++++++++++
2 files changed, 70 insertions(+), 6 deletions(-)
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/util/ErrorRedirectFilterTests.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
index 74496c030..dd6f4a288 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
@@ -24,22 +24,22 @@
import java.util.List;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Filters that redirects to the supplied url based on an exception. Exceptions and the urls are configured via
* init filter name/param values.
- *
+ *
* If there is an exact match the filter uses that value. If there's a non-exact match (i.e. inheritance), then the filter
* uses the last value that matched.
- *
+ *
* If there is no match it will redirect to a default error page. The default exception is configured via the "defaultErrorRedirectPage" property.
- *
+ *
* @author Scott Battaglia
* @version $Revision$ $Date$
* @since 3.1.4
- *
*/
public final class ErrorRedirectFilter implements Filter {
@@ -58,8 +58,8 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
final HttpServletResponse httpResponse = (HttpServletResponse) response;
try {
filterChain.doFilter(request, response);
- } catch (final ServletException e) {
- final Throwable t = e.getCause();
+ } catch (final Throwable e) {
+ final Throwable t = extractErrorToCompare(e);
ErrorHolder currentMatch = null;
for (final ErrorHolder errorHolder : this.errors) {
if (errorHolder.exactMatch(t)) {
@@ -78,6 +78,22 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
}
}
+ /**
+ * Determine which error to use for comparison. If there is an {@link Throwable#getCause()} then that will be used. Otherwise, the original throwable is used.
+ *
+ * @param throwable the throwable to look for a root cause.
+ * @return the throwable to use for comparison. MUST NOT BE NULL.
+ */
+ private Throwable extractErrorToCompare(final Throwable throwable) {
+ final Throwable cause = throwable.getCause();
+
+ if (cause != null) {
+ return cause;
+ }
+
+ return throwable;
+ }
+
public void init(final FilterConfig filterConfig) throws ServletException {
this.defaultErrorRedirectPage = filterConfig.getInitParameter("defaultErrorRedirectPage");
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/ErrorRedirectFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/ErrorRedirectFilterTests.java
new file mode 100644
index 000000000..b79daf41e
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/ErrorRedirectFilterTests.java
@@ -0,0 +1,48 @@
+package org.jasig.cas.client.util;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockFilterChain;
+import org.springframework.mock.web.MockFilterConfig;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import javax.servlet.FilterChain;
+
+import static org.junit.Assert.*;
+
+public final class ErrorRedirectFilterTests {
+
+ private static final String REDIRECT_URL = "/ise.html";
+
+ private ErrorRedirectFilter errorRedirectFilter;
+
+ private FilterChain filterChain;
+
+
+ @Before
+ public void setUp() throws Exception {
+ this.errorRedirectFilter = new ErrorRedirectFilter();
+
+ final MockFilterConfig filterConfig = new MockFilterConfig();
+ filterConfig.addInitParameter(IllegalStateException.class.getName(), REDIRECT_URL);
+ this.errorRedirectFilter.init(filterConfig);
+ this.filterChain = new MockFilterChain();
+ }
+
+
+ @Test
+ public void noRootCause() throws Exception {
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+
+ // this should be okay as the mock filter chain allows one call
+ this.errorRedirectFilter.doFilter(request, response, this.filterChain);
+
+ // this will fail as the mock filter chain will throw IllegalStateException
+ this.errorRedirectFilter.doFilter(request, response, this.filterChain);
+
+ assertEquals(REDIRECT_URL, response.getRedirectedUrl());
+
+ }
+}
From 56467dd463722a09ddd69e106ab254ea7e3bc39f Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 26 Nov 2014 22:31:01 -0500
Subject: [PATCH 127/239] Per feedback, scoped catch block to Exception instead
of Throwable
---
.../java/org/jasig/cas/client/util/ErrorRedirectFilter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
index dd6f4a288..b1425a4bb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ErrorRedirectFilter.java
@@ -58,7 +58,7 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
final HttpServletResponse httpResponse = (HttpServletResponse) response;
try {
filterChain.doFilter(request, response);
- } catch (final Throwable e) {
+ } catch (final Exception e) {
final Throwable t = extractErrorToCompare(e);
ErrorHolder currentMatch = null;
for (final ErrorHolder errorHolder : this.errors) {
From f65d227a4874239cc365c738cac2d0401ed96c77 Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Wed, 26 Nov 2014 22:58:12 -0500
Subject: [PATCH 128/239] Addressed formatting feedback as well as reserved
keywords.
---
.../Saml11AuthenticationFilter.java | 2 +-
.../client/configuration/ConfigurationKey.java | 3 +++
.../configuration/ConfigurationStrategy.java | 1 -
...Cas20ProxyReceivingTicketValidationFilter.java | 15 ++++++++++-----
4 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
index 63483b2e3..8a7ddae46 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
@@ -21,7 +21,7 @@
import org.jasig.cas.client.Protocol;
/**
- * Extension to the default Authentication filter that sets the required SAML11.1 artifact parameter name and service parameter name.
+ * Extension to the default Authentication filter that sets the required SAML1.1 artifact parameter name and service parameter name.
*
* Note, as of 3.3, the final keyword was removed to allow you to override the method to retrieve tickets, per CASC-154
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
index f6c0df7d7..dfe51507c 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
@@ -1,5 +1,7 @@
package org.jasig.cas.client.configuration;
+import org.jasig.cas.client.util.CommonUtils;
+
/**
* Holder class to represent a particular configuration key and its optional default value.
*
@@ -17,6 +19,7 @@ public ConfigurationKey(final String name) {
}
public ConfigurationKey(final String name, final E defaultValue) {
+ CommonUtils.assertNotNull(name, "name must not be null.");
this.name = name;
this.defaultValue = defaultValue;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
index cd1b9dd8a..15905eafe 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
@@ -11,7 +11,6 @@
*/
public interface ConfigurationStrategy {
-
/**
* Retrieves the value for the provided {@param configurationKey}, falling back to the {@param configurationKey}'s {@link ConfigurationKey#getDefaultValue()} if nothing can be found.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index cfea9e7c5..8c7a63279 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -32,6 +32,8 @@
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
+import static org.jasig.cas.client.configuration.ConfigurationKeys.*;
+
/**
* Creates either a CAS20ProxyTicketValidator or a CAS20ServiceTicketValidator depending on whether any of the
* proxy parameters are set.
@@ -46,11 +48,14 @@
*/
public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketValidationFilter {
- private static final String[] RESERVED_INIT_PARAMS = new String[]{"proxyGrantingTicketStorageClass",
- "proxyReceptorUrl", "acceptAnyProxy", "allowedProxyChains", "casServerUrlPrefix", "proxyCallbackUrl",
- "renew", "exceptionOnValidationFailure", "redirectAfterValidation", "useSession", "serverName", "service",
- "artifactParameterName", "serviceParameterName", "encodeServiceUrl", "millisBetweenCleanUps",
- "hostnameVerifier", "encoding", "config", "ticketValidatorClass"};
+ private static final String[] RESERVED_INIT_PARAMS = new String[]{ARTIFACT_PARAMETER_NAME.getName(), SERVER_NAME.getName(), SERVICE.getName(), RENEW.getName(), LOGOUT_PARAMETER_NAME.getName(),
+ ARTIFACT_PARAMETER_OVER_POST.getName(), EAGERLY_CREATE_SESSIONS.getName(), ENCODE_SERVICE_URL.getName(), SSL_CONFIG_FILE.getName(), ROLE_ATTRIBUTE.getName(), IGNORE_CASE.getName(),
+ CAS_SERVER_LOGIN_URL.getName(), GATEWAY.getName(), AUTHENTICATION_REDIRECT_STRATEGY_CLASS.getName(), GATEWAY_STORAGE_CLASS.getName(), CAS_SERVER_URL_PREFIX.getName(), ENCODING.getName(),
+ TOLERANCE.getName(), DISABLE_XML_SCHEMA_VALIDATION.getName(), IGNORE_PATTERN.getName(), IGNORE_URL_PATTERN_TYPE.getName(), HOSTNAME_VERIFIER.getName(), HOSTNAME_VERIFIER_CONFIG.getName(),
+ EXCEPTION_ON_VALIDATION_FAILURE.getName(), REDIRECT_AFTER_VALIDATION.getName(), USE_SESSION.getName(), SECRET_KEY.getName(), CIPHER_ALGORITHM.getName(), PROXY_RECEPTOR_URL.getName(),
+ PROXY_GRANTING_TICKET_STORAGE_CLASS.getName(), MILLIS_BETWEEN_CLEAN_UPS.getName(), ACCEPT_ANY_PROXY.getName(), ALLOWED_PROXY_CHAINS.getName(), TICKET_VALIDATOR_CLASS.getName(),
+ PROXY_CALLBACK_URL.getName(), FRONT_LOGOUT_PARAMETER_NAME.getName(), RELAY_STATE_PARAMETER_NAME.getName()
+ };
/**
* The URL to send to the CAS server as the URL that will process proxying requests on the CAS client.
From c89eba71410e23319b008c5e0c75decc161adb0e Mon Sep 17 00:00:00 2001
From: Scott Battaglia
Date: Sun, 30 Nov 2014 17:09:09 -0500
Subject: [PATCH 129/239] Updated try/catch loop to log when a class is not
found.
---
.../cas/client/configuration/ConfigurationStrategyName.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
index ea089fe7a..bc257f28b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
@@ -1,6 +1,8 @@
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Enumeration to map simple names to the underlying classes so that deployers can reference the simple name in the
@@ -13,6 +15,8 @@ public enum ConfigurationStrategyName {
DEFAULT(LegacyConfigurationStrategyImpl.class), JNDI(JndiConfigurationStrategyImpl.class), WEB_XML(WebXmlConfigurationStrategyImpl.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationStrategyName.class);
+
private final Class extends ConfigurationStrategy> configurationStrategyClass;
private ConfigurationStrategyName(final Class extends ConfigurationStrategy> configurationStrategyClass) {
@@ -43,7 +47,7 @@ public static Class extends ConfigurationStrategy> resolveToConfigurationStrat
return (Class extends ConfigurationStrategy>) clazz;
}
} catch (final ClassNotFoundException e) {
- // nothing we can do here
+ LOGGER.error("Unable to locate strategy {} by name or class name. Using default strategy instead.", value, e);
}
return DEFAULT.configurationStrategyClass;
From a7010659f1d42cb3ab965ff8644463d233d87bdd Mon Sep 17 00:00:00 2001
From: Scott
Date: Sun, 7 Dec 2014 13:32:14 -0500
Subject: [PATCH 130/239] CASC-231 HttpsURLConnectonFactory is Not Serializable
Problem: THe HttpsURLConnectionFactory is not serializable, causing problems
for clients that must serialize the principal (which depends on a
ProxyRetriever).
Solution: Make the HttpsURLConnectionFactory serializable.
QA Notes: added unit test to confirm serialize-deserialize
---
.../client/ssl/HttpURLConnectionFactory.java | 3 +-
.../client/ssl/HttpsURLConnectionFactory.java | 46 ++++++++++++++++++-
.../cas/client/ssl/RegexHostnameVerifier.java | 5 +-
.../client/ssl/WhitelistHostnameVerifier.java | 5 +-
.../ssl/HttpsURLConnectionFactoryTests.java | 37 +++++++++++++++
.../ssl/WhitelistHostnameVerifierTests.java | 2 +-
6 files changed, 92 insertions(+), 6 deletions(-)
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactoryTests.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
index e280b7a62..8ea298f09 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpURLConnectionFactory.java
@@ -18,6 +18,7 @@
*/
package org.jasig.cas.client.ssl;
+import java.io.Serializable;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
@@ -28,7 +29,7 @@
* @author Misagh Moayyed
* @since 3.3
*/
-public interface HttpURLConnectionFactory {
+public interface HttpURLConnectionFactory extends Serializable {
/**
* Receives a {@link URLConnection} instance typically as a result of a {@link URL}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
index d0b230874..cede90858 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactory.java
@@ -18,8 +18,7 @@
*/
package org.jasig.cas.client.ssl;
-import java.io.FileInputStream;
-import java.io.InputStream;
+import java.io.*;
import java.net.HttpURLConnection;
import java.net.URLConnection;
import java.security.KeyStore;
@@ -41,6 +40,8 @@
*/
public final class HttpsURLConnectionFactory implements HttpURLConnectionFactory {
+ private static final long serialVersionUID = 1L;
+
private static final Logger LOGGER = LoggerFactory.getLogger(HttpsURLConnectionFactory.class);
/**
@@ -146,4 +147,45 @@ private SSLSocketFactory createSSLSocketFactory() {
return null;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ final HttpsURLConnectionFactory that = (HttpsURLConnectionFactory) o;
+
+ if (!hostnameVerifier.equals(that.hostnameVerifier)) return false;
+ if (!sslConfiguration.equals(that.sslConfiguration)) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = hostnameVerifier.hashCode();
+ result = 31 * result + sslConfiguration.hashCode();
+ return result;
+ }
+
+ private void writeObject(final ObjectOutputStream out) throws IOException {
+ if (this.hostnameVerifier == HttpsURLConnection.getDefaultHostnameVerifier()) {
+ out.writeObject(null);
+ } else {
+ out.writeObject(this.hostnameVerifier);
+ }
+
+ out.writeObject(this.sslConfiguration);
+
+ }
+
+ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
+ final Object internalHostNameVerifier = in.readObject();
+ if (internalHostNameVerifier == null) {
+ this.hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
+ } else {
+ this.hostnameVerifier = (HostnameVerifier) internalHostNameVerifier;
+ }
+
+ this.sslConfiguration = (Properties) in.readObject();
+ }
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/RegexHostnameVerifier.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/RegexHostnameVerifier.java
index 15763644b..a13c9f734 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/RegexHostnameVerifier.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/RegexHostnameVerifier.java
@@ -19,6 +19,7 @@
package org.jasig.cas.client.ssl;
+import java.io.Serializable;
import java.util.regex.Pattern;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
@@ -32,7 +33,9 @@
* @since 3.1.10
*
*/
-public final class RegexHostnameVerifier implements HostnameVerifier {
+public final class RegexHostnameVerifier implements HostnameVerifier, Serializable {
+
+ private static final long serialVersionUID = 1L;
/** Allowed hostname pattern */
private Pattern pattern;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifier.java b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifier.java
index db9abb5ab..c882225e4 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifier.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifier.java
@@ -20,6 +20,7 @@
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
+import java.io.Serializable;
/**
* Verifies a SSL peer host name based on an explicit whitelist of allowed hosts.
@@ -29,7 +30,9 @@
* @since 3.1.10
*
*/
-public final class WhitelistHostnameVerifier implements HostnameVerifier {
+public final class WhitelistHostnameVerifier implements HostnameVerifier, Serializable {
+
+ private static final long serialVersionUID = 1L;
/** Allowed hosts */
private String[] allowedHosts;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactoryTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactoryTests.java
new file mode 100644
index 000000000..f5d11d166
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactoryTests.java
@@ -0,0 +1,37 @@
+package org.jasig.cas.client.ssl;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.*;
+
+import static org.junit.Assert.*;
+
+public final class HttpsURLConnectionFactoryTests {
+
+ private HttpsURLConnectionFactory httpsURLConnectionFactory;
+
+
+ @Before
+ public void setUp() throws Exception {
+ this.httpsURLConnectionFactory = new HttpsURLConnectionFactory();
+ }
+
+
+ @Test
+ public void serializeAndDeserialize() throws Exception {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final ObjectOutputStream oos = new ObjectOutputStream(baos);
+
+ oos.writeObject(this.httpsURLConnectionFactory);
+ oos.close();
+
+ final byte[] serializedHttpsUrlConnectionFactory = baos.toByteArray();
+
+ final ByteArrayInputStream bais = new ByteArrayInputStream(serializedHttpsUrlConnectionFactory);
+ final ObjectInputStream ois = new ObjectInputStream(bais);
+
+ final HttpsURLConnectionFactory deserializedObject = (HttpsURLConnectionFactory) ois.readObject();
+ assertEquals(this.httpsURLConnectionFactory, deserializedObject);
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifierTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifierTests.java
index a021c750d..92a41f58b 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifierTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/WhitelistHostnameVerifierTests.java
@@ -43,7 +43,7 @@
*/
public class WhitelistHostnameVerifierTests extends TestCase {
/**
- * Test method for {@link WhitelistHostnameVerifier#verify(String, SSLSession)}.
+ * Test method for {@link WhitelistHostnameVerifier#verify(String, javax.net.ssl.SSLSession)}.
*/
public void testVerify() {
final WhitelistHostnameVerifier verifier = new WhitelistHostnameVerifier("red.vt.edu, green.vt.edu,blue.vt.edu");
From e0b2618b3d6b3ed0fd0d6d002dc418677ce4bdbd Mon Sep 17 00:00:00 2001
From: Scott
Date: Sun, 7 Dec 2014 14:14:08 -0500
Subject: [PATCH 131/239] CASC-200 Introduce Properties File Configuration
Option
Problem: We can configure via JNDI, WebXML (or both) but not by properties file.
Solution: Introduce a method to use property files.
---
.../ConfigurationStrategyName.java | 2 +-
.../PropertiesConfigurationStrategyImpl.java | 83 +++++++++++++++++++
2 files changed, 84 insertions(+), 1 deletion(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/PropertiesConfigurationStrategyImpl.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
index bc257f28b..d4b46abd9 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
@@ -13,7 +13,7 @@
*/
public enum ConfigurationStrategyName {
- DEFAULT(LegacyConfigurationStrategyImpl.class), JNDI(JndiConfigurationStrategyImpl.class), WEB_XML(WebXmlConfigurationStrategyImpl.class);
+ DEFAULT(LegacyConfigurationStrategyImpl.class), JNDI(JndiConfigurationStrategyImpl.class), WEB_XML(WebXmlConfigurationStrategyImpl.class), PROPERTY_FILE(PropertiesConfigurationStrategyImpl.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationStrategyName.class);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/PropertiesConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/PropertiesConfigurationStrategyImpl.java
new file mode 100644
index 000000000..7222abe90
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/PropertiesConfigurationStrategyImpl.java
@@ -0,0 +1,83 @@
+package org.jasig.cas.client.configuration;
+
+import org.jasig.cas.client.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * @author Scott Battaglia
+ * @since 3.4.0
+ */
+public final class PropertiesConfigurationStrategyImpl extends BaseConfigurationStrategy {
+
+ /**
+ * Property name we'll use in the {@link javax.servlet.FilterConfig} and {@link javax.servlet.ServletConfig} to try and find where
+ * you stored the configuration file.
+ */
+ private static final String CONFIGURATION_FILE_LOCATION = "configFileLocation";
+
+ /**
+ * Default location of the configuration file. Mostly for testing/demo. You will most likely want to configure an alternative location.
+ */
+ private static final String DEFAULT_CONFIGURATION_FILE_LOCATION = "/etc/java-cas-client.properties";
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesConfigurationStrategyImpl.class);
+
+ private String simpleFilterName;
+
+ private Properties properties = new Properties();
+
+ @Override
+ protected String get(final ConfigurationKey configurationKey) {
+ final String property = configurationKey.getName();
+ final String filterSpecificProperty = this.simpleFilterName + "." + property;
+
+ final String filterSpecificValue = this.properties.getProperty(filterSpecificProperty);
+
+ if (CommonUtils.isNotEmpty(filterSpecificValue)) {
+ return filterSpecificValue;
+ }
+
+ return this.properties.getProperty(property);
+ }
+
+ public void init(final FilterConfig filterConfig, final Class extends Filter> filterClazz) {
+ this.simpleFilterName = filterClazz.getSimpleName();
+ final String fileLocationFromFilterConfig = filterConfig.getInitParameter(CONFIGURATION_FILE_LOCATION);
+ final boolean filterConfigFileLoad = loadPropertiesFromFile(fileLocationFromFilterConfig);
+
+ if (!filterConfigFileLoad) {
+ final String fileLocationFromServletConfig = filterConfig.getServletContext().getInitParameter(CONFIGURATION_FILE_LOCATION);
+ final boolean servletContextFileLoad = loadPropertiesFromFile(fileLocationFromServletConfig);
+
+ if (!servletContextFileLoad) {
+ final boolean defaultConfigFileLoaded = loadPropertiesFromFile(DEFAULT_CONFIGURATION_FILE_LOCATION);
+ CommonUtils.assertTrue(defaultConfigFileLoaded, "unable to load properties to configure CAS client");
+ }
+ }
+ }
+
+ private boolean loadPropertiesFromFile(final String file) {
+ if (CommonUtils.isEmpty(file)) {
+ return false;
+ }
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(file);
+ this.properties.load(fis);
+ return true;
+ } catch (final IOException e) {
+ LOGGER.warn("Unable to load properties for file {}", file, e);
+ return false;
+ } finally {
+ CommonUtils.closeQuietly(fis);
+ }
+ }
+}
From a8dc2bdc7d0377a325fed875feb16f8c94bdcf93 Mon Sep 17 00:00:00 2001
From: Scott
Date: Mon, 22 Dec 2014 23:55:23 -0500
Subject: [PATCH 132/239] Added license headers
---
.../java/org/jasig/cas/client/Protocol.java | 18 ++++++++++++++++++
.../BaseConfigurationStrategy.java | 18 ++++++++++++++++++
.../client/configuration/ConfigurationKey.java | 18 ++++++++++++++++++
.../configuration/ConfigurationKeys.java | 18 ++++++++++++++++++
.../configuration/ConfigurationStrategy.java | 18 ++++++++++++++++++
.../ConfigurationStrategyName.java | 18 ++++++++++++++++++
.../JndiConfigurationStrategyImpl.java | 18 ++++++++++++++++++
.../LegacyConfigurationStrategyImpl.java | 18 ++++++++++++++++++
.../PropertiesConfigurationStrategyImpl.java | 18 ++++++++++++++++++
.../WebXmlConfigurationStrategyImpl.java | 18 ++++++++++++++++++
.../configuration/ConfigurationKeyTests.java | 18 ++++++++++++++++++
.../ConfigurationStrategyNameTests.java | 18 ++++++++++++++++++
.../WebXmlConfigurationStrategyImplTests.java | 18 ++++++++++++++++++
.../ssl/HttpsURLConnectionFactoryTests.java | 18 ++++++++++++++++++
.../client/util/ErrorRedirectFilterTests.java | 18 ++++++++++++++++++
...ompatibleJndiConfigurationStrategyImpl.java | 18 ++++++++++++++++++
16 files changed, 288 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java b/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
index b484d112a..e26761db3 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client;
/**
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
index 384f89db4..79872c5c7 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.apache.commons.lang.BooleanUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
index dfe51507c..da6a3a19f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
index 138c459f7..9418151d1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.Protocol;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
index 15905eafe..1493d7230 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategy.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import javax.servlet.Filter;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
index d4b46abd9..e180d2684 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/JndiConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/JndiConfigurationStrategyImpl.java
index b81f1eedf..6fcaa110b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/JndiConfigurationStrategyImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/JndiConfigurationStrategyImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/LegacyConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/LegacyConfigurationStrategyImpl.java
index d1f47c3c5..a9af77ca6 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/LegacyConfigurationStrategyImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/LegacyConfigurationStrategyImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/PropertiesConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/PropertiesConfigurationStrategyImpl.java
index 7222abe90..5dd7dd9ae 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/PropertiesConfigurationStrategyImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/PropertiesConfigurationStrategyImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImpl.java
index 1c05b0b8a..634b9f16e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImpl.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.util.CommonUtils;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationKeyTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationKeyTests.java
index add5b3fd3..3a93a4179 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationKeyTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationKeyTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.junit.Test;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
index 534ecbc77..1fb2ee1dd 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.junit.Test;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
index 503713324..57c66d50c 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/WebXmlConfigurationStrategyImplTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
import org.jasig.cas.client.util.AbstractCasFilter;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactoryTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactoryTests.java
index f5d11d166..321d9781b 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactoryTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/ssl/HttpsURLConnectionFactoryTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.ssl;
import org.junit.Before;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/ErrorRedirectFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/ErrorRedirectFilterTests.java
index b79daf41e..69ad9aa82 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/ErrorRedirectFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/ErrorRedirectFilterTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.util;
import org.junit.Before;
diff --git a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/configuration/JBossCompatibleJndiConfigurationStrategyImpl.java b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/configuration/JBossCompatibleJndiConfigurationStrategyImpl.java
index 99e2a0c70..1675f48c0 100644
--- a/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/configuration/JBossCompatibleJndiConfigurationStrategyImpl.java
+++ b/cas-client-integration-jboss/src/main/java/org/jasig/cas/client/configuration/JBossCompatibleJndiConfigurationStrategyImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.configuration;
/**
From 7647009ca45a94be3b9f05cbf0658c66740d25c8 Mon Sep 17 00:00:00 2001
From: LELEU Jerome
Date: Mon, 5 Jan 2015 15:55:33 +0100
Subject: [PATCH 133/239] CASC-217: Update the ticket validators to point to
the new endpoint
First commit
---
.../java/org/jasig/cas/client/Protocol.java | 2 +-
...0ProxyReceivingTicketValidationFilter.java | 16 ++++++--
...0ProxyReceivingTicketValidationFilter.java | 40 +++++++++++++++++++
.../validation/Cas30ProxyTicketValidator.java | 37 +++++++++++++++++
.../Cas30ServiceTicketValidator.java | 37 +++++++++++++++++
5 files changed, 128 insertions(+), 4 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyReceivingTicketValidationFilter.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyTicketValidator.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ServiceTicketValidator.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java b/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
index e26761db3..bf259aaef 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/Protocol.java
@@ -26,7 +26,7 @@
*/
public enum Protocol {
- CAS1("ticket", "service"), CAS2(CAS1), SAML11("SAMLart", "TARGET");
+ CAS1("ticket", "service"), CAS2(CAS1), CAS3(CAS2), SAML11("SAMLart", "TARGET");
private final String artifactParameterName;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 8c7a63279..deefe2262 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -68,13 +68,23 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
private int millisBetweenCleanUps;
+ protected Class extends Cas20ServiceTicketValidator> defaultServiceTicketValidatorClass;
+
+ protected Class extends Cas20ProxyTicketValidator> defaultProxyTicketValidatorClass;
+
/**
* Storage location of ProxyGrantingTickets and Proxy Ticket IOUs.
*/
private ProxyGrantingTicketStorage proxyGrantingTicketStorage = new ProxyGrantingTicketStorageImpl();
public Cas20ProxyReceivingTicketValidationFilter() {
- super(Protocol.CAS2);
+ this(Protocol.CAS2);
+ this.defaultServiceTicketValidatorClass = Cas20ServiceTicketValidator.class;
+ this.defaultProxyTicketValidatorClass = Cas20ProxyTicketValidator.class;
+ }
+
+ protected Cas20ProxyReceivingTicketValidationFilter(final Protocol protocol) {
+ super(protocol);
}
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
@@ -144,13 +154,13 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
if (allowAnyProxy || CommonUtils.isNotBlank(allowedProxyChains)) {
final Cas20ProxyTicketValidator v = createNewTicketValidator(ticketValidatorClass, casServerUrlPrefix,
- Cas20ProxyTicketValidator.class);
+ this.defaultProxyTicketValidatorClass);
v.setAcceptAnyProxy(allowAnyProxy);
v.setAllowedProxyChains(CommonUtils.createProxyList(allowedProxyChains));
validator = v;
} else {
validator = createNewTicketValidator(ticketValidatorClass, casServerUrlPrefix,
- Cas20ServiceTicketValidator.class);
+ this.defaultServiceTicketValidatorClass);
}
validator.setProxyCallbackUrl(getString(ConfigurationKeys.PROXY_CALLBACK_URL));
validator.setProxyGrantingTicketStorage(this.proxyGrantingTicketStorage);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyReceivingTicketValidationFilter.java
new file mode 100644
index 000000000..4f11627c0
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyReceivingTicketValidationFilter.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.validation;
+
+import org.jasig.cas.client.Protocol;
+
+/**
+ * Creates either a Cas30ProxyTicketValidator or a Cas30ServiceTicketValidator depending on whether any of the
+ * proxy parameters are set.
+ *
+ * This filter can also pass additional parameters to the ticket validator. Any init parameter not included in the
+ * reserved list {@link org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter#RESERVED_INIT_PARAMS}.
+ *
+ * @author Jerome Leleu
+ * @since 3.4.0
+ */
+public class Cas30ProxyReceivingTicketValidationFilter extends Cas20ProxyReceivingTicketValidationFilter {
+
+ public Cas30ProxyReceivingTicketValidationFilter() {
+ super(Protocol.CAS3);
+ this.defaultServiceTicketValidatorClass = Cas30ServiceTicketValidator.class;
+ this.defaultProxyTicketValidatorClass = Cas30ProxyTicketValidator.class;
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyTicketValidator.java
new file mode 100644
index 000000000..2cdb641e7
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyTicketValidator.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.validation;
+
+/**
+ * Service and proxy tickets validation service for the CAS protocol v3.
+ *
+ * @author Jerome Leleu
+ * @since 3.4.0
+ */
+public class Cas30ProxyTicketValidator extends Cas20ProxyTicketValidator {
+
+ public Cas30ProxyTicketValidator(String casServerUrlPrefix) {
+ super(casServerUrlPrefix);
+ }
+
+ @Override
+ protected String getUrlSuffix() {
+ return "p3/proxyValidate";
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ServiceTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ServiceTicketValidator.java
new file mode 100644
index 000000000..cb155a7ff
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ServiceTicketValidator.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.validation;
+
+/**
+ * Service tickets validation service for the CAS protocol v3.
+ *
+ * @author Jerome Leleu
+ * @since 3.4.0
+ */
+public class Cas30ServiceTicketValidator extends Cas20ServiceTicketValidator {
+
+ public Cas30ServiceTicketValidator(String casServerUrlPrefix) {
+ super(casServerUrlPrefix);
+ }
+
+ @Override
+ protected String getUrlSuffix() {
+ return "p3/serviceValidate";
+ }
+}
From fae996bde767aa3973fa241373a1616b4754b50a Mon Sep 17 00:00:00 2001
From: LELEU Jerome
Date: Mon, 5 Jan 2015 17:19:40 +0100
Subject: [PATCH 134/239] Issue-91: Introduce system properties configuration
option
First commit
---
.../ConfigurationStrategyName.java | 3 +-
...emPropertiesConfigurationStrategyImpl.java | 39 ++++++++++++
.../ConfigurationStrategyNameTests.java | 2 +
...pertiesConfigurationStrategyImplTests.java | 62 +++++++++++++++++++
4 files changed, 105 insertions(+), 1 deletion(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/configuration/SystemPropertiesConfigurationStrategyImpl.java
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/configuration/SystemPropertiesConfigurationStrategyImplTests.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
index e180d2684..2d3146f0b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
@@ -31,7 +31,8 @@
*/
public enum ConfigurationStrategyName {
- DEFAULT(LegacyConfigurationStrategyImpl.class), JNDI(JndiConfigurationStrategyImpl.class), WEB_XML(WebXmlConfigurationStrategyImpl.class), PROPERTY_FILE(PropertiesConfigurationStrategyImpl.class);
+ DEFAULT(LegacyConfigurationStrategyImpl.class), JNDI(JndiConfigurationStrategyImpl.class), WEB_XML(WebXmlConfigurationStrategyImpl.class),
+ PROPERTY_FILE(PropertiesConfigurationStrategyImpl.class), SYSTEM_PROPERTIES(SystemPropertiesConfigurationStrategyImpl.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationStrategyName.class);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/SystemPropertiesConfigurationStrategyImpl.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/SystemPropertiesConfigurationStrategyImpl.java
new file mode 100644
index 000000000..49be2c5f0
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/SystemPropertiesConfigurationStrategyImpl.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.configuration;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+
+/**
+ * Load all configuration from system properties.
+ *
+ * @author Jerome Leleu
+ * @since 3.4.0
+ */
+public class SystemPropertiesConfigurationStrategyImpl extends BaseConfigurationStrategy {
+
+ public void init(FilterConfig filterConfig, Class extends Filter> filterClazz) {
+ }
+
+ @Override
+ protected String get(ConfigurationKey configurationKey) {
+ return System.getProperty(configurationKey.getName());
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
index 1fb2ee1dd..5c2da1e2c 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
@@ -28,6 +28,8 @@ public final class ConfigurationStrategyNameTests {
public void stringToClass() {
assertEquals(JndiConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.JNDI.name()));
assertEquals(WebXmlConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.WEB_XML.name()));
+ assertEquals(PropertiesConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.PROPERTY_FILE.name()));
+ assertEquals(SystemPropertiesConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.SYSTEM_PROPERTIES.name()));
assertEquals(LegacyConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.DEFAULT.name()));
assertEquals(LegacyConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy("bleh!"));
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/SystemPropertiesConfigurationStrategyImplTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/SystemPropertiesConfigurationStrategyImplTests.java
new file mode 100644
index 000000000..9b362d04b
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/SystemPropertiesConfigurationStrategyImplTests.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.configuration;
+
+import static org.junit.Assert.assertEquals;
+
+import org.jasig.cas.client.util.AbstractCasFilter;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockFilterConfig;
+
+/**
+ * Tests {@link SystemPropertiesConfigurationStrategyImpl}.
+ *
+ * @author Jerome Leleu
+ * @since 3.4.0
+ */
+public class SystemPropertiesConfigurationStrategyImplTests {
+
+ private final static String PARAMETER_NAME = "parameter";
+
+ private SystemPropertiesConfigurationStrategyImpl impl;
+
+ private MockFilterConfig filterConfig;
+
+ @Before
+ public void setUp() throws Exception {
+ this.filterConfig = new MockFilterConfig();
+ this.impl = new SystemPropertiesConfigurationStrategyImpl();
+ this.impl.init(this.filterConfig, AbstractCasFilter.class);
+ }
+
+ @Test
+ public void testNoSystemPropertyDefined() {
+ final ConfigurationKey key = ConfigurationKeys.SERVER_NAME;
+ // no system property defined
+ assertEquals(key.getDefaultValue(), impl.getString(key));
+ }
+
+ @Test
+ public void testWithSystemProperty() {
+ final ConfigurationKey key = ConfigurationKeys.ARTIFACT_PARAMETER_NAME;
+ System.setProperty(key.getName(), PARAMETER_NAME);
+ assertEquals(PARAMETER_NAME, impl.getString(key));
+ }
+}
From cf0ed4094b282b6c3f475c9d90f33d5287ac3afa Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Sat, 17 Jan 2015 11:25:03 -0500
Subject: [PATCH 135/239] CASC-237 Make OpenSAML bootstrap conditional.
---
.../jasig/cas/client/validation/Saml11TicketValidator.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index c99ea1d68..007fc5cdc 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -56,8 +56,11 @@ public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator
static {
try {
- // we really only need to do this once, so this is why its here.
- DefaultBootstrap.bootstrap();
+ // Check for prior OpenSAML initialization to prevent double init
+ // that would overwrite existing OpenSAML configuration
+ if (Configuration.getParserPool() == null) {
+ DefaultBootstrap.bootstrap();
+ }
} catch (final ConfigurationException e) {
throw new RuntimeException(e);
}
From e33af401b27e796be2d76c4cba72b70e608f18b6 Mon Sep 17 00:00:00 2001
From: Scott
Date: Sat, 24 Jan 2015 23:58:51 -0500
Subject: [PATCH 136/239] CASC-239 Saml11AuthenticationFilter Constructor was
Private instead of Public.
---
.../cas/client/authentication/Saml11AuthenticationFilter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
index 8a7ddae46..14cbd1cdc 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
@@ -31,7 +31,7 @@
*/
public class Saml11AuthenticationFilter extends AuthenticationFilter {
- private Saml11AuthenticationFilter() {
+ public Saml11AuthenticationFilter() {
super(Protocol.SAML11);
}
}
From cc465041267a48ef4ade268f8ebbc62f873b29ec Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 20 Feb 2015 09:18:05 -0500
Subject: [PATCH 137/239] SAML validation with XPath instead of OpenSAML.
---
cas-client-core/pom.xml | 27 +-
.../configuration/ConfigurationKeys.java | 1 -
.../jasig/cas/client/util/CommonUtils.java | 20 +-
.../org/jasig/cas/client/util/IOUtils.java | 74 +++++
.../cas/client/util/MapNamespaceContext.java | 62 ++++
.../org/jasig/cas/client/util/XmlUtils.java | 99 +++++-
...actCasProtocolUrlBasedTicketValidator.java | 4 -
.../AbstractUrlBasedTicketValidator.java | 7 -
...0ProxyReceivingTicketValidationFilter.java | 2 +-
.../Saml11TicketValidationFilter.java | 4 +-
.../validation/Saml11TicketValidator.java | 299 +++++++-----------
.../META-INF/cas/samlRequestTemplate.xml | 8 +
.../cas/client/util/CommonUtilsTests.java | 7 +
.../Saml11TicketValidatorTests.java | 17 +-
14 files changed, 416 insertions(+), 215 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
create mode 100644 cas-client-core/src/main/resources/META-INF/cas/samlRequestTemplate.xml
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index b0de44b4b..795b67447 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -11,6 +11,18 @@
Jasig CAS Client for Java - Core
+
+ commons-lang
+ commons-lang
+ 2.6
+
+
+
+ joda-time
+ joda-time
+ 2.7
+
+
xml-securityxmlsec
@@ -19,20 +31,6 @@
true
-
- org.opensaml
- opensaml
- ${opensaml.version}
- jar
- compile
-
-
- org.slf4j
- jcl-over-slf4j
-
-
-
-
commons-codeccommons-codec
@@ -99,6 +97,5 @@
3.1.3.RELEASE
- 2.5.1-1
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
index 9418151d1..b9838cb1f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
@@ -54,7 +54,6 @@ public interface ConfigurationKeys {
ConfigurationKey CAS_SERVER_URL_PREFIX = new ConfigurationKey("casServerUrlPrefix", null);
ConfigurationKey ENCODING = new ConfigurationKey("encoding", null);
ConfigurationKey TOLERANCE = new ConfigurationKey("tolerance", 1000L);
- ConfigurationKey DISABLE_XML_SCHEMA_VALIDATION = new ConfigurationKey("disableXmlSchemaValidation", Boolean.FALSE);
ConfigurationKey IGNORE_PATTERN = new ConfigurationKey("ignorePattern", null);
ConfigurationKey IGNORE_URL_PATTERN_TYPE = new ConfigurationKey("ignoreUrlPatternType", "REGEX");
ConfigurationKey> HOSTNAME_VERIFIER = new ConfigurationKey>("hostnameVerifier", null);
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 5f2ca6170..e7cc375b1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -23,6 +23,7 @@
import java.net.URL;
import java.net.URLEncoder;
import java.text.DateFormat;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
@@ -32,6 +33,11 @@
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
import org.jasig.cas.client.validation.ProxyList;
import org.jasig.cas.client.validation.ProxyListEditor;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDateTime;
+import org.joda.time.format.DateTimeFormatter;
+import org.joda.time.format.ISODateTimeFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,14 +64,22 @@ public final class CommonUtils {
private static final HttpURLConnectionFactory DEFAULT_URL_CONNECTION_FACTORY = new HttpsURLConnectionFactory();
+ private static final DateTimeFormatter ISO_FORMAT = ISODateTimeFormat.dateTimeNoMillis();
+
private CommonUtils() {
// nothing to do
}
public static String formatForUtcTime(final Date date) {
- final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- return dateFormat.format(date);
+ return ISO_FORMAT.print(new DateTime(date).withZone(DateTimeZone.UTC));
+ }
+
+
+ public static Date parseUtcDate(final String date) {
+ if (isEmpty(date)) {
+ return null;
+ }
+ return ISODateTimeFormat.dateTimeParser().parseDateTime(date).toDate();
}
/**
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
new file mode 100644
index 000000000..722046514
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
@@ -0,0 +1,74 @@
+package org.jasig.cas.client.util;
+
+import java.io.*;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+
+/**
+ * IO utility class.
+ *
+ * @author Marvin S. Addison
+ * @since 3.3.1
+ */
+public class IOUtils {
+
+ /** UTF-8 character set. */
+ public static final Charset UTF8 = Charset.forName("UTF-8");
+
+
+ private IOUtils() { /** Utility class pattern. */ }
+
+ /**
+ * Reads all data from the given stream as UTF-8 character data and closes it on completion or errors.
+ *
+ * @param in Input stream containing character data.
+ *
+ * @return String of all data in stream.
+ *
+ * @throws IOException On IO errors.
+ */
+ public static String readString(final InputStream in) throws IOException {
+ return readString(in, UTF8);
+ }
+
+ /**
+ * Reads all data from the given stream as character data in the given character set and closes it on completion
+ * or errors.
+ *
+ * @param in Input stream containing character data.
+ * @param charset Character set of data in stream.
+ *
+ * @return String of all data in stream.
+ *
+ * @throws IOException On IO errors.
+ */
+ public static String readString(final InputStream in, final Charset charset) throws IOException {
+ final Reader reader = new InputStreamReader(in, charset);
+ final StringBuilder builder = new StringBuilder();
+ final CharBuffer buffer = CharBuffer.allocate(2048);
+ try {
+ while (reader.read(buffer) > -1) {
+ buffer.flip();
+ builder.append(buffer);
+ }
+ } finally {
+ closeQuietly(reader);
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Unconditionally close a {@link Closeable} resource. Errors on close are ignored.
+ *
+ * @param resource Resource to close.
+ */
+ public static void closeQuietly(final Closeable resource) {
+ try {
+ if (resource != null) {
+ resource.close();
+ }
+ } catch (final IOException e) {
+ //ignore
+ }
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
new file mode 100644
index 000000000..0dd773c0f
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
@@ -0,0 +1,62 @@
+package org.jasig.cas.client.util;
+
+import javax.xml.namespace.NamespaceContext;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Namespace context implementation backed by a map of XML prefixes to namespace URIs.
+ *
+ * @author Marvin S. Addison
+ * @since 3.3.1
+ */
+public class MapNamespaceContext implements NamespaceContext {
+
+ private final Map namespaceMap;
+
+ /**
+ * Creates a new instance from an array of namespace delcarations.
+ *
+ * @param namespaceDeclarations An array of namespace declarations of the form prefix->uri.
+ */
+ public MapNamespaceContext(final String ... namespaceDeclarations) {
+ namespaceMap = new HashMap();
+ int index;
+ String key;
+ String value;
+ for (final String decl : namespaceDeclarations) {
+ index = decl.indexOf('-');
+ key = decl.substring(0, index);
+ value = decl.substring(index + 2);
+ namespaceMap.put(key, value);
+ }
+ }
+
+ /**
+ * Creates a new instance from a map.
+ *
+ * @param namespaceMap Map of XML namespace prefixes (keys) to URIs (values).
+ */
+ public MapNamespaceContext(final Map namespaceMap) {
+ this.namespaceMap = namespaceMap;
+ }
+
+ public String getNamespaceURI(final String prefix) {
+ return namespaceMap.get(prefix);
+ }
+
+ public String getPrefix(final String namespaceURI) {
+ for (final Map.Entry entry : namespaceMap.entrySet()) {
+ if (entry.getValue().equalsIgnoreCase(namespaceURI)) {
+ return entry.getKey();
+ }
+ }
+ return null;
+ }
+
+ public Iterator getPrefixes(final String namespaceURI) {
+ return Collections.singleton(getPrefix(namespaceURI)).iterator();
+ }
+}
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
index f882b04c6..926ec912e 100644
--- 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
@@ -19,17 +19,24 @@
package org.jasig.cas.client.util;
import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
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 javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
+import javax.xml.xpath.*;
/**
* Common utilities for easily parsing XML without duplicating logic.
@@ -45,6 +52,93 @@ public final class XmlUtils {
*/
private final static Logger LOGGER = LoggerFactory.getLogger(XmlUtils.class);
+
+ /**
+ * Creates a new namespace-aware DOM document object by parsing the given XML.
+ *
+ * @param xml XML content.
+ *
+ * @return DOM document.
+ */
+ public static Document newDocument(final String xml) {
+ final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ final Map features = new HashMap();
+ features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ features.put("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ for (final Map.Entry entry : features.entrySet()) {
+ try {
+ factory.setFeature(entry.getKey(), entry.getValue());
+ } catch (ParserConfigurationException e) {
+ LOGGER.warn("Failed setting XML feature {}: {}", entry.getKey(), e);
+ }
+ }
+ factory.setNamespaceAware(true);
+ try {
+ return factory.newDocumentBuilder().parse(new InputSource(new StringReader(xml)));
+ } catch (Exception e) {
+ throw new RuntimeException("XML parsing error: " + e);
+ }
+ }
+
+
+ /**
+ * Compiles the given XPath expression.
+ *
+ * @param expression XPath expression.
+ * @param nsContext XML namespace context for resolving namespace prefixes in XPath expressions.
+ *
+ * @return Compiled XPath expression.
+ */
+ public static XPathExpression compileXPath(final String expression, final NamespaceContext nsContext) {
+ try {
+ final XPath xPath = XPathFactory.newInstance().newXPath();
+ xPath.setNamespaceContext(nsContext);
+ return xPath.compile(expression);
+ } catch (XPathExpressionException e) {
+ throw new IllegalArgumentException("Invalid XPath expression");
+ }
+ }
+
+
+ /**
+ * Evaluates the given XPath expression as a string result.
+ *
+ * @param expression XPath expression.
+ * @param nsContext XML namespace context for resolving namespace prefixes in XPath expressions.
+ * @param document DOM document on which to evaluate expression.
+ *
+ * @return Evaluated XPath expression as a string.
+ */
+ public static String evaluateXPathString(
+ final String expression, final NamespaceContext nsContext, final Document document) {
+ try {
+ return (String) compileXPath(expression, nsContext).evaluate(document, XPathConstants.STRING);
+ } catch (XPathExpressionException e) {
+ throw new RuntimeException("XPath evaluation error", e);
+ }
+ }
+
+
+
+ /**
+ * Evaluates the given XPath expression as a node list result.
+ *
+ * @param expression XPath expression.
+ * @param nsContext XML namespace context for resolving namespace prefixes in XPath expressions.
+ * @param document DOM document on which to evaluate expression.
+ *
+ * @return Evaluated XPath expression as a node list.
+ */
+ public static NodeList evaluateXPathNodeList(
+ final String expression, final NamespaceContext nsContext, final Document document) {
+ try {
+ return (NodeList) compileXPath(expression, nsContext).evaluate(document, XPathConstants.NODESET);
+ } catch (XPathExpressionException e) {
+ throw new RuntimeException("XPath evaluation error", e);
+ }
+ }
+
+
/**
* Get an instance of an XML reader from the XMLReaderFactory.
*
@@ -62,6 +156,7 @@ public static XMLReader getXmlReader() {
}
}
+
/**
* Retrieve the text for a group of elements. Each text element is an entry
* in a list.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
index b5d5c2fac..146280d7e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/AbstractCasProtocolUrlBasedTicketValidator.java
@@ -34,10 +34,6 @@ protected AbstractCasProtocolUrlBasedTicketValidator(final String casServerUrlPr
super(casServerUrlPrefix);
}
- protected final void setDisableXmlSchemaValidation(final boolean disable) {
- // nothing to do
- }
-
/**
* Retrieves the response from the server by opening a connection and merely reading the response.
*/
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
index fab058150..59c4d88e1 100644
--- 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
@@ -90,13 +90,6 @@ protected void populateUrlAttributeMap(final Map urlParameters)
*/
protected abstract String getUrlSuffix();
- /**
- * Disable XML Schema validation. Note, setting this to true may not be reversable. Defaults to false. Setting it to false
- * after setting it to true may not have any affect.
- *
- * @param disabled whether to disable or not.
- */
- protected abstract void setDisableXmlSchemaValidation(boolean disabled);
/**
* Constructs the URL to send the validation request to.
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 8c7a63279..c43e958ed 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -51,7 +51,7 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
private static final String[] RESERVED_INIT_PARAMS = new String[]{ARTIFACT_PARAMETER_NAME.getName(), SERVER_NAME.getName(), SERVICE.getName(), RENEW.getName(), LOGOUT_PARAMETER_NAME.getName(),
ARTIFACT_PARAMETER_OVER_POST.getName(), EAGERLY_CREATE_SESSIONS.getName(), ENCODE_SERVICE_URL.getName(), SSL_CONFIG_FILE.getName(), ROLE_ATTRIBUTE.getName(), IGNORE_CASE.getName(),
CAS_SERVER_LOGIN_URL.getName(), GATEWAY.getName(), AUTHENTICATION_REDIRECT_STRATEGY_CLASS.getName(), GATEWAY_STORAGE_CLASS.getName(), CAS_SERVER_URL_PREFIX.getName(), ENCODING.getName(),
- TOLERANCE.getName(), DISABLE_XML_SCHEMA_VALIDATION.getName(), IGNORE_PATTERN.getName(), IGNORE_URL_PATTERN_TYPE.getName(), HOSTNAME_VERIFIER.getName(), HOSTNAME_VERIFIER_CONFIG.getName(),
+ TOLERANCE.getName(), IGNORE_PATTERN.getName(), IGNORE_URL_PATTERN_TYPE.getName(), HOSTNAME_VERIFIER.getName(), HOSTNAME_VERIFIER_CONFIG.getName(),
EXCEPTION_ON_VALIDATION_FAILURE.getName(), REDIRECT_AFTER_VALIDATION.getName(), USE_SESSION.getName(), SECRET_KEY.getName(), CIPHER_ALGORITHM.getName(), PROXY_RECEPTOR_URL.getName(),
PROXY_GRANTING_TICKET_STORAGE_CLASS.getName(), MILLIS_BETWEEN_CLEAN_UPS.getName(), ACCEPT_ANY_PROXY.getName(), ALLOWED_PROXY_CHAINS.getName(), TICKET_VALIDATOR_CLASS.getName(),
PROXY_CALLBACK_URL.getName(), FRONT_LOGOUT_PARAMETER_NAME.getName(), RELAY_STATE_PARAMETER_NAME.getName()
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
index 73aede03c..78d37a327 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
@@ -47,12 +47,10 @@ protected final TicketValidator getTicketValidator(final FilterConfig filterConf
validator.setTolerance(tolerance);
validator.setRenew(getBoolean(ConfigurationKeys.RENEW));
- final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(),
- getSSLConfig());
+ final HttpURLConnectionFactory factory = new HttpsURLConnectionFactory(getHostnameVerifier(), getSSLConfig());
validator.setURLConnectionFactory(factory);
validator.setEncoding(getString(ConfigurationKeys.ENCODING));
- validator.setDisableXmlSchemaValidation(getBoolean(ConfigurationKeys.DISABLE_XML_SCHEMA_VALIDATION));
return validator;
}
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 007fc5cdc..506d9a3ee 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -22,29 +22,22 @@
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
import java.util.*;
-import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.IOUtils;
+import org.jasig.cas.client.util.MapNamespaceContext;
+import org.jasig.cas.client.util.XmlUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.Interval;
-import org.opensaml.Configuration;
-import org.opensaml.DefaultBootstrap;
-import org.opensaml.common.IdentifierGenerator;
-import org.opensaml.common.impl.SecureRandomIdentifierGenerator;
-import org.opensaml.saml1.core.*;
-import org.opensaml.ws.soap.soap11.Envelope;
-import org.opensaml.xml.ConfigurationException;
-import org.opensaml.xml.io.Unmarshaller;
-import org.opensaml.xml.io.UnmarshallerFactory;
-import org.opensaml.xml.io.UnmarshallingException;
-import org.opensaml.xml.parse.BasicParserPool;
-import org.opensaml.xml.parse.XMLParserException;
-import org.opensaml.xml.schema.XSAny;
-import org.opensaml.xml.schema.XSString;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import javax.xml.namespace.NamespaceContext;
/**
* TicketValidator that can understand validating a SAML artifact. This includes the SOAP request/response.
@@ -54,34 +47,59 @@
*/
public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator {
- static {
- try {
- // Check for prior OpenSAML initialization to prevent double init
- // that would overwrite existing OpenSAML configuration
- if (Configuration.getParserPool() == null) {
- DefaultBootstrap.bootstrap();
- }
- } catch (final ConfigurationException e) {
- throw new RuntimeException(e);
- }
- }
+ /** Authentication attribute containing SAML AuthenticationMethod attribute value. */
+ public static final String AUTH_METHOD_ATTRIBUTE = "samlAuthenticationStatement::authMethod";
+
+ /** SAML 1.1 request template. */
+ private static final String SAML_REQUEST_TEMPLATE;
+
+ /** SAML 1.1. namespace context. */
+ private static final NamespaceContext SAML_NS_CONTEXT = new MapNamespaceContext(
+ "soap->http://schemas.xmlsoap.org/soap/envelope/",
+ "sa->urn:oasis:names:tc:SAML:1.0:assertion",
+ "sp->urn:oasis:names:tc:SAML:1.0:protocol");
+
+ /** XPath expression to extract Assertion validity start date. */
+ private static final String XPATH_ASSERTION_DATE_START = "//sa:Assertion/sa:Conditions/@NotBefore";
+
+ /** XPath expression to extract Assertion validity end date. */
+ private static final String XPATH_ASSERTION_DATE_END = "//sa:Assertion/sa:Conditions/@NotOnOrAfter";
+
+ /** XPath expression to extract NameIdentifier. */
+ private static final String XPATH_NAME_ID = "//sa:AuthenticationStatement/sa:Subject/sa:NameIdentifier";
+
+ /** XPath expression to extract authentication method. */
+ private static final String XPATH_AUTH_METHOD = "//sa:AuthenticationStatement/@AuthenticationMethod";
+
+ /** XPath expression to extract attributes. */
+ private static final String XPATH_ATTRIBUTES = "//sa:AttributeStatement/sa:Attribute";
+
+ private static final String HEX_CHARS = "0123456789abcdef";
/** Time tolerance to allow for time drifting. */
private long tolerance = 1000L;
- private final BasicParserPool basicParserPool;
+ private final Random random;
+
+
+ /** Class initializer. */
+ static {
+ try {
+ SAML_REQUEST_TEMPLATE = IOUtils.readString(
+ Saml11TicketValidator.class.getResourceAsStream("/META-INF/cas/samlRequestTemplate.xml"));
+ } catch (IOException e) {
+ throw new IllegalStateException("Cannot load SAML request template from classpath", e);
+ }
- private final IdentifierGenerator identifierGenerator;
+ }
public Saml11TicketValidator(final String casServerUrlPrefix) {
super(casServerUrlPrefix);
- this.basicParserPool = new BasicParserPool();
- this.basicParserPool.setNamespaceAware(true);
try {
- this.identifierGenerator = new SecureRandomIdentifierGenerator();
- } catch (final Exception e) {
- throw new RuntimeException(e);
+ random = SecureRandom.getInstance("SHA1PRNG");
+ } catch (NoSuchAlgorithmException e) {
+ throw new IllegalStateException("Cannot find required SHA1PRNG algorithm");
}
}
@@ -96,95 +114,62 @@ protected void populateUrlAttributeMap(final Map urlParameters)
urlParameters.put("TARGET", service);
}
- @Override
- protected void setDisableXmlSchemaValidation(final boolean disabled) {
- if (disabled) {
- this.basicParserPool.setSchema(null);
- }
- }
-
- protected byte[] getBytes(final String text) {
- try {
- return CommonUtils.isNotBlank(getEncoding()) ? text.getBytes(getEncoding()) : text.getBytes();
- } catch (final Exception e) {
- return text.getBytes();
- }
- }
-
protected Assertion parseResponseFromServer(final String response) throws TicketValidationException {
try {
-
- final Document responseDocument = this.basicParserPool.parse(new ByteArrayInputStream(getBytes(response)));
- final Element responseRoot = responseDocument.getDocumentElement();
- final UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
- final Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(responseRoot);
- final Envelope envelope = (Envelope) unmarshaller.unmarshall(responseRoot);
- final Response samlResponse = (Response) envelope.getBody().getOrderedChildren().get(0);
-
- final List assertions = samlResponse.getAssertions();
- if (assertions.isEmpty()) {
- throw new TicketValidationException("No assertions found.");
+ final Document document = XmlUtils.newDocument(response);
+ final Date assertionValidityStart = CommonUtils.parseUtcDate(
+ XmlUtils.evaluateXPathString(XPATH_ASSERTION_DATE_START, SAML_NS_CONTEXT, document));
+ final Date assertionValidityEnd = CommonUtils.parseUtcDate(
+ XmlUtils.evaluateXPathString(XPATH_ASSERTION_DATE_END, SAML_NS_CONTEXT, document));
+ if (!isValidAssertion(assertionValidityStart, assertionValidityEnd)) {
+ throw new TicketValidationException("Invalid SAML assertion");
}
-
- for (final org.opensaml.saml1.core.Assertion assertion : assertions) {
-
- if (!isValidAssertion(assertion)) {
- continue;
- }
-
- final AuthenticationStatement authenticationStatement = getSAMLAuthenticationStatement(assertion);
-
- if (authenticationStatement == null) {
- throw new TicketValidationException("No AuthentiationStatement found in SAML Assertion.");
- }
- final Subject subject = authenticationStatement.getSubject();
-
- if (subject == null) {
- throw new TicketValidationException("No Subject found in SAML Assertion.");
- }
-
- final List attributes = getAttributesFor(assertion, subject);
- final Map personAttributes = new HashMap();
- for (final Attribute samlAttribute : attributes) {
- final List> values = getValuesFrom(samlAttribute);
-
- personAttributes.put(samlAttribute.getAttributeName(), values.size() == 1 ? values.get(0) : values);
+ final String nameId = XmlUtils.evaluateXPathString(XPATH_NAME_ID, SAML_NS_CONTEXT, document);
+ if (nameId == null) {
+ throw new TicketValidationException("SAML assertion does not contain NameIdentifier element");
+ }
+ final String authMethod = XmlUtils.evaluateXPathString(XPATH_AUTH_METHOD, SAML_NS_CONTEXT, document);
+ final NodeList attributes = XmlUtils.evaluateXPathNodeList(XPATH_ATTRIBUTES, SAML_NS_CONTEXT, document);
+ final Map principalAttributes = new HashMap(attributes.getLength());
+ Element attribute;
+ NodeList values;
+ String name;
+ for (int i = 0; i < attributes.getLength(); i++) {
+ attribute = (Element) attributes.item(i);
+ name = attribute.getAttribute("AttributeName");
+ logger.trace("Processing attribute {}", name);
+ values = attribute.getElementsByTagNameNS("*", "AttributeValue");
+ if (values.getLength() == 1) {
+ principalAttributes.put(name, values.item(0).getTextContent());
+ } else {
+ final Collection items = new ArrayList(values.getLength());
+ for (int j = 0; j < values.getLength(); j++) {
+ items.add(values.item(j).getTextContent());
+ }
+ principalAttributes.put(name, items);
}
-
- final AttributePrincipal principal = new AttributePrincipalImpl(subject.getNameIdentifier()
- .getNameIdentifier(), personAttributes);
-
- final Map authenticationAttributes = new HashMap();
- authenticationAttributes.put("samlAuthenticationStatement::authMethod",
- authenticationStatement.getAuthenticationMethod());
-
- final DateTime notBefore = assertion.getConditions().getNotBefore();
- final DateTime notOnOrAfter = assertion.getConditions().getNotOnOrAfter();
- final DateTime authenticationInstant = authenticationStatement.getAuthenticationInstant();
- return new AssertionImpl(principal, notBefore.toDate(), notOnOrAfter.toDate(),
- authenticationInstant.toDate(), authenticationAttributes);
}
- } catch (final UnmarshallingException e) {
- throw new TicketValidationException(e);
- } catch (final XMLParserException e) {
- throw new TicketValidationException(e);
+ return new AssertionImpl(
+ new AttributePrincipalImpl(nameId, principalAttributes),
+ assertionValidityStart,
+ assertionValidityEnd,
+ new Date(),
+ Collections.singletonMap(AUTH_METHOD_ATTRIBUTE, (Object) authMethod));
+ } catch (final Exception e) {
+ throw new TicketValidationException("Error processing SAML response", e);
}
-
- throw new TicketValidationException(
- "No Assertion found within valid time range. Either there's a replay of the ticket or there's clock drift. Check tolerance range, or server/client synchronization.");
}
- private boolean isValidAssertion(final org.opensaml.saml1.core.Assertion assertion) {
- final DateTime notBefore = assertion.getConditions().getNotBefore();
- final DateTime notOnOrAfter = assertion.getConditions().getNotOnOrAfter();
-
+ private boolean isValidAssertion(final Date notBefore, final Date notOnOrAfter) {
if (notBefore == null || notOnOrAfter == null) {
- logger.debug("Assertion has no bounding dates. Will not process.");
+ logger.debug("Assertion is not valid because it does not have bounding dates.");
return false;
}
final DateTime currentTime = new DateTime(DateTimeZone.UTC);
- final Interval validityRange = new Interval(notBefore.minus(this.tolerance), notOnOrAfter.plus(this.tolerance));
+ final Interval validityRange = new Interval(
+ new DateTime(notBefore).minus(this.tolerance),
+ new DateTime(notOnOrAfter).plus(this.tolerance));
if (validityRange.contains(currentTime)) {
logger.debug("Current time is within the interval validity.");
@@ -192,93 +177,41 @@ private boolean isValidAssertion(final org.opensaml.saml1.core.Assertion asserti
}
if (currentTime.isBefore(validityRange.getStart())) {
- logger.debug("skipping assertion that's not yet valid...");
- return false;
+ logger.debug("Assertion is not yet valid");
+ } else {
+ logger.debug("Assertion is expired");
}
-
- logger.debug("skipping expired assertion...");
return false;
}
- private AuthenticationStatement getSAMLAuthenticationStatement(final org.opensaml.saml1.core.Assertion assertion) {
- final List statements = assertion.getAuthenticationStatements();
-
- if (statements.isEmpty()) {
- return null;
- }
-
- return statements.get(0);
- }
-
- private List getAttributesFor(final org.opensaml.saml1.core.Assertion assertion, final Subject subject) {
- final List attributes = new ArrayList();
- for (final AttributeStatement attribute : assertion.getAttributeStatements()) {
- if (subject.getNameIdentifier().getNameIdentifier()
- .equals(attribute.getSubject().getNameIdentifier().getNameIdentifier())) {
- attributes.addAll(attribute.getAttributes());
- }
- }
-
- return attributes;
- }
-
- private List> getValuesFrom(final Attribute attribute) {
- final List list = new ArrayList();
- for (final Object o : attribute.getAttributeValues()) {
- if (o instanceof XSAny) {
- list.add(((XSAny) o).getTextContent());
- } else if (o instanceof XSString) {
- list.add(((XSString) o).getValue());
- } else {
- list.add(o.toString());
- }
- }
- return list;
- }
-
protected String retrieveResponseFromServer(final URL validationUrl, final String ticket) {
- final String MESSAGE_TO_SEND = ""
- + ""
- + ticket
- + "";
+ final String request = String.format(
+ SAML_REQUEST_TEMPLATE,
+ generateId(),
+ CommonUtils.formatForUtcTime(new Date()),
+ ticket);
HttpURLConnection conn = null;
- DataOutputStream out = null;
- BufferedReader in = null;
-
try {
conn = this.getURLConnectionFactory().buildHttpURLConnection(validationUrl.openConnection());
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml");
- conn.setRequestProperty("Content-Length", Integer.toString(MESSAGE_TO_SEND.length()));
+ conn.setRequestProperty("Content-Type", "text/xml");
+ conn.setRequestProperty("Content-Length", Integer.toString(request.length()));
conn.setRequestProperty("SOAPAction", "http://www.oasis-open.org/committees/security");
conn.setUseCaches(false);
conn.setDoInput(true);
conn.setDoOutput(true);
- out = new DataOutputStream(conn.getOutputStream());
- out.writeBytes(MESSAGE_TO_SEND);
- out.flush();
-
- in = new BufferedReader(CommonUtils.isNotBlank(getEncoding()) ? new InputStreamReader(
- conn.getInputStream(), Charset.forName(getEncoding())) : new InputStreamReader(
- conn.getInputStream()));
- final StringBuilder buffer = new StringBuilder(256);
- String line;
+ final Charset charset = CommonUtils.isNotBlank(getEncoding()) ?
+ Charset.forName(getEncoding()) : IOUtils.UTF8;
+ conn.getOutputStream().write(request.getBytes(charset));
+ conn.getOutputStream().flush();
- while ((line = in.readLine()) != null) {
- buffer.append(line);
- }
- return buffer.toString();
+ return IOUtils.readString(conn.getInputStream(), charset);
} catch (final IOException e) {
- throw new RuntimeException(e);
+ throw new RuntimeException("IO error sending HTTP request to /samlValidate", e);
} finally {
- CommonUtils.closeQuietly(out);
- CommonUtils.closeQuietly(in);
if (conn != null) {
conn.disconnect();
}
@@ -288,4 +221,16 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
public void setTolerance(final long tolerance) {
this.tolerance = tolerance;
}
+
+ private String generateId() {
+ final byte[] data = new byte[16];
+ random.nextBytes(data);
+ final StringBuilder id = new StringBuilder(33);
+ id.append('_');
+ for (int i = 0; i < data.length; i++) {
+ id.append(HEX_CHARS.charAt((data[i] & 0xF0) >> 4));
+ id.append(HEX_CHARS.charAt(data[i] & 0x0F));
+ }
+ return id.toString();
+ }
}
diff --git a/cas-client-core/src/main/resources/META-INF/cas/samlRequestTemplate.xml b/cas-client-core/src/main/resources/META-INF/cas/samlRequestTemplate.xml
new file mode 100644
index 000000000..4247909f2
--- /dev/null
+++ b/cas-client-core/src/main/resources/META-INF/cas/samlRequestTemplate.xml
@@ -0,0 +1,8 @@
+
+
+
+
+ %s
+
+
+
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index 8b585b41a..479a3f33d 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -21,6 +21,8 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
+
import junit.framework.TestCase;
import org.jasig.cas.client.PublicTestHttpServer;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
@@ -192,4 +194,9 @@ public void testGetResponseFromServer() throws Exception {
public void testUrlEncode() {
assertEquals("this+is+a+very+special+parameter+with+%3D%25%2F", CommonUtils.urlEncode("this is a very special parameter with =%/"));
}
+
+ public void testParseUtcDate() {
+ final Date expected = new Date(1424437961025L);
+ assertEquals(expected, CommonUtils.parseUtcDate("2015-02-20T08:12:41.025-0500"));
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
index 417db57a6..c6482324c 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
@@ -21,6 +21,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.UnsupportedEncodingException;
+import java.util.Collection;
import java.util.Date;
import org.jasig.cas.client.PublicTestHttpServer;
import org.jasig.cas.client.util.CommonUtils;
@@ -117,11 +118,17 @@ public void openSaml2GeneratedResponse() throws UnsupportedEncodingException {
+ "\" NotOnOrAfter=\""
+ CommonUtils.formatForUtcTime(range.getEnd().toDate())
+ "\">"
- + "https://example.com/test-client/secure/"
+ + "https://example.com/test-client/secure/"
+ + ""
+ ""
- + "testPrincipalurn:oasis:names:tc:SAML:1.0:cm:artifacttestPrincipalurn:oasis:names:tc:SAML:1.0:cm:artifact12345"
+ + "testPrincipal"
+ + "urn:oasis:names:tc:SAML:1.0:cm:artifact"
+ + ""
+ + "testPrincipal"
+ + "urn:oasis:names:tc:SAML:1.0:cm:artifact"
+ + "12345"
+ ""
+ "ACTIVE"
+ ""
@@ -132,7 +139,13 @@ public void openSaml2GeneratedResponse() throws UnsupportedEncodingException {
server.content = response.getBytes(server.encoding);
try {
final Assertion a = this.validator.validate("test", "test");
+ assertEquals(
+ "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport",
+ a.getAttributes().get(Saml11TicketValidator.AUTH_METHOD_ATTRIBUTE));
assertEquals("testPrincipal", a.getPrincipal().getName());
+ assertEquals("12345", a.getPrincipal().getAttributes().get("uid"));
+ assertEquals("ACTIVE", a.getPrincipal().getAttributes().get("accountState"));
+ assertEquals(3, ((Collection) a.getPrincipal().getAttributes().get("eduPersonAffiliation")).size());
} catch (final TicketValidationException e) {
fail(e.toString());
}
From 618b8a5dabf136586d0bcc2778bee1f3d500a9ac Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 20 Feb 2015 10:26:01 -0500
Subject: [PATCH 138/239] Sensible XPath processing optimizations.
---
.../util/ThreadLocalXPathExpression.java | 87 +++++++++++++++++++
.../org/jasig/cas/client/util/XmlUtils.java | 62 -------------
.../validation/Saml11TicketValidator.java | 32 +++----
3 files changed, 104 insertions(+), 77 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
new file mode 100644
index 000000000..23d6ce14d
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
@@ -0,0 +1,87 @@
+package org.jasig.cas.client.util;
+
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.xpath.*;
+
+/**
+ * Thread local XPath expression.
+ *
+ * @author Marvin S. Addison
+ * @since 3.3
+ */
+public class ThreadLocalXPathExpression extends ThreadLocal implements XPathExpression {
+
+ /** XPath expression */
+ private String expression;
+
+ /** Namespace context. */
+ private NamespaceContext context;
+
+ /**
+ * Creates a new instance from an XPath expression and namespace context.
+ *
+ * @param xPath XPath expression.
+ * @param context Namespace context for handling namespace prefix to URI mappings.
+ */
+ public ThreadLocalXPathExpression(final String xPath, final NamespaceContext context) {
+ this.expression = xPath;
+ this.context = context;
+ }
+
+ public Object evaluate(final Object o, final QName qName) throws XPathExpressionException {
+ return get().evaluate(o, qName);
+ }
+
+ public String evaluate(final Object o) throws XPathExpressionException {
+ return get().evaluate(o);
+ }
+
+ public Object evaluate(final InputSource inputSource, final QName qName) throws XPathExpressionException {
+ return get().evaluate(inputSource, qName);
+ }
+
+ public String evaluate(final InputSource inputSource) throws XPathExpressionException {
+ return get().evaluate(inputSource);
+ }
+
+ /**
+ * Evaluates the XPath expression and returns the result coerced to a string.
+ *
+ * @param o Object on which to evaluate the expression; typically a DOM node.
+ *
+ * @return Evaluation result as a string.
+ *
+ * @throws XPathExpressionException On XPath evaluation errors.
+ */
+ public String evaluateAsString(final Object o) throws XPathExpressionException {
+ return (String) evaluate(o, XPathConstants.STRING);
+ }
+
+ /**
+ * Evaluates the XPath expression and returns the result coerced to a node list.
+ *
+ * @param o Object on which to evaluate the expression; typically a DOM node.
+ *
+ * @return Evaluation result as a node list.
+ *
+ * @throws XPathExpressionException On XPath evaluation errors.
+ */
+ public NodeList evaluateAsNodeList(final Object o) throws XPathExpressionException {
+ return (NodeList) evaluate(o, XPathConstants.NODESET);
+ }
+
+ @Override
+ protected XPathExpression initialValue() {
+ try {
+ final XPath xPath = XPathFactory.newInstance().newXPath();
+ xPath.setNamespaceContext(context);
+ return xPath.compile(expression);
+ } catch (XPathExpressionException e) {
+ throw new IllegalArgumentException("Invalid XPath expression");
+ }
+ }
+}
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
index 926ec912e..77831f495 100644
--- 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
@@ -24,7 +24,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -32,11 +31,9 @@
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
-import javax.xml.xpath.*;
/**
* Common utilities for easily parsing XML without duplicating logic.
@@ -80,65 +77,6 @@ public static Document newDocument(final String xml) {
}
}
-
- /**
- * Compiles the given XPath expression.
- *
- * @param expression XPath expression.
- * @param nsContext XML namespace context for resolving namespace prefixes in XPath expressions.
- *
- * @return Compiled XPath expression.
- */
- public static XPathExpression compileXPath(final String expression, final NamespaceContext nsContext) {
- try {
- final XPath xPath = XPathFactory.newInstance().newXPath();
- xPath.setNamespaceContext(nsContext);
- return xPath.compile(expression);
- } catch (XPathExpressionException e) {
- throw new IllegalArgumentException("Invalid XPath expression");
- }
- }
-
-
- /**
- * Evaluates the given XPath expression as a string result.
- *
- * @param expression XPath expression.
- * @param nsContext XML namespace context for resolving namespace prefixes in XPath expressions.
- * @param document DOM document on which to evaluate expression.
- *
- * @return Evaluated XPath expression as a string.
- */
- public static String evaluateXPathString(
- final String expression, final NamespaceContext nsContext, final Document document) {
- try {
- return (String) compileXPath(expression, nsContext).evaluate(document, XPathConstants.STRING);
- } catch (XPathExpressionException e) {
- throw new RuntimeException("XPath evaluation error", e);
- }
- }
-
-
-
- /**
- * Evaluates the given XPath expression as a node list result.
- *
- * @param expression XPath expression.
- * @param nsContext XML namespace context for resolving namespace prefixes in XPath expressions.
- * @param document DOM document on which to evaluate expression.
- *
- * @return Evaluated XPath expression as a node list.
- */
- public static NodeList evaluateXPathNodeList(
- final String expression, final NamespaceContext nsContext, final Document document) {
- try {
- return (NodeList) compileXPath(expression, nsContext).evaluate(document, XPathConstants.NODESET);
- } catch (XPathExpressionException e) {
- throw new RuntimeException("XPath evaluation error", e);
- }
- }
-
-
/**
* Get an instance of an XML reader from the XMLReaderFactory.
*
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 506d9a3ee..33cb00501 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -26,10 +26,7 @@
import java.security.SecureRandom;
import java.util.*;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
-import org.jasig.cas.client.util.CommonUtils;
-import org.jasig.cas.client.util.IOUtils;
-import org.jasig.cas.client.util.MapNamespaceContext;
-import org.jasig.cas.client.util.XmlUtils;
+import org.jasig.cas.client.util.*;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.Interval;
@@ -54,25 +51,30 @@ public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator
private static final String SAML_REQUEST_TEMPLATE;
/** SAML 1.1. namespace context. */
- private static final NamespaceContext SAML_NS_CONTEXT = new MapNamespaceContext(
+ private static final NamespaceContext NS_CONTEXT = new MapNamespaceContext(
"soap->http://schemas.xmlsoap.org/soap/envelope/",
"sa->urn:oasis:names:tc:SAML:1.0:assertion",
"sp->urn:oasis:names:tc:SAML:1.0:protocol");
/** XPath expression to extract Assertion validity start date. */
- private static final String XPATH_ASSERTION_DATE_START = "//sa:Assertion/sa:Conditions/@NotBefore";
+ private static final ThreadLocalXPathExpression XPATH_ASSERTION_DATE_START =
+ new ThreadLocalXPathExpression("//sa:Assertion/sa:Conditions/@NotBefore", NS_CONTEXT);
/** XPath expression to extract Assertion validity end date. */
- private static final String XPATH_ASSERTION_DATE_END = "//sa:Assertion/sa:Conditions/@NotOnOrAfter";
+ private static final ThreadLocalXPathExpression XPATH_ASSERTION_DATE_END =
+ new ThreadLocalXPathExpression("//sa:Assertion/sa:Conditions/@NotOnOrAfter", NS_CONTEXT);
/** XPath expression to extract NameIdentifier. */
- private static final String XPATH_NAME_ID = "//sa:AuthenticationStatement/sa:Subject/sa:NameIdentifier";
+ private static final ThreadLocalXPathExpression XPATH_NAME_ID =
+ new ThreadLocalXPathExpression("//sa:AuthenticationStatement/sa:Subject/sa:NameIdentifier", NS_CONTEXT);
/** XPath expression to extract authentication method. */
- private static final String XPATH_AUTH_METHOD = "//sa:AuthenticationStatement/@AuthenticationMethod";
+ private static final ThreadLocalXPathExpression XPATH_AUTH_METHOD =
+ new ThreadLocalXPathExpression("//sa:AuthenticationStatement/@AuthenticationMethod", NS_CONTEXT);
/** XPath expression to extract attributes. */
- private static final String XPATH_ATTRIBUTES = "//sa:AttributeStatement/sa:Attribute";
+ private static final ThreadLocalXPathExpression XPATH_ATTRIBUTES =
+ new ThreadLocalXPathExpression("//sa:AttributeStatement/sa:Attribute", NS_CONTEXT);
private static final String HEX_CHARS = "0123456789abcdef";
@@ -118,18 +120,18 @@ protected Assertion parseResponseFromServer(final String response) throws Ticket
try {
final Document document = XmlUtils.newDocument(response);
final Date assertionValidityStart = CommonUtils.parseUtcDate(
- XmlUtils.evaluateXPathString(XPATH_ASSERTION_DATE_START, SAML_NS_CONTEXT, document));
+ XPATH_ASSERTION_DATE_START.evaluateAsString(document));
final Date assertionValidityEnd = CommonUtils.parseUtcDate(
- XmlUtils.evaluateXPathString(XPATH_ASSERTION_DATE_END, SAML_NS_CONTEXT, document));
+ XPATH_ASSERTION_DATE_END.evaluateAsString(document));
if (!isValidAssertion(assertionValidityStart, assertionValidityEnd)) {
throw new TicketValidationException("Invalid SAML assertion");
}
- final String nameId = XmlUtils.evaluateXPathString(XPATH_NAME_ID, SAML_NS_CONTEXT, document);
+ final String nameId = XPATH_NAME_ID.evaluateAsString(document);
if (nameId == null) {
throw new TicketValidationException("SAML assertion does not contain NameIdentifier element");
}
- final String authMethod = XmlUtils.evaluateXPathString(XPATH_AUTH_METHOD, SAML_NS_CONTEXT, document);
- final NodeList attributes = XmlUtils.evaluateXPathNodeList(XPATH_ATTRIBUTES, SAML_NS_CONTEXT, document);
+ final String authMethod = XPATH_AUTH_METHOD.evaluateAsString(document);
+ final NodeList attributes = XPATH_ATTRIBUTES.evaluateAsNodeList(document);
final Map principalAttributes = new HashMap(attributes.getLength());
Element attribute;
NodeList values;
From b55a1a4eaff55291a58adf796d5f8b007660517d Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 20 Feb 2015 10:35:05 -0500
Subject: [PATCH 139/239] Fix @since version.
---
.../src/main/java/org/jasig/cas/client/util/IOUtils.java | 2 +-
.../java/org/jasig/cas/client/util/MapNamespaceContext.java | 2 +-
.../org/jasig/cas/client/util/ThreadLocalXPathExpression.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
index 722046514..e8dd77ea3 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
@@ -8,7 +8,7 @@
* IO utility class.
*
* @author Marvin S. Addison
- * @since 3.3.1
+ * @since 3.3.4
*/
public class IOUtils {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
index 0dd773c0f..f6c219944 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
@@ -10,7 +10,7 @@
* Namespace context implementation backed by a map of XML prefixes to namespace URIs.
*
* @author Marvin S. Addison
- * @since 3.3.1
+ * @since 3.3.4
*/
public class MapNamespaceContext implements NamespaceContext {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
index 23d6ce14d..86a4a0917 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
@@ -11,7 +11,7 @@
* Thread local XPath expression.
*
* @author Marvin S. Addison
- * @since 3.3
+ * @since 3.3.4
*/
public class ThreadLocalXPathExpression extends ThreadLocal implements XPathExpression {
From 8038e69fc09feaa8a2dd4d1780a7e9521b9ad8f4 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Tue, 14 Apr 2015 16:19:12 -0400
Subject: [PATCH 140/239] Move SAML components into separate module.
---
cas-client-core/pom.xml | 29 ++++++-----
cas-client-integration-atlassian/pom.xml | 5 ++
cas-client-integration-tomcat-v6/pom.xml | 8 +++
cas-client-integration-tomcat-v7/pom.xml | 8 +++
cas-client-support-saml/pom.xml | 38 ++++++++++++++
.../Saml11AuthenticationFilter.java | 0
.../Saml11TicketValidationFilter.java | 0
.../validation/Saml11TicketValidator.java | 0
.../Saml11TicketValidationFilterTests.java | 0
.../Saml11TicketValidatorTests.java | 2 +-
pom.xml | 52 +++++++++++++++++++
11 files changed, 129 insertions(+), 13 deletions(-)
create mode 100644 cas-client-support-saml/pom.xml
rename {cas-client-core => cas-client-support-saml}/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java (100%)
rename {cas-client-core => cas-client-support-saml}/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java (100%)
rename {cas-client-core => cas-client-support-saml}/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java (100%)
rename {cas-client-core => cas-client-support-saml}/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java (100%)
rename {cas-client-core => cas-client-support-saml}/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java (98%)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 795b67447..08a42b1c2 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -10,6 +10,23 @@
jarJasig CAS Client for Java - Core
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.6
+
+
+
+ test-jar
+
+
+
+
+
+
+
commons-lang
@@ -49,27 +66,18 @@
org.springframeworkspring-test
- ${spring.version}testorg.springframeworkspring-core
- ${spring.version}test
-
-
- commons-logging
- commons-logging
-
- org.springframeworkspring-context
- ${spring.version}test
@@ -95,7 +103,4 @@
-
- 3.1.3.RELEASE
-
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 96895e919..ce13bce4d 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -46,6 +46,11 @@
true
+
+ org.springframework
+ spring-context
+
+
atlassian-osusercom.atlassian.osuser
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 5d40ce408..37d0465b2 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -20,6 +20,14 @@
jarcompile
+
+ org.jasig.cas.client
+ cas-client-support-saml
+ ${project.version}
+ jar
+ compile
+ true
+ org.apache.tomcatcatalina
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 5bc817def..e1068bac6 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -20,6 +20,14 @@
jarcompile
+
+ org.jasig.cas.client
+ cas-client-support-saml
+ ${project.version}
+ jar
+ compile
+ true
+ org.apache.tomcattomcat-catalina
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
new file mode 100644
index 000000000..60c49f79d
--- /dev/null
+++ b/cas-client-support-saml/pom.xml
@@ -0,0 +1,38 @@
+
+
+ org.jasig.cas.client
+ 3.3.4-SNAPSHOT
+ cas-client
+
+ 4.0.0
+ org.jasig.cas.client
+ cas-client-support-saml
+ jar
+ Jasig CAS Client for Java - SAML Protocol Support
+
+
+
+ org.jasig.cas.client
+ cas-client-core
+ ${project.version}
+
+
+
+ org.jasig.cas.client
+ cas-client-core
+ ${project.version}
+ test-jar
+ test
+
+
+ org.springframework
+ spring-test
+ test
+
+
+ org.springframework
+ spring-core
+ test
+
+
+
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
similarity index 100%
rename from cas-client-core/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
rename to cas-client-support-saml/src/main/java/org/jasig/cas/client/authentication/Saml11AuthenticationFilter.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
similarity index 100%
rename from cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
rename to cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
similarity index 100%
rename from cas-client-core/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
rename to cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java b/cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
similarity index 100%
rename from cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
rename to cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidationFilterTests.java
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java b/cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
similarity index 98%
rename from cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
rename to cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
index c6482324c..773896640 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
+++ b/cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
@@ -46,7 +46,7 @@ public final class Saml11TicketValidatorTests extends AbstractTicketValidatorTes
@Before
public void setUp() throws Exception {
- this.validator = new Saml11TicketValidator(CONST_CAS_SERVER_URL_PREFIX + "9051");
+ this.validator = new Saml11TicketValidator(AbstractTicketValidatorTests.CONST_CAS_SERVER_URL_PREFIX + "9051");
this.validator.setTolerance(1000L);
}
diff --git a/pom.xml b/pom.xml
index 70befaee2..bac41cec6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,6 +159,56 @@
+
+
+
+ org.springframework
+ spring-core
+ ${spring.version}
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+
+ org.springframework
+ spring-context
+ ${spring.version}
+
+
+
+ org.springframework
+ spring-test
+ ${spring.version}
+ test
+
+
+
+ log4j
+ log4j
+ test
+ 1.2.15
+
+
+ jmxri
+ com.sun.jmx
+
+
+ com.sun.jdmk
+ jmxtools
+
+
+ javax.jms
+ jms
+
+
+
+
+
+
junit
@@ -198,12 +248,14 @@
cas-client-integration-jbosscas-client-support-distributed-ehcachecas-client-support-distributed-memcached
+ cas-client-support-samlcas-client-integration-tomcat-commoncas-client-integration-tomcat-v6cas-client-integration-tomcat-v7
+ 3.1.3.RELEASE2.2.03.0.21.7.1
From 2362d6ac179072ec0d1a040c7cdf7d3132931494 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 20 Apr 2015 10:34:28 -0400
Subject: [PATCH 141/239] Issue #100 Respond to code review feedback.
---
.../src/main/java/org/jasig/cas/client/util/IOUtils.java | 2 +-
.../org/jasig/cas/client/util/ThreadLocalXPathExpression.java | 4 ++--
.../jasig/cas/client/validation/Saml11TicketValidator.java | 1 -
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
index e8dd77ea3..f3c3107b6 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
@@ -10,7 +10,7 @@
* @author Marvin S. Addison
* @since 3.3.4
*/
-public class IOUtils {
+public final class IOUtils {
/** UTF-8 character set. */
public static final Charset UTF8 = Charset.forName("UTF-8");
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
index 86a4a0917..f1ed1f41d 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
@@ -16,10 +16,10 @@
public class ThreadLocalXPathExpression extends ThreadLocal implements XPathExpression {
/** XPath expression */
- private String expression;
+ private final String expression;
/** Namespace context. */
- private NamespaceContext context;
+ private final NamespaceContext context;
/**
* Creates a new instance from an XPath expression and namespace context.
diff --git a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 33cb00501..644654482 100644
--- a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -197,7 +197,6 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
conn = this.getURLConnectionFactory().buildHttpURLConnection(validationUrl.openConnection());
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml");
- conn.setRequestProperty("Content-Type", "text/xml");
conn.setRequestProperty("Content-Length", Integer.toString(request.length()));
conn.setRequestProperty("SOAPAction", "http://www.oasis-open.org/committees/security");
conn.setUseCaches(false);
From 2227376122dcf5a8468140250571edd24f951850 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 4 May 2015 16:07:47 -0400
Subject: [PATCH 142/239] Add Marvin to SAML validator component authorship.
---
.../cas/client/validation/Saml11TicketValidationFilter.java | 1 +
.../org/jasig/cas/client/validation/Saml11TicketValidator.java | 1 +
2 files changed, 2 insertions(+)
diff --git a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
index 78d37a327..2d2e18f2c 100644
--- a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
+++ b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidationFilter.java
@@ -32,6 +32,7 @@
* context or filter init parameters.
*
* @author Scott Battaglia
+ * @author Marvin S. Addison
* @version $Revision$ $Date$
* @since 3.1
*/
diff --git a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 644654482..f1e5f3abe 100644
--- a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -40,6 +40,7 @@
* TicketValidator that can understand validating a SAML artifact. This includes the SOAP request/response.
*
* @author Scott Battaglia
+ * @author Marvin S. Addison
* @since 3.1
*/
public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator {
From fc4a31448a45643208697ea68aad7e422f3289bc Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 4 May 2015 16:09:32 -0400
Subject: [PATCH 143/239] Issue 100 Restore configuration key for backward
compatibility.
---
.../org/jasig/cas/client/configuration/ConfigurationKeys.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
index b9838cb1f..9418151d1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
@@ -54,6 +54,7 @@ public interface ConfigurationKeys {
ConfigurationKey CAS_SERVER_URL_PREFIX = new ConfigurationKey("casServerUrlPrefix", null);
ConfigurationKey ENCODING = new ConfigurationKey("encoding", null);
ConfigurationKey TOLERANCE = new ConfigurationKey("tolerance", 1000L);
+ ConfigurationKey DISABLE_XML_SCHEMA_VALIDATION = new ConfigurationKey("disableXmlSchemaValidation", Boolean.FALSE);
ConfigurationKey IGNORE_PATTERN = new ConfigurationKey("ignorePattern", null);
ConfigurationKey IGNORE_URL_PATTERN_TYPE = new ConfigurationKey("ignoreUrlPatternType", "REGEX");
ConfigurationKey> HOSTNAME_VERIFIER = new ConfigurationKey>("hostnameVerifier", null);
From 333ab96ba336d0052f115805810498886ac197aa Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 11 May 2015 12:01:48 -0400
Subject: [PATCH 144/239] Issue #100 Isolate JodaTime to SAML module.
---
cas-client-core/pom.xml | 6 ---
.../jasig/cas/client/util/CommonUtils.java | 22 --------
.../cas/client/util/CommonUtilsTests.java | 6 ---
cas-client-support-saml/pom.xml | 6 +++
.../org/jasig/cas/client/util/SamlUtils.java | 53 +++++++++++++++++++
.../validation/Saml11TicketValidator.java | 6 +--
.../jasig/cas/client/util/SamlUtilsTest.java | 40 ++++++++++++++
.../Saml11TicketValidatorTests.java | 20 +++----
8 files changed, 112 insertions(+), 47 deletions(-)
create mode 100644 cas-client-support-saml/src/main/java/org/jasig/cas/client/util/SamlUtils.java
create mode 100644 cas-client-support-saml/src/test/java/org/jasig/cas/client/util/SamlUtilsTest.java
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 08a42b1c2..f82ac35ac 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -34,12 +34,6 @@
2.6
-
- joda-time
- joda-time
- 2.7
-
-
xml-securityxmlsec
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index e7cc375b1..95eff5150 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -22,9 +22,6 @@
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -33,11 +30,6 @@
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
import org.jasig.cas.client.validation.ProxyList;
import org.jasig.cas.client.validation.ProxyListEditor;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.LocalDateTime;
-import org.joda.time.format.DateTimeFormatter;
-import org.joda.time.format.ISODateTimeFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,24 +56,10 @@ public final class CommonUtils {
private static final HttpURLConnectionFactory DEFAULT_URL_CONNECTION_FACTORY = new HttpsURLConnectionFactory();
- private static final DateTimeFormatter ISO_FORMAT = ISODateTimeFormat.dateTimeNoMillis();
-
private CommonUtils() {
// nothing to do
}
- public static String formatForUtcTime(final Date date) {
- return ISO_FORMAT.print(new DateTime(date).withZone(DateTimeZone.UTC));
- }
-
-
- public static Date parseUtcDate(final String date) {
- if (isEmpty(date)) {
- return null;
- }
- return ISODateTimeFormat.dateTimeParser().parseDateTime(date).toDate();
- }
-
/**
* Check whether the object is null or not. If it is, throw an exception and
* display the message.
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index 479a3f33d..1b28ad5ad 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -21,7 +21,6 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
import junit.framework.TestCase;
import org.jasig.cas.client.PublicTestHttpServer;
@@ -194,9 +193,4 @@ public void testGetResponseFromServer() throws Exception {
public void testUrlEncode() {
assertEquals("this+is+a+very+special+parameter+with+%3D%25%2F", CommonUtils.urlEncode("this is a very special parameter with =%/"));
}
-
- public void testParseUtcDate() {
- final Date expected = new Date(1424437961025L);
- assertEquals(expected, CommonUtils.parseUtcDate("2015-02-20T08:12:41.025-0500"));
- }
}
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index 60c49f79d..b63ae11e7 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -16,7 +16,13 @@
cas-client-core${project.version}
+
+ joda-time
+ joda-time
+ 2.7
+
+
org.jasig.cas.clientcas-client-core
diff --git a/cas-client-support-saml/src/main/java/org/jasig/cas/client/util/SamlUtils.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/util/SamlUtils.java
new file mode 100644
index 000000000..8e74a71fa
--- /dev/null
+++ b/cas-client-support-saml/src/main/java/org/jasig/cas/client/util/SamlUtils.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.cas.client.util;
+
+import java.util.Date;
+
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.format.DateTimeFormatter;
+import org.joda.time.format.ISODateTimeFormat;
+
+/**
+ * SAML utility class.
+ *
+ * @author Marvin S. Addison
+ * @since 3.4
+ */
+public final class SamlUtils {
+
+ private static final DateTimeFormatter ISO_FORMAT = ISODateTimeFormat.dateTimeNoMillis();
+
+ private SamlUtils() {
+ // nothing to do
+ }
+
+ public static String formatForUtcTime(final Date date) {
+ return ISO_FORMAT.print(new DateTime(date).withZone(DateTimeZone.UTC));
+ }
+
+ public static Date parseUtcDate(final String date) {
+ if (CommonUtils.isEmpty(date)) {
+ return null;
+ }
+ return ISODateTimeFormat.dateTimeParser().parseDateTime(date).toDate();
+ }
+}
diff --git a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index f1e5f3abe..4a5908198 100644
--- a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -120,9 +120,9 @@ protected void populateUrlAttributeMap(final Map urlParameters)
protected Assertion parseResponseFromServer(final String response) throws TicketValidationException {
try {
final Document document = XmlUtils.newDocument(response);
- final Date assertionValidityStart = CommonUtils.parseUtcDate(
+ final Date assertionValidityStart = SamlUtils.parseUtcDate(
XPATH_ASSERTION_DATE_START.evaluateAsString(document));
- final Date assertionValidityEnd = CommonUtils.parseUtcDate(
+ final Date assertionValidityEnd = SamlUtils.parseUtcDate(
XPATH_ASSERTION_DATE_END.evaluateAsString(document));
if (!isValidAssertion(assertionValidityStart, assertionValidityEnd)) {
throw new TicketValidationException("Invalid SAML assertion");
@@ -191,7 +191,7 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
final String request = String.format(
SAML_REQUEST_TEMPLATE,
generateId(),
- CommonUtils.formatForUtcTime(new Date()),
+ SamlUtils.formatForUtcTime(new Date()),
ticket);
HttpURLConnection conn = null;
try {
diff --git a/cas-client-support-saml/src/test/java/org/jasig/cas/client/util/SamlUtilsTest.java b/cas-client-support-saml/src/test/java/org/jasig/cas/client/util/SamlUtilsTest.java
new file mode 100644
index 000000000..bd42201e7
--- /dev/null
+++ b/cas-client-support-saml/src/test/java/org/jasig/cas/client/util/SamlUtilsTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.cas.client.util;
+
+import java.util.Date;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Test cases for {@link SamlUtils}.
+ *
+ * @author Marvin S. Addison
+ */
+public class SamlUtilsTest {
+
+ @Test
+ public void testParseUtcDate() {
+ final Date expected = new Date(1424437961025L);
+ assertEquals(expected, SamlUtils.parseUtcDate("2015-02-20T08:12:41.025-0500"));
+ }
+}
\ No newline at end of file
diff --git a/cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java b/cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
index 773896640..8d9080023 100644
--- a/cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
+++ b/cas-client-support-saml/src/test/java/org/jasig/cas/client/validation/Saml11TicketValidatorTests.java
@@ -24,7 +24,7 @@
import java.util.Collection;
import java.util.Date;
import org.jasig.cas.client.PublicTestHttpServer;
-import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.SamlUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.Interval;
@@ -83,13 +83,13 @@ public void testCompatibilityValidationSuccessWithNoAttributes() throws Unsuppor
final Interval range = currentTimeRangeInterval();
final Date now = new Date();
final String RESPONSE = "testtestPrincipalurn:oasis:names:tc:SAML:1.0:cm:artifact";
server.content = RESPONSE.getBytes(server.encoding);
try {
@@ -107,21 +107,21 @@ public void openSaml2GeneratedResponse() throws UnsupportedEncodingException {
final String response = ""
+ ""
+ ""
+ ""
+ ""
+ "https://example.com/test-client/secure/"
+ ""
+ ""
+ "testPrincipal"
+ "urn:oasis:names:tc:SAML:1.0:cm:artifact"
From d0cb1441713014897ed7c2a52b4e3b7f46c49ce6 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 11 May 2015 12:09:00 -0400
Subject: [PATCH 145/239] Issue #100 Bump minor version due to refactoring.
---
cas-client-core/pom.xml | 2 +-
.../src/main/java/org/jasig/cas/client/util/IOUtils.java | 2 +-
.../java/org/jasig/cas/client/util/MapNamespaceContext.java | 2 +-
.../org/jasig/cas/client/util/ThreadLocalXPathExpression.java | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
cas-client-support-saml/pom.xml | 2 +-
pom.xml | 2 +-
13 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index f82ac35ac..e8d0a31b0 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
index f3c3107b6..b003775c4 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
@@ -8,7 +8,7 @@
* IO utility class.
*
* @author Marvin S. Addison
- * @since 3.3.4
+ * @since 3.4
*/
public final class IOUtils {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
index f6c219944..6eb5b628e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
@@ -10,7 +10,7 @@
* Namespace context implementation backed by a map of XML prefixes to namespace URIs.
*
* @author Marvin S. Addison
- * @since 3.3.4
+ * @since 3.4
*/
public class MapNamespaceContext implements NamespaceContext {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
index f1ed1f41d..2e51c0c90 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
@@ -11,7 +11,7 @@
* Thread local XPath expression.
*
* @author Marvin S. Addison
- * @since 3.3.4
+ * @since 3.4
*/
public class ThreadLocalXPathExpression extends ThreadLocal implements XPathExpression {
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index ce13bce4d..009a58d06 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 5a118eab1..43c24da56 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 06a1c3386..13c23179c 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 37d0465b2..d7dd9bd4e 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index e1068bac6..0c83322c2 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 1e1f71241..c4bcde0c5 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 52a86404a..3a1cb2ad1 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOT4.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index b63ae11e7..6c68d4387 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOTcas-client4.0.0
diff --git a/pom.xml b/pom.xml
index bac41cec6..e17ab1036 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.3.4-SNAPSHOT
+ 3.4.0-SNAPSHOTcas-clientpom
From be2a64147320aacc6262b5fd181bea46e02618cd Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 13 May 2015 03:44:13 -0700
Subject: [PATCH 146/239] added uri builder to construct query params
---
.../cas/client/util/AbstractCasFilter.java | 1 +
.../jasig/cas/client/util/CommonUtils.java | 78 +--
.../org/jasig/cas/client/util/URIBuilder.java | 604 ++++++++++++++++++
.../cas/client/util/CommonUtilsTests.java | 94 ++-
.../client/tomcat/AuthenticatorDelegate.java | 2 +-
5 files changed, 730 insertions(+), 49 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
index 6e0df5fc5..9b48296f1 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/AbstractCasFilter.java
@@ -102,6 +102,7 @@ public void destroy() {
protected final String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response) {
return CommonUtils.constructServiceUrl(request, response, this.service, this.serverName,
+ this.protocol.getServiceParameterName(),
this.protocol.getArtifactParameterName(), this.encodeServiceUrl);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 95eff5150..92bec84ba 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -20,6 +20,7 @@
import java.io.*;
import java.net.HttpURLConnection;
+import java.net.URI;
import java.net.URL;
import java.net.URLEncoder;
import java.util.*;
@@ -259,70 +260,59 @@ private static boolean requestIsOnStandardPort(final HttpServletRequest request)
}
/**
- * 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
- * @param service the configured service url (this will be used if not null)
- * @param serverNames the server name to use to constuct the service url if the service param is empty. Note, prior to CAS Client 3.3, this was a single value.
- * As of 3.3, it can be a space-separated value. We keep it as a single value, but will convert it to an array internally to get the matching value. This keeps backward compatability with anything using this public
- * method.
- * @param artifactParameterName the artifact parameter name to remove (i.e. ticket)
- * @param encode whether to encode the url or not (i.e. Jsession).
- * @return the service url to use.
- */
+ * 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
+ * @param service the configured service url (this will be used if not null)
+ * @param serverNames the server name to use to constuct the service url if the service param is empty. Note, prior to CAS Client 3.3, this was a single value.
+ * As of 3.3, it can be a space-separated value. We keep it as a single value, but will convert it to an array internally to get the matching value. This keeps backward compatability with anything using this public
+ * method.
+ * @param serviceParameterName the service parameter name to remove (i.e. service)
+ * @param artifactParameterName the artifact parameter name to remove (i.e. ticket)
+ * @param encode whether to encode the url or not (i.e. Jsession).
+ * @return the service url to use.
+ */
public static String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response,
- final String service, final String serverNames, final String artifactParameterName, final boolean encode) {
+ final String service, final String serverNames, final String serviceParameterName,
+ final String artifactParameterName, final boolean encode) {
if (CommonUtils.isNotBlank(service)) {
return encode ? response.encodeURL(service) : service;
}
- final StringBuilder buffer = new StringBuilder();
-
final String serverName = findMatchingServerName(request, serverNames);
+ final URIBuilder originalRequestUrl = new URIBuilder(request.getRequestURL().toString(), encode);
+ originalRequestUrl.setParameters(request.getQueryString());
+
+ URIBuilder builder = null;
boolean containsScheme = true;
if (!serverName.startsWith("https://") && !serverName.startsWith("http://")) {
- buffer.append(request.isSecure() ? "https://" : "http://");
+ builder = new URIBuilder(encode);
+ builder.setScheme(request.isSecure() ? "https" : "http");
+ builder.setHost(serverName);
containsScheme = false;
+ } else {
+ builder = new URIBuilder(serverName, encode);
}
- buffer.append(serverName);
if (!serverNameContainsPort(containsScheme, serverName) && !requestIsOnStandardPort(request)) {
- buffer.append(":");
- buffer.append(request.getServerPort());
+ builder.setPort(request.getServerPort());
}
- buffer.append(request.getRequestURI());
-
- if (CommonUtils.isNotBlank(request.getQueryString())) {
- final int location = request.getQueryString().indexOf(artifactParameterName + "=");
-
- if (location == 0) {
- final String returnValue = encode ? response.encodeURL(buffer.toString()) : buffer.toString();
- LOGGER.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 + "=");
+ builder.setEncodedPath(request.getRequestURI());
- if (actualLocation == -1) {
- buffer.append(request.getQueryString());
- } else if (actualLocation > 0) {
- buffer.append(request.getQueryString().substring(0, actualLocation));
- }
+ for (final URIBuilder.BasicNameValuePair pair : originalRequestUrl.getQueryParams()) {
+ if (!pair.getName().equals(artifactParameterName) && !pair.getName().equals(serviceParameterName)) {
+ builder.addParameter(pair.getName(), pair.getValue());
}
}
- final String returnValue = encode ? response.encodeURL(buffer.toString()) : buffer.toString();
+ final String result = builder.toString();
+ final String returnValue = encode ? response.encodeURL(result) : result;
LOGGER.debug("serviceUrl generated: {}", returnValue);
return returnValue;
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
new file mode 100644
index 000000000..5cad25701
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
@@ -0,0 +1,604 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * A utility class borrowed from apache http-client to build uris.
+ * @author Misagh Moayyed
+ * @since 3.4
+ */
+public final class URIBuilder {
+ private static final Logger LOGGER = LoggerFactory.getLogger(URIBuilder.class);
+ private static final Pattern IPV6_STD_PATTERN = Pattern.compile("^[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){7}$");
+
+ private String scheme;
+ private String encodedSchemeSpecificPart;
+ private String encodedAuthority;
+ private String userInfo;
+ private String encodedUserInfo;
+ private String host;
+ private int port;
+ private String path;
+ private String encodedPath;
+ private String encodedQuery;
+ private List queryParams;
+ private String query;
+ private boolean encode;
+ private String fragment;
+ private String encodedFragment;
+
+ /**
+ * Constructs an empty instance.
+ */
+ public URIBuilder() {
+ super();
+ this.port = -1;
+ }
+
+ public URIBuilder(final boolean encode) {
+ this();
+ setEncode(encode);
+ }
+
+ /**
+ * Construct an instance from the string which must be a valid URI.
+ *
+ * @param string a valid URI in string form
+ * @throws URISyntaxException if the input is not a valid URI
+ */
+ public URIBuilder(final String string) {
+ super();
+ try {
+ digestURI(new URI(string));
+ } catch (final URISyntaxException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public URIBuilder(final String string, boolean encode) {
+ super();
+ try {
+ setEncode(encode);
+ digestURI(new URI(string));
+ } catch (final URISyntaxException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+
+ /**
+ * Construct an instance from the provided URI.
+ * @param uri
+ */
+ public URIBuilder(final URI uri) {
+ super();
+ digestURI(uri);
+ }
+
+ private List parseQuery(final String query) {
+
+ try {
+ final Charset utf8 = Charset.forName("UTF-8");
+ if (query != null && !query.isEmpty()) {
+ final List list = new ArrayList();
+ final String queryValue = URLDecoder.decode(query, utf8.name());
+ final String[] parametersArray = queryValue.split("&");
+
+ for (final String parameter : parametersArray) {
+ final String[] parameterCombo = parameter.split("=");
+ if (parameterCombo.length == 2) {
+ list.add(new BasicNameValuePair(parameterCombo[0], parameterCombo[1]));
+ }
+ }
+ return list;
+ }
+ } catch (final UnsupportedEncodingException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * Builds a {@link URI} instance.
+ */
+ public URI build() {
+ try {
+ return new URI(buildString());
+ } catch (final URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static boolean isIPv6Address(final String input) {
+ return IPV6_STD_PATTERN.matcher(input).matches();
+ }
+
+ private String buildString() {
+ final StringBuilder sb = new StringBuilder();
+ if (this.scheme != null) {
+ sb.append(this.scheme).append(':');
+ }
+ if (this.encodedSchemeSpecificPart != null) {
+ sb.append(this.encodedSchemeSpecificPart);
+ } else {
+ if (this.encodedAuthority != null) {
+ sb.append("//").append(this.encodedAuthority);
+ } else if (this.host != null) {
+ sb.append("//");
+ if (this.encodedUserInfo != null) {
+ sb.append(this.encodedUserInfo).append("@");
+ } else if (this.userInfo != null) {
+ sb.append(encodeUserInfo(this.userInfo)).append("@");
+ }
+ if (isIPv6Address(this.host)) {
+ sb.append("[").append(this.host).append("]");
+ } else {
+ sb.append(this.host);
+ }
+ if (this.port >= 0) {
+ sb.append(":").append(this.port);
+ }
+ }
+ if (this.encodedPath != null) {
+ sb.append(normalizePath(this.encodedPath));
+ } else if (this.path != null) {
+ sb.append(encodePath(normalizePath(this.path)));
+ }
+ if (this.encodedQuery != null) {
+ sb.append("?").append(this.encodedQuery);
+ } else if (this.queryParams != null && !this.queryParams.isEmpty()) {
+ sb.append("?").append(encodeUrlForm(this.queryParams));
+ } else if (this.query != null) {
+ sb.append("?").append(encodeUric(this.query));
+ }
+ }
+ if (this.encodedFragment != null) {
+ sb.append("#").append(this.encodedFragment);
+ } else if (this.fragment != null) {
+ sb.append("#").append(encodeUric(this.fragment));
+ }
+ return sb.toString();
+ }
+
+ public URIBuilder digestURI(final URI uri) {
+ this.scheme = uri.getScheme();
+ this.encodedSchemeSpecificPart = uri.getRawSchemeSpecificPart();
+ this.encodedAuthority = uri.getRawAuthority();
+ this.host = uri.getHost();
+ this.port = uri.getPort();
+ this.encodedUserInfo = uri.getRawUserInfo();
+ this.userInfo = uri.getUserInfo();
+ this.encodedPath = uri.getRawPath();
+ this.path = uri.getPath();
+ this.encodedQuery = uri.getRawQuery();
+ this.queryParams = parseQuery(uri.getRawQuery());
+ this.encodedFragment = uri.getRawFragment();
+ this.fragment = uri.getFragment();
+ return this;
+ }
+
+ private String encodeUserInfo(final String userInfo) {
+ return this.encode ? CommonUtils.urlEncode(userInfo) : userInfo;
+ }
+
+ private String encodePath(final String path) {
+ return this.encode ? CommonUtils.urlEncode(path) : path;
+ }
+
+ private String encodeUrlForm(final List params) {
+ final StringBuilder result = new StringBuilder();
+ for (final BasicNameValuePair parameter : params) {
+ final String encodedName = this.encode ? CommonUtils.urlEncode(parameter.getName()) : parameter.getName();
+ final String encodedValue = this.encode ? CommonUtils.urlEncode(parameter.getValue()) : parameter.getValue();
+
+ if (result.length() > 0) {
+ result.append("&");
+ }
+ result.append(encodedName);
+ if (encodedValue != null) {
+ result.append("=");
+ result.append(encodedValue);
+ }
+ }
+ return result.toString();
+ }
+
+ private String encodeUric(final String fragment) {
+ return this.encode ? CommonUtils.urlEncode(fragment) : fragment;
+ }
+
+ public void setEncode(boolean encode) {
+ this.encode = encode;
+ }
+
+ /**
+ * Sets URI scheme.
+ */
+ public URIBuilder setScheme(final String scheme) {
+ this.scheme = scheme;
+ return this;
+ }
+
+ /**
+ * Sets URI user info. The value is expected to be unescaped and may contain non ASCII
+ * characters.
+ */
+ public URIBuilder setUserInfo(final String userInfo) {
+ this.userInfo = userInfo;
+ this.encodedSchemeSpecificPart = null;
+ this.encodedAuthority = null;
+ this.encodedUserInfo = null;
+ return this;
+ }
+
+ /**
+ * Sets URI user info as a combination of username and password. These values are expected to
+ * be unescaped and may contain non ASCII characters.
+ */
+ public URIBuilder setUserInfo(final String username, final String password) {
+ return setUserInfo(username + ':' + password);
+ }
+
+ /**
+ * Sets URI host.
+ */
+ public URIBuilder setHost(final String host) {
+ this.host = host;
+ this.encodedSchemeSpecificPart = null;
+ this.encodedAuthority = null;
+ return this;
+ }
+
+ /**
+ * Sets URI port.
+ */
+ public URIBuilder setPort(final int port) {
+ this.port = port < 0 ? -1 : port;
+ this.encodedSchemeSpecificPart = null;
+ this.encodedAuthority = null;
+ return this;
+ }
+
+ /**
+ * Sets URI path. The value is expected to be unescaped and may contain non ASCII characters.
+ */
+ public URIBuilder setPath(final String path) {
+ this.path = path;
+ this.encodedSchemeSpecificPart = null;
+ this.encodedPath = null;
+ return this;
+ }
+
+ public URIBuilder setEncodedPath(final String path) {
+ this.encodedPath = path;
+ this.encodedSchemeSpecificPart = null;
+ return this;
+ }
+
+ /**
+ * Removes URI query.
+ */
+ public URIBuilder removeQuery() {
+ this.queryParams = null;
+ this.query = null;
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ return this;
+ }
+
+ /**
+ * Sets URI query parameters. The parameter name / values are expected to be unescaped
+ * and may contain non ASCII characters.
+ *
+ * Please note query parameters and custom query component are mutually exclusive. This method
+ * will remove custom query if present.
+ *
+ */
+ public URIBuilder setParameters(final List nvps) {
+ this.queryParams = new ArrayList();
+ this.queryParams.addAll(nvps);
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ this.query = null;
+ return this;
+ }
+
+ public URIBuilder setParameters(final String queryParameters) {
+ this.queryParams = new ArrayList();
+ this.queryParams.addAll(parseQuery(queryParameters));
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ this.query = null;
+ return this;
+ }
+
+
+
+ /**
+ * Adds URI query parameters. The parameter name / values are expected to be unescaped
+ * and may contain non ASCII characters.
+ *
+ * Please note query parameters and custom query component are mutually exclusive. This method
+ * will remove custom query if present.
+ *
+ */
+ public URIBuilder addParameters(final List nvps) {
+ if (this.queryParams == null) {
+ this.queryParams = new ArrayList();
+ }
+ this.queryParams.addAll(nvps);
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ this.query = null;
+ return this;
+ }
+
+ /**
+ * Sets URI query parameters. The parameter name / values are expected to be unescaped
+ * and may contain non ASCII characters.
+ *
+ * Please note query parameters and custom query component are mutually exclusive. This method
+ * will remove custom query if present.
+ *
+ */
+ public URIBuilder setParameters(final BasicNameValuePair... nvps) {
+ if (this.queryParams == null) {
+ this.queryParams = new ArrayList();
+ } else {
+ this.queryParams.clear();
+ }
+ for (final BasicNameValuePair nvp: nvps) {
+ this.queryParams.add(nvp);
+ }
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ this.query = null;
+ return this;
+ }
+
+ /**
+ * Adds parameter to URI query. The parameter name and value are expected to be unescaped
+ * and may contain non ASCII characters.
+ *
+ * Please note query parameters and custom query component are mutually exclusive. This method
+ * will remove custom query if present.
+ *
+ */
+ public URIBuilder addParameter(final String param, final String value) {
+ if (this.queryParams == null) {
+ this.queryParams = new ArrayList();
+ }
+ this.queryParams.add(new BasicNameValuePair(param, value));
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ this.query = null;
+ return this;
+ }
+
+ /**
+ * Sets parameter of URI query overriding existing value if set. The parameter name and value
+ * are expected to be unescaped and may contain non ASCII characters.
+ *
+ * Please note query parameters and custom query component are mutually exclusive. This method
+ * will remove custom query if present.
+ *
+ */
+ public URIBuilder setParameter(final String param, final String value) {
+ if (this.queryParams == null) {
+ this.queryParams = new ArrayList();
+ }
+ if (!this.queryParams.isEmpty()) {
+ for (final Iterator it = this.queryParams.iterator(); it.hasNext(); ) {
+ final BasicNameValuePair nvp = it.next();
+ if (nvp.getName().equals(param)) {
+ it.remove();
+ }
+ }
+ }
+ this.queryParams.add(new BasicNameValuePair(param, value));
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ this.query = null;
+ return this;
+ }
+
+ /**
+ * Clears URI query parameters.
+ */
+ public URIBuilder clearParameters() {
+ this.queryParams = null;
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ return this;
+ }
+
+ /**
+ * Sets custom URI query. The value is expected to be unescaped and may contain non ASCII
+ * characters.
+ *
+ * Please note query parameters and custom query component are mutually exclusive. This method
+ * will remove query parameters if present.
+ *
+ */
+ public URIBuilder setCustomQuery(final String query) {
+ this.query = query;
+ this.encodedQuery = null;
+ this.encodedSchemeSpecificPart = null;
+ this.queryParams = null;
+ return this;
+ }
+
+ /**
+ * Sets URI fragment. The value is expected to be unescaped and may contain non ASCII
+ * characters.
+ */
+ public URIBuilder setFragment(final String fragment) {
+ this.fragment = fragment;
+ this.encodedFragment = null;
+ return this;
+ }
+
+ public boolean isAbsolute() {
+ return this.scheme != null;
+ }
+
+ public boolean isOpaque() {
+ return this.path == null;
+ }
+
+ public String getScheme() {
+ return this.scheme;
+ }
+
+ public String getUserInfo() {
+ return this.userInfo;
+ }
+
+ public String getHost() {
+ return this.host;
+ }
+
+ public int getPort() {
+ return this.port;
+ }
+
+ public String getPath() {
+ return this.path;
+ }
+
+ public List getQueryParams() {
+ if (this.queryParams != null) {
+ return new ArrayList(this.queryParams);
+ }
+ return new ArrayList();
+
+ }
+
+ public String getFragment() {
+ return this.fragment;
+ }
+
+ @Override
+ public String toString() {
+ return buildString();
+ }
+
+ private static String normalizePath(final String path) {
+ String s = path;
+ if (s == null) {
+ return null;
+ }
+ int n = 0;
+ for (; n < s.length(); n++) {
+ if (s.charAt(n) != '/') {
+ break;
+ }
+ }
+ if (n > 1) {
+ s = s.substring(n - 1);
+ }
+ return s;
+ }
+
+ public static class BasicNameValuePair implements Cloneable, Serializable {
+ private static final long serialVersionUID = -6437800749411518984L;
+
+ private final String name;
+ private final String value;
+
+ /**
+ * Default Constructor taking a name and a value. The value may be null.
+ *
+ * @param name The name.
+ * @param value The value.
+ */
+ public BasicNameValuePair(final String name, final String value) {
+ super();
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ @Override
+ public String toString() {
+ // don't call complex default formatting for a simple toString
+
+ if (this.value == null) {
+ return name;
+ }
+ final int len = this.name.length() + 1 + this.value.length();
+ final StringBuilder buffer = new StringBuilder(len);
+ buffer.append(this.name);
+ buffer.append("=");
+ buffer.append(this.value);
+ return buffer.toString();
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ if (this == object) {
+ return true;
+ }
+
+ if (object == null) {
+ return false;
+ }
+
+ if (object instanceof BasicNameValuePair) {
+ final BasicNameValuePair that = (BasicNameValuePair) object;
+ return this.name.equals(that.name)
+ && this.value.equals(that.value);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 133 * this.name.hashCode() * this.value.hashCode();
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ }
+}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index 1b28ad5ad..aaac4e62d 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -23,6 +23,7 @@
import java.util.Collection;
import junit.framework.TestCase;
+import org.jasig.cas.client.Protocol;
import org.jasig.cas.client.PublicTestHttpServer;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -132,11 +133,96 @@ public void testConstructServiceUrlWithTrailingSlash() {
request.setSecure(true);
final MockHttpServletResponse response = new MockHttpServletResponse();
final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com",
- "ticket", false);
+ "service", "ticket", false);
assertEquals(CONST_MY_URL, constructedUrl);
}
+ public void testConstructServiceUrlWithParamsCas() {
+ final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setQueryString("service=this&ticket=that&custom=custom");
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com",
+ Protocol.CAS3.getServiceParameterName(), Protocol.CAS3.getArtifactParameterName() , false);
+
+ assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl);
+ }
+
+
+ public void testConstructServiceUrlWithParamsSaml() {
+ final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setQueryString("TARGET=this&SAMLart=that&custom=custom");
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com",
+ Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName() , false);
+
+ assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl);
+ }
+
+ public void testConstructServiceUrlWithEncodedParamsSaml() {
+ final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setQueryString("TARGET%3Dthis%26SAMLart%3Dthat%26custom%3Dcustom");
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com",
+ Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName() , false);
+
+ assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl);
+ }
+
+ public void testConstructServiceUrlWithEncodedParams2Saml() {
+ final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setQueryString("TARGET%3Dthis%26SAMLart%3Dthat%26custom%3Dcustom%20value%20here%26another%3Dgood");
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com",
+ Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName() , true);
+
+ assertEquals("https://www.myserver.com/hello/hithere/?custom=custom+value+here&another=good", constructedUrl);
+ }
+
+ public void testConstructServiceUrlWithoutEncodedParamsSamlAndNoEncoding() {
+ final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setQueryString("TARGET=this&SAMLart=that&custom=custom value here&another=good");
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com",
+ Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName() , false);
+
+ assertEquals("https://www.myserver.com/hello/hithere/?custom=custom value here&another=good", constructedUrl);
+ }
+
+ public void testConstructServiceUrlWithEncodedParamsSamlAndNoEncoding() {
+ final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setQueryString("TARGET=this&SAMLart=that&custom=custom+value+here&another=good");
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com",
+ Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName() , true);
+
+ assertEquals("https://www.myserver.com/hello/hithere/?custom=custom+value+here&another=good", constructedUrl);
+ }
+
private void constructUrlNonStandardPortAndNoPortInConfigTest(final String serverNameList) {
final String CONST_MY_URL = "https://www.myserver.com:555/hello/hithere/";
final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
@@ -146,7 +232,7 @@ private void constructUrlNonStandardPortAndNoPortInConfigTest(final String serve
request.setServerPort(555);
final MockHttpServletResponse response = new MockHttpServletResponse();
final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null,
- serverNameList, "ticket", false);
+ serverNameList, "service", "ticket", false);
assertEquals(CONST_MY_URL, constructedUrl);
}
@@ -166,7 +252,7 @@ public void testConstructUrlWithMultipleHostsNoPortsOrProtocol() {
request.setSecure(true);
final MockHttpServletResponse response = new MockHttpServletResponse();
final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null,
- "www.amazon.com www.bestbuy.com www.myserver.com", "ticket", false);
+ "www.amazon.com www.bestbuy.com www.myserver.com", "service", "ticket", false);
assertEquals(CONST_MY_URL, constructedUrl);
}
@@ -178,7 +264,7 @@ public void testConstructURlWithMultipleHostsAndPorts() {
request.setSecure(true);
final MockHttpServletResponse response = new MockHttpServletResponse();
final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null,
- "http://www.amazon.com https://www.bestbuy.com https://www.myserver.com", "ticket", false);
+ "http://www.amazon.com https://www.bestbuy.com https://www.myserver.com", "service", "ticket", false);
assertEquals(CONST_MY_URL, constructedUrl);
}
diff --git a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
index 3f92d32e5..9fae1a685 100644
--- a/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
+++ b/cas-client-integration-tomcat-common/src/main/java/org/jasig/cas/client/tomcat/AuthenticatorDelegate.java
@@ -86,7 +86,7 @@ public final Principal authenticate(final HttpServletRequest request, final Http
logger.debug("CAS assertion not found in session -- authentication required.");
final String token = request.getParameter(this.artifactParameterName);
final String service = CommonUtils.constructServiceUrl(request, response, this.serviceUrl, this.serverName,
- this.artifactParameterName, true);
+ this.serviceParameterName, this.artifactParameterName, true);
if (CommonUtils.isBlank(token)) {
final String redirectUrl = CommonUtils.constructRedirectUrl(this.casServerLoginUrl,
this.serviceParameterName, service, false, false);
From 73522833c424df291bcce671a17f1d3bf493c63d Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 02:45:28 +0400
Subject: [PATCH 147/239] Delete README.txt
---
README.txt | 6 ------
1 file changed, 6 deletions(-)
delete mode 100644 README.txt
diff --git a/README.txt b/README.txt
deleted file mode 100644
index 97a80ee2e..000000000
--- a/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-BUILDING THE CAS CLIENT FOR JAVA
-
-Please note that to be deployed in Maven Central, we mark a number of JARs as provided (related to JBoss and Memcache
-Clients). In order to build the clients, you must enable the commented out repositories in the appropriate pom.xml
-files in the modules (cas-client-integration-jboss and cas-client-support-distributed-memcached) or follow the
-instructions on how to install the file manually.
From a6416fbf5bd01ed5aca8c4d90e2859c025d0a9e1 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 02:46:17 +0400
Subject: [PATCH 148/239] Create README.md
---
README.md | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 README.md
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..a33a281e7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# Java Apereo CAS Client
+==================================
+
+## Build
+Please note that to be deployed in Maven Central, we mark a number of JARs as provided (related to JBoss and Memcache
+Clients). In order to build the clients, you must enable the commented out repositories in the appropriate pom.xml
+files in the modules (cas-client-integration-jboss and cas-client-support-distributed-memcached) or follow the
+instructions on how to install the file manually.
From 9d7bbd3e0946d192f45f2151490bd4ded02a8e94 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 16:40:15 +0400
Subject: [PATCH 149/239] Update README.md
---
README.md | 501 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 497 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index a33a281e7..da52ab086 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,501 @@
-# Java Apereo CAS Client
+# Java Apereo CAS Client [](https://maven-badges.herokuapp.com/maven-central/org.jasig.cas/cas-server)
==================================
+## Intro
+This is the official home of the Java Apereo CAS client. The client consists of a collection of Servlet filters that are suitable for most Java-based web applications. It also serves as an API platform to interact with the CAS server programmatically to make authentication requests, validate tickets and consume principal attributes.
+
+All client artifacts are published to Maven central. At a minimum, a given application will need to configure the following dependency:
+
+```xml
+
+ org.jasig.cas.client
+ cas-client-core
+ ${java.cas.client.version}
+
+```
+## Configurtion
+
+### Client Configuration Using `web.xml`
+
+The client can be configured via `web.xml` via a series of `context-param`s and filter `init-param`s. Each filter for the client has a required (and optional) set of properties. The filters are designed to look for these properties in the following way:
+
+- Check the filter's local `init-param`s for a parameter matching the required property name.
+- Check the `context-param`s for a parameter matching the required property name.
+- If two properties are found with the same name in the `init-param`s and the `context-param`s, the `init-param` takes precedence.
+
+**Note**: If you're using the `serverName` property, you should note well that the fragment-URI (the stuff after the #) is not sent to the server by all browsers, thus the CAS client can't capture it as part of the URL.
+
+An example application that is protected by the client is [available here](https://github.com/UniconLabs/cas-sample-java-webapp).
+
+#### org.jasig.cas.client.authentication.AuthenticationFilter
+The `AuthenticationFilter` is what detects whether a user needs to be authenticated or not. If a user needs to be authenticated, it will redirect the user to the CAS server.
+
+```xml
+
+ CAS Authentication Filter
+ org.jasig.cas.client.authentication.AuthenticationFilter
+
+ casServerLoginUrl
+ https://battags.ad.ess.rutgers.edu:8443/cas/login
+
+
+ serverName
+ http://www.acme-client.com
+
+
+```
+
+| Property | Description | Required
+|----------|-------|-----------
+| `casServerLoginUrl` | Defines the location of the CAS server login URL, i.e. `https://localhost:8443/cas/login` | Yes
+| `serverName` | The name of the server this application is hosted on. Service URL will be dynamically constructed using this, i.e. https://localhost:8443 (you must include the protocol, but port is optional if it's a standard port). | Yes
+| `service` | The service URL to send to the CAS server, i.e. `https://localhost:8443/yourwebapp/index.html` | No
+| `renew` | specifies whether `renew=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all). Note that `renew` cannot be specified as local `init-param` setting. | No
+| `gateway ` | specifies whether `gateway=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all) | No
+| `artifactParameterName ` | specifies the name of the request parameter on where to find the artifact (i.e. `ticket`). | No
+| `serviceParameterName ` | specifies the name of the request parameter on where to find the service (i.e. `service`) | No
+
+
+#### org.jasig.cas.client.authentication.Saml11AuthenticationFilter
+The SAML 1.1 `AuthenticationFilter` is what detects whether a user needs to be authenticated or not. If a user needs to be authenticated, it will redirect the user to the CAS server.
+
+```xml
+
+ CAS Authentication Filter
+ org.jasig.cas.client.authentication.Saml11AuthenticationFilter
+
+ casServerLoginUrl
+ https://somewhere.cas.edu:8443/cas/login
+
+
+ serverName
+ http://www.the-client.com
+
+
+```
+
+| Property | Description | Required
+|----------|-------|-----------
+| `casServerLoginUrl` | Defines the location of the CAS server login URL, i.e. `https://localhost:8443/cas/login` | Yes
+| `serverName` | The name of the server this application is hosted on. Service URL will be dynamically constructed using this, i.e. https://localhost:8443 (you must include the protocol, but port is optional if it's a standard port). | Yes
+| `service` | The service URL to send to the CAS server, i.e. `https://localhost:8443/yourwebapp/index.html` | No
+| `renew` | specifies whether `renew=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all). Note that `renew` cannot be specified as local `init-param` setting. | No
+| `gateway ` | specifies whether `gateway=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all) | No
+| `artifactParameterName ` | specifies the name of the request parameter on where to find the artifact (i.e. `SAMLart`). | No
+| `serviceParameterName ` | specifies the name of the request parameter on where to find the service (i.e. `TARGET`) | No
+
+
+####org.jasig.cas.client.validation.Cas10TicketValidationFilter
+Validates tickets using the CAS 1.0 Protocol.
+
+```xml
+
+ CAS Validation Filter
+ org.jasig.cas.client.validation.Cas10TicketValidationFilter
+
+ casServerUrlPrefix
+ https://somewhere.cas.edu:8443/cas
+
+
+```
+
+| Property | Description | Required
+|----------|-------|-----------
+| `casServerUrlPrefix ` | The start of the CAS server URL, i.e. `https://localhost:8443/cas` | Yes
+| `serverName` | The name of the server this application is hosted on. Service URL will be dynamically constructed using this, i.e. `https://localhost:8443` (you must include the protocol, but port is optional if it's a standard port). | Yes
+| `renew` | Specifies whether `renew=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all). Note that `renew` cannot be specified as local `init-param` setting. | No
+| `redirectAfterValidation ` | Whether to redirect to the same URL after ticket validation, but without the ticket in the parameter. Defaults to `true`. | No
+| `useSession ` | Whether to store the Assertion in session or not. If sessions are not used, tickets will be required for each request. Defaults to `true`. | No
+| `exceptionOnValidationFailure ` | Whether to throw an exception or not on ticket validation failure. Defaults to `true`. | No
+
+
+#### org.jasig.cas.client.validation.Saml11TicketValidationFilter
+Validates tickets using the SAML 1.1 protocol.
+
+```xml
+
+ CAS Validation Filter
+ org.jasig.cas.client.validation.Saml11TicketValidationFilter
+
+ casServerUrlPrefix
+ https://battags.ad.ess.rutgers.edu:8443/cas
+
+
+ serverName
+ http://www.acme-client.com
+
+
+```
+
+| Property | Description | Required
+|----------|-------|-----------
+| `casServerUrlPrefix ` | The start of the CAS server URL, i.e. `https://localhost:8443/cas` | Yes
+| `serverName` | The name of the server this application is hosted on. Service URL will be dynamically constructed using this, i.e. `https://localhost:8443` (you must include the protocol, but port is optional if it's a standard port). | Yes
+| `renew` | Specifies whether `renew=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all). Note that `renew` cannot be specified as local `init-param` setting. | No
+| `redirectAfterValidation ` | Whether to redirect to the same URL after ticket validation, but without the ticket in the parameter. Defaults to `true`. | No
+| `useSession ` | Whether to store the Assertion in session or not. If sessions are not used, tickets will be required for each request. Defaults to `true`. | No
+| `exceptionOnValidationFailure ` | whether to throw an exception or not on ticket validation failure. Defaults to `true` | No
+| `tolerance ` | The tolerance for drifting clocks when validating SAML tickets. Note that 10 seconds should be more than enough for most environments that have NTP time synchronization. Defaults to `1000 msec` | No
+
+
+#### org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter
+Validates the tickets using the CAS 2.0 protocol. If you provide either the `acceptAnyProxy` or the `allowedProxyChains` parameters, a `Cas20ProxyTicketValidator` will be constructed. Otherwise a general `Cas20ServiceTicketValidator` will be constructed that does not accept proxy tickets.
+
+**Note**: If you are using proxy validation, you should place the `filter-mapping` of the validation filter before the authentication filter.
+
+```xml
+
+ CAS Validation Filter
+ org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter
+
+ casServerUrlPrefix
+ https://battags.ad.ess.rutgers.edu:8443/cas
+
+
+ serverName
+ http://www.acme-client.com
+
+
+```
+
+| Property | Description | Required
+|----------|-------|-----------
+| `casServerUrlPrefix ` | The start of the CAS server URL, i.e. `https://localhost:8443/cas` | Yes
+| `serverName` | The name of the server this application is hosted on. Service URL will be dynamically constructed using this, i.e. `https://localhost:8443` (you must include the protocol, but port is optional if it's a standard port). | Yes
+| `renew` | Specifies whether `renew=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all). Note that `renew` cannot be specified as local `init-param` setting. | No
+| `redirectAfterValidation ` | Whether to redirect to the same URL after ticket validation, but without the ticket in the parameter. Defaults to `true`. | No
+| `useSession ` | Whether to store the Assertion in session or not. If sessions are not used, tickets will be required for each request. Defaults to `true`. | No
+| `exceptionOnValidationFailure ` | whether to throw an exception or not on ticket validation failure. Defaults to `true` | No
+| `proxyReceptorUrl ` | The URL to watch for `PGTIOU/PGT` responses from the CAS server. Should be defined from the root of the context. For example, if your application is deployed in `/cas-client-app` and you want the proxy receptor URL to be `/cas-client-app/my/receptor` you need to configure proxyReceptorUrl to be `/my/receptor`. | No
+| `acceptAnyProxy ` | Specifies whether any proxy is OK. Defaults to `false`. | No
+| `allowedProxyChains ` | Specifies the proxy chain. Each acceptable proxy chain should include a space-separated list of URLs. Each acceptable proxy chain should appear on its own line. | No
+| `proxyCallbackUrl` | The callback URL to provide the CAS server to accept Proxy Granting Tickets. | No
+| `proxyGrantingTicketStorageClass ` | Specify an implementation of the ProxyGrantingTicketStorage class that has a no-arg constructor. | No
+
+
+##### Proxy Authentication vs. Distributed Caching
+The client has support for clustering and distributing the TGT state among application nodes that are behind a load balancer. In order to do so, the parameter needs to be defined as such for the filter.
+
+###### Ehcache
+
+Include the following dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-support-distributed-ehcache
+ ${java.cas.client.version}
+
+```
+
+Configure the client:
+
+```xml
+
+ proxyGrantingTicketStorageClass
+ org.jasig.cas.client.proxy.EhcacheBackedProxyGrantingTicketStorageImpl
+
+```
+The setting provides an implementation for proxy storage using EhCache to take advantage of its replication features so that the PGT is successfully replicated and shared among nodes, regardless which node is selected as the result of the load balancer rerouting.
+
+Configuration of this parameter is not enough. The EhCache configuration needs to enable the replication mechanism through once of its suggested ways. A sample of that configuration based on RMI replication can be found here. Please note that while the sample is done for a distributed ticket registry implementation, the basic idea and configuration should easily be transferable.
+
+When loading from the `web.xml`, the Jasig CAS Client relies on a series of default values, one of which being that the cache must be configured in the default location (i.e. `classpath:ehcache.xml`).
+
+```xml
+
+
+
+
+
+
+
+```
+
+###### Memcached
+A similar implementation based on Memcached is also available:
+
+Include the following dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-support-distributed-memcached
+ ${java.cas.client.version}
+
+```
+
+Configure the client:
+
+```xml
+
+ proxyGrantingTicketStorageClass
+ org.jasig.cas.client.proxy. MemcachedBackedProxyGrantingTicketStorageImpl
+
+```
+
+When loading from the `web.xml`, the Client relies on a series of default values, one of which being that the list of memcached servers must be defined in `/cas/casclient_memcached_hosts.txt` on the classpath). The file is a simple list of `:` on separate lines. **BE SURE NOT TO HAVE EXTRA LINE BREAKS**.
+
+#### org.jasig.cas.client.util.HttpServletRequestWrapperFilter
+Wraps an `HttpServletRequest` so that the `getRemoteUser` and `getPrincipal` return the CAS related entries.
+
+```xml
+
+ CAS HttpServletRequest Wrapper Filter
+ org.jasig.cas.client.util.HttpServletRequestWrapperFilter
+
+```
+
+#### org.jasig.cas.client.util.AssertionThreadLocalFilter
+Places the `Assertion` in a `ThreadLocal` for portions of the application that need access to it. This is useful when the Web application that this filter "fronts" needs to get the Principal name, but it has no access to the `HttpServletRequest`, hence making `getRemoteUser()` call impossible.
+
+```xml
+
+ CAS Assertion Thread Local Filter
+ org.jasig.cas.client.util.AssertionThreadLocalFilter
+
+```
+
+### Client Configuration Using Spring
+
+Configuration via Spring IoC will depend heavily on `DelegatingFilterProxy` class. For each filter that will be configured for CAS via Spring, a corresponding `DelegatingFilterProxy` is needed in the web.xml.
+
+As the `SingleSignOutFilter`, `HttpServletRequestWrapperFilter` and `AssertionThreadLocalFilter` have no configuration options, we recommend you just configure them in the `web.xml`
+
+```xml
+
+ CAS Authentication Filter
+ org.springframework.web.filter.DelegatingFilterProxy
+
+ targetBeanName
+ authenticationFilter
+
+
+
+ CAS Authentication Filter
+ /*
+
+```
+
+#### Bean Configuration
+
+##### AuthenticationFilter
+```xml
+
+```
+
+##### Cas10TicketValidationFilter
+```xml
+
+
+
+
+
+
+
+```
+
+##### Saml11TicketValidationFilter
+```xml
+
+
+
+
+
+
+
+```
+
+##### Cas20ProxyReceivingTicketValidationFilter
+Configuration to validate tickets:
+```xml
+
+
+
+
+
+
+
+```
+
+Configuration to accept a Proxy Granting Ticket:
+```xml
+
+
+
+
+
+
+
+```
+
+Configuration to accept any Proxy Ticket (and Proxy Granting Tickets):
+
+```xml
+
+
+
+
+
+
+
+```
+
+Configuration to accept Proxy Ticket from a chain (and Proxy Granting Tickets):
+
+```xml
+
+
+
+
+
+
+ http://proxy1 http://proxy2
+
+
+
+
+
+```
+
+The specific filters can be configured in the following ways. Please see the JavaDocs included in the distribution for specific required and optional properties:
+
+
+### Client Configuration Using JNDI
+
+Configuring the CAS client via JNDI is essentially the same as configuring the client via the `web.xml`, except the properties will reside in JNDI and not in the `web.xml`.
+All properties that are placed in JNDI should be placed under `java:comp/env/cas`
+
+We use the following conventions:
+1. JNDI will first look in `java:comp/env/cas/{SHORT FILTER NAME}/{PROPERTY NAME}` (i.e. `java:comp/env/cas/AuthenticationFilter/serverName`)
+2. JNDI will as a last resort look in `java:comp/env/cas/{PROPERTY NAME}` (i.e. `java:comp/env/cas/serverName`)
+
+#### Example
+This is an update to the `META-INF/context.xml` that is included in Tomcat's Manager application:
+
+```xml
+
+
+
+
+
+
+
+
+
+```
+
+### Configuring Single Sign Out
+The Single Sign Out support in CAS consists of configuring one `SingleSignOutFilter` and one `ContextListener`. Please note that if you have configured the CAS Client for Java as Web filters, this filter must come before the other filters as described.
+
+The `SingleSignOutFilter` can affect character encoding. This becomes most obvious when used in conjunction with Confluence. Its recommended you explicitly configure either the [VT Character Encoding Filter](http://code.google.com/p/vt-middleware/wiki/vtservletfilters#CharacterEncodingFilter) or the [Spring Character Encoding Filter](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/CharacterEncodingFilter.html) with explicit encodings.
+
+#### CAS Protocol
+
+```xml
+
+ CAS Single Sign Out Filter
+ org.jasig.cas.client.session.SingleSignOutFilter
+
+...
+
+ CAS Single Sign Out Filter
+ /*
+
+...
+
+ org.jasig.cas.client.session.SingleSignOutHttpSessionListener
+
+```
+
+#### SAML Protocol
+
+```xml
+filter>
+ CAS Single Sign Out Filter
+ org.jasig.cas.client.session.SingleSignOutFilter
+
+ artifactParameterName
+ SAMLart
+
+
+...
+
+ CAS Single Sign Out Filter
+ /*
+
+...
+
+ org.jasig.cas.client.session.SingleSignOutHttpSessionListener
+
+```
+
+#### Recommend Logout Procedure
+The client has no code to help you handle log out. The client merely places objects in session. Therefore, we recommend you do a `session.invalidate()` call when you log a user out. However, that's entirely your application's responsibility. We recommend that text similar to the following appear when the application's session is ended.
+
+```html
+You have been logged out of [APPLICATION NAME GOES HERE].
+To log out of all applications, click here. (provide link to CAS server's logout)
+```
+
+## JBoss Integration
+
+## Tomcat 6 Integration
+
+## Tomcat 7 Integration
+
+## Confluence Integration
## Build
+
+```bash
+git clone git@github.com:Jasig/java-cas-client.git
+cd java-cas-client
+mvn clean package
+```
+
Please note that to be deployed in Maven Central, we mark a number of JARs as provided (related to JBoss and Memcache
-Clients). In order to build the clients, you must enable the commented out repositories in the appropriate pom.xml
-files in the modules (cas-client-integration-jboss and cas-client-support-distributed-memcached) or follow the
-instructions on how to install the file manually.
+Clients). In order to build the clients, you must enable the commented out repositories in the appropriate `pom.xml`
+files in the modules (cas-client-integration-jboss and cas-client-support-distributed-memcached) or follow the instructions on how to install the file manually.
From fb93a5df500f8b336ce9382b782ba70c4bfc2909 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 16:41:15 +0400
Subject: [PATCH 150/239] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index da52ab086..e61956d4d 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Java Apereo CAS Client [](https://maven-badges.herokuapp.com/maven-central/org.jasig.cas/cas-server)
-==================================
+
## Intro
This is the official home of the Java Apereo CAS client. The client consists of a collection of Servlet filters that are suitable for most Java-based web applications. It also serves as an API platform to interact with the CAS server programmatically to make authentication requests, validate tickets and consume principal attributes.
From 5124ac3b0603df7f8804e0d06927fec4d9ae4538 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 21:50:09 +0400
Subject: [PATCH 151/239] Update README.md
---
README.md | 497 +++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 473 insertions(+), 24 deletions(-)
diff --git a/README.md b/README.md
index e61956d4d..9eccc7269 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,11 @@
## Intro
This is the official home of the Java Apereo CAS client. The client consists of a collection of Servlet filters that are suitable for most Java-based web applications. It also serves as an API platform to interact with the CAS server programmatically to make authentication requests, validate tickets and consume principal attributes.
-All client artifacts are published to Maven central. At a minimum, a given application will need to configure the following dependency:
+All client artifacts are published to Maven central. Depending on functionality, applications will need include one or more of the listed dependencies in their configuration.
+
+## Components
+
+- Core functionality, which includes CAS authentication/validation filters.
```xml
@@ -12,6 +16,77 @@ All client artifacts are published to Maven central. At a minimum, a given appli
${java.cas.client.version}
```
+
+- Support for SAML functionality is provided by this dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-support-saml
+ ${java.cas.client.version}
+
+```
+
+- Distributed proxy ticket caching with Ehcache is provided by this dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-support-distributed-ehcache
+ ${java.cas.client.version}
+
+```
+
+- Distributed proxy ticket caching with Memcached is provided by this dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-support-distributed-memcached
+ ${java.cas.client.version}
+
+```
+
+- Atlassian integration is provided by this dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-integration-atlassian
+ ${java.cas.client.version}
+
+```
+
+- JBoss integration is provided by this dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-integration-jboss
+ ${java.cas.client.version}
+
+```
+
+- Tomcat 6 integration is provided by this dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-integration-tomcat-v6
+ ${java.cas.client.version}
+
+```
+
+- Tomcat 7 is provided by this dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-integration-tomcat-v7
+ ${java.cas.client.version}
+
+```
+
## Configurtion
### Client Configuration Using `web.xml`
@@ -177,16 +252,6 @@ The client has support for clustering and distributing the TGT state among appli
###### Ehcache
-Include the following dependency:
-
-```xml
-
- org.jasig.cas
- cas-client-support-distributed-ehcache
- ${java.cas.client.version}
-
-```
-
Configure the client:
```xml
@@ -220,17 +285,7 @@ When loading from the `web.xml`, the Jasig CAS Client relies on a series of defa
```
###### Memcached
-A similar implementation based on Memcached is also available:
-
-Include the following dependency:
-
-```xml
-
- org.jasig.cas
- cas-client-support-distributed-memcached
- ${java.cas.client.version}
-
-```
+A similar implementation based on Memcached is also available.
Configure the client:
@@ -430,7 +485,7 @@ type="java.lang.String" value="https://www.apereo.org/cas"/>
### Configuring Single Sign Out
The Single Sign Out support in CAS consists of configuring one `SingleSignOutFilter` and one `ContextListener`. Please note that if you have configured the CAS Client for Java as Web filters, this filter must come before the other filters as described.
-The `SingleSignOutFilter` can affect character encoding. This becomes most obvious when used in conjunction with Confluence. Its recommended you explicitly configure either the [VT Character Encoding Filter](http://code.google.com/p/vt-middleware/wiki/vtservletfilters#CharacterEncodingFilter) or the [Spring Character Encoding Filter](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/CharacterEncodingFilter.html) with explicit encodings.
+The `SingleSignOutFilter` can affect character encoding. This becomes most obvious when used in conjunction with applications such as Atlassian Confluence. Its recommended you explicitly configure either the [VT Character Encoding Filter](http://code.google.com/p/vt-middleware/wiki/vtservletfilters#CharacterEncodingFilter) or the [Spring Character Encoding Filter](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/CharacterEncodingFilter.html) with explicit encodings.
#### CAS Protocol
@@ -480,13 +535,407 @@ You have been logged out of [APPLICATION NAME GOES HERE].
To log out of all applications, click here. (provide link to CAS server's logout)
```
+## JAAS
+The client supports the Java Authentication and Authorization Service (JAAS) framework, which provides authnz facilities to CAS-enabled JEE applications.
+
+A general JAAS authentication module, `CasLoginModule`, is available with the specific purpose of providing authentication and authorization services to CAS-enabled JEE applications. The design of the module is simple: given a service URL and a service ticket in a `NameCallback` and `PasswordCallback`, respectively, the module contacts the CAS server and attempts to validate the ticket. In keeping with CAS integration for Java applications, a JEE container-specific servlet filter is needed to protect JEE Web applications. The JAAS support should be extensible to any JEE container.
+
+### Configure CasLoginModule
+It is expected that for JEE applications both authentication and authorization services will be required for CAS integration. The following JAAS module configuration file excerpt demonstrates how to leverage SAML 1.1 attribute release in CAS to provide authorization data in addition to authentication:
+
+```json
+cas {
+ org.jasig.cas.client.jaas.CasLoginModule required
+ ticketValidatorClass="org.jasig.cas.client.validation.Saml11TicketValidator"
+ casServerUrlPrefix="https://cas.example.com/cas"
+ tolerance="20000"
+ service="https://webapp.example.com/webapp"
+ defaultRoles="admin,operator"
+ roleAttributeNames="memberOf,eduPersonAffiliation"
+ principalGroupName="CallerPrincipal"
+ roleGroupName="Roles"
+ cacheAssertions="true"
+ cacheTimeout="480";
+}
+```
+
+
+| Property | Description | Required
+|----------|-------|-----------|
+| `ticketValidatorClass ` | Fully-qualified class name of CAS ticket validator class. | Yes
+| `casServerUrlPrefix` | URL to root of CAS Web application context. | Yes
+| `service` | CAS service parameter that may be overridden by callback handler. **Note**: service must be specified by at least one component such that it is available at service ticket validation time. | No
+| `defaultRoles` | Comma-delimited list of static roles applied to all authenticated principals. | No
+| `roleAttributeNames` | Comma-delimited list of attribute names that describe role data delivered to CAS in the service-ticket validation response that should be applied to the current authenticated principal. | No
+| `principalGroupName` | The name of a group principal containing the primary principal name of the current JAAS subject. The default value is `CallerPrincipal`. | No
+| `roleGroupName` | The name of a group principal containing all role data. The default value is `Roles`. | No
+| `cacheAssertions` | Flag to enable assertion caching. This may be required for JAAS providers that attempt to periodically reauthenticate to renew principal. Since CAS tickets are one-time-use, a cached assertion must be provided on reauthentication. | No
+| `cacheTimeout` | Assertion cache timeout in minutes. | No
+| `tolerance` | The tolerance for drifting clocks when validating SAML tickets. | No
+
+
## JBoss Integration
+In keeping with CAS integration for Java applications, a JEE container-specific servlet filter is needed to protect JEE Web applications. The JBoss `WebAuthenticationFilter` component provided a convenient integration piece between a servlet filter and the JAAS framework, so a complete integration solution is available only for JBoss AS versions that provide the `WebAuthenticationFilter` class. The JAAS support should be extensible to any JEE container with additional development.
+
+For JBoss it is vitally important to use the correct values for `principalGroupName` and `roleGroupName`. Additionally, the `cacheAssertions` and `cacheTimeout` are required since JBoss by default attempts to reauthenticate the JAAS principal with a fairly aggressive default timeout. Since CAS tickets are single-use authentication tokens by default, assertion caching is required to support periodic reauthentication.
+
+### Configure Servlet Filters
+
+Integration with the servlet pipeline is required for a number of purposes:
+
+1. Examine servlet request for an authenticated session
+2. Redirect to CAS server for unauthenticated sessions
+3. Provide service URL and CAS ticket to JAAS pipeline for validation
+
+The `WebAuthenticationFilter` performs these operations for the JBoss AS container. It is important to note that this filter simply collects the service URL and CAS ticket from the request and passes it to the JAAS pipeline. It is assumed that the `CasLoginModule` will be present in the JAAS pipeline to consume the data and perform ticket validation. The following web.xml excerpts demonstrate how to integrate WebAuthenticationFilter into a JEE Web application.
+
+
+```xml
+...
+
+ CASWebAuthenticationFilter
+ org.jasig.cas.client.jboss.authentication.WebAuthenticationFilter
+
+
+
+ CASAuthenticationFilter
+ org.jasig.cas.client.authentication.AuthenticationFilter
+
+ casServerLoginUrl
+ https://cas.example.com/cas/login
+
+
+...
+```
+
+The JAAS LoginModule configuration in `conf/login-config.xml` may require the following changes in a JBoss environment:
+
+```xml
+
+
+
+ org.jasig.cas.client.validation.Saml11TicketValidator
+ http://yourcasserver/cas
+ 20000
+ admin,user
+ memberOf,eduPersonAffiliation,authorities
+ CallerPrincipal
+ Roles
+ true
+ 480
+
+
+
+```
+It may be necessary to modify the JBoss `server.xml` and uncomment:
+
+```xml
+
+```
+
+Remember not to add `` and `` elements in your `web.xml`.
+
+If you have any trouble, you can enable the log of cas in `jboss-logging.xml` by adding:
+
+```xml
+
+
+
+```
+
## Tomcat 6 Integration
## Tomcat 7 Integration
-## Confluence Integration
+## Atlassian Integration
+The clien includes Atlassian Confluence and JIRA support. Support is enabled by a custom CAS authenticator that extends the default authenticators.
+
+### Configuration
+
+#### $JIRA_HOME Location
+
+- WAR/EAR Installation: /webapp
+`/opt/atlassian/jira/atlassian-jira-enterprise-x.y.z/webapp`
+
+- Standalone: /atlassian-jira
+`/opt/atlassian/jira/atlassian-jira-enterprise-x.y.z-standalone/atlassian-jira`
+
+#### $CONFLUENCE_INSTALL Description
+
+- /confluence
+`/opt/atlassian/confluence/confluence-x.y.z/confluence`
+
+#### Changes to web.xml
+Add the CAS filters to the end of the filter list. See `web.xml` configuration of the client.
+
+
+#### Modify the seraph-config.xml
+To rely on the Single Sign Out functionality to sign off of Jira, comment out the normal logout URL and replace it with the CAS logout URL. Also, change the login links to point to the CAS login service.
+
+```xml
+
+
+ login.url
+
+ http://cas.institution.edu/cas/login?service=${originalurl}
+
+
+
+ link.login.url
+
+
+ http://cas.institution.edu/cas/login?service=${originalurl}
+
+
+
+ logout.url
+
+ https://cas.institution.edu/cas/logout
+
+```
+
+#### CAS Authenticator
+Comment out the `DefaultAuthenticator` like so in `[$JIRA_HOME|$CONFLUENCE_INSTALL]/WEB-INF/classes/seraph-config.xml`:
+
+```xml
+
+
+
+```
+
+For JIRA, add in the Client Jira Authenticator:
+
+```xml
+
+
+
+```
+
+For Confluence, add in the Client Confluence Authenticator:
+
+```xml
+
+
+
+```
+
+#### Confluence CAS Logout
+
+As of this writing, Atlassian doesn't support a config option yet (like Jira). To rely on the Single Sign Out functionality to sign off of Confluence we need to modify the logout link.
+
+
+- Copy `$CONFLUENCE_INSTALL/WEB-INF/lib/confluence-x.x.x.jar` to a temporary directory
+- `mkdir /tmp/confluence-jar && cp WEB-INF/lib/confluence-x.y.z.jar /tmp/confluence-jar`
+- Unpack the jar
+- `cd /tmp/confluence-jar && jar xvf confluence-x.y.z.jar`
+- `cp xwork.xml $CONFLUENCE_INSTALL/WEB-INF/classes`
+- `cp xwork.xml $CONFLUENCE_INSTALL/WEB-INF/classes/ && cd $CONFLUENCE_INSTALL/WEB-INF/classes/`
+- Edit `$CONFLUENCE_INSTALL/WEB-INF/classes/xwork.xml`, find the logout action and comment out the success result and replace it with this one:
+
+```xml
+
+
+https://cas.institution.edu/cas/logout
+
+```
+
+#### Copy Jars
+Copy cas-client-core-x.y.x.jar and cas-client-integration-atlassian-x.y.x.jar to `$JIRA_HOME/WEB-INF/lib`
+
+## Spring Security Integration
+This configuration tested against the sample application that is included with Spring Security. As of this writing, replacing the `applicationContext-security.xml` in the sample application with the one below would enable this alternative configuration. We can not guarantee this version will work without modification in future versions of Spring Security.
+
+### Changes to web.xml
+
+```xml
+...
+
+ contextConfigLocation
+
+ /WEB-INF/applicationContext-security.xml
+
+
+
+
+ log4jConfigLocation
+ /WEB-INF/classes/log4j.properties
+
+
+
+ webAppRootKey
+ cas.root
+
+
+
+ CAS Single Sign Out Filter
+ org.jasig.cas.client.session.SingleSignOutFilter
+
+
+
+ springSecurityFilterChain
+ org.springframework.web.filter.DelegatingFilterProxy
+
+
+
+ CAS Single Sign Out Filter
+ /*
+
+
+
+ springSecurityFilterChain
+ /*
+
+
+
+ org.jasig.cas.client.session.SingleSignOutHttpSessionListener
+
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
+
+ org.springframework.web.util.Log4jConfigListener
+
+
+
+ 403
+ /casfailed.jsp
+
+...
+```
+
+The important additions to the `web.xml` include the addition of the 403 error page. 403 is what the CAS Validation Filter will throw if it has a problem with the ticket. Also, if you want Single Log Out, you should enable the `SingleSignOutHttpSessionListener`.
+
+### Changes to applicationContext-security.xml
+
+```xml
+...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+...
+```
+
+1. You should replace the userService with something that checks your user storage.
+2. Replace the `serverName` and `casServerLoginUrl` with your values (or better yet, externalize them).
+3. Replace the URLs with the URL configuration for your application.
## Build
From 9ac94a89d4107f437409509a7a00d8794c841782 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 22:01:48 +0400
Subject: [PATCH 152/239] Update README.md
---
README.md | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 139 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 9eccc7269..601811577 100644
--- a/README.md
+++ b/README.md
@@ -543,7 +543,7 @@ A general JAAS authentication module, `CasLoginModule`, is available with the sp
### Configure CasLoginModule
It is expected that for JEE applications both authentication and authorization services will be required for CAS integration. The following JAAS module configuration file excerpt demonstrates how to leverage SAML 1.1 attribute release in CAS to provide authorization data in addition to authentication:
-```json
+```
cas {
org.jasig.cas.client.jaas.CasLoginModule required
ticketValidatorClass="org.jasig.cas.client.validation.Saml11TicketValidator"
@@ -644,9 +644,144 @@ If you have any trouble, you can enable the log of cas in `jboss-logging.xml` by
```
-## Tomcat 6 Integration
+## Tomcat 6/7 Integration
+The client supports container-based CAS authentication and authorization support for the Tomcat servlet container.
+
+Suppose a single Tomcat container hosts multiple Web applications with similar authentication and authorization needs. Prior to Tomcat container support, each application would require a similar configuration of CAS servlet filters and authorization configuration in the `web.xml` servlet descriptor. Using the new container-based authentication/authorization feature, a single CAS configuration can be applied to the container and leveraged by all Web applications hosted by the container.
+
+CAS authentication support for Tomcat is based on the Tomcat-specific Realm component. The Realm component has a fairly broad surface area and RealmBase is provided as a convenient superclass for custom implementations; the CAS realm implementations derive from `RealmBase`. Unfortunately RealmBase and related components have proven to change over both major and minor number releases, which requires version-specific CAS components for integration. We have provided two packages with similar components with the hope of supporting all 6.x and 7.x versions. **No support for 5.x is provided.**
+
+### Component Overview
+In the following discussion of components, only the Tomcat 6.x components are mentioned. The Tomcat 7.0.x components have exactly the same name, but **are in the tomcat.v7 package**, e.g. `org.jasig.cas.client.tomcat.v7.Cas20CasAuthenticator`.
+
+#### Authenticators
+Authenticators are responsible for performing CAS authentication using a particular protocol. All protocols supported by the Jasig Java CAS client are supported: CAS 1.0, CAS 2.0, and SAML 1.1. The following components provide protocol-specific support:
+
+```
+org.jasig.cas.client.tomcat.v6.Cas10CasAuthenticator
+org.jasig.cas.client.tomcat.v6.Cas20CasAuthenticator
+org.jasig.cas.client.tomcat.v6.Cas20ProxyCasAuthenticator
+org.jasig.cas.client.tomcat.v6.Saml11Authenticator
+```
+
+#### Realms
+In terms of CAS configuration, Tomcat realms serve as containers for users and role definitions. The roles defined in a Tomcat realm may be referenced in the web.xml servlet descriptor to define authorization constraints on Web applications hosted by the container. Two sources of user/role data are supported:
+
+```
+org.jasig.cas.client.tomcat.v6.PropertiesCasRealm
+org.jasig.cas.client.tomcat.v6.AssertionCasRealm
+```
+
+`PropertiesCasRealm` uses a Java properties file as a source of static user/role information. This component is conceptually similar to the `MemoryRealm` component that ships with Tomcat and defines user/role data via XML configuration. The PropertiesCasRealm is different in that it explicitly lacks support for passwords, which have no use with CAS.
+
+`AssertionCasRealm` is designed to be used in conjunction with the SAML 1.1. protocol to take advantage of CAS attribute release to provide for dynamic user/role data driven by the CAS server. With this component the deployer may define a role attribute, e.g. memberOf, which could be backed by LDAP group membership information. In that case the user would be added to all roles defined in the SAML attribute assertion for values of the the `memberOf` attribute.
+
+#### Valves
+A number of Tomcat valves are provided to handle functionality outside Realms and Authenticators.
+
+##### Logout Valves
+Logout valves provide a way of destroying the CAS authentication state bound to the container for a particular user/session; the destruction of authenticated state is synonymous with logout for the container and its hosted applications. (Note this does not destroy the CAS SSO session.) The implementations provide various strategies to map a URI onto the state-destroying logout function.
+
+```
+org.jasig.cas.client.tomcat.v6.StaticUriLogoutValve
+org.jasig.cas.client.tomcat.v6.RegexUriLogoutValve
+```
+
+##### SingleSignOutValve
+The `org.jasig.cas.client.tomcat.v6.SingleSignOutValve` allows the container to participate in CAS single sign-out. In particular this valve handles the SAML LogoutRequest message sent from the CAS server that is delivered when the CAS SSO session ends.
-## Tomcat 7 Integration
+##### ProxyCallbackValve
+The `org.jasig.cas.client.tomcat.v6.ProxyCallbackValve` provides a handler for watching request URIs for requests that contain a proxy callback request in support of the CAS 2.0 protocol proxy feature.
+
+### Container Setup
+The version-specific CAS libraries must be placed on the container classpath, `$CATALINA_HOME/lib`.
+
+### Context Configuration
+The Realm, Authenticator, and Valve components are wired together inside a Tomcat Context configuration element. The location and scope of the Context determines the scope of the applied configuration. To apply a CAS configuration to every Web application hosted in the container, configure the default Context at `$CATALINA_HOME/conf/context.xml`. Note that individual Web applications/servlets can override the default context; see the Context Container reference for more information.
+
+Alternatively, CAS configuration can be applied to individual Web applications through a Context configuration element located in a `$CONTEXT_NAME.xml` file placed in `$CATALINA_HOME/conf/$ENGINE/$HOST`, where `$ENGINE` is typically Catalina and `$HOST` is `localhost`, `$CATALINA_HOME/conf/Catalina/localhost`. For example, to configure the Tomcat manager servlet, a `manager.xml` file contains Context configuration elements.
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+The following example shows how to configure a Context for dynamic role data provided by the CAS attribute release feature.
+
+```xml
+
+
+
+
+
+
+
+
+
+```
## Atlassian Integration
The clien includes Atlassian Confluence and JIRA support. Support is enabled by a custom CAS authenticator that extends the default authenticators.
@@ -947,4 +1082,4 @@ mvn clean package
Please note that to be deployed in Maven Central, we mark a number of JARs as provided (related to JBoss and Memcache
Clients). In order to build the clients, you must enable the commented out repositories in the appropriate `pom.xml`
-files in the modules (cas-client-integration-jboss and cas-client-support-distributed-memcached) or follow the instructions on how to install the file manually.
+files in the modules (`cas-client-integration-jboss` and `cas-client-support-distributed-memcached`) or follow the instructions on how to install the file manually.
From abcd057d4d070b106cff2f9b51b8d66898ba4f59 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 22:50:09 +0400
Subject: [PATCH 153/239] Update README.md
---
README.md | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 148 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 601811577..680ef01e7 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,64 @@
# Java Apereo CAS Client [](https://maven-badges.herokuapp.com/maven-central/org.jasig.cas/cas-server)
+
+
+- [Intro][intro]
+- [Components][components]
+- [Configurtion][configurtion]
+ - [Client Configuration Using `web.xml`][client-configuration-using-webxml]
+ - [org.jasig.cas.client.authentication.AuthenticationFilter][orgjasigcasclientauthenticationauthenticationfilter]
+ - [org.jasig.cas.client.authentication.Saml11AuthenticationFilter][orgjasigcasclientauthenticationsaml11authenticationfilter]
+ - [rg.jasig.cas.client.validation.Cas10TicketValidationFilter][rgjasigcasclientvalidationcas10ticketvalidationfilter]
+ - [org.jasig.cas.client.validation.Saml11TicketValidationFilter][orgjasigcasclientvalidationsaml11ticketvalidationfilter]
+ - [org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter][orgjasigcasclientvalidationcas20proxyreceivingticketvalidationfilter]
+ - [org.jasig.cas.client.validation.Cas30ProxyReceivingTicketValidationFilter][orgjasigcasclientvalidationcas30proxyreceivingticketvalidationfilter]
+ - [org.jasig.cas.client.util.HttpServletRequestWrapperFilter][orgjasigcasclientutilhttpservletrequestwrapperfilter]
+ - [org.jasig.cas.client.util.AssertionThreadLocalFilter][orgjasigcasclientutilassertionthreadlocalfilter]
+ - [Client Configuration Using Spring][client-configuration-using-spring]
+ - [Bean Configuration][bean-configuration]
+ - [Client Configuration Using JNDI][client-configuration-using-jndi]
+ - [Example][example]
+ - [Configuring Single Sign Out][configuring-single-sign-out]
+ - [Configuration][configuration]
+ - [CAS Protocol][cas-protocol]
+ - [SAML Protocol][saml-protocol]
+ - [Recommend Logout Procedure][recommend-logout-procedure]
+- [JAAS][jaas]
+ - [Configure CasLoginModule][configure-casloginmodule]
+ - [Programmatic JAAS login using the Servlet 3][programmatic-jaas-login-using-the-servlet-3]
+- [JBoss Integration][jboss-integration]
+ - [Configure Servlet Filters][configure-servlet-filters]
+- [Tomcat 6/7 Integration][tomcat-67-integration]
+ - [Component Overview][component-overview]
+ - [Authenticators][authenticators]
+ - [Realms][realms]
+ - [Valves][valves]
+ - [Container Setup][container-setup]
+ - [Context Configuration][context-configuration]
+- [Atlassian Integration][atlassian-integration]
+ - [Configuration][configuration-1]
+ - [$JIRA_HOME Location][jira_home-location]
+ - [$CONFLUENCE_INSTALL Description][confluence_install-description]
+ - [Changes to web.xml][changes-to-webxml]
+ - [Modify the seraph-config.xml][modify-the-seraph-configxml]
+ - [CAS Authenticator][cas-authenticator]
+ - [Confluence CAS Logout][confluence-cas-logout]
+ - [Copy Jars][copy-jars]
+- [Spring Security Integration][spring-security-integration]
+ - [Changes to web.xml][changes-to-webxml-1]
+ - [Changes to applicationContext-security.xml][changes-to-applicationcontext-securityxml]
+- [Build][build]
+
+
+
+
+
## Intro
This is the official home of the Java Apereo CAS client. The client consists of a collection of Servlet filters that are suitable for most Java-based web applications. It also serves as an API platform to interact with the CAS server programmatically to make authentication requests, validate tickets and consume principal attributes.
All client artifacts are published to Maven central. Depending on functionality, applications will need include one or more of the listed dependencies in their configuration.
+
## Components
- Core functionality, which includes CAS authentication/validation filters.
@@ -87,8 +141,10 @@ All client artifacts are published to Maven central. Depending on functionality,
```
+
## Configurtion
+
### Client Configuration Using `web.xml`
The client can be configured via `web.xml` via a series of `context-param`s and filter `init-param`s. Each filter for the client has a required (and optional) set of properties. The filters are designed to look for these properties in the following way:
@@ -101,6 +157,7 @@ The client can be configured via `web.xml` via a series of `context-param`s and
An example application that is protected by the client is [available here](https://github.com/UniconLabs/cas-sample-java-webapp).
+
#### org.jasig.cas.client.authentication.AuthenticationFilter
The `AuthenticationFilter` is what detects whether a user needs to be authenticated or not. If a user needs to be authenticated, it will redirect the user to the CAS server.
@@ -128,8 +185,13 @@ The `AuthenticationFilter` is what detects whether a user needs to be authentica
| `gateway ` | specifies whether `gateway=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all) | No
| `artifactParameterName ` | specifies the name of the request parameter on where to find the artifact (i.e. `ticket`). | No
| `serviceParameterName ` | specifies the name of the request parameter on where to find the service (i.e. `service`) | No
+| `encodeServiceUrl ` | Whether the client should auto encode the service url. Defaults to `true` | No
+| `ignorePattern` | Defines the url pattern to ignore, when intercepting authentication requests. | No
+| `ignoreUrlPatternType` | Defines the type of the pattern specified. Defaults to `REGEX`. Other types are `CONTAINS`, `EXACT`. | No
+| `gatewayStorageClass` | The storage class used to record gateway requests | No
+| `authenticationRedirectStrategyClass` | The class name of the component to decide how to handle authn redirects to CAS | No
-
+
#### org.jasig.cas.client.authentication.Saml11AuthenticationFilter
The SAML 1.1 `AuthenticationFilter` is what detects whether a user needs to be authenticated or not. If a user needs to be authenticated, it will redirect the user to the CAS server.
@@ -157,8 +219,9 @@ The SAML 1.1 `AuthenticationFilter` is what detects whether a user needs to be a
| `gateway ` | specifies whether `gateway=true` should be sent to the CAS server. Valid values are either `true/false` (or no value at all) | No
| `artifactParameterName ` | specifies the name of the request parameter on where to find the artifact (i.e. `SAMLart`). | No
| `serviceParameterName ` | specifies the name of the request parameter on where to find the service (i.e. `TARGET`) | No
+| `encodeServiceUrl ` | Whether the client should auto encode the service url. Defaults to `true` | No
-
+
####org.jasig.cas.client.validation.Cas10TicketValidationFilter
Validates tickets using the CAS 1.0 Protocol.
@@ -181,8 +244,11 @@ Validates tickets using the CAS 1.0 Protocol.
| `redirectAfterValidation ` | Whether to redirect to the same URL after ticket validation, but without the ticket in the parameter. Defaults to `true`. | No
| `useSession ` | Whether to store the Assertion in session or not. If sessions are not used, tickets will be required for each request. Defaults to `true`. | No
| `exceptionOnValidationFailure ` | Whether to throw an exception or not on ticket validation failure. Defaults to `true`. | No
+| `sslConfigFile` | A reference to a properties file that includes SSL settings for client-side SSL config, used during back-channel calls. The configuration includes keys for `protocol` which defaults to `SSL`, `keyStoreType`, `keyStorePath`, `keyStorePass`, `keyManagerType` which defaults to `SunX509` and `certificatePassword`. | No.
+| `encoding` | Specifies the encoding charset the client should use | No
+| `hostnameVerifier` | Hostname verifier class name, used when making back-channel calls | No
-
+
#### org.jasig.cas.client.validation.Saml11TicketValidationFilter
Validates tickets using the SAML 1.1 protocol.
@@ -210,8 +276,11 @@ Validates tickets using the SAML 1.1 protocol.
| `useSession ` | Whether to store the Assertion in session or not. If sessions are not used, tickets will be required for each request. Defaults to `true`. | No
| `exceptionOnValidationFailure ` | whether to throw an exception or not on ticket validation failure. Defaults to `true` | No
| `tolerance ` | The tolerance for drifting clocks when validating SAML tickets. Note that 10 seconds should be more than enough for most environments that have NTP time synchronization. Defaults to `1000 msec` | No
+| `sslConfigFile` | A reference to a properties file that includes SSL settings for client-side SSL config, used during back-channel calls. The configuration includes keys for `protocol` which defaults to `SSL`, `keyStoreType`, `keyStorePath`, `keyStorePass`, `keyManagerType` which defaults to `SunX509` and `certificatePassword`. | No.
+| `encoding` | Specifies the encoding charset the client should use | No
+| `hostnameVerifier` | Hostname verifier class name, used when making back-channel calls | No
-
+
#### org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter
Validates the tickets using the CAS 2.0 protocol. If you provide either the `acceptAnyProxy` or the `allowedProxyChains` parameters, a `Cas20ProxyTicketValidator` will be constructed. Otherwise a general `Cas20ServiceTicketValidator` will be constructed that does not accept proxy tickets.
@@ -245,7 +314,17 @@ Validates the tickets using the CAS 2.0 protocol. If you provide either the `acc
| `allowedProxyChains ` | Specifies the proxy chain. Each acceptable proxy chain should include a space-separated list of URLs. Each acceptable proxy chain should appear on its own line. | No
| `proxyCallbackUrl` | The callback URL to provide the CAS server to accept Proxy Granting Tickets. | No
| `proxyGrantingTicketStorageClass ` | Specify an implementation of the ProxyGrantingTicketStorage class that has a no-arg constructor. | No
-
+| `sslConfigFile` | A reference to a properties file that includes SSL settings for client-side SSL config, used during back-channel calls. The configuration includes keys for `protocol` which defaults to `SSL`, `keyStoreType`, `keyStorePath`, `keyStorePass`, `keyManagerType` which defaults to `SunX509` and `certificatePassword`. | No.
+| `encoding` | Specifies the encoding charset the client should use | No
+| `secretKey` | The secret key used by the `proxyGrantingTicketStorageClass` if it supports encryption. | No
+| `cipherAlgorithm` | The algorithm used by the `proxyGrantingTicketStorageClass` if it supports encryption. Defaults to `DESede` | No
+| `millisBetweenCleanUps` | Startup delay for the cleanup task to remove expired tickets from the storage. Defaults to `60000 msec` | No
+| `ticketValidatorClass` | Ticket validator class to use/create | No
+| `hostnameVerifier` | Hostname verifier class name, used when making back-channel calls | No
+
+
+#### org.jasig.cas.client.validation.Cas30ProxyReceivingTicketValidationFilter
+Validates the tickets using the CAS 3.0 protocol. If you provide either the `acceptAnyProxy` or the `allowedProxyChains` parameters, a `Cas30ProxyTicketValidator` will be constructed. Otherwise a general `Cas30ServiceTicketValidator` will be constructed that does not accept proxy tickets. Supports all configurations that are available for `Cas20ProxyReceivingTicketValidationFilter`.
##### Proxy Authentication vs. Distributed Caching
The client has support for clustering and distributing the TGT state among application nodes that are behind a load balancer. In order to do so, the parameter needs to be defined as such for the filter.
@@ -298,6 +377,7 @@ Configure the client:
When loading from the `web.xml`, the Client relies on a series of default values, one of which being that the list of memcached servers must be defined in `/cas/casclient_memcached_hosts.txt` on the classpath). The file is a simple list of `:` on separate lines. **BE SURE NOT TO HAVE EXTRA LINE BREAKS**.
+
#### org.jasig.cas.client.util.HttpServletRequestWrapperFilter
Wraps an `HttpServletRequest` so that the `getRemoteUser` and `getPrincipal` return the CAS related entries.
@@ -308,6 +388,12 @@ Wraps an `HttpServletRequest` so that the `getRemoteUser` and `getPrincipal` ret
```
+| Property | Description | Required
+|----------|-------|-----------
+| `roleAttribute` | Used to determine the principal role. | No
+| `ignoreCase` | Whether role checking should ignore case. Defaults to `false` | No
+
+
#### org.jasig.cas.client.util.AssertionThreadLocalFilter
Places the `Assertion` in a `ThreadLocal` for portions of the application that need access to it. This is useful when the Web application that this filter "fronts" needs to get the Principal name, but it has no access to the `HttpServletRequest`, hence making `getRemoteUser()` call impossible.
@@ -318,6 +404,7 @@ Places the `Assertion` in a `ThreadLocal` for portions of the application that n
```
+
### Client Configuration Using Spring
Configuration via Spring IoC will depend heavily on `DelegatingFilterProxy` class. For each filter that will be configured for CAS via Spring, a corresponding `DelegatingFilterProxy` is needed in the web.xml.
@@ -339,6 +426,7 @@ As the `SingleSignOutFilter`, `HttpServletRequestWrapperFilter` and `AssertionTh
```
+
#### Bean Configuration
##### AuthenticationFilter
@@ -455,6 +543,7 @@ Configuration to accept Proxy Ticket from a chain (and Proxy Granting Tickets):
The specific filters can be configured in the following ways. Please see the JavaDocs included in the distribution for specific required and optional properties:
+
### Client Configuration Using JNDI
Configuring the CAS client via JNDI is essentially the same as configuring the client via the `web.xml`, except the properties will reside in JNDI and not in the `web.xml`.
@@ -464,6 +553,7 @@ We use the following conventions:
1. JNDI will first look in `java:comp/env/cas/{SHORT FILTER NAME}/{PROPERTY NAME}` (i.e. `java:comp/env/cas/AuthenticationFilter/serverName`)
2. JNDI will as a last resort look in `java:comp/env/cas/{PROPERTY NAME}` (i.e. `java:comp/env/cas/serverName`)
+
#### Example
This is an update to the `META-INF/context.xml` that is included in Tomcat's Manager application:
@@ -482,11 +572,26 @@ type="java.lang.String" value="https://www.apereo.org/cas"/>
```
+
### Configuring Single Sign Out
The Single Sign Out support in CAS consists of configuring one `SingleSignOutFilter` and one `ContextListener`. Please note that if you have configured the CAS Client for Java as Web filters, this filter must come before the other filters as described.
The `SingleSignOutFilter` can affect character encoding. This becomes most obvious when used in conjunction with applications such as Atlassian Confluence. Its recommended you explicitly configure either the [VT Character Encoding Filter](http://code.google.com/p/vt-middleware/wiki/vtservletfilters#CharacterEncodingFilter) or the [Spring Character Encoding Filter](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/CharacterEncodingFilter.html) with explicit encodings.
+
+#### Configuration
+
+| Property | Description | Required
+|----------|-------|-----------
+| `artifactParameterName` | The ticket artifact parameter name. Defaults to `ticket`| No
+| `logoutParameterName` | Defaults to `logoutRequest` | No
+| `frontLogoutParameterName` | Defaults to `SAMLRequest` | No
+| `relayStateParameterName` | Defaults to `RelayState` | No
+| `eagerlyCreateSessions` | Defaults to `true` | No
+| `artifactParameterOverPost` | Defaults to `false` | No
+| `casServerUrlPrefix` | URL to root of CAS Web application context. | Yes
+
+
#### CAS Protocol
```xml
@@ -505,6 +610,7 @@ The `SingleSignOutFilter` can affect character encoding. This becomes most obvio
```
+
#### SAML Protocol
```xml
@@ -527,6 +633,9 @@ filter>
```
+
+
+
#### Recommend Logout Procedure
The client has no code to help you handle log out. The client merely places objects in session. Therefore, we recommend you do a `session.invalidate()` call when you log a user out. However, that's entirely your application's responsibility. We recommend that text similar to the following appear when the application's session is ended.
@@ -535,11 +644,13 @@ You have been logged out of [APPLICATION NAME GOES HERE].
To log out of all applications, click here. (provide link to CAS server's logout)
```
+
## JAAS
The client supports the Java Authentication and Authorization Service (JAAS) framework, which provides authnz facilities to CAS-enabled JEE applications.
A general JAAS authentication module, `CasLoginModule`, is available with the specific purpose of providing authentication and authorization services to CAS-enabled JEE applications. The design of the module is simple: given a service URL and a service ticket in a `NameCallback` and `PasswordCallback`, respectively, the module contacts the CAS server and attempts to validate the ticket. In keeping with CAS integration for Java applications, a JEE container-specific servlet filter is needed to protect JEE Web applications. The JAAS support should be extensible to any JEE container.
+
### Configure CasLoginModule
It is expected that for JEE applications both authentication and authorization services will be required for CAS integration. The following JAAS module configuration file excerpt demonstrates how to leverage SAML 1.1 attribute release in CAS to provide authorization data in addition to authentication:
@@ -573,13 +684,24 @@ cas {
| `cacheTimeout` | Assertion cache timeout in minutes. | No
| `tolerance` | The tolerance for drifting clocks when validating SAML tickets. | No
+
+### Programmatic JAAS login using the Servlet 3
+A `org.jasig.cas.client.jaas.Servlet3AuthenticationFilter` servlet filter that performs a programmatic JAAS login using the Servlet 3.0 `HttpServletRequest#login()` facility. This component should be compatible with any servlet container that supports the Servlet 3.0/JEE6 specification.
+
+The filter executes when it receives a CAS ticket and expects the
+`CasLoginModule` JAAS module to perform the CAS ticket validation in order to produce an `AssertionPrincipal` from which the CAS assertion is obtained and inserted into the session to enable SSO.
+If a `service` init-param is specified for this filter, it supersedes
+the service defined for the `CasLoginModule`.
+
+
## JBoss Integration
In keeping with CAS integration for Java applications, a JEE container-specific servlet filter is needed to protect JEE Web applications. The JBoss `WebAuthenticationFilter` component provided a convenient integration piece between a servlet filter and the JAAS framework, so a complete integration solution is available only for JBoss AS versions that provide the `WebAuthenticationFilter` class. The JAAS support should be extensible to any JEE container with additional development.
For JBoss it is vitally important to use the correct values for `principalGroupName` and `roleGroupName`. Additionally, the `cacheAssertions` and `cacheTimeout` are required since JBoss by default attempts to reauthenticate the JAAS principal with a fairly aggressive default timeout. Since CAS tickets are single-use authentication tokens by default, assertion caching is required to support periodic reauthentication.
+
### Configure Servlet Filters
Integration with the servlet pipeline is required for a number of purposes:
@@ -644,6 +766,7 @@ If you have any trouble, you can enable the log of cas in `jboss-logging.xml` by
```
+
## Tomcat 6/7 Integration
The client supports container-based CAS authentication and authorization support for the Tomcat servlet container.
@@ -651,9 +774,11 @@ Suppose a single Tomcat container hosts multiple Web applications with similar a
CAS authentication support for Tomcat is based on the Tomcat-specific Realm component. The Realm component has a fairly broad surface area and RealmBase is provided as a convenient superclass for custom implementations; the CAS realm implementations derive from `RealmBase`. Unfortunately RealmBase and related components have proven to change over both major and minor number releases, which requires version-specific CAS components for integration. We have provided two packages with similar components with the hope of supporting all 6.x and 7.x versions. **No support for 5.x is provided.**
+
### Component Overview
In the following discussion of components, only the Tomcat 6.x components are mentioned. The Tomcat 7.0.x components have exactly the same name, but **are in the tomcat.v7 package**, e.g. `org.jasig.cas.client.tomcat.v7.Cas20CasAuthenticator`.
+
#### Authenticators
Authenticators are responsible for performing CAS authentication using a particular protocol. All protocols supported by the Jasig Java CAS client are supported: CAS 1.0, CAS 2.0, and SAML 1.1. The following components provide protocol-specific support:
@@ -664,6 +789,7 @@ org.jasig.cas.client.tomcat.v6.Cas20ProxyCasAuthenticator
org.jasig.cas.client.tomcat.v6.Saml11Authenticator
```
+
#### Realms
In terms of CAS configuration, Tomcat realms serve as containers for users and role definitions. The roles defined in a Tomcat realm may be referenced in the web.xml servlet descriptor to define authorization constraints on Web applications hosted by the container. Two sources of user/role data are supported:
@@ -676,6 +802,7 @@ org.jasig.cas.client.tomcat.v6.AssertionCasRealm
`AssertionCasRealm` is designed to be used in conjunction with the SAML 1.1. protocol to take advantage of CAS attribute release to provide for dynamic user/role data driven by the CAS server. With this component the deployer may define a role attribute, e.g. memberOf, which could be backed by LDAP group membership information. In that case the user would be added to all roles defined in the SAML attribute assertion for values of the the `memberOf` attribute.
+
#### Valves
A number of Tomcat valves are provided to handle functionality outside Realms and Authenticators.
@@ -693,9 +820,11 @@ The `org.jasig.cas.client.tomcat.v6.SingleSignOutValve` allows the container to
##### ProxyCallbackValve
The `org.jasig.cas.client.tomcat.v6.ProxyCallbackValve` provides a handler for watching request URIs for requests that contain a proxy callback request in support of the CAS 2.0 protocol proxy feature.
+
### Container Setup
The version-specific CAS libraries must be placed on the container classpath, `$CATALINA_HOME/lib`.
+
### Context Configuration
The Realm, Authenticator, and Valve components are wired together inside a Tomcat Context configuration element. The location and scope of the Context determines the scope of the applied configuration. To apply a CAS configuration to every Web application hosted in the container, configure the default Context at `$CATALINA_HOME/conf/context.xml`. Note that individual Web applications/servlets can override the default context; see the Context Container reference for more information.
@@ -783,11 +912,14 @@ The following example shows how to configure a Context for dynamic role data pro
```
+
## Atlassian Integration
The clien includes Atlassian Confluence and JIRA support. Support is enabled by a custom CAS authenticator that extends the default authenticators.
+
### Configuration
+
#### $JIRA_HOME Location
- WAR/EAR Installation: /webapp
@@ -796,15 +928,18 @@ The clien includes Atlassian Confluence and JIRA support. Support is enabled by
- Standalone: /atlassian-jira
`/opt/atlassian/jira/atlassian-jira-enterprise-x.y.z-standalone/atlassian-jira`
+
#### $CONFLUENCE_INSTALL Description
- /confluence
`/opt/atlassian/confluence/confluence-x.y.z/confluence`
+
#### Changes to web.xml
Add the CAS filters to the end of the filter list. See `web.xml` configuration of the client.
+
#### Modify the seraph-config.xml
To rely on the Single Sign Out functionality to sign off of Jira, comment out the normal logout URL and replace it with the CAS logout URL. Also, change the login links to point to the CAS login service.
@@ -845,6 +980,7 @@ To rely on the Single Sign Out functionality to sign off of Jira, comment out th
```
+
#### CAS Authenticator
Comment out the `DefaultAuthenticator` like so in `[$JIRA_HOME|$CONFLUENCE_INSTALL]/WEB-INF/classes/seraph-config.xml`:
@@ -872,6 +1008,7 @@ For Confluence, add in the Client Confluence Authenticator:
```
+
#### Confluence CAS Logout
As of this writing, Atlassian doesn't support a config option yet (like Jira). To rely on the Single Sign Out functionality to sign off of Confluence we need to modify the logout link.
@@ -892,12 +1029,15 @@ As of this writing, Atlassian doesn't support a config option yet (like Jira). T
```
+
#### Copy Jars
Copy cas-client-core-x.y.x.jar and cas-client-integration-atlassian-x.y.x.jar to `$JIRA_HOME/WEB-INF/lib`
+
## Spring Security Integration
This configuration tested against the sample application that is included with Spring Security. As of this writing, replacing the `applicationContext-security.xml` in the sample application with the one below would enable this alternative configuration. We can not guarantee this version will work without modification in future versions of Spring Security.
+
### Changes to web.xml
```xml
@@ -960,6 +1100,7 @@ This configuration tested against the sample application that is included with S
The important additions to the `web.xml` include the addition of the 403 error page. 403 is what the CAS Validation Filter will throw if it has a problem with the ticket. Also, if you want Single Log Out, you should enable the `SingleSignOutHttpSessionListener`.
+
### Changes to applicationContext-security.xml
```xml
@@ -1068,10 +1209,11 @@ The important additions to the `web.xml` include the addition of the 403 error p
...
```
-1. You should replace the userService with something that checks your user storage.
+1. You should replace the `userService` with something that checks your user storage.
2. Replace the `serverName` and `casServerLoginUrl` with your values (or better yet, externalize them).
3. Replace the URLs with the URL configuration for your application.
+
## Build
```bash
From 1fb0bb542828a95bd5163b2606dcdb562168c0d6 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 22:50:52 +0400
Subject: [PATCH 154/239] Update README.md
---
README.md | 52 ----------------------------------------------------
1 file changed, 52 deletions(-)
diff --git a/README.md b/README.md
index 680ef01e7..dab9c529a 100644
--- a/README.md
+++ b/README.md
@@ -1,57 +1,5 @@
# Java Apereo CAS Client [](https://maven-badges.herokuapp.com/maven-central/org.jasig.cas/cas-server)
-
-
-- [Intro][intro]
-- [Components][components]
-- [Configurtion][configurtion]
- - [Client Configuration Using `web.xml`][client-configuration-using-webxml]
- - [org.jasig.cas.client.authentication.AuthenticationFilter][orgjasigcasclientauthenticationauthenticationfilter]
- - [org.jasig.cas.client.authentication.Saml11AuthenticationFilter][orgjasigcasclientauthenticationsaml11authenticationfilter]
- - [rg.jasig.cas.client.validation.Cas10TicketValidationFilter][rgjasigcasclientvalidationcas10ticketvalidationfilter]
- - [org.jasig.cas.client.validation.Saml11TicketValidationFilter][orgjasigcasclientvalidationsaml11ticketvalidationfilter]
- - [org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter][orgjasigcasclientvalidationcas20proxyreceivingticketvalidationfilter]
- - [org.jasig.cas.client.validation.Cas30ProxyReceivingTicketValidationFilter][orgjasigcasclientvalidationcas30proxyreceivingticketvalidationfilter]
- - [org.jasig.cas.client.util.HttpServletRequestWrapperFilter][orgjasigcasclientutilhttpservletrequestwrapperfilter]
- - [org.jasig.cas.client.util.AssertionThreadLocalFilter][orgjasigcasclientutilassertionthreadlocalfilter]
- - [Client Configuration Using Spring][client-configuration-using-spring]
- - [Bean Configuration][bean-configuration]
- - [Client Configuration Using JNDI][client-configuration-using-jndi]
- - [Example][example]
- - [Configuring Single Sign Out][configuring-single-sign-out]
- - [Configuration][configuration]
- - [CAS Protocol][cas-protocol]
- - [SAML Protocol][saml-protocol]
- - [Recommend Logout Procedure][recommend-logout-procedure]
-- [JAAS][jaas]
- - [Configure CasLoginModule][configure-casloginmodule]
- - [Programmatic JAAS login using the Servlet 3][programmatic-jaas-login-using-the-servlet-3]
-- [JBoss Integration][jboss-integration]
- - [Configure Servlet Filters][configure-servlet-filters]
-- [Tomcat 6/7 Integration][tomcat-67-integration]
- - [Component Overview][component-overview]
- - [Authenticators][authenticators]
- - [Realms][realms]
- - [Valves][valves]
- - [Container Setup][container-setup]
- - [Context Configuration][context-configuration]
-- [Atlassian Integration][atlassian-integration]
- - [Configuration][configuration-1]
- - [$JIRA_HOME Location][jira_home-location]
- - [$CONFLUENCE_INSTALL Description][confluence_install-description]
- - [Changes to web.xml][changes-to-webxml]
- - [Modify the seraph-config.xml][modify-the-seraph-configxml]
- - [CAS Authenticator][cas-authenticator]
- - [Confluence CAS Logout][confluence-cas-logout]
- - [Copy Jars][copy-jars]
-- [Spring Security Integration][spring-security-integration]
- - [Changes to web.xml][changes-to-webxml-1]
- - [Changes to applicationContext-security.xml][changes-to-applicationcontext-securityxml]
-- [Build][build]
-
-
-
-
## Intro
This is the official home of the Java Apereo CAS client. The client consists of a collection of Servlet filters that are suitable for most Java-based web applications. It also serves as an API platform to interact with the CAS server programmatically to make authentication requests, validate tickets and consume principal attributes.
From d68849dd1504bc98f8386daa48c431ffdcc6d181 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 23:08:50 +0400
Subject: [PATCH 155/239] Update README.md
---
README.md | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index dab9c529a..39839417e 100644
--- a/README.md
+++ b/README.md
@@ -92,6 +92,35 @@ All client artifacts are published to Maven central. Depending on functionality,
## Configurtion
+### Strategies
+The client provide multiple strategies/options for the deployer to provide options and settings. The following strategies are supported:
+
+- JNDI (`JNDI`)
+- Properties File (`PROPERTY_FILE`). The configuration is provided via an external properties file. The path may be specified in the web context as such:
+
+```xml
+
+ configFileLocation
+ /etc/cas/file.properties
+
+```
+If no location is specified, by default `/etc/java-cas-client.properties` will be used.
+
+- System Properties (`SYSTEM_PROPERTIES`)
+- Web Context (`WEB_XML`)
+- Default (`DEFAULT`)
+
+In order to instruct the client to pick a strategy, strategy name must be specified in the web application's context:
+
+```xml
+
+ configurationStrategy
+ DEFAULT
+
+```
+
+If no `configurationStrategy` is defined, `DEFAULT` is used which is a combination of `WEB_XML` and `JNDI`.
+
### Client Configuration Using `web.xml`
@@ -270,7 +299,6 @@ Validates the tickets using the CAS 2.0 protocol. If you provide either the `acc
| `ticketValidatorClass` | Ticket validator class to use/create | No
| `hostnameVerifier` | Hostname verifier class name, used when making back-channel calls | No
-
#### org.jasig.cas.client.validation.Cas30ProxyReceivingTicketValidationFilter
Validates the tickets using the CAS 3.0 protocol. If you provide either the `acceptAnyProxy` or the `allowedProxyChains` parameters, a `Cas30ProxyTicketValidator` will be constructed. Otherwise a general `Cas30ServiceTicketValidator` will be constructed that does not accept proxy tickets. Supports all configurations that are available for `Cas20ProxyReceivingTicketValidationFilter`.
@@ -526,7 +554,6 @@ The Single Sign Out support in CAS consists of configuring one `SingleSignOutFil
The `SingleSignOutFilter` can affect character encoding. This becomes most obvious when used in conjunction with applications such as Atlassian Confluence. Its recommended you explicitly configure either the [VT Character Encoding Filter](http://code.google.com/p/vt-middleware/wiki/vtservletfilters#CharacterEncodingFilter) or the [Spring Character Encoding Filter](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/CharacterEncodingFilter.html) with explicit encodings.
-
#### Configuration
| Property | Description | Required
@@ -632,7 +659,6 @@ cas {
| `cacheTimeout` | Assertion cache timeout in minutes. | No
| `tolerance` | The tolerance for drifting clocks when validating SAML tickets. | No
-
### Programmatic JAAS login using the Servlet 3
A `org.jasig.cas.client.jaas.Servlet3AuthenticationFilter` servlet filter that performs a programmatic JAAS login using the Servlet 3.0 `HttpServletRequest#login()` facility. This component should be compatible with any servlet container that supports the Servlet 3.0/JEE6 specification.
@@ -864,7 +890,7 @@ The following example shows how to configure a Context for dynamic role data pro
## Atlassian Integration
The clien includes Atlassian Confluence and JIRA support. Support is enabled by a custom CAS authenticator that extends the default authenticators.
-
+
### Configuration
From 6e22c2748b2b03ee61530d7ef51fba46a5856913 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sat, 23 May 2015 23:09:30 +0400
Subject: [PATCH 156/239] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 39839417e..b99a84466 100644
--- a/README.md
+++ b/README.md
@@ -90,7 +90,7 @@ All client artifacts are published to Maven central. Depending on functionality,
```
-## Configurtion
+## Configuration
### Strategies
The client provide multiple strategies/options for the deployer to provide options and settings. The following strategies are supported:
From 916813f76a42048edc43bf3bc973ba493ec86525 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 24 May 2015 18:59:20 +0400
Subject: [PATCH 157/239] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index b99a84466..d21ecef39 100644
--- a/README.md
+++ b/README.md
@@ -93,7 +93,7 @@ All client artifacts are published to Maven central. Depending on functionality,
## Configuration
### Strategies
-The client provide multiple strategies/options for the deployer to provide options and settings. The following strategies are supported:
+The client provides multiple strategies for the deployer to provide client settings. The following strategies are supported:
- JNDI (`JNDI`)
- Properties File (`PROPERTY_FILE`). The configuration is provided via an external properties file. The path may be specified in the web context as such:
@@ -124,7 +124,7 @@ If no `configurationStrategy` is defined, `DEFAULT` is used which is a combinati
### Client Configuration Using `web.xml`
-The client can be configured via `web.xml` via a series of `context-param`s and filter `init-param`s. Each filter for the client has a required (and optional) set of properties. The filters are designed to look for these properties in the following way:
+The client can be configured in `web.xml` via a series of `context-param`s and filter `init-param`s. Each filter for the client has a required (and optional) set of properties. The filters are designed to look for these properties in the following way:
- Check the filter's local `init-param`s for a parameter matching the required property name.
- Check the `context-param`s for a parameter matching the required property name.
From 3080484a885987e4043ab10805cbd28ac0771d44 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Fri, 5 Jun 2015 15:17:04 -0700
Subject: [PATCH 158/239] updated param building
---
.../src/main/java/org/jasig/cas/client/util/URIBuilder.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
index 5cad25701..ef0db5278 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
@@ -75,7 +75,7 @@ public URIBuilder(final boolean encode) {
* Construct an instance from the string which must be a valid URI.
*
* @param string a valid URI in string form
- * @throws URISyntaxException if the input is not a valid URI
+ * @throws RuntimeException if the input is not a valid URI
*/
public URIBuilder(final String string) {
super();
@@ -99,7 +99,7 @@ public URIBuilder(final String string, boolean encode) {
/**
* Construct an instance from the provided URI.
- * @param uri
+ * @param uri the uri to digest
*/
public URIBuilder(final URI uri) {
super();
@@ -354,7 +354,7 @@ public URIBuilder setParameters(final String queryParameters) {
*
*/
public URIBuilder addParameters(final List nvps) {
- if (this.queryParams == null) {
+ if (this.queryParams == null || this.queryParams.isEmpty()) {
this.queryParams = new ArrayList();
}
this.queryParams.addAll(nvps);
From cb4f1f9bacedd83e45095a64c6409184dda0d7be Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 7 Jun 2015 13:18:19 -0700
Subject: [PATCH 159/239] deprecated unused const
---
.../jasig/cas/client/configuration/ConfigurationKeys.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
index 9418151d1..14ec12062 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
@@ -54,6 +54,12 @@ public interface ConfigurationKeys {
ConfigurationKey CAS_SERVER_URL_PREFIX = new ConfigurationKey("casServerUrlPrefix", null);
ConfigurationKey ENCODING = new ConfigurationKey("encoding", null);
ConfigurationKey TOLERANCE = new ConfigurationKey("tolerance", 1000L);
+
+ /**
+ * @deprecated As of 3.4. This constant is not used by the client and will
+ * be removed in future versions.
+ */
+ @Deprecated
ConfigurationKey DISABLE_XML_SCHEMA_VALIDATION = new ConfigurationKey("disableXmlSchemaValidation", Boolean.FALSE);
ConfigurationKey IGNORE_PATTERN = new ConfigurationKey("ignorePattern", null);
ConfigurationKey IGNORE_URL_PATTERN_TYPE = new ConfigurationKey("ignoreUrlPatternType", "REGEX");
From 80840842ad344653493f90ecf39a8c3e1a9e7a6d Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 7 Jun 2015 13:24:12 -0700
Subject: [PATCH 160/239] upgrade to commons-lang3 v3.4
---
cas-client-core/pom.xml | 6 +++---
.../cas/client/configuration/BaseConfigurationStrategy.java | 4 ++--
.../org/jasig/cas/client/session/SingleSignOutHandler.java | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index e8d0a31b0..8e6420b2f 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -29,9 +29,9 @@
- commons-lang
- commons-lang
- 2.6
+ org.apache.commons
+ commons-lang3
+ 3.4
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
index 79872c5c7..dbf4e89be 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
@@ -18,8 +18,8 @@
*/
package org.jasig.cas.client.configuration;
-import org.apache.commons.lang.BooleanUtils;
-import org.apache.commons.lang.math.NumberUtils;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.math.NumberUtils;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
import org.slf4j.Logger;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 162c7b94a..4efc018ba 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -28,7 +28,7 @@
import javax.servlet.http.HttpSession;
import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.jasig.cas.client.Protocol;
import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.util.CommonUtils;
From e31fa763a217210ebae51a601624a7010bde5d2d Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 7 Jun 2015 13:27:32 -0700
Subject: [PATCH 161/239] Create .travis.yml
---
.travis.yml | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 .travis.yml
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..7ac7e80e3
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+#
+# Licensed to Jasig under one or more contributor license
+# agreements. See the NOTICE file distributed with this work
+# for additional information regarding copyright ownership.
+# Jasig licenses this file to you under the Apache License,
+# Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a
+# copy of the License at the following location:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+before_install:
+- mvn -v
+- java -version
+script: mvn install
+language: java
From ceaf323ae0eb4c3ed1ee36bc3ede2ef0dd3047df Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 7 Jun 2015 13:29:05 -0700
Subject: [PATCH 162/239] Update README.md
---
README.md | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index d21ecef39..8399606f9 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,19 @@ This is the official home of the Java Apereo CAS client. The client consists of
All client artifacts are published to Maven central. Depending on functionality, applications will need include one or more of the listed dependencies in their configuration.
+
+## Build [](https://travis-ci.org/Jasig/java-cas-client)
+
+```bash
+git clone git@github.com:Jasig/java-cas-client.git
+cd java-cas-client
+mvn clean package
+```
+
+Please note that to be deployed in Maven Central, we mark a number of JARs as provided (related to JBoss and Memcache
+Clients). In order to build the clients, you must enable the commented out repositories in the appropriate `pom.xml`
+files in the modules (`cas-client-integration-jboss` and `cas-client-support-distributed-memcached`) or follow the instructions on how to install the file manually.
+
## Components
@@ -1186,16 +1199,3 @@ The important additions to the `web.xml` include the addition of the 403 error p
1. You should replace the `userService` with something that checks your user storage.
2. Replace the `serverName` and `casServerLoginUrl` with your values (or better yet, externalize them).
3. Replace the URLs with the URL configuration for your application.
-
-
-## Build
-
-```bash
-git clone git@github.com:Jasig/java-cas-client.git
-cd java-cas-client
-mvn clean package
-```
-
-Please note that to be deployed in Maven Central, we mark a number of JARs as provided (related to JBoss and Memcache
-Clients). In order to build the clients, you must enable the commented out repositories in the appropriate `pom.xml`
-files in the modules (`cas-client-integration-jboss` and `cas-client-support-distributed-memcached`) or follow the instructions on how to install the file manually.
From 973b1340b8c0d701183b20fcf288f976ff95fa5e Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 7 Jun 2015 17:05:47 -0700
Subject: [PATCH 163/239] added additional logs to proxy validation
---
.../validation/Cas20ProxyTicketValidator.java | 21 ++++++++++++++++++-
.../validation/Cas30ProxyTicketValidator.java | 2 +-
.../cas/client/validation/ProxyList.java | 2 +-
3 files changed, 22 insertions(+), 3 deletions(-)
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
index 592c33049..c97cf216c 100644
--- 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
@@ -18,6 +18,7 @@
*/
package org.jasig.cas.client.validation;
+import java.util.Arrays;
import java.util.List;
import org.jasig.cas.client.util.XmlUtils;
@@ -53,8 +54,22 @@ protected void customParseResponse(final String response, final Assertion assert
throws TicketValidationException {
final List proxies = XmlUtils.getTextForElements(response, "proxy");
+ if (proxies == null) {
+ throw new InvalidProxyChainTicketValidationException(
+ "Invalid proxy chain: No proxy could be retrieved from response. "
+ + "This indicates a problem with CAS validation. Review logs/configuration to find the root cause."
+ );
+ }
// this means there was nothing in the proxy chain, which is okay
- if ((this.allowEmptyProxyChain && proxies.isEmpty()) || this.acceptAnyProxy) {
+ if ((this.allowEmptyProxyChain && proxies.isEmpty())) {
+ logger.debug("Found an empty proxy chain, permitted by client configuration");
+ return;
+ }
+
+ if (this.acceptAnyProxy) {
+ logger.debug("Client configuration accepts any proxy. "
+ + "It is generally dangerous to use a non-proxied CAS filter "
+ + "specially for protecting resources that require proxy access.");
return;
}
@@ -63,6 +78,10 @@ protected void customParseResponse(final String response, final Assertion assert
return;
}
+ logger.warn("Proxies received from the CAS validation response are {}. "
+ + "However, none are allowed by allowed proxy chain of the client which is {}",
+ Arrays.toString(proxiedList), this.allowedProxyChains);
+
throw new InvalidProxyChainTicketValidationException("Invalid proxy chain: " + proxies.toString());
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyTicketValidator.java
index 2cdb641e7..6dfffc850 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyTicketValidator.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30ProxyTicketValidator.java
@@ -26,7 +26,7 @@
*/
public class Cas30ProxyTicketValidator extends Cas20ProxyTicketValidator {
- public Cas30ProxyTicketValidator(String casServerUrlPrefix) {
+ public Cas30ProxyTicketValidator(final String casServerUrlPrefix) {
super(casServerUrlPrefix);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
index 3585d5b37..35642d313 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/ProxyList.java
@@ -43,7 +43,7 @@ public ProxyList() {
this(new ArrayList());
}
- public boolean contains(String[] proxiedList) {
+ public boolean contains(final String[] proxiedList) {
for (final String[] list : this.proxyChains) {
if (Arrays.equals(proxiedList, list)) {
return true;
From f010d5033dda995c36a45c1e1e056cf70c0ab760 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 10 Jun 2015 20:04:12 -0700
Subject: [PATCH 164/239] removed commons-lang dep
---
cas-client-core/pom.xml | 6 -
.../BaseConfigurationStrategy.java | 8 +-
.../client/session/SingleSignOutHandler.java | 6 +-
.../jasig/cas/client/util/CommonUtils.java | 215 +++++++++++++++++-
4 files changed, 219 insertions(+), 16 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 8e6420b2f..749069ea6 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -28,12 +28,6 @@
-
- org.apache.commons
- commons-lang3
- 3.4
-
-
xml-securityxmlsec
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
index dbf4e89be..0ae9d976e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/BaseConfigurationStrategy.java
@@ -18,8 +18,6 @@
*/
package org.jasig.cas.client.configuration;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.math.NumberUtils;
import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.util.ReflectUtils;
import org.slf4j.Logger;
@@ -38,7 +36,7 @@ public abstract class BaseConfigurationStrategy implements ConfigurationStrategy
public final boolean getBoolean(final ConfigurationKey configurationKey) {
return getValue(configurationKey, new Parser() {
public Boolean parse(final String value) {
- return BooleanUtils.toBoolean(value);
+ return CommonUtils.toBoolean(value);
}
});
}
@@ -46,7 +44,7 @@ public Boolean parse(final String value) {
public final long getLong(final ConfigurationKey configurationKey) {
return getValue(configurationKey, new Parser() {
public Long parse(final String value) {
- return NumberUtils.toLong(value, configurationKey.getDefaultValue());
+ return CommonUtils.toLong(value, configurationKey.getDefaultValue());
}
});
}
@@ -54,7 +52,7 @@ public Long parse(final String value) {
public final int getInt(final ConfigurationKey configurationKey) {
return getValue(configurationKey, new Parser() {
public Integer parse(final String value) {
- return NumberUtils.toInt(value, configurationKey.getDefaultValue());
+ return CommonUtils.toInt(value, configurationKey.getDefaultValue());
}
});
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 4efc018ba..5d07095cc 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -28,7 +28,6 @@
import javax.servlet.http.HttpSession;
import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
import org.jasig.cas.client.Protocol;
import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.util.CommonUtils;
@@ -301,8 +300,7 @@ private void destroySession(final HttpServletRequest request) {
final HttpSession session = this.sessionMappingStorage.removeSessionByMappingId(token);
if (session != null) {
- String sessionID = session.getId();
-
+ final String sessionID = session.getId();
logger.debug("Invalidating session [{}] for token [{}]", sessionID, token);
try {
@@ -325,7 +323,7 @@ private void destroySession(final HttpServletRequest request) {
private String computeRedirectionToServer(final HttpServletRequest request) {
final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName);
// if we have a state value -> redirect to the CAS server to continue the logout process
- if (StringUtils.isNotBlank(relayStateValue)) {
+ if (CommonUtils.isNotBlank(relayStateValue)) {
final StringBuilder buffer = new StringBuilder();
buffer.append(casServerUrlPrefix);
if (!this.casServerUrlPrefix.endsWith("/")) {
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 95eff5150..295bc09bb 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -447,7 +447,7 @@ public static void sendRedirect(final HttpServletResponse response, final String
/**
* Unconditionally close a {@link Closeable}. Equivalent to {@link java.io.Closeable#close()}close(), except any exceptions
* will be ignored. This is typically used in finally blocks.
- * @param resource
+ * @param resource the resource to close
*/
public static void closeQuietly(final Closeable resource) {
try {
@@ -458,4 +458,217 @@ public static void closeQuietly(final Closeable resource) {
//ignore
}
}
+
+ /**
+ *
Converts a String to a boolean (optimised for performance).
+ *
+ *
{@code 'true'}, {@code 'on'}, {@code 'y'}, {@code 't'} or {@code 'yes'}
+ * (case insensitive) will return {@code true}. Otherwise,
+ * {@code false} is returned.
+ *
+ *
This method performs 4 times faster (JDK1.4) than
+ * {@code Boolean.valueOf(String)}. However, this method accepts
+ * 'on' and 'yes', 't', 'y' as true values.
+ *
+ *
+ *
+ * @param str the String to check
+ * @return the boolean value of the string, {@code false} if no match or the String is null
+ */
+ public static boolean toBoolean(final String str) {
+ return toBooleanObject(str) == Boolean.TRUE;
+ }
+
+ /**
+ *
Converts a String to a Boolean.
+ *
+ *
{@code 'true'}, {@code 'on'}, {@code 'y'}, {@code 't'} or {@code 'yes'}
+ * (case insensitive) will return {@code true}.
+ * {@code 'false'}, {@code 'off'}, {@code 'n'}, {@code 'f'} or {@code 'no'}
+ * (case insensitive) will return {@code false}.
+ * Otherwise, {@code null} is returned.
+ *
+ *
NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.
+ *
+ *
+ * // N.B. case is not significant
+ * BooleanUtils.toBooleanObject(null) = null
+ * BooleanUtils.toBooleanObject("true") = Boolean.TRUE
+ * BooleanUtils.toBooleanObject("T") = Boolean.TRUE // i.e. T[RUE]
+ * BooleanUtils.toBooleanObject("false") = Boolean.FALSE
+ * BooleanUtils.toBooleanObject("f") = Boolean.FALSE // i.e. f[alse]
+ * BooleanUtils.toBooleanObject("No") = Boolean.FALSE
+ * BooleanUtils.toBooleanObject("n") = Boolean.FALSE // i.e. n[o]
+ * BooleanUtils.toBooleanObject("on") = Boolean.TRUE
+ * BooleanUtils.toBooleanObject("ON") = Boolean.TRUE
+ * BooleanUtils.toBooleanObject("off") = Boolean.FALSE
+ * BooleanUtils.toBooleanObject("oFf") = Boolean.FALSE
+ * BooleanUtils.toBooleanObject("yes") = Boolean.TRUE
+ * BooleanUtils.toBooleanObject("Y") = Boolean.TRUE // i.e. Y[ES]
+ * BooleanUtils.toBooleanObject("blue") = null
+ * BooleanUtils.toBooleanObject("true ") = null // trailing space (too long)
+ * BooleanUtils.toBooleanObject("ono") = null // does not match on or no
+ *
+ *
+ * @param str the String to check; upper and lower case are treated as the same
+ * @return the Boolean value of the string, {@code null} if no match or {@code null} input
+ */
+ public static Boolean toBooleanObject(final String str) {
+ // Previously used equalsIgnoreCase, which was fast for interned 'true'.
+ // Non interned 'true' matched 15 times slower.
+ //
+ // Optimisation provides same performance as before for interned 'true'.
+ // Similar performance for null, 'false', and other strings not length 2/3/4.
+ // 'true'/'TRUE' match 4 times slower, 'tRUE'/'True' 7 times slower.
+ if (str == "true") {
+ return Boolean.TRUE;
+ }
+ if (str == null) {
+ return null;
+ }
+ switch (str.length()) {
+ case 1: {
+ final char ch0 = str.charAt(0);
+ if (ch0 == 'y' || ch0 == 'Y' ||
+ ch0 == 't' || ch0 == 'T') {
+ return Boolean.TRUE;
+ }
+ if (ch0 == 'n' || ch0 == 'N' ||
+ ch0 == 'f' || ch0 == 'F') {
+ return Boolean.FALSE;
+ }
+ break;
+ }
+ case 2: {
+ final char ch0 = str.charAt(0);
+ final char ch1 = str.charAt(1);
+ if ((ch0 == 'o' || ch0 == 'O') &&
+ (ch1 == 'n' || ch1 == 'N') ) {
+ return Boolean.TRUE;
+ }
+ if ((ch0 == 'n' || ch0 == 'N') &&
+ (ch1 == 'o' || ch1 == 'O') ) {
+ return Boolean.FALSE;
+ }
+ break;
+ }
+ case 3: {
+ final char ch0 = str.charAt(0);
+ final char ch1 = str.charAt(1);
+ final char ch2 = str.charAt(2);
+ if ((ch0 == 'y' || ch0 == 'Y') &&
+ (ch1 == 'e' || ch1 == 'E') &&
+ (ch2 == 's' || ch2 == 'S') ) {
+ return Boolean.TRUE;
+ }
+ if ((ch0 == 'o' || ch0 == 'O') &&
+ (ch1 == 'f' || ch1 == 'F') &&
+ (ch2 == 'f' || ch2 == 'F') ) {
+ return Boolean.FALSE;
+ }
+ break;
+ }
+ case 4: {
+ final char ch0 = str.charAt(0);
+ final char ch1 = str.charAt(1);
+ final char ch2 = str.charAt(2);
+ final char ch3 = str.charAt(3);
+ if ((ch0 == 't' || ch0 == 'T') &&
+ (ch1 == 'r' || ch1 == 'R') &&
+ (ch2 == 'u' || ch2 == 'U') &&
+ (ch3 == 'e' || ch3 == 'E') ) {
+ return Boolean.TRUE;
+ }
+ break;
+ }
+ case 5: {
+ final char ch0 = str.charAt(0);
+ final char ch1 = str.charAt(1);
+ final char ch2 = str.charAt(2);
+ final char ch3 = str.charAt(3);
+ final char ch4 = str.charAt(4);
+ if ((ch0 == 'f' || ch0 == 'F') &&
+ (ch1 == 'a' || ch1 == 'A') &&
+ (ch2 == 'l' || ch2 == 'L') &&
+ (ch3 == 's' || ch3 == 'S') &&
+ (ch4 == 'e' || ch4 == 'E') ) {
+ return Boolean.FALSE;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ return null;
+ }
+
+ /**
+ *
Convert a String to a long, returning a
+ * default value if the conversion fails.
+ *
+ *
If the string is null, the default value is returned.
+ *
+ * @param str the string to convert, may be null
+ * @param defaultValue the default value
+ * @return the long represented by the string, or the default if conversion fails
+ * @since 2.1
+ */
+ public static long toLong(final String str, final long defaultValue) {
+ if (str == null) {
+ return defaultValue;
+ }
+ try {
+ return Long.parseLong(str);
+ } catch (final NumberFormatException nfe) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ *
Convert a String to an int, returning a
+ * default value if the conversion fails.
+ *
+ *
If the string is null, the default value is returned.
+ *
+ * @param str the string to convert, may be null
+ * @param defaultValue the default value
+ * @return the int represented by the string, or the default if conversion fails
+ * @since 2.1
+ */
+ public static int toInt(final String str, final int defaultValue) {
+ if(str == null) {
+ return defaultValue;
+ }
+ try {
+ return Integer.parseInt(str);
+ } catch (final NumberFormatException nfe) {
+ return defaultValue;
+ }
+ }
}
From d644cdfc20fcf19cbd16cc178a02e2cbec941ab9 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 10 Jun 2015 20:09:15 -0700
Subject: [PATCH 165/239] removed since tags
---
.../src/main/java/org/jasig/cas/client/util/CommonUtils.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 295bc09bb..d5df52486 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -631,7 +631,6 @@ public static Boolean toBooleanObject(final String str) {
* @param str the string to convert, may be null
* @param defaultValue the default value
* @return the long represented by the string, or the default if conversion fails
- * @since 2.1
*/
public static long toLong(final String str, final long defaultValue) {
if (str == null) {
@@ -659,7 +658,6 @@ public static long toLong(final String str, final long defaultValue) {
* @param str the string to convert, may be null
* @param defaultValue the default value
* @return the int represented by the string, or the default if conversion fails
- * @since 2.1
*/
public static int toInt(final String str, final int defaultValue) {
if(str == null) {
From fdc09968f7eb1f90ba11abb410a7ec8fdf151d68 Mon Sep 17 00:00:00 2001
From: Christian Brunotte
Date: Tue, 16 Jun 2015 19:29:16 +0200
Subject: [PATCH 166/239] Added to all web.xml
examples.
---
README.md | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 8399606f9..f7e6b0394 100644
--- a/README.md
+++ b/README.md
@@ -164,6 +164,10 @@ The `AuthenticationFilter` is what detects whether a user needs to be authentica
http://www.acme-client.com
+
+ CAS Authentication Filter
+ /*
+
```
| Property | Description | Required
@@ -197,7 +201,11 @@ The SAML 1.1 `AuthenticationFilter` is what detects whether a user needs to be a
serverNamehttp://www.the-client.com
-
+
+
+ CAS Authentication Filter
+ /*
+
```
| Property | Description | Required
@@ -224,6 +232,10 @@ Validates tickets using the CAS 1.0 Protocol.
https://somewhere.cas.edu:8443/cas
+
+ CAS Validation Filter
+ /*
+
```
| Property | Description | Required
@@ -254,7 +266,11 @@ Validates tickets using the SAML 1.1 protocol.
serverNamehttp://www.acme-client.com
-
+
+
+ CAS Validation Filter
+ /*
+
```
| Property | Description | Required
@@ -289,6 +305,10 @@ Validates the tickets using the CAS 2.0 protocol. If you provide either the `acc
http://www.acme-client.com
+
+ CAS Validation Filter
+ /*
+
```
| Property | Description | Required
@@ -375,6 +395,10 @@ Wraps an `HttpServletRequest` so that the `getRemoteUser` and `getPrincipal` ret
CAS HttpServletRequest Wrapper Filterorg.jasig.cas.client.util.HttpServletRequestWrapperFilter
+
+ CAS HttpServletRequest Wrapper Filter
+ /*
+
```
| Property | Description | Required
@@ -391,6 +415,10 @@ Places the `Assertion` in a `ThreadLocal` for portions of the application that n
CAS Assertion Thread Local Filterorg.jasig.cas.client.util.AssertionThreadLocalFilter
+
+ CAS Assertion Thread Local Filter
+ /*
+
```
@@ -716,6 +744,8 @@ The `WebAuthenticationFilter` performs these operations for the JBoss AS contain
...
+
+...
```
The JAAS LoginModule configuration in `conf/login-config.xml` may require the following changes in a JBoss environment:
From 6ecc03de9d40f9cad5bb5fe25dad8db2cfa7cc3a Mon Sep 17 00:00:00 2001
From: Christian Brunotte
Date: Tue, 16 Jun 2015 19:30:49 +0200
Subject: [PATCH 167/239] missing "<" in example
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f7e6b0394..59c755e2d 100644
--- a/README.md
+++ b/README.md
@@ -630,7 +630,7 @@ The `SingleSignOutFilter` can affect character encoding. This becomes most obvio
#### SAML Protocol
```xml
-filter>
+CAS Single Sign Out Filterorg.jasig.cas.client.session.SingleSignOutFilter
From 300c537db28396caf5b04db3786591f1703dd3d6 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Fri, 10 Jul 2015 08:34:46 -0700
Subject: [PATCH 168/239] Moved build to the new travis environment
---
.travis.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.travis.yml b/.travis.yml
index 7ac7e80e3..5b4e1c78e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,3 +22,4 @@ before_install:
- java -version
script: mvn install
language: java
+sudo: false
From 1d3e8d7f4bd13a19c2efc9154bf03ccb3db6b976 Mon Sep 17 00:00:00 2001
From: Scott
Date: Tue, 21 Jul 2015 22:16:53 -0400
Subject: [PATCH 169/239] Updated NOTICE generation.
---
NOTICE | 56 ++++++-------------
cas-client-core/NOTICE | 42 ++++----------
cas-client-integration-atlassian/NOTICE | 50 ++++++-----------
cas-client-integration-jboss/NOTICE | 43 ++++----------
cas-client-integration-tomcat-common/NOTICE | 43 ++++----------
cas-client-integration-tomcat-v6/NOTICE | 45 +++++----------
cas-client-integration-tomcat-v7/NOTICE | 45 +++++----------
cas-client-support-distributed-ehcache/NOTICE | 43 ++++----------
.../NOTICE | 43 ++++----------
cas-client-support-saml/NOTICE | 30 ++++++++++
10 files changed, 146 insertions(+), 294 deletions(-)
create mode 100644 cas-client-support-saml/NOTICE
diff --git a/NOTICE b/NOTICE
index 44db3d1e4..1011bab71 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,41 +1,33 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
Apache Log4j under The Apache Software License, Version 2.0
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
Apache XML Security under The Apache Software License, Version 2.0
- Bouncy Castle Provider under Bouncy Castle Licence
+ Atlassian Event under Atlassian End User License
+ Atlassian JIRA - Code - Core under Atlassian End User License
+ Atlassian Seraph under Atlassian End User License
+ atlassian-osuser under Atlassian End User License
catalina under Apache License, Version 2.0
- Codec under The Apache Software License, Version 2.0
- com.atlassian.confluence:confluence under Atlassian End User License
- com.atlassian.event:atlassian-event under Atlassian End User License
- com.atlassian.jira:jira-core under Atlassian End User License
- com.atlassian.osuser:atlassian-osuser under Atlassian End User License
- com.atlassian.seraph:atlassian-seraph under Atlassian End User License
Commons Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
+ Confluence Core under Atlassian End User License
Ehcache Core under The Apache Software License, Version 2.0
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
Google Collections Library under The Apache Software License, Version 2.0
- HttpClient under Apache License
Jasig CAS Client for Java under Apache License Version 2.0
Jasig CAS Client for Java - Atlassian Integration under Apache License Version 2.0
Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
@@ -44,6 +36,7 @@ This project includes:
Memcached under Apache License Version 2.0
Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache under Apache License Version 2.0
Jasig CAS Client for Java - JBoss Integration under Apache License Version 2.0
+ Jasig CAS Client for Java - SAML Protocol Support under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 6.x Integration under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
@@ -51,17 +44,10 @@ This project includes:
JavaMail API under Common Development and Distribution License (CDDL) v1.0
JBoss Application Server Tomcat under lgpl
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
+ Joda-Time under Apache 2
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
- Spring Framework: Context under The Apache Software License, Version 2.0
spring-aop under The Apache Software License, Version 2.0
spring-asm under The Apache Software License, Version 2.0
spring-beans under The Apache Software License, Version 2.0
@@ -71,10 +57,4 @@ This project includes:
spring-test under The Apache Software License, Version 2.0
Spymemcached under The Apache Software License, Version 2.0
tomcat-catalina under Apache License, Version 2.0
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
diff --git a/cas-client-core/NOTICE b/cas-client-core/NOTICE
index 2297c6f78..8b26daa03 100644
--- a/cas-client-core/NOTICE
+++ b/cas-client-core/NOTICE
@@ -1,45 +1,31 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
Apache Log4j under The Apache Software License, Version 2.0
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
Apache XML Security under The Apache Software License, Version 2.0
- Bouncy Castle Provider under Bouncy Castle Licence
Commons Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
- HttpClient under Apache License
Jasig CAS Client for Java - Core under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
JavaMail API under Common Development and Distribution License (CDDL) v1.0
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
spring-aop under The Apache Software License, Version 2.0
@@ -49,10 +35,4 @@ This project includes:
spring-core under The Apache Software License, Version 2.0
spring-expression under The Apache Software License, Version 2.0
spring-test under The Apache Software License, Version 2.0
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
diff --git a/cas-client-integration-atlassian/NOTICE b/cas-client-integration-atlassian/NOTICE
index 502f17217..264e83971 100644
--- a/cas-client-integration-atlassian/NOTICE
+++ b/cas-client-integration-atlassian/NOTICE
@@ -1,55 +1,39 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
AOP alliance under Public Domain
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
Atlassian Event under Atlassian End User License
Atlassian JIRA - Code - Core under Atlassian End User License
Atlassian Seraph under Atlassian End User License
atlassian-osuser under Atlassian End User License
- Bouncy Castle Provider under Bouncy Castle Licence
- Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
Confluence Core under Atlassian End User License
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
Google Collections Library under The Apache Software License, Version 2.0
- HttpClient under Apache License
Jasig CAS Client for Java - Atlassian Integration under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
- Spring Framework: Context under The Apache Software License, Version 2.0
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
+ spring-aop under The Apache Software License, Version 2.0
+ spring-asm under The Apache Software License, Version 2.0
+ spring-beans under The Apache Software License, Version 2.0
+ spring-context under The Apache Software License, Version 2.0
+ spring-core under The Apache Software License, Version 2.0
+ spring-expression under The Apache Software License, Version 2.0
diff --git a/cas-client-integration-jboss/NOTICE b/cas-client-integration-jboss/NOTICE
index d37370841..93718dd71 100644
--- a/cas-client-integration-jboss/NOTICE
+++ b/cas-client-integration-jboss/NOTICE
@@ -1,48 +1,27 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
- Bouncy Castle Provider under Bouncy Castle Licence
- Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
- HttpClient under Apache License
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - JBoss Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JBoss Application Server Tomcat under lgpl
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
diff --git a/cas-client-integration-tomcat-common/NOTICE b/cas-client-integration-tomcat-common/NOTICE
index 7c109fcb9..aa5bf99c7 100644
--- a/cas-client-integration-tomcat-common/NOTICE
+++ b/cas-client-integration-tomcat-common/NOTICE
@@ -1,47 +1,26 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
- Bouncy Castle Provider under Bouncy Castle Licence
- Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
- HttpClient under Apache License
Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
diff --git a/cas-client-integration-tomcat-v6/NOTICE b/cas-client-integration-tomcat-v6/NOTICE
index 05565bb8d..9532d55a9 100644
--- a/cas-client-integration-tomcat-v6/NOTICE
+++ b/cas-client-integration-tomcat-v6/NOTICE
@@ -1,49 +1,30 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
- Bouncy Castle Provider under Bouncy Castle Licence
catalina under Apache License, Version 2.0
- Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
- HttpClient under Apache License
Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - SAML Protocol Support under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 6.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
+ Joda-Time under Apache 2
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
diff --git a/cas-client-integration-tomcat-v7/NOTICE b/cas-client-integration-tomcat-v7/NOTICE
index c129bf42d..f5ce3c060 100644
--- a/cas-client-integration-tomcat-v7/NOTICE
+++ b/cas-client-integration-tomcat-v7/NOTICE
@@ -1,49 +1,30 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
- Bouncy Castle Provider under Bouncy Castle Licence
- Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
- HttpClient under Apache License
Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - SAML Protocol Support under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
+ Joda-Time under Apache 2
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
tomcat-catalina under Apache License, Version 2.0
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
diff --git a/cas-client-support-distributed-ehcache/NOTICE b/cas-client-support-distributed-ehcache/NOTICE
index e355d62bb..1ccc84be8 100644
--- a/cas-client-support-distributed-ehcache/NOTICE
+++ b/cas-client-support-distributed-ehcache/NOTICE
@@ -1,48 +1,27 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
- Bouncy Castle Provider under Bouncy Castle Licence
- Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
Ehcache Core under The Apache Software License, Version 2.0
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
- HttpClient under Apache License
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
diff --git a/cas-client-support-distributed-memcached/NOTICE b/cas-client-support-distributed-memcached/NOTICE
index 2fe29a890..ac2d7c0d7 100644
--- a/cas-client-support-distributed-memcached/NOTICE
+++ b/cas-client-support-distributed-memcached/NOTICE
@@ -1,49 +1,28 @@
-Copyright 2010, JA-SIG, Inc.
-This project includes software developed by Jasig.
-http://www.jasig.org/
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
-Licensed under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on
-an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
This project includes:
- "Java Concurrency in Practice" book annotations under Creative Commons Attribution License
- Apache Santuario under The Apache Software License, Version 2.0
- Apache Velocity under The Apache Software License, Version 2.0
- Bouncy Castle Provider under Bouncy Castle Licence
- Codec under The Apache Software License, Version 2.0
- commons-collections under Apache License, Version 2.0
- ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
- HttpClient under Apache License
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - Distributed Proxy Storage Support:
Memcached under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JCL 1.1.1 implemented over SLF4J under MIT License
- Joda time under Apache 2
- JUL to SLF4J bridge under MIT License
JUnit under Common Public License Version 1.0
- Lang under The Apache Software License, Version 2.0
- Log4j Implemented Over SLF4J under Apache Software Licenses
- Not Yet Commons SSL under Apache License v2
- OpenSAML-J under Apache 2
- OpenWS under Apache 2
SLF4J API Module under MIT License
SLF4J Simple Binding under MIT License
Spymemcached under The Apache Software License, Version 2.0
- Xalan Java under The Apache Software License, Version 2.0
- Xalan Java Serializer under The Apache Software License, Version 2.0
- Xerces2-j under The Apache Software License, Version 2.0
- XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License
- XML Commons Resolver Component under The Apache Software License, Version 2.0
- XMLTooling-J under Apache 2
diff --git a/cas-client-support-saml/NOTICE b/cas-client-support-saml/NOTICE
new file mode 100644
index 000000000..bab9bec52
--- /dev/null
+++ b/cas-client-support-saml/NOTICE
@@ -0,0 +1,30 @@
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - SAML Protocol Support under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda-Time under Apache 2
+ JUnit under Common Public License Version 1.0
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ spring-asm under The Apache Software License, Version 2.0
+ spring-core under The Apache Software License, Version 2.0
+ spring-test under The Apache Software License, Version 2.0
+
From 0287c5000de4f10cbac33b85b08130c1eb23aa97 Mon Sep 17 00:00:00 2001
From: Scott
Date: Tue, 21 Jul 2015 22:19:00 -0400
Subject: [PATCH 170/239] Added missing license headers
---
.../org/jasig/cas/client/util/IOUtils.java | 18 +++++++++++++++++
.../cas/client/util/MapNamespaceContext.java | 18 +++++++++++++++++
.../util/ThreadLocalXPathExpression.java | 18 +++++++++++++++++
.../META-INF/cas/samlRequestTemplate.xml | 20 +++++++++++++++++++
4 files changed, 74 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
index b003775c4..d1d82f76f 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/IOUtils.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.util;
import java.io.*;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
index 6eb5b628e..0afac39dc 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/MapNamespaceContext.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.util;
import javax.xml.namespace.NamespaceContext;
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
index 2e51c0c90..e0d9b5dc9 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ThreadLocalXPathExpression.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jasig.cas.client.util;
import org.w3c.dom.NodeList;
diff --git a/cas-client-core/src/main/resources/META-INF/cas/samlRequestTemplate.xml b/cas-client-core/src/main/resources/META-INF/cas/samlRequestTemplate.xml
index 4247909f2..a67501025 100644
--- a/cas-client-core/src/main/resources/META-INF/cas/samlRequestTemplate.xml
+++ b/cas-client-core/src/main/resources/META-INF/cas/samlRequestTemplate.xml
@@ -1,3 +1,23 @@
+
From 775eeb2fe106f1bc50e375a43fec0c301ff62883 Mon Sep 17 00:00:00 2001
From: Scott
Date: Tue, 21 Jul 2015 22:42:41 -0400
Subject: [PATCH 171/239] Fixed licenses
---
.../src/main/java/org/jasig/cas/client/util/SamlUtils.java | 5 ++---
.../test/java/org/jasig/cas/client/util/SamlUtilsTest.java | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/cas-client-support-saml/src/main/java/org/jasig/cas/client/util/SamlUtils.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/util/SamlUtils.java
index 8e74a71fa..55b1bfe62 100644
--- a/cas-client-support-saml/src/main/java/org/jasig/cas/client/util/SamlUtils.java
+++ b/cas-client-support-saml/src/main/java/org/jasig/cas/client/util/SamlUtils.java
@@ -6,9 +6,9 @@
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
- * *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- * *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import java.util.Date;
diff --git a/cas-client-support-saml/src/test/java/org/jasig/cas/client/util/SamlUtilsTest.java b/cas-client-support-saml/src/test/java/org/jasig/cas/client/util/SamlUtilsTest.java
index bd42201e7..3958e24ac 100644
--- a/cas-client-support-saml/src/test/java/org/jasig/cas/client/util/SamlUtilsTest.java
+++ b/cas-client-support-saml/src/test/java/org/jasig/cas/client/util/SamlUtilsTest.java
@@ -6,9 +6,9 @@
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
- * *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- * *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.jasig.cas.client.util;
import java.util.Date;
From 02aa3da8dea78f0dd57c43acab149ae6a9ffde1b Mon Sep 17 00:00:00 2001
From: Scott
Date: Tue, 21 Jul 2015 22:57:26 -0400
Subject: [PATCH 172/239] [maven-release-plugin] prepare release
cas-client-3.4.0
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
cas-client-support-saml/pom.xml | 2 +-
pom.xml | 4 ++--
10 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 749069ea6..b9cde165c 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.0cas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 009a58d06..2b9b93ca4 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.0cas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 43c24da56..ebb260889 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.0cas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 13c23179c..ac678b1d7 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.04.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index d7dd9bd4e..90d5612bc 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.04.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 0c83322c2..0e97c3475 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.04.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index c4bcde0c5..1bdb68cf4 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.04.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 3a1cb2ad1..b0c873254 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.04.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index 6c68d4387..14a763c08 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.0cas-client4.0.0
diff --git a/pom.xml b/pom.xml
index e17ab1036..42f5f579e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.4.0-SNAPSHOT
+ 3.4.0cas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- HEAD
+ cas-client-3.4.02006
From 1aec723f3eb929c9946bf56d2fd6da12bf9b40d3 Mon Sep 17 00:00:00 2001
From: Scott
Date: Tue, 21 Jul 2015 22:57:28 -0400
Subject: [PATCH 173/239] [maven-release-plugin] prepare for next development
iteration
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
cas-client-support-saml/pom.xml | 2 +-
pom.xml | 4 ++--
10 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index b9cde165c..522f05acc 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 2b9b93ca4..53b1f1540 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index ebb260889..c0113c27b 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index ac678b1d7..4a688a8f7 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 90d5612bc..ce874f264 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 0e97c3475..7399f8c6a 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index 1bdb68cf4..b8e6db191 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index b0c873254..fcabc69c6 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOT4.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index 14a763c08..26aef5b6c 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOTcas-client4.0.0
diff --git a/pom.xml b/pom.xml
index 42f5f579e..ac95973c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.4.0
+ 3.4.1-SNAPSHOTcas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- cas-client-3.4.0
+ HEAD2006
From a9240f0cdaa19c683be2d19452ad913e6770f365 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Tue, 28 Jul 2015 08:42:33 +0200
Subject: [PATCH 174/239] Deploy SNAPSHOTs to Sonatype
---
.travis.yml | 17 ++++++++++++++++-
travis/deploy-to-sonatype.sh | 7 +++++++
travis/settings.xml | 21 +++++++++++++++++++++
3 files changed, 44 insertions(+), 1 deletion(-)
create mode 100644 travis/deploy-to-sonatype.sh
create mode 100644 travis/settings.xml
diff --git a/.travis.yml b/.travis.yml
index 5b4e1c78e..8357e8eda 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,6 +20,21 @@
before_install:
- mvn -v
- java -version
-script: mvn install
+
language: java
+
sudo: false
+
+script: "mvn install --settings travis/settings.xml"
+
+jdk:
+ - oraclejdk7
+
+env:
+ global:
+ - secure: "JM/FMiec3GYShrMlJQSW2QG208+V0GCAj2bsP5eF8q4yzgp6o4rT+r57KDIDD6MapRN+G1Pnl3WPcS0aQYnwOhPg4tA2De1bFUPaJltP47eHFfblpjZeHMxcauCQ6BwFFr8yuC0ORsYCW3TOK00Mxq4CRlTlg5iclzHyS/pnkLI="
+ - secure: "eXfgf3v8Kw/L22DO39Y61os13bfNpop8Xpkmz+HZ1djQWavOkRn58gSg8EVjBYRPOrTuEbhEWb+s3qpx8j3qRdi6roMs9MTr5gEPTAyjTtJ/Zv1qhJ6OlEl2w5c2fRMsk5cB//mtxtZ+qMaz6sdZI2csbQ2xlhjz4AbGQL5i1lY="
+
+after_success:
+- chmod -R 777 ./travis/deploy-to-sonatype.sh
+- ./travis/deploy-to-sonatype.sh
diff --git a/travis/deploy-to-sonatype.sh b/travis/deploy-to-sonatype.sh
new file mode 100644
index 000000000..80f2154e3
--- /dev/null
+++ b/travis/deploy-to-sonatype.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# Only invoke the deployment to Sonatype when it's not a PR and only for master
+if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
+ mvn deploy --settings travis/settings.xml
+ echo -e "Successfully deployed SNAPSHOT artifacts to Sonatype under Travis job ${TRAVIS_JOB_NUMBER}"
+fi
diff --git a/travis/settings.xml b/travis/settings.xml
new file mode 100644
index 000000000..de99f7713
--- /dev/null
+++ b/travis/settings.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+ sonatype-nexus-snapshots
+ ${env.SONATYPE_USER}
+ ${env.SONATYPE_PWD}
+
+
+
+
+
+
+
From 09b2b7dd905c6be85de32e76ba1c5360dbf5cba8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Tue, 28 Jul 2015 09:29:27 +0200
Subject: [PATCH 175/239] Update README with 3.4 features
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 59c755e2d..91d9fbb7d 100644
--- a/README.md
+++ b/README.md
@@ -321,7 +321,7 @@ Validates the tickets using the CAS 2.0 protocol. If you provide either the `acc
| `exceptionOnValidationFailure ` | whether to throw an exception or not on ticket validation failure. Defaults to `true` | No
| `proxyReceptorUrl ` | The URL to watch for `PGTIOU/PGT` responses from the CAS server. Should be defined from the root of the context. For example, if your application is deployed in `/cas-client-app` and you want the proxy receptor URL to be `/cas-client-app/my/receptor` you need to configure proxyReceptorUrl to be `/my/receptor`. | No
| `acceptAnyProxy ` | Specifies whether any proxy is OK. Defaults to `false`. | No
-| `allowedProxyChains ` | Specifies the proxy chain. Each acceptable proxy chain should include a space-separated list of URLs. Each acceptable proxy chain should appear on its own line. | No
+| `allowedProxyChains ` | Specifies the proxy chain. Each acceptable proxy chain should include a space-separated list of URLs (for exact match) or regular expressions of URLs (starting by the `^` character). Each acceptable proxy chain should appear on its own line. | No
| `proxyCallbackUrl` | The callback URL to provide the CAS server to accept Proxy Granting Tickets. | No
| `proxyGrantingTicketStorageClass ` | Specify an implementation of the ProxyGrantingTicketStorage class that has a no-arg constructor. | No
| `sslConfigFile` | A reference to a properties file that includes SSL settings for client-side SSL config, used during back-channel calls. The configuration includes keys for `protocol` which defaults to `SSL`, `keyStoreType`, `keyStorePath`, `keyStorePass`, `keyManagerType` which defaults to `SunX509` and `certificatePassword`. | No.
From ce06a4fd919fd5a22322cd12c8eb16e25eb8217c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Thu, 30 Jul 2015 11:05:12 +0200
Subject: [PATCH 176/239] using the old Travis infrastructure (no container)
---
.travis.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 8357e8eda..e5c3fda62 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,8 +23,6 @@ before_install:
language: java
-sudo: false
-
script: "mvn install --settings travis/settings.xml"
jdk:
From 531f22e2c1070e3563625bfa3182bfdefaf6c203 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Thu, 30 Jul 2015 11:23:47 +0200
Subject: [PATCH 177/239] Revert "using the old Travis infrastructure (no
container)"
This reverts commit ce06a4fd919fd5a22322cd12c8eb16e25eb8217c.
---
.travis.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index e5c3fda62..8357e8eda 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,6 +23,8 @@ before_install:
language: java
+sudo: false
+
script: "mvn install --settings travis/settings.xml"
jdk:
From a63dac8bc6117a21f9506c3a1fc5f719bef25c36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Fri, 31 Jul 2015 17:02:21 +0200
Subject: [PATCH 178/239] Upgrade to Java 6
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index ac95973c2..0233fc220 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,8 +76,8 @@
maven-compiler-plugin3.0
- 1.5
- 1.5
+ 1.6
+ 1.6
From 505d90eb2c27beadd2c5424b1155d9c4c75378b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?=
Date: Mon, 3 Aug 2015 12:53:19 +0200
Subject: [PATCH 179/239] upgrade version to 3.5.0-SNAPSHOT
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
cas-client-support-saml/pom.xml | 2 +-
pom.xml | 2 +-
10 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 522f05acc..441269d7a 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 53b1f1540..df787e69f 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index c0113c27b..1e97cd96d 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 4a688a8f7..fb9fd2f91 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index ce874f264..83d9b4a37 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 7399f8c6a..a612ed46b 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index b8e6db191..ee68c1dce 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index fcabc69c6..f1b8ae143 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOT4.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index 26aef5b6c..f18ca7574 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOTcas-client4.0.0
diff --git a/pom.xml b/pom.xml
index 0233fc220..c161137e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.5.0-SNAPSHOTcas-clientpom
From c03d7c798025d7d433b4fafbcba9ec4e1d0d3673 Mon Sep 17 00:00:00 2001
From: Xu Huisheng
Date: Tue, 4 Aug 2015 18:20:31 +0800
Subject: [PATCH 180/239] When serverName contains schema, the URIBuilder will
throw an UnsupportedOperationException while adding a parameter.
---
.../java/org/jasig/cas/client/util/URIBuilder.java | 2 +-
.../jasig/cas/client/util/CommonUtilsTests.java | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
index ef0db5278..f57499d63 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
@@ -126,7 +126,7 @@ private List parseQuery(final String query) {
} catch (final UnsupportedEncodingException e) {
LOGGER.error(e.getMessage(), e);
}
- return Collections.emptyList();
+ return new ArrayList();
}
/**
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index aaac4e62d..8ec0541e5 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -152,6 +152,20 @@ public void testConstructServiceUrlWithParamsCas() {
assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl);
}
+ public void testConstructServiceUrlWithParamsCasAndServerNameWithSchema() {
+ final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setQueryString("service=this&ticket=that&custom=custom");
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "https://www.myserver.com",
+ Protocol.CAS3.getServiceParameterName(), Protocol.CAS3.getArtifactParameterName() , false);
+
+ assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl);
+ }
+
public void testConstructServiceUrlWithParamsSaml() {
final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
From 3bb6daa3fb1b4670f17b86b0aa7f5700aa5b276b Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 12 Aug 2015 12:36:50 -0700
Subject: [PATCH 181/239] URIBuilder test cases
---
.../org/jasig/cas/client/util/URIBuilder.java | 63 +++-
.../cas/client/util/URIBuilderTests.java | 316 ++++++++++++++++++
2 files changed, 378 insertions(+), 1 deletion(-)
create mode 100644 cas-client-core/src/test/java/org/jasig/cas/client/util/URIBuilderTests.java
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
index f57499d63..7a6874a3b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/URIBuilder.java
@@ -238,8 +238,9 @@ private String encodeUric(final String fragment) {
return this.encode ? CommonUtils.urlEncode(fragment) : fragment;
}
- public void setEncode(boolean encode) {
+ public URIBuilder setEncode(boolean encode) {
this.encode = encode;
+ return this;
}
/**
@@ -469,6 +470,18 @@ public URIBuilder setFragment(final String fragment) {
return this;
}
+ public URIBuilder setEncodedFragment(final String fragment) {
+ this.fragment = null;
+ this.encodedFragment = fragment;
+ return this;
+ }
+
+ public URIBuilder setEncodedQuery(final String query) {
+ this.query = null;
+ this.encodedFragment = query;
+ return this;
+ }
+
public boolean isAbsolute() {
return this.scheme != null;
}
@@ -531,6 +544,54 @@ private static String normalizePath(final String path) {
return s;
}
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ final URIBuilder that = (URIBuilder) o;
+
+ if (port != that.port) return false;
+ if (encode != that.encode) return false;
+ if (scheme != null ? !scheme.equals(that.scheme) : that.scheme != null) return false;
+ if (encodedSchemeSpecificPart != null ? !encodedSchemeSpecificPart.equals(that.encodedSchemeSpecificPart) : that.encodedSchemeSpecificPart != null)
+ return false;
+ if (encodedAuthority != null ? !encodedAuthority.equals(that.encodedAuthority) : that.encodedAuthority != null)
+ return false;
+ if (userInfo != null ? !userInfo.equals(that.userInfo) : that.userInfo != null) return false;
+ if (encodedUserInfo != null ? !encodedUserInfo.equals(that.encodedUserInfo) : that.encodedUserInfo != null)
+ return false;
+ if (host != null ? !host.equals(that.host) : that.host != null) return false;
+ if (path != null ? !path.equals(that.path) : that.path != null) return false;
+ if (encodedPath != null ? !encodedPath.equals(that.encodedPath) : that.encodedPath != null) return false;
+ if (encodedQuery != null ? !encodedQuery.equals(that.encodedQuery) : that.encodedQuery != null) return false;
+ if (queryParams != null ? !queryParams.equals(that.queryParams) : that.queryParams != null) return false;
+ if (query != null ? !query.equals(that.query) : that.query != null) return false;
+ if (fragment != null ? !fragment.equals(that.fragment) : that.fragment != null) return false;
+ return !(encodedFragment != null ? !encodedFragment.equals(that.encodedFragment) : that.encodedFragment != null);
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = scheme != null ? scheme.hashCode() : 0;
+ result = 31 * result + (encodedSchemeSpecificPart != null ? encodedSchemeSpecificPart.hashCode() : 0);
+ result = 31 * result + (encodedAuthority != null ? encodedAuthority.hashCode() : 0);
+ result = 31 * result + (userInfo != null ? userInfo.hashCode() : 0);
+ result = 31 * result + (encodedUserInfo != null ? encodedUserInfo.hashCode() : 0);
+ result = 31 * result + (host != null ? host.hashCode() : 0);
+ result = 31 * result + port;
+ result = 31 * result + (path != null ? path.hashCode() : 0);
+ result = 31 * result + (encodedPath != null ? encodedPath.hashCode() : 0);
+ result = 31 * result + (encodedQuery != null ? encodedQuery.hashCode() : 0);
+ result = 31 * result + (queryParams != null ? queryParams.hashCode() : 0);
+ result = 31 * result + (query != null ? query.hashCode() : 0);
+ result = 31 * result + (encode ? 1 : 0);
+ result = 31 * result + (fragment != null ? fragment.hashCode() : 0);
+ result = 31 * result + (encodedFragment != null ? encodedFragment.hashCode() : 0);
+ return result;
+ }
+
public static class BasicNameValuePair implements Cloneable, Serializable {
private static final long serialVersionUID = -6437800749411518984L;
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/URIBuilderTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/URIBuilderTests.java
new file mode 100644
index 000000000..5144d131c
--- /dev/null
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/URIBuilderTests.java
@@ -0,0 +1,316 @@
+/*
+
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+ */
+
+package org.jasig.cas.client.util;
+
+import org.junit.Test;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ * @author Misagh Moayyed
+ */
+public class URIBuilderTests {
+
+ @Test
+ public void allPartsUsed() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .setCustomQuery("hello=world")
+ .setFragment("foo");
+ assertEquals("http://apache.org/shindig?hello=world#foo", builder.toString());
+ }
+
+ @Test
+ public void noSchemeUsed() {
+ URIBuilder builder = new URIBuilder()
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .setCustomQuery("hello=world")
+ .setFragment("foo");
+ assertEquals("//apache.org/shindig?hello=world#foo", builder.toString());
+ }
+
+ @Test
+ public void noAuthorityUsed() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setPath("/shindig")
+ .setCustomQuery("hello=world")
+ .setFragment("foo");
+ assertEquals("http:/shindig?hello=world#foo", builder.toString());
+ }
+
+ @Test
+ public void noPathUsed() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setCustomQuery("hello=world")
+ .setFragment("foo");
+ assertEquals("http://apache.org?hello=world#foo", builder.toString());
+ }
+
+ @Test
+ public void noQueryUsed() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .setFragment("foo");
+ assertEquals("http://apache.org/shindig#foo", builder.toString());
+ }
+
+ @Test
+ public void noFragmentUsed() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .setCustomQuery("hello=world");
+ assertEquals("http://apache.org/shindig?hello=world", builder.toString());
+ }
+
+ @Test
+ public void hostRelativePaths() {
+ URIBuilder builder = new URIBuilder()
+ .setPath("/shindig")
+ .setCustomQuery("hello=world")
+ .setFragment("foo");
+ assertEquals("/shindig?hello=world#foo", builder.toString());
+ }
+
+ @Test
+ public void relativePaths() {
+ URIBuilder builder = new URIBuilder()
+ .setPath("foo")
+ .setCustomQuery("hello=world")
+ .setFragment("foo");
+ assertEquals("foo?hello=world#foo", builder.toString());
+ }
+
+ @Test
+ public void noPathNoHostNoAuthority() {
+ URIBuilder builder = new URIBuilder()
+ .setCustomQuery("hello=world")
+ .setFragment("foo");
+ assertEquals("?hello=world#foo", builder.toString());
+ }
+
+ @Test
+ public void justSchemeAndAuthority() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org");
+ assertEquals("http://apache.org", builder.toString());
+ }
+
+ @Test
+ public void justPath() {
+ URIBuilder builder = new URIBuilder()
+ .setPath("/shindig");
+ assertEquals("/shindig", builder.toString());
+ }
+
+ @Test
+ public void justAuthorityAndPath() {
+ URIBuilder builder = new URIBuilder()
+ .setHost("apache.org")
+ .setPath("/shindig");
+ assertEquals("//apache.org/shindig", builder.toString());
+ }
+
+ @Test
+ public void justQuery() {
+ URIBuilder builder = new URIBuilder()
+ .setCustomQuery("hello=world");
+ assertEquals("?hello=world", builder.toString());
+ }
+
+ @Test
+ public void justFragment() {
+ URIBuilder builder = new URIBuilder()
+ .setFragment("foo");
+ assertEquals("#foo", builder.toString());
+ }
+
+ @Test
+ public void addSingleQueryParameter() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .addParameter("hello", "world")
+ .setFragment("foo");
+ assertEquals("http://apache.org/shindig?hello=world#foo", builder.toString());
+ }
+
+ @Test
+ public void addTwoQueryParameters() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .addParameter("hello", "world")
+ .addParameter("foo", "bar")
+ .setFragment("foo");
+ assertEquals("http://apache.org/shindig?hello=world&foo=bar#foo", builder.toString());
+ }
+
+ @Test
+ public void iterableQueryParameters() {
+ List list = new ArrayList();
+ list.add(new URIBuilder.BasicNameValuePair("hello", "world"));
+ list.add(new URIBuilder.BasicNameValuePair("hello", "monde"));
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .addParameters(list)
+ .setFragment("foo");
+ assertEquals("http://apache.org/shindig?hello=world&hello=monde#foo", builder.toString());
+ }
+
+ @Test
+ public void removeQueryParameter() {
+ URIBuilder uri = new URIBuilder("http://www.example.com/foo?bar=baz&quux=baz");
+ uri.removeQuery();
+ assertEquals("http://www.example.com/foo", uri.toString());
+ }
+
+ @Test
+ public void addIdenticalParameters() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .addParameter("hello", "world")
+ .addParameter("hello", "goodbye")
+ .setFragment("foo");
+ assertEquals("http://apache.org/shindig?hello=world&hello=goodbye#foo", builder.toString());
+ }
+
+ @Test
+ public void queryStringIsUnescaped() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .setCustomQuery("hello+world=world%26bar");
+ assertEquals("world&bar", builder.build().getQuery().split("=")[1]);
+ }
+
+ @Test
+ public void queryParamsAreEscaped() {
+ URIBuilder builder = new URIBuilder(true)
+ .setScheme("http")
+ .setHost("apache.org")
+ .setEncodedPath("/shindig")
+ .addParameter("hello world", "foo&bar")
+ .setFragment("foo");
+ assertEquals("http://apache.org/shindig?hello+world=foo%26bar#foo", builder.toString());
+ assertEquals("hello+world=foo&bar", builder.build().getQuery());
+ }
+
+ @Test
+ public void addSingleFragmentParameter() {
+ URIBuilder builder = new URIBuilder()
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .setFragment("hello=world")
+ .setCustomQuery("foo");
+ assertEquals("http://apache.org/shindig?foo#hello=world", builder.toString());
+ }
+
+ @Test
+ public void fragmentStringIsUnescaped() {
+ URIBuilder builder = new URIBuilder(true)
+ .setScheme("http")
+ .setHost("apache.org")
+ .setPath("/shindig")
+ .setEncodedFragment("hello+world=world%26bar");
+
+ assertEquals("world&bar", builder.build().getFragment().split("=")[1]);
+ }
+
+ @Test
+ public void parse() {
+ URIBuilder builder = new URIBuilder()
+ .digestURI(URI.create("http://apache.org/shindig?foo=bar%26baz&foo=three#blah"));
+
+ assertEquals("http", builder.getScheme());
+ assertEquals("apache.org", builder.getHost());
+ assertEquals("/shindig", builder.getPath());
+
+ List list = builder.getQueryParams();
+ for (URIBuilder.BasicNameValuePair pair : list) {
+ assertEquals(pair.getName(), "foo");
+ assertTrue(pair.getValue().equals("three") || pair.getValue().equals("bar"));
+ }
+ assertEquals(list.size(), 2);
+ assertEquals("blah", builder.getFragment());
+ }
+
+ @Test
+ public void constructFromUriAndBack() {
+ URI uri = URI.create("http://apache.org/foo/bar?foo=bar&a=b&c=d&y=z&foo=zoo#foo");
+ URIBuilder builder = new URIBuilder(uri);
+
+ assertEquals(uri, builder.build());
+ }
+
+ @Test
+ public void constructFromUriAndModify() {
+ URI uri = URI.create("http://apache.org/foo/bar?foo=bar#foo");
+ URIBuilder builder = new URIBuilder(uri);
+
+ builder.setHost("example.org");
+ builder.addParameter("bar", "foo");
+
+ assertEquals("http://example.org/foo/bar?foo=bar&bar=foo#foo", builder.toString());
+ }
+
+ @Test
+ public void equalsAndHashCodeOk() {
+ URIBuilder uri = new URIBuilder().digestURI(URI.create("http://example.org/foo/bar/baz?blah=blah#boo"));
+ URIBuilder uri2 = new URIBuilder(URI.create("http://example.org/foo/bar/baz?blah=blah#boo"));
+
+ assertEquals(uri, uri2);
+ assertEquals(uri2, uri);
+
+ assertEquals(uri, uri);
+
+ assertNotNull(uri);
+ assertNotSame(uri, "http://example.org/foo/bar/baz?blah=blah#boo");
+ assertNotSame(uri, URI.create("http://example.org/foo/bar/baz?blah=blah#boo"));
+ assertEquals(uri.hashCode(), uri2.hashCode());
+ }
+
+
+}
From 549fea4b210948e24b2d1de1139cc73bd9de7822 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?LELEU=20J=C3=A9r=C3=B4me?=
Date: Thu, 13 Aug 2015 11:36:24 +0200
Subject: [PATCH 182/239] Update .travis.yml
---
.travis.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 8357e8eda..e5c3fda62 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,8 +23,6 @@ before_install:
language: java
-sudo: false
-
script: "mvn install --settings travis/settings.xml"
jdk:
From bd4b87aaf628fb2e3bf1d0fd5b01cae91821de4a Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Thu, 13 Aug 2015 02:59:36 -0700
Subject: [PATCH 183/239] Update .travis.yml
---
.travis.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 8357e8eda..fda449411 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,9 +20,7 @@
before_install:
- mvn -v
- java -version
-
language: java
-
sudo: false
script: "mvn install --settings travis/settings.xml"
From e98aabfc6f9a8307dad3f5af7b8d6b58f11d0e33 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Thu, 13 Aug 2015 03:00:26 -0700
Subject: [PATCH 184/239] Update .travis.yml
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index fda449411..e5c3fda62 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,8 +20,8 @@
before_install:
- mvn -v
- java -version
+
language: java
-sudo: false
script: "mvn install --settings travis/settings.xml"
From 49fdccf81c064a0dd89367c3d0319f7ef8f1a671 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 19 Aug 2015 02:28:20 -0700
Subject: [PATCH 185/239] overload constructServiceUrl to keep backward
compatibility
---
.../jasig/cas/client/util/CommonUtils.java | 45 +++++++++++++++++--
.../cas/client/util/CommonUtilsTests.java | 14 ++++++
2 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index a95fb9aac..d8881e30a 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -26,6 +26,8 @@
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.jasig.cas.client.Protocol;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.jasig.cas.client.ssl.HttpURLConnectionFactory;
import org.jasig.cas.client.ssl.HttpsURLConnectionFactory;
@@ -259,6 +261,38 @@ private static boolean requestIsOnStandardPort(final HttpServletRequest request)
return serverPort == 80 || serverPort == 443;
}
+ /**
+ * Constructs a service url from the HttpServletRequest or from the given
+ * serviceUrl. Prefers the serviceUrl provided if both a serviceUrl and a
+ * serviceName. Compiles a list of all service parameters for supported protocols
+ * and removes them all from the query string.
+ *
+ * @param request the HttpServletRequest
+ * @param response the HttpServletResponse
+ * @param service the configured service url (this will be used if not null)
+ * @param serverNames the server name to use to construct the service url if the service param is empty. Note, prior to CAS Client 3.3, this was a single value.
+ * As of 3.3, it can be a space-separated value. We keep it as a single value, but will convert it to an array internally to get the matching value. This keeps backward compatability with anything using this public
+ * method.
+ * @param artifactParameterName the artifact parameter name to remove (i.e. ticket)
+ * @param encode whether to encode the url or not (i.e. Jsession).
+ * @return the service url to use.
+ */
+ @Deprecated
+ public static String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response,
+ final String service, final String serverNames,
+ final String artifactParameterName, final boolean encode) {
+ final Set serviceParameterSet = new HashSet(4);
+ for (final Protocol protocol : Protocol.values()) {
+ serviceParameterSet.add(protocol.getServiceParameterName());
+ }
+ final String serviceParameterNames = serviceParameterSet.toString()
+ .replaceAll("\\[|\\]", "")
+ .replaceAll("\\s", "");
+
+ return constructServiceUrl(request, response, service, serverNames, serviceParameterNames
+ , artifactParameterName, encode);
+ }
+
/**
* Constructs a service url from the HttpServletRequest or from the given
* serviceUrl. Prefers the serviceUrl provided if both a serviceUrl and a
@@ -267,7 +301,7 @@ private static boolean requestIsOnStandardPort(final HttpServletRequest request)
* @param request the HttpServletRequest
* @param response the HttpServletResponse
* @param service the configured service url (this will be used if not null)
- * @param serverNames the server name to use to constuct the service url if the service param is empty. Note, prior to CAS Client 3.3, this was a single value.
+ * @param serverNames the server name to use to construct the service url if the service param is empty. Note, prior to CAS Client 3.3, this was a single value.
* As of 3.3, it can be a space-separated value. We keep it as a single value, but will convert it to an array internally to get the matching value. This keeps backward compatability with anything using this public
* method.
* @param serviceParameterName the service parameter name to remove (i.e. service)
@@ -305,9 +339,12 @@ public static String constructServiceUrl(final HttpServletRequest request, final
builder.setEncodedPath(request.getRequestURI());
- for (final URIBuilder.BasicNameValuePair pair : originalRequestUrl.getQueryParams()) {
- if (!pair.getName().equals(artifactParameterName) && !pair.getName().equals(serviceParameterName)) {
- builder.addParameter(pair.getName(), pair.getValue());
+ final List serviceParameterNames = Arrays.asList(serviceParameterName.split(","));
+ if (!serviceParameterNames.isEmpty() && !originalRequestUrl.getQueryParams().isEmpty()) {
+ for (final URIBuilder.BasicNameValuePair pair : originalRequestUrl.getQueryParams()) {
+ if (!pair.getName().equals(artifactParameterName) && !serviceParameterNames.contains(pair.getName())) {
+ builder.addParameter(pair.getName(), pair.getValue());
+ }
}
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
index 8ec0541e5..b2a9d136c 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/CommonUtilsTests.java
@@ -195,6 +195,20 @@ public void testConstructServiceUrlWithEncodedParamsSaml() {
assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl);
}
+ public void testConstructServiceUrlWithNoServiceParametersPassed() {
+ final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
+ final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
+ request.setScheme("https");
+ request.setSecure(true);
+ request.setQueryString("TARGET=Test1&service=Test2&custom=custom");
+
+ final MockHttpServletResponse response = new MockHttpServletResponse();
+ final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com",
+ Protocol.SAML11.getArtifactParameterName() , true);
+
+ assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl);
+ }
+
public void testConstructServiceUrlWithEncodedParams2Saml() {
final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/";
final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/");
From 0e4c808bb7787996ff935e47b5f6a3e29177f9d6 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 19 Aug 2015 08:51:28 -0700
Subject: [PATCH 186/239] initialize service parameter names once, statically
---
.../jasig/cas/client/util/CommonUtils.java | 21 +++++++++++--------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index d8881e30a..639b3b48b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -59,10 +59,21 @@ public final class CommonUtils {
private static final HttpURLConnectionFactory DEFAULT_URL_CONNECTION_FACTORY = new HttpsURLConnectionFactory();
+ private static final String SERVICE_PARAMETER_NAMES;
+
private CommonUtils() {
// nothing to do
}
+ static {
+ final Set serviceParameterSet = new HashSet(4);
+ for (final Protocol protocol : Protocol.values()) {
+ serviceParameterSet.add(protocol.getServiceParameterName());
+ }
+ SERVICE_PARAMETER_NAMES = serviceParameterSet.toString()
+ .replaceAll("\\[|\\]", "")
+ .replaceAll("\\s", "");
+ }
/**
* Check whether the object is null or not. If it is, throw an exception and
* display the message.
@@ -281,15 +292,7 @@ private static boolean requestIsOnStandardPort(final HttpServletRequest request)
public static String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response,
final String service, final String serverNames,
final String artifactParameterName, final boolean encode) {
- final Set serviceParameterSet = new HashSet(4);
- for (final Protocol protocol : Protocol.values()) {
- serviceParameterSet.add(protocol.getServiceParameterName());
- }
- final String serviceParameterNames = serviceParameterSet.toString()
- .replaceAll("\\[|\\]", "")
- .replaceAll("\\s", "");
-
- return constructServiceUrl(request, response, service, serverNames, serviceParameterNames
+ return constructServiceUrl(request, response, service, serverNames, SERVICE_PARAMETER_NAMES
, artifactParameterName, encode);
}
From 3dca4b395a5298523b9bb7a4bcd6b65fa4d66940 Mon Sep 17 00:00:00 2001
From: Scott
Date: Wed, 9 Sep 2015 23:30:53 -0400
Subject: [PATCH 187/239] Issue #131 - ConfigurationStrategyName does not
Properly Resolve Custom classes
Problem: The assignable check was reversed, always resulting in a false return value.
Solution: Add test to confirm failure and then swap check. Unit tests pass.
---
.../ConfigurationStrategyName.java | 2 +-
.../ConfigurationStrategyNameTests.java | 21 +++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
index 2d3146f0b..b298d9929 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationStrategyName.java
@@ -62,7 +62,7 @@ public static Class extends ConfigurationStrategy> resolveToConfigurationStrat
try {
final Class> clazz = Class.forName(value);
- if (clazz.isAssignableFrom(ConfigurationStrategy.class)) {
+ if (ConfigurationStrategy.class.isAssignableFrom(clazz)) {
return (Class extends ConfigurationStrategy>) clazz;
}
} catch (final ClassNotFoundException e) {
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
index 5c2da1e2c..449ace5d7 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/configuration/ConfigurationStrategyNameTests.java
@@ -20,6 +20,9 @@
import org.junit.Test;
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+
import static org.junit.Assert.*;
public final class ConfigurationStrategyNameTests {
@@ -33,4 +36,22 @@ public void stringToClass() {
assertEquals(LegacyConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy(ConfigurationStrategyName.DEFAULT.name()));
assertEquals(LegacyConfigurationStrategyImpl.class, ConfigurationStrategyName.resolveToConfigurationStrategy("bleh!"));
}
+
+
+ @Test
+ public void resolveToClass() {
+ assertEquals(TestClass.class, ConfigurationStrategyName.resolveToConfigurationStrategy(TestClass.class.getName()));
+ }
+
+ private class TestClass extends BaseConfigurationStrategy {
+
+ @Override
+ protected String get(ConfigurationKey configurationKey) {
+ return null;
+ }
+
+ public void init(FilterConfig filterConfig, Class extends Filter> filterClazz) {
+
+ }
+ }
}
From 481422365aa223977e8b064601f3826414dc9025 Mon Sep 17 00:00:00 2001
From: Scott
Date: Sun, 13 Sep 2015 00:11:09 -0400
Subject: [PATCH 188/239] Added missing license headers.
---
.../cas/client/util/URIBuilderTests.java | 18 +++++++++++++++++
travis/deploy-to-sonatype.sh | 19 ++++++++++++++++++
travis/settings.xml | 20 +++++++++++++++++++
3 files changed, 57 insertions(+)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/URIBuilderTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/URIBuilderTests.java
index 5144d131c..e41ca275c 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/URIBuilderTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/URIBuilderTests.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
/*
* Licensed to Jasig under one or more contributor license
diff --git a/travis/deploy-to-sonatype.sh b/travis/deploy-to-sonatype.sh
index 80f2154e3..63b409e84 100644
--- a/travis/deploy-to-sonatype.sh
+++ b/travis/deploy-to-sonatype.sh
@@ -1,4 +1,23 @@
#!/bin/bash
+#
+# Licensed to Jasig under one or more contributor license
+# agreements. See the NOTICE file distributed with this work
+# for additional information regarding copyright ownership.
+# Jasig licenses this file to you under the Apache License,
+# Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a
+# copy of the License at the following location:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
# Only invoke the deployment to Sonatype when it's not a PR and only for master
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
diff --git a/travis/settings.xml b/travis/settings.xml
index de99f7713..32a680404 100644
--- a/travis/settings.xml
+++ b/travis/settings.xml
@@ -1,3 +1,23 @@
+
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 53b1f1540..0a36f5c2b 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index c0113c27b..62561d528 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 4a688a8f7..337ca4f0d 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index ce874f264..15e34df49 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 7399f8c6a..ea870cb22 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index b8e6db191..b50bc697c 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index fcabc69c6..bdd79865b 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOT4.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index 26aef5b6c..ce40fd9d2 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOTcas-client4.0.0
diff --git a/pom.xml b/pom.xml
index ac95973c2..964d6697b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.2-SNAPSHOTcas-clientpom
From f6f935e5cefb11399798e5174e9aa6be991f0e71 Mon Sep 17 00:00:00 2001
From: Scott
Date: Sun, 13 Sep 2015 00:18:34 -0400
Subject: [PATCH 190/239] [maven-release-plugin] rollback the release of
cas-client-3.4.1
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
cas-client-support-saml/pom.xml | 2 +-
pom.xml | 2 +-
10 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index cb8cddf14..522f05acc 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 0a36f5c2b..53b1f1540 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 62561d528..c0113c27b 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 337ca4f0d..4a688a8f7 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 15e34df49..ce874f264 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index ea870cb22..7399f8c6a 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index b50bc697c..b8e6db191 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index bdd79865b..fcabc69c6 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOT4.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index ce40fd9d2..26aef5b6c 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOTcas-client4.0.0
diff --git a/pom.xml b/pom.xml
index 964d6697b..ac95973c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.4.2-SNAPSHOT
+ 3.4.1-SNAPSHOTcas-clientpom
From 00e580cbc0b3d893de95a75c8a431819b617f18b Mon Sep 17 00:00:00 2001
From: Scott
Date: Sun, 13 Sep 2015 00:19:52 -0400
Subject: [PATCH 191/239] [maven-release-plugin] prepare release
cas-client-3.4.1
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
cas-client-support-saml/pom.xml | 2 +-
pom.xml | 4 ++--
10 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 522f05acc..5ca3ec846 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.1cas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 53b1f1540..aebb4bbf0 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.1cas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index c0113c27b..ec10fd019 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.1cas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 4a688a8f7..6812b0416 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.14.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index ce874f264..8e99b75fa 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.14.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index 7399f8c6a..b08878223 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.14.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index b8e6db191..e6d4e29f4 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.14.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index fcabc69c6..406342474 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.14.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index 26aef5b6c..41d93356a 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.1cas-client4.0.0
diff --git a/pom.xml b/pom.xml
index ac95973c2..4a53b8466 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.4.1-SNAPSHOT
+ 3.4.1cas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- HEAD
+ cas-client-3.4.12006
From 45bcec30807b883e86adaa91498aa809f03f9c49 Mon Sep 17 00:00:00 2001
From: Scott
Date: Sun, 13 Sep 2015 00:23:55 -0400
Subject: [PATCH 192/239] [maven-release-plugin] prepare for next development
iteration
---
cas-client-core/pom.xml | 2 +-
cas-client-integration-atlassian/pom.xml | 2 +-
cas-client-integration-jboss/pom.xml | 2 +-
cas-client-integration-tomcat-common/pom.xml | 2 +-
cas-client-integration-tomcat-v6/pom.xml | 2 +-
cas-client-integration-tomcat-v7/pom.xml | 2 +-
cas-client-support-distributed-ehcache/pom.xml | 2 +-
cas-client-support-distributed-memcached/pom.xml | 2 +-
cas-client-support-saml/pom.xml | 2 +-
pom.xml | 4 ++--
10 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index 5ca3ec846..cb8cddf14 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index aebb4bbf0..0a36f5c2b 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index ec10fd019..62561d528 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOTcas-client4.0.0
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 6812b0416..337ca4f0d 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 8e99b75fa..15e34df49 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOT4.0.0
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index b08878223..ea870cb22 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOT4.0.0
diff --git a/cas-client-support-distributed-ehcache/pom.xml b/cas-client-support-distributed-ehcache/pom.xml
index e6d4e29f4..b50bc697c 100644
--- a/cas-client-support-distributed-ehcache/pom.xml
+++ b/cas-client-support-distributed-ehcache/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOT4.0.0Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index 406342474..bdd79865b 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -3,7 +3,7 @@
cas-clientorg.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOT4.0.0
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index 41d93356a..ce40fd9d2 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -1,7 +1,7 @@
org.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOTcas-client4.0.0
diff --git a/pom.xml b/pom.xml
index 4a53b8466..964d6697b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0org.jasig.cas.client
- 3.4.1
+ 3.4.2-SNAPSHOTcas-clientpom
@@ -26,7 +26,7 @@
scm:git:git@github.com:Jasig/java-cas-client.gitscm:git:git@github.com:Jasig/java-cas-client.githttps://github.com/Jasig/java-cas-client
- cas-client-3.4.1
+ HEAD2006
From 739d0908ad12263c7065469e59d9f16f0be86e4c Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 13 Sep 2015 08:16:18 -0700
Subject: [PATCH 193/239] Fix badge link for maven version
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 91d9fbb7d..23e04e728 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Java Apereo CAS Client [](https://maven-badges.herokuapp.com/maven-central/org.jasig.cas/cas-server)
+# Java Apereo CAS Client [](https://maven-badges.herokuapp.com/maven-central/org.jasig.cas.client/cas-client)
## Intro
From 4e49d6083286ca3a84b58083f5901dd39c6efa39 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 5 Nov 2015 16:44:05 -0500
Subject: [PATCH 194/239] Issue-141 Remove redundant Content-Length header.
---
.../org/jasig/cas/client/validation/Saml11TicketValidator.java | 3 ---
1 file changed, 3 deletions(-)
diff --git a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
index 4a5908198..8e9561ac2 100644
--- a/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
+++ b/cas-client-support-saml/src/main/java/org/jasig/cas/client/validation/Saml11TicketValidator.java
@@ -198,7 +198,6 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
conn = this.getURLConnectionFactory().buildHttpURLConnection(validationUrl.openConnection());
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml");
- conn.setRequestProperty("Content-Length", Integer.toString(request.length()));
conn.setRequestProperty("SOAPAction", "http://www.oasis-open.org/committees/security");
conn.setUseCaches(false);
conn.setDoInput(true);
@@ -208,8 +207,6 @@ protected String retrieveResponseFromServer(final URL validationUrl, final Strin
final Charset charset = CommonUtils.isNotBlank(getEncoding()) ?
Charset.forName(getEncoding()) : IOUtils.UTF8;
conn.getOutputStream().write(request.getBytes(charset));
- conn.getOutputStream().flush();
-
return IOUtils.readString(conn.getInputStream(), charset);
} catch (final IOException e) {
throw new RuntimeException("IO error sending HTTP request to /samlValidate", e);
From 8d6c6e375840956461bba08f28dfddc89a5a9f37 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 8 Nov 2015 13:53:33 -0700
Subject: [PATCH 195/239] updated docs on SSOFilter and ErrorRedirectFilter
---
README.md | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 23e04e728..df8340bbf 100644
--- a/README.md
+++ b/README.md
@@ -421,12 +421,42 @@ Places the `Assertion` in a `ThreadLocal` for portions of the application that n
```
+
+#### org.jasig.cas.client.util.ErrorRedirectFilter
+Filters that redirects to the supplied url based on an exception. Exceptions and the urls are configured via init filter name/param values.
+
+| Property | Description | Required
+|----------|-------|-----------
+| `defaultErrorRedirectPage` | Default url to redirect to, in case no erorr matches are found. | Yes
+| `java.lang.Exception` | Fully qualified exception name. Its value must be redirection url | No
+
+
+```xml
+
+ CAS Error Redirect Filter
+ org.jasig.cas.client.util.ErrorRedirectFilter
+
+ java.lang.Exception
+ /error.jsp
+
+
+ defaultErrorRedirectPage
+ /defaulterror.jsp
+
+
+
+ CAS Error Redirect Filter
+ /*
+
+```
+
+
### Client Configuration Using Spring
Configuration via Spring IoC will depend heavily on `DelegatingFilterProxy` class. For each filter that will be configured for CAS via Spring, a corresponding `DelegatingFilterProxy` is needed in the web.xml.
-As the `SingleSignOutFilter`, `HttpServletRequestWrapperFilter` and `AssertionThreadLocalFilter` have no configuration options, we recommend you just configure them in the `web.xml`
+As the `HttpServletRequestWrapperFilter` and `AssertionThreadLocalFilter` have no configuration options, we recommend you just configure them in the `web.xml`
```xml
@@ -614,6 +644,10 @@ The `SingleSignOutFilter` can affect character encoding. This becomes most obvio
CAS Single Sign Out Filterorg.jasig.cas.client.session.SingleSignOutFilter
+
+ casServerUrlPrefix
+ https://cas.example.com/cas
+
...
@@ -637,6 +671,10 @@ The `SingleSignOutFilter` can affect character encoding. This becomes most obvio
artifactParameterNameSAMLart
+
+ casServerUrlPrefix
+ https://cas.example.com/cas
+
...
@@ -1079,6 +1117,10 @@ This configuration tested against the sample application that is included with S
CAS Single Sign Out Filterorg.jasig.cas.client.session.SingleSignOutFilter
+
+ casServerUrlPrefix
+ https://cas.example.com/cas
+
From e99aaac160e4a4cff1c6097824e9037098f76228 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Sun, 8 Nov 2015 13:54:31 -0700
Subject: [PATCH 196/239] updated docs on SSOFilter and ErrorRedirectFilter
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index df8340bbf..29c66b743 100644
--- a/README.md
+++ b/README.md
@@ -644,7 +644,7 @@ The `SingleSignOutFilter` can affect character encoding. This becomes most obvio
CAS Single Sign Out Filterorg.jasig.cas.client.session.SingleSignOutFilter
-
+ casServerUrlPrefixhttps://cas.example.com/cas
From fb8c14fc846a1da6159d3d6d47cbc5973fe3696a Mon Sep 17 00:00:00 2001
From: Scott
Date: Wed, 18 Nov 2015 21:58:06 -0500
Subject: [PATCH 197/239] CASC-127 Remove Commons Codec Dependency
Problem: We rely on Commons Codec for some simple Base64 decoding/encoding, most of which is available in Java 1.6+
Solution: Set minimum version to Java 1.6 and rely on provided methods.
QA Notes: Unit tests pass
---
cas-client-core/pom.xml | 8 --------
.../jasig/cas/client/session/SingleSignOutHandler.java | 7 ++++---
.../jasig/cas/client/session/LogoutMessageGenerator.java | 5 ++---
pom.xml | 4 ++--
4 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index cb8cddf14..ea484e125 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -36,14 +36,6 @@
true
-
- commons-codec
- commons-codec
- 1.4
- jar
- true
-
-
org.springframeworkspring-beans
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index 5d07095cc..de1358239 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -19,6 +19,7 @@
package org.jasig.cas.client.session;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.zip.Inflater;
@@ -26,8 +27,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.xml.bind.DatatypeConverter;
-import org.apache.commons.codec.binary.Base64;
import org.jasig.cas.client.Protocol;
import org.jasig.cas.client.configuration.ConfigurationKeys;
import org.jasig.cas.client.util.CommonUtils;
@@ -146,7 +147,7 @@ public synchronized void init() {
if (this.artifactParameterOverPost) {
this.safeParameters = Arrays.asList(this.logoutParameterName, this.artifactParameterName);
} else {
- this.safeParameters = Arrays.asList(this.logoutParameterName);
+ this.safeParameters = Collections.singletonList(this.logoutParameterName);
}
}
}
@@ -256,7 +257,7 @@ private void recordSession(final HttpServletRequest request) {
* @return the uncompressed logout message.
*/
private String uncompressLogoutMessage(final String originalMessage) {
- final byte[] binaryMessage = Base64.decodeBase64(originalMessage);
+ final byte[] binaryMessage = DatatypeConverter.parseBase64Binary(originalMessage);
Inflater decompresser = null;
try {
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
index 861fffc4f..84b9a8dba 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/LogoutMessageGenerator.java
@@ -18,12 +18,11 @@
*/
package org.jasig.cas.client.session;
+import javax.xml.bind.DatatypeConverter;
import java.nio.charset.Charset;
import java.util.Date;
import java.util.zip.Deflater;
-import org.apache.commons.codec.binary.Base64;
-
/**
* Logout message generator to perform tests on Single Sign Out feature.
* Greatly inspired by the source code in the CAS server itself.
@@ -51,6 +50,6 @@ public static String generateFrontChannelLogoutMessage(final String sessionIndex
final int resultSize = deflater.deflate(buffer);
final byte[] output = new byte[resultSize];
System.arraycopy(buffer, 0, output, 0, resultSize);
- return Base64.encodeBase64String(output);
+ return DatatypeConverter.printBase64Binary(output);
}
}
diff --git a/pom.xml b/pom.xml
index 964d6697b..75886fa02 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,8 +76,8 @@
maven-compiler-plugin3.0
- 1.5
- 1.5
+ 1.6
+ 1.6
From 78205a53a966ba4d3157bb2d522166be3b46d0de Mon Sep 17 00:00:00 2001
From: BernhardLenz
Date: Thu, 4 Feb 2016 18:45:03 -0500
Subject: [PATCH 198/239] Added cas-client-integration-tomcat-v8
---
cas-client-integration-tomcat-v8/NOTICE | 30 +++
cas-client-integration-tomcat-v8/pom.xml | 70 +++++++
.../tomcat/v8/AbstractAuthenticator.java | 198 ++++++++++++++++++
.../tomcat/v8/AbstractCasAuthenticator.java | 47 +++++
.../client/tomcat/v8/AbstractCasRealm.java | 85 ++++++++
.../client/tomcat/v8/AbstractLogoutValve.java | 55 +++++
.../client/tomcat/v8/AssertionCasRealm.java | 49 +++++
.../tomcat/v8/Cas10CasAuthenticator.java | 56 +++++
.../tomcat/v8/Cas20CasAuthenticator.java | 62 ++++++
.../tomcat/v8/Cas20ProxyCasAuthenticator.java | 77 +++++++
.../client/tomcat/v8/PropertiesCasRealm.java | 63 ++++++
.../client/tomcat/v8/ProxyCallbackValve.java | 90 ++++++++
.../client/tomcat/v8/RegexUriLogoutValve.java | 55 +++++
.../client/tomcat/v8/Saml11Authenticator.java | 84 ++++++++
.../client/tomcat/v8/SingleSignOutValve.java | 97 +++++++++
.../tomcat/v8/StaticUriLogoutValve.java | 55 +++++
pom.xml | 1 +
17 files changed, 1174 insertions(+)
create mode 100644 cas-client-integration-tomcat-v8/NOTICE
create mode 100644 cas-client-integration-tomcat-v8/pom.xml
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractAuthenticator.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractCasAuthenticator.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractCasRealm.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractLogoutValve.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AssertionCasRealm.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas10CasAuthenticator.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas20CasAuthenticator.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas20ProxyCasAuthenticator.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/PropertiesCasRealm.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/ProxyCallbackValve.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/RegexUriLogoutValve.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Saml11Authenticator.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/SingleSignOutValve.java
create mode 100644 cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/StaticUriLogoutValve.java
diff --git a/cas-client-integration-tomcat-v8/NOTICE b/cas-client-integration-tomcat-v8/NOTICE
new file mode 100644
index 000000000..f5ce3c060
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/NOTICE
@@ -0,0 +1,30 @@
+Licensed to Apereo under one or more contributor license
+agreements. See the NOTICE file distributed with this work
+for additional information regarding copyright ownership.
+Apereo licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a
+copy of the License at the following location:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
+ Jasig CAS Client for Java - Core under Apache License Version 2.0
+ Jasig CAS Client for Java - SAML Protocol Support under Apache License Version 2.0
+ Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
+ Java Servlet API under CDDL + GPLv2 with classpath exception
+ JCL 1.1.1 implemented over SLF4J under MIT License
+ Joda-Time under Apache 2
+ JUnit under Common Public License Version 1.0
+ SLF4J API Module under MIT License
+ SLF4J Simple Binding under MIT License
+ tomcat-catalina under Apache License, Version 2.0
+
diff --git a/cas-client-integration-tomcat-v8/pom.xml b/cas-client-integration-tomcat-v8/pom.xml
new file mode 100644
index 000000000..531abde57
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/pom.xml
@@ -0,0 +1,70 @@
+
+
+
+ cas-client
+ org.jasig.cas.client
+ 3.4.2-SNAPSHOT
+
+ 4.0.0
+
+ org.jasig.cas.client
+ cas-client-integration-tomcat-v8
+ jar
+ Jasig CAS Client for Java - Tomcat 8.x Integration
+
+
+
+ org.jasig.cas.client
+ cas-client-integration-tomcat-common
+ ${project.version}
+ jar
+ compile
+
+
+ org.jasig.cas.client
+ cas-client-support-saml
+ ${project.version}
+ jar
+ compile
+ true
+
+
+ org.apache.tomcat
+ tomcat-catalina
+ 8.0.1
+ jar
+ provided
+
+
+ org.apache.tomcat
+ tomcat-servlet-api
+
+
+ org.apache.tomcat
+ tomcat-juli
+
+
+ org.apache.tomcat
+ tomcat-annotations-api
+
+
+ org.apache.tomcat
+ tomcat-api
+
+
+ org.apache.tomcat
+ tomcat-util
+
+
+
+
+
+ org.jasig.cas.client
+ cas-client-core
+ ${project.version}
+ jar
+ compile
+
+
+
+
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractAuthenticator.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractAuthenticator.java
new file mode 100644
index 000000000..6ad0d4bad
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractAuthenticator.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import java.io.IOException;
+import java.security.Principal;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.*;
+import org.apache.catalina.authenticator.AuthenticatorBase;
+import org.apache.catalina.connector.Request;
+import org.jasig.cas.client.tomcat.AuthenticatorDelegate;
+import org.jasig.cas.client.tomcat.CasRealm;
+import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.validation.TicketValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base authenticator for all authentication protocols supported by CAS.
+ *
+ * @author Scott Battaglia
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public abstract class AbstractAuthenticator extends AuthenticatorBase implements LifecycleListener {
+
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private final AuthenticatorDelegate delegate = new AuthenticatorDelegate();
+
+ private String casServerUrlPrefix;
+
+ private String encoding;
+
+ private boolean encode;
+
+ private boolean renew;
+
+ protected abstract String getAuthenticationMethod();
+
+ /**
+ * Provided for Tomcat 7.0.8 support.
+ *
+ * @return the authentication method.
+ */
+ protected String getAuthMethod() {
+ return getAuthenticationMethod();
+ }
+
+ /**
+ * Abstract method that subclasses should use to provide the name of the artifact parameter (i.e. ticket)
+ *
+ * @return the artifact parameter name. CANNOT be NULL.
+ */
+ protected abstract String getArtifactParameterName();
+
+ /**
+ * Abstract method that subclasses should use to provide the name of the service parameter (i.e. service)
+ *
+ * @return the service parameter name. CANNOT be NULL.
+ */
+ protected abstract String getServiceParameterName();
+
+ /**
+ * Returns the single instance of the ticket validator to use to validate tickets. Sub classes should include
+ * the one appropriate for the
+ *
+ * @return a fully configured ticket validator. CANNOT be NULL.
+ */
+ protected abstract TicketValidator getTicketValidator();
+
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ logger.debug("{} starting.", getName());
+ final Realm realm = this.context.getRealm();
+ try {
+ CommonUtils.assertTrue(realm instanceof CasRealm, "Expected CasRealm but got " + realm.getClass());
+ CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
+ CommonUtils.assertNotNull(this.delegate.getCasServerLoginUrl(), "casServerLoginUrl cannot be null.");
+ CommonUtils.assertTrue(this.delegate.getServerName() != null || this.delegate.getServiceUrl() != null,
+ "either serverName or serviceUrl must be set.");
+ this.delegate.setRealm((CasRealm) realm);
+ } catch (final Exception e) {
+ throw new LifecycleException(e);
+ }
+ // Complete delegate initialization after the component is started.
+ // See #lifecycleEvent() method.
+ addLifecycleListener(this);
+ }
+
+ protected final String getCasServerUrlPrefix() {
+ return this.casServerUrlPrefix;
+ }
+
+ public final void setCasServerUrlPrefix(final String casServerUrlPrefix) {
+ this.casServerUrlPrefix = casServerUrlPrefix;
+ }
+
+ public final void setCasServerLoginUrl(final String casServerLoginUrl) {
+ this.delegate.setCasServerLoginUrl(casServerLoginUrl);
+ }
+
+ public final boolean isEncode() {
+ return this.encode;
+ }
+
+ public final void setEncode(final boolean encode) {
+ this.encode = encode;
+ }
+
+ protected final boolean isRenew() {
+ return this.renew;
+ }
+
+ public void setRenew(final boolean renew) {
+ this.renew = renew;
+ }
+
+ public final void setServerName(final String serverName) {
+ this.delegate.setServerName(serverName);
+ }
+
+ public final void setServiceUrl(final String serviceUrl) {
+ this.delegate.setServiceUrl(serviceUrl);
+ }
+
+ protected final String getEncoding() {
+ return this.encoding;
+ }
+
+ public final void setEncoding(final String encoding) {
+ this.encoding = encoding;
+ }
+
+ /** {@inheritDoc} */
+ public final boolean authenticate(final Request request, final HttpServletResponse response) throws IOException {
+ Principal principal = request.getUserPrincipal();
+ boolean result = false;
+ if (principal == null) {
+ // Authentication sets the response headers for status and redirect if needed
+ principal = this.delegate.authenticate(request.getRequest(), response);
+ if (principal != null) {
+ register(request, response, principal, getAuthenticationMethod(), null, null);
+ result = true;
+ }
+ } else {
+ result = true;
+ }
+ return result;
+ }
+
+ /** {@inheritDoc} */
+ public void lifecycleEvent(final LifecycleEvent event) {
+ if (AFTER_START_EVENT.equals(event.getType())) {
+ logger.debug("{} processing lifecycle event {}", getName(), AFTER_START_EVENT);
+ this.delegate.setTicketValidator(getTicketValidator());
+ this.delegate.setArtifactParameterName(getArtifactParameterName());
+ this.delegate.setServiceParameterName(getServiceParameterName());
+ }
+ }
+
+ /** {@inheritDoc} */
+ public String getInfo() {
+ return getName() + "/1.0";
+ }
+
+ /** {@inheritDoc}
+ * @throws LifecycleException */
+ protected synchronized void setState(LifecycleState state, Object data) throws LifecycleException {
+ super.setState(state, data);
+ if (LifecycleState.STARTED.equals(state)) {
+ logger.info("{} started.", getName());
+ }
+ }
+
+ /**
+ * @return Authenticator descriptive name.
+ */
+ protected abstract String getName();
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractCasAuthenticator.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractCasAuthenticator.java
new file mode 100644
index 000000000..3be3db80e
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractCasAuthenticator.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+/**
+ * Base class for all CAS protocol authenticators.
+ *
+ * @author Scott Battaglia
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public abstract class AbstractCasAuthenticator extends AbstractAuthenticator {
+
+ private String proxyCallbackUrl;
+
+ protected final String getProxyCallbackUrl() {
+ return this.proxyCallbackUrl;
+ }
+
+ public final void setProxyCallbackUrl(final String proxyCallbackUrl) {
+ this.proxyCallbackUrl = proxyCallbackUrl;
+ }
+
+ protected final String getArtifactParameterName() {
+ return "ticket";
+ }
+
+ protected final String getServiceParameterName() {
+ return "service";
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractCasRealm.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractCasRealm.java
new file mode 100644
index 000000000..c3b2144d5
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractCasRealm.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import java.security.Principal;
+import org.apache.catalina.Wrapper;
+import org.apache.catalina.realm.RealmBase;
+import org.jasig.cas.client.tomcat.CasRealm;
+
+/**
+ * Base Realm implementation for all CAS realms.
+ *
+ * @author Marvin S. Addison
+ * @version $Revision$
+ *
+ */
+public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
+
+ /** {@inheritDoc} */
+ public Principal authenticate(final Principal p) {
+ return getDelegate().authenticate(p);
+ }
+
+ /** {@inheritDoc} */
+ public String[] getRoles(final Principal p) {
+ return getDelegate().getRoles(p);
+ }
+
+ public boolean hasRole(final Principal principal, final String role) {
+ return getDelegate().hasRole(principal, role);
+ }
+
+ /**
+ * Tomcat 7.0.8 changed their APIs so {@link #hasRole(java.security.Principal, String)} is only valid for 7.0.7 and below.
+ */
+ public boolean hasRole(final Wrapper wrapper, final Principal principal, final String role) {
+ return hasRole(principal, role);
+ }
+
+ /** {@inheritDoc} */
+ public String toString() {
+ return getName();
+ }
+
+ /** {@inheritDoc} */
+ public String getInfo() {
+ return getClass().getName() + "/1.0";
+ }
+
+ /** {@inheritDoc} */
+ protected String getName() {
+ return getClass().getSimpleName();
+ }
+
+ /** {@inheritDoc} */
+ protected String getPassword(final String userName) {
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ protected Principal getPrincipal(final String userName) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @return Delegate that all {@link CasRealm} operations are delegated to.
+ */
+ protected abstract CasRealm getDelegate();
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractLogoutValve.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractLogoutValve.java
new file mode 100644
index 000000000..4264c0d4c
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AbstractLogoutValve.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.valves.ValveBase;
+import org.jasig.cas.client.tomcat.LogoutHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract base class for Container-managed log out. Removes the attributes
+ * from the session.
+ *
+ * @author Scott Battaglia
+ * @author Marvin S. Addison
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public abstract class AbstractLogoutValve extends ValveBase {
+
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+ public final void invoke(final Request request, final Response response) throws IOException, ServletException {
+ if (getLogoutHandler().isLogoutRequest(request)) {
+ getLogoutHandler().logout(request, response);
+ // Do not proceed up valve chain
+ return;
+ }
+
+ logger.debug("URI is not a logout request: {}", request.getRequestURI());
+ getNext().invoke(request, response);
+ }
+
+ protected abstract LogoutHandler getLogoutHandler();
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AssertionCasRealm.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AssertionCasRealm.java
new file mode 100644
index 000000000..422f48ace
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/AssertionCasRealm.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import org.jasig.cas.client.tomcat.AssertionCasRealmDelegate;
+import org.jasig.cas.client.tomcat.CasRealm;
+
+/**
+ * Tomcat Realm that implements {@link CasRealm} for principal and
+ * role data backed by the CAS {@link org.jasig.cas.client.validation.Assertion}.
+ *
+ * Authentication always succeeds and simply returns the given principal.
+ *
+ * @author Marvin S. Addison
+ * @version $Revision$
+ *
+ */
+public class AssertionCasRealm extends AbstractCasRealm {
+
+ private final AssertionCasRealmDelegate delegate = new AssertionCasRealmDelegate();
+
+ /**
+ * @param name Name of the attribute in the principal that contains role data.
+ */
+ public void setRoleAttributeName(final String name) {
+ delegate.setRoleAttributeName(name);
+ }
+
+ /** {@inheritDoc} */
+ protected CasRealm getDelegate() {
+ return delegate;
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas10CasAuthenticator.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas10CasAuthenticator.java
new file mode 100644
index 000000000..a5183430e
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas10CasAuthenticator.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import org.apache.catalina.LifecycleException;
+import org.jasig.cas.client.validation.Cas10TicketValidator;
+import org.jasig.cas.client.validation.TicketValidator;
+
+/**
+ * Authenticator that handles CAS 1.0 protocol.
+ *
+ * @author Scott Battaglia
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public final class Cas10CasAuthenticator extends AbstractCasAuthenticator {
+
+ public static final String AUTH_METHOD = "CAS10";
+
+ private static final String NAME = Cas10CasAuthenticator.class.getName();
+
+ private Cas10TicketValidator ticketValidator;
+
+ protected TicketValidator getTicketValidator() {
+ return this.ticketValidator;
+ }
+
+ protected String getAuthenticationMethod() {
+ return AUTH_METHOD;
+ }
+
+ protected String getName() {
+ return NAME;
+ }
+
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ this.ticketValidator = new Cas10TicketValidator(getCasServerUrlPrefix());
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas20CasAuthenticator.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas20CasAuthenticator.java
new file mode 100644
index 000000000..86d40b4f9
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas20CasAuthenticator.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import org.apache.catalina.LifecycleException;
+import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
+import org.jasig.cas.client.validation.TicketValidator;
+
+/**
+ * Authenticator that handles the CAS 2.0 protocol.
+ *
+ * @author Scott Battaglia
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public final class Cas20CasAuthenticator extends AbstractCasAuthenticator {
+
+ public static final String AUTH_METHOD = "CAS20";
+
+ private static final String NAME = Cas20CasAuthenticator.class.getName();
+
+ private Cas20ServiceTicketValidator ticketValidator;
+
+ protected TicketValidator getTicketValidator() {
+ return this.ticketValidator;
+ }
+
+ protected String getAuthenticationMethod() {
+ return AUTH_METHOD;
+ }
+
+ protected String getName() {
+ return NAME;
+ }
+
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ this.ticketValidator = new Cas20ServiceTicketValidator(getCasServerUrlPrefix());
+ if (getEncoding() != null) {
+ this.ticketValidator.setEncoding(getEncoding());
+ }
+ this.ticketValidator.setProxyCallbackUrl(getProxyCallbackUrl());
+ this.ticketValidator.setProxyGrantingTicketStorage(ProxyCallbackValve.getProxyGrantingTicketStorage());
+ this.ticketValidator.setRenew(isRenew());
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas20ProxyCasAuthenticator.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas20ProxyCasAuthenticator.java
new file mode 100644
index 000000000..b5fa7028b
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Cas20ProxyCasAuthenticator.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import org.apache.catalina.LifecycleException;
+import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.validation.Cas20ProxyTicketValidator;
+import org.jasig.cas.client.validation.TicketValidator;
+
+/**
+ * Authenticator that handles the CAS 2.0 protocol with proxying support.
+ *
+ * @author Scott Battaglia
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public final class Cas20ProxyCasAuthenticator extends AbstractCasAuthenticator {
+
+ public static final String AUTH_METHOD = "CAS20-PROXY";
+
+ private static final String NAME = Cas20ProxyCasAuthenticator.class.getName();
+
+ private Cas20ProxyTicketValidator ticketValidator;
+
+ private boolean acceptAnyProxy;
+
+ private String allowedProxyChains;
+
+ public void setAcceptAnyProxy(final boolean acceptAnyProxy) {
+ this.acceptAnyProxy = acceptAnyProxy;
+ }
+
+ public void setAllowedProxyChains(final String allowedProxyChains) {
+ this.allowedProxyChains = allowedProxyChains;
+ }
+
+ protected TicketValidator getTicketValidator() {
+ return this.ticketValidator;
+ }
+
+ protected String getAuthenticationMethod() {
+ return AUTH_METHOD;
+ }
+
+ protected String getName() {
+ return NAME;
+ }
+
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ this.ticketValidator = new Cas20ProxyTicketValidator(getCasServerUrlPrefix());
+ this.ticketValidator.setRenew(isRenew());
+ this.ticketValidator.setProxyCallbackUrl(getProxyCallbackUrl());
+ this.ticketValidator.setProxyGrantingTicketStorage(ProxyCallbackValve.getProxyGrantingTicketStorage());
+ this.ticketValidator.setAcceptAnyProxy(this.acceptAnyProxy);
+ this.ticketValidator.setAllowedProxyChains(CommonUtils.createProxyList(this.allowedProxyChains));
+ if (getEncoding() != null) {
+ this.ticketValidator.setEncoding(getEncoding());
+ }
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/PropertiesCasRealm.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/PropertiesCasRealm.java
new file mode 100644
index 000000000..9cbe8ea70
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/PropertiesCasRealm.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import org.apache.catalina.LifecycleException;
+import org.jasig.cas.client.tomcat.CasRealm;
+import org.jasig.cas.client.tomcat.PropertiesCasRealmDelegate;
+
+/**
+ * Tomcat Realm that implements {@link CasRealm} backed by properties file
+ * containing usernames/and roles of the following format:
+ *
+ * User authentication succeeds if the name of the given principal exists as
+ * a username in the properties file.
+ *
+ * @author Marvin S. Addison
+ * @version $Revision$
+ * @since 3.1.12
+ *
+ */
+public class PropertiesCasRealm extends AbstractCasRealm {
+
+ private final PropertiesCasRealmDelegate delegate = new PropertiesCasRealmDelegate();
+
+ /**
+ * @param path Path to properties file container username/role data.
+ */
+ public void setPropertiesFilePath(final String path) {
+ this.delegate.setPropertiesFilePath(path);
+ }
+
+ /** {@inheritDoc} */
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ this.delegate.readProperties();
+ }
+
+ /** {@inheritDoc} */
+ protected CasRealm getDelegate() {
+ return this.delegate;
+ }
+
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/ProxyCallbackValve.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/ProxyCallbackValve.java
new file mode 100644
index 000000000..adc98cc1c
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/ProxyCallbackValve.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.valves.ValveBase;
+import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
+import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.ReflectUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Handles watching a url for the proxy callback.
+ *
+ * Because its tough to share state between valves, we expose the storage mechanism via a static variable.
+ *
+ * This valve should be ordered before the authentication valves.
+ *
+ * @author Scott Battaglia
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public final class ProxyCallbackValve extends ValveBase {
+
+ private static ProxyGrantingTicketStorage PROXY_GRANTING_TICKET_STORAGE;
+
+ /** Logger instance */
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private String proxyGrantingTicketStorageClass;
+
+ private String proxyCallbackUrl;
+
+ public static ProxyGrantingTicketStorage getProxyGrantingTicketStorage() {
+ return PROXY_GRANTING_TICKET_STORAGE;
+ }
+
+ public void setProxyGrantingTicketStorageClass(final String proxyGrantingTicketStorageClass) {
+ this.proxyGrantingTicketStorageClass = proxyGrantingTicketStorageClass;
+ }
+
+ public void setProxyCallbackUrl(final String proxyCallbackUrl) {
+ this.proxyCallbackUrl = proxyCallbackUrl;
+ }
+
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+
+ try {
+ CommonUtils.assertNotNull(this.proxyCallbackUrl, "the proxy callback url cannot be null");
+ CommonUtils.assertTrue(this.proxyCallbackUrl.startsWith("/"), "proxy callback url must start with \"/\"");
+
+ PROXY_GRANTING_TICKET_STORAGE = ReflectUtils.newInstance(proxyGrantingTicketStorageClass);
+ } catch (final Exception e) {
+ throw new LifecycleException(e);
+ }
+ logger.info("Startup completed.");
+ }
+
+ public void invoke(final Request request, final Response response) throws IOException, ServletException {
+ if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
+ logger.debug("Processing proxy callback request.");
+ CommonUtils.readAndRespondToProxyReceptorRequest(request, response, PROXY_GRANTING_TICKET_STORAGE);
+ return;
+ }
+
+ getNext().invoke(request, response);
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/RegexUriLogoutValve.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/RegexUriLogoutValve.java
new file mode 100644
index 000000000..fc8999f70
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/RegexUriLogoutValve.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import org.apache.catalina.LifecycleException;
+import org.jasig.cas.client.tomcat.LogoutHandler;
+import org.jasig.cas.client.tomcat.RegexUriLogoutHandler;
+
+/**
+ * Performs CAS logout when the request URI matches a regular expression.
+ *
+ * @author Scott Battaglia
+ * @author Marvin S. Addison
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public final class RegexUriLogoutValve extends AbstractLogoutValve {
+
+ private RegexUriLogoutHandler logoutHandler = new RegexUriLogoutHandler();
+
+ public void setRedirectUrl(final String redirectUrl) {
+ this.logoutHandler.setRedirectUrl(redirectUrl);
+ }
+
+ public void setLogoutUriRegex(final String regex) {
+ this.logoutHandler.setLogoutUriRegex(regex);
+ }
+
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ this.logoutHandler.init();
+ logger.info("Startup completed.");
+ }
+
+ /** {@inheritDoc} */
+ protected LogoutHandler getLogoutHandler() {
+ return this.logoutHandler;
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Saml11Authenticator.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Saml11Authenticator.java
new file mode 100644
index 000000000..fc44569e3
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/Saml11Authenticator.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import org.apache.catalina.LifecycleException;
+import org.jasig.cas.client.validation.Saml11TicketValidator;
+import org.jasig.cas.client.validation.TicketValidator;
+
+/**
+ * CAS authenticator that uses the SAML 1.1 protocol.
+ *
+ * @author Marvin S. Addison
+ * @version $Revision$
+ * @since 3.1.12
+ *
+ */
+public final class Saml11Authenticator extends AbstractAuthenticator {
+
+ public static final String AUTH_METHOD = "SAML11";
+
+ private static final String NAME = Saml11Authenticator.class.getName();
+
+ private Saml11TicketValidator ticketValidator;
+
+ /** SAML protocol clock drift tolerance in ms */
+ private int tolerance = -1;
+
+ /**
+ * @param ms SAML clock drift tolerance in milliseconds.
+ */
+ public void setTolerance(final int ms) {
+ this.tolerance = ms;
+ }
+
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ this.ticketValidator = new Saml11TicketValidator(getCasServerUrlPrefix());
+ if (this.tolerance > -1) {
+ this.ticketValidator.setTolerance(this.tolerance);
+ }
+ if (getEncoding() != null) {
+ this.ticketValidator.setEncoding(getEncoding());
+ }
+ this.ticketValidator.setRenew(isRenew());
+ }
+
+ protected TicketValidator getTicketValidator() {
+ return this.ticketValidator;
+ }
+
+ protected String getAuthenticationMethod() {
+ return AUTH_METHOD;
+ }
+
+ /** {@inheritDoc} */
+ protected String getArtifactParameterName() {
+ return "SAMLart";
+ }
+
+ /** {@inheritDoc} */
+ protected String getServiceParameterName() {
+ return "TARGET";
+ }
+
+ protected String getName() {
+ return NAME;
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/SingleSignOutValve.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/SingleSignOutValve.java
new file mode 100644
index 000000000..02fe955f2
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/SingleSignOutValve.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.Session;
+import org.apache.catalina.SessionEvent;
+import org.apache.catalina.SessionListener;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.valves.ValveBase;
+import org.jasig.cas.client.session.SessionMappingStorage;
+import org.jasig.cas.client.session.SingleSignOutHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Handles logout request messages sent from the CAS server by ending the current
+ * HTTP session.
+ *
+ * @author Marvin S. Addison
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ *
+ */
+public class SingleSignOutValve extends ValveBase implements SessionListener {
+
+ /** Logger instance */
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private final SingleSignOutHandler handler = new SingleSignOutHandler();
+
+ public void setArtifactParameterName(final String name) {
+ this.handler.setArtifactParameterName(name);
+ }
+
+ public void setLogoutParameterName(final String name) {
+ this.handler.setLogoutParameterName(name);
+ }
+
+ public void setFrontLogoutParameterName(final String name) {
+ this.handler.setFrontLogoutParameterName(name);
+ }
+
+ public void setRelayStateParameterName(final String name) {
+ this.handler.setRelayStateParameterName(name);
+ }
+
+ public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
+ this.handler.setCasServerUrlPrefix(casServerUrlPrefix);
+ }
+
+ public void setSessionMappingStorage(final SessionMappingStorage storage) {
+ this.handler.setSessionMappingStorage(storage);
+ }
+
+ /** {@inheritDoc} */
+ public void invoke(final Request request, final Response response) throws IOException, ServletException {
+ if (this.handler.process(request, response)) {
+ getNext().invoke(request, response);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void sessionEvent(final SessionEvent event) {
+ if (Session.SESSION_DESTROYED_EVENT.equals(event.getType())) {
+ logger.debug("Cleaning up SessionMappingStorage on destroySession event");
+ this.handler.getSessionMappingStorage().removeBySessionById(event.getSession().getId());
+ }
+ }
+
+ /** {@inheritDoc} */
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ logger.info("Starting...");
+ this.handler.init();
+ logger.info("Startup completed.");
+ }
+}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/StaticUriLogoutValve.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/StaticUriLogoutValve.java
new file mode 100644
index 000000000..516f33186
--- /dev/null
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/StaticUriLogoutValve.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.tomcat.v8;
+
+import org.apache.catalina.LifecycleException;
+import org.jasig.cas.client.tomcat.LogoutHandler;
+import org.jasig.cas.client.tomcat.StaticUriLogoutHandler;
+
+/**
+ * Monitors a specific request URI for logout requests.
+ *
+ * @author Scott Battaglia
+ * @author Marvin S. Addison
+ * @version $Revision$ $Date$
+ * @since 3.1.12
+ */
+public final class StaticUriLogoutValve extends AbstractLogoutValve {
+
+ private StaticUriLogoutHandler logoutHandler = new StaticUriLogoutHandler();
+
+ public void setRedirectUrl(final String redirectUrl) {
+ this.logoutHandler.setRedirectUrl(redirectUrl);
+ }
+
+ public void setLogoutUri(final String logoutUri) {
+ this.logoutHandler.setLogoutUri(logoutUri);
+ }
+
+ protected void startInternal() throws LifecycleException {
+ super.startInternal();
+ this.logoutHandler.init();
+ logger.info("Startup completed.");
+ }
+
+ /** {@inheritDoc} */
+ protected LogoutHandler getLogoutHandler() {
+ return this.logoutHandler;
+ }
+}
diff --git a/pom.xml b/pom.xml
index 75886fa02..a5d3ba82d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -252,6 +252,7 @@
cas-client-integration-tomcat-commoncas-client-integration-tomcat-v6cas-client-integration-tomcat-v7
+ cas-client-integration-tomcat-v8
From 71a6113b7397ed698ede3306c1c952663e4e1b53 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 11 Feb 2016 14:53:14 -0500
Subject: [PATCH 199/239] Issue #152 Jetty container-based authn.
---
.../jasig/cas/client/util/ReflectUtils.java | 32 +++
.../cas/client/util/ReflectUtilsTests.java | 24 ++
cas-client-integration-jetty/pom.xml | 106 ++++++++
.../cas/client/jetty/CasAuthentication.java | 45 ++++
.../cas/client/jetty/CasAuthenticator.java | 249 ++++++++++++++++++
.../cas/client/jetty/CasUserIdentity.java | 66 +++++
.../client/jetty/CasAuthenticatorTest.java | 210 +++++++++++++++
.../src/test/resources/jetty/webapp.xml | 14 +
.../src/test/webapp/index.jsp | 9 +
.../src/test/webapp/secure.jsp | 9 +
pom.xml | 1 +
11 files changed, 765 insertions(+)
create mode 100644 cas-client-integration-jetty/pom.xml
create mode 100644 cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthentication.java
create mode 100644 cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
create mode 100644 cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasUserIdentity.java
create mode 100644 cas-client-integration-jetty/src/test/java/org/jasig/cas/client/jetty/CasAuthenticatorTest.java
create mode 100644 cas-client-integration-jetty/src/test/resources/jetty/webapp.xml
create mode 100644 cas-client-integration-jetty/src/test/webapp/index.jsp
create mode 100644 cas-client-integration-jetty/src/test/webapp/secure.jsp
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/ReflectUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/ReflectUtils.java
index 1ec21162e..875959363 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/ReflectUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/ReflectUtils.java
@@ -22,6 +22,7 @@
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
/**
@@ -148,4 +149,35 @@ public static void setProperty(final String propertyName, final Object value, fi
throw new RuntimeException("Error setting property " + propertyName, e);
}
}
+
+ /**
+ * Gets the value of the given declared field on the target object or any of its superclasses.
+ *
+ * @param fieldName Name of field to get.
+ * @param target Target object that possesses field.
+ *
+ * @return Field value.
+ */
+ public static Object getField(final String fieldName, final Object target) {
+ Class> clazz = target.getClass();
+ Field field = null;
+ do {
+ try {
+ field = clazz.getDeclaredField(fieldName);
+ } catch (NoSuchFieldException e) {
+ clazz = clazz.getSuperclass();
+ }
+ } while (field == null && clazz != null);
+ if (field == null) {
+ throw new IllegalArgumentException(fieldName + " does not exist on " + target);
+ }
+ try {
+ if (!field.isAccessible()) {
+ field.setAccessible(true);
+ }
+ return field.get(target);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Error getting field " + fieldName, e);
+ }
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/util/ReflectUtilsTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/util/ReflectUtilsTests.java
index d39e3bbf1..57d741c39 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/util/ReflectUtilsTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/util/ReflectUtilsTests.java
@@ -54,6 +54,18 @@ public void testSetPropertyStringObjectObject() {
assertTrue(bean.isFlag());
}
+ public void testGetField() {
+ final TestBean bean = new TestBean();
+ bean.setName("bob");
+ assertEquals(bean.getName(), ReflectUtils.getField("name", bean));
+ }
+
+ public void testGetFieldSuperclass() {
+ final TestSubBean bean = new TestSubBean();
+ bean.setName("bob");
+ assertEquals(bean.getName(), ReflectUtils.getField("name", bean));
+ }
+
static class TestBean {
private int count;
private boolean flag;
@@ -102,4 +114,16 @@ public void setFlag(boolean flag) {
}
}
+
+ static class TestSubBean extends TestBean {
+ private String state;
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+ }
}
diff --git a/cas-client-integration-jetty/pom.xml b/cas-client-integration-jetty/pom.xml
new file mode 100644
index 000000000..96a28ac7a
--- /dev/null
+++ b/cas-client-integration-jetty/pom.xml
@@ -0,0 +1,106 @@
+
+
+
+ cas-client
+ org.jasig.cas.client
+ 3.4.2-SNAPSHOT
+
+ 4.0.0
+
+ org.jasig.cas.client
+ cas-client-integration-jetty
+ jar
+ Jasig CAS Client for Java - Jetty Container Integration
+
+
+ 9.2.14.v20151106
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.jasig.cas.client
+ cas-client-core
+ ${project.version}
+
+
+ org.eclipse.jetty
+ jetty-security
+ ${jetty.version}
+
+
+
+
+ org.jasig.cas.client
+ cas-client-core
+ ${project.version}
+ test-jar
+ test
+
+
+ org.eclipse.jetty
+ jetty-webapp
+ ${jetty.version}
+ test
+
+
+ org.eclipse.jetty
+ jetty-plus
+ ${jetty.version}
+ test
+
+
+ org.eclipse.jetty
+ jetty-annotations
+ ${jetty.version}
+ test
+
+
+ org.eclipse.jetty
+ apache-jsp
+ ${jetty.version}
+ test
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+ provided
+
+
+
+
+
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthentication.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthentication.java
new file mode 100644
index 000000000..0b8fb2a75
--- /dev/null
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthentication.java
@@ -0,0 +1,45 @@
+package org.jasig.cas.client.jetty;
+
+import org.eclipse.jetty.security.UserAuthentication;
+import org.jasig.cas.client.validation.Assertion;
+
+/**
+ * CAS-specific user authentication.
+ *
+ * @author Marvin S. Addison
+ */
+public class CasAuthentication extends UserAuthentication {
+
+ /** CAS authenticator that produced this authentication. */
+ private final CasAuthenticator authenticator;
+
+ /** CAS ticket that was successfully validated to permit authentication. */
+ private final String ticket;
+
+
+ /**
+ * Creates a new instance.
+ *
+ * @param authenticator The authenticator that produced this authentication.
+ * @param ticket The CAS ticket that was successfully validated to permit authentication.
+ * @param assertion The CAS assertion produced from successful ticket validation.
+ */
+ public CasAuthentication(final CasAuthenticator authenticator, final String ticket, final Assertion assertion) {
+ super(authenticator.getAuthMethod(), new CasUserIdentity(assertion, authenticator.getRoleAttribute()));
+ assert ticket != null : "Ticket cannot be null";
+ assert authenticator != null : "CasAuthenticator cannot be null";
+ this.authenticator = authenticator;
+ this.ticket = ticket;
+ }
+
+ /** @return The CAS ticket that was successfully validated to permit authentication. */
+ public String getTicket() {
+ return ticket;
+ }
+
+ @Override
+ public void logout() {
+ super.logout();
+ this.authenticator.clearCachedAuthentication(ticket);
+ }
+}
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
new file mode 100644
index 000000000..01c2c370d
--- /dev/null
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -0,0 +1,249 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.jetty;
+
+import org.eclipse.jetty.security.Authenticator;
+import org.eclipse.jetty.security.ServerAuthException;
+import org.eclipse.jetty.server.Authentication;
+import org.eclipse.jetty.util.component.AbstractLifeCycle;
+import org.jasig.cas.client.Protocol;
+import org.jasig.cas.client.util.CommonUtils;
+import org.jasig.cas.client.util.ReflectUtils;
+import org.jasig.cas.client.validation.AbstractCasProtocolUrlBasedTicketValidator;
+import org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator;
+import org.jasig.cas.client.validation.Assertion;
+import org.jasig.cas.client.validation.TicketValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * Jetty authenticator component for container-managed CAS authentication.
+ *
NOTE: This component does not support CAS gateway mode.
+ *
+ * @author Marvin S. Addison
+ * @since 3.4.2
+ */
+public class CasAuthenticator extends AbstractLifeCycle implements Authenticator {
+
+ /** Name of authentication method provided by this authenticator. */
+ public static final String AUTH_METHOD = "CAS";
+
+ /** Session attribute used to cache CAS authentication data. */
+ private static final String CACHED_AUTHN_ATTRIBUTE = "org.jasig.cas.client.jetty.Authentication";
+
+ /** Logger instance. */
+ private final Logger logger = LoggerFactory.getLogger(CasAuthenticator.class);
+
+ /** Map of tickets to sessions. */
+ private final ConcurrentMap sessionMap = new ConcurrentHashMap();
+
+ /** CAS ticket validator component. */
+ private TicketValidator ticketValidator;
+
+ /** Space-delimited ist of server names. */
+ private String serverNames;
+
+ /** CAS principal attribute containing role data. */
+ private String roleAttribute;
+
+ /** URL to /login URI on CAS server. */
+ private String casServerLoginUrl;
+
+ /** Protocol used by ticket validator. */
+ private Protocol protocol;
+
+ /** CAS renew parameter. */
+ private boolean renew;
+
+
+ /**
+ * Sets the CAS ticket validator component.
+ *
+ * @param ticketValidator Ticket validator, MUST NOT be null.
+ */
+ public void setTicketValidator(final TicketValidator ticketValidator) {
+ assert ticketValidator != null : "TicketValidator cannot be null";
+ if (ticketValidator instanceof AbstractUrlBasedTicketValidator) {
+ if (ticketValidator instanceof AbstractCasProtocolUrlBasedTicketValidator) {
+ protocol = Protocol.CAS2;
+ } else {
+ protocol = Protocol.SAML11;
+ }
+ casServerLoginUrl = ReflectUtils.getField("casServerUrlPrefix", ticketValidator) + "/login";
+ renew = (Boolean) ReflectUtils.getField("renew", ticketValidator);
+ } else {
+ throw new IllegalArgumentException("Unsupported ticket validator " + ticketValidator);
+ }
+ this.ticketValidator = ticketValidator;
+ }
+
+ /**
+ * Sets the names of the server host running Jetty.
+ *
+ * @param nameList Space-delimited list of one or more server names, e.g. "www1.example.com www2.example.com".
+ * MUST NOT be blank.
+ */
+ public void setServerNames(final String nameList) {
+ CommonUtils.isNotBlank(nameList);
+ this.serverNames = nameList;
+ }
+
+ /** @return The name of the CAS principal attribute that contains role data. */
+ public String getRoleAttribute() {
+ return roleAttribute;
+ }
+
+ /**
+ * Sets the name of the CAS principal attribute that contains role data.
+ *
+ * @param roleAttribute Role attribute name. MUST NOT be blank.
+ */
+ public void setRoleAttribute(final String roleAttribute) {
+ CommonUtils.isNotBlank(roleAttribute);
+ this.roleAttribute = roleAttribute;
+ }
+
+ @Override
+ public void setConfiguration(final AuthConfiguration configuration) {
+ // Nothing to do
+ // All configuration must be via CAS-specific setter methods
+ }
+
+ @Override
+ public String getAuthMethod() {
+ return AUTH_METHOD;
+ }
+
+ @Override
+ public void prepareRequest(final ServletRequest request) {
+ // Nothing to do
+ }
+
+ @Override
+ public Authentication validateRequest(
+ final ServletRequest servletRequest, final ServletResponse servletResponse, final boolean mandatory)
+ throws ServerAuthException {
+
+ final HttpServletRequest request = (HttpServletRequest) servletRequest;
+ final HttpServletResponse response = (HttpServletResponse) servletResponse;
+
+ CasAuthentication authentication = fetchCachedAuthentication(request);
+ if (!mandatory) {
+ if (authentication != null) {
+ return authentication;
+ }
+ return Authentication.UNAUTHENTICATED;
+ }
+
+ String ticket;
+ for (final Protocol protocol : Protocol.values()) {
+ ticket = request.getParameter(protocol.getArtifactParameterName());
+ if (ticket != null) {
+ try {
+ logger.debug("Attempting to validate {}", ticket);
+ final Assertion assertion = ticketValidator.validate(ticket, serviceUrl(request, response));
+ logger.debug("Successfully authenticated {}", assertion.getPrincipal());
+ authentication = new CasAuthentication(this, ticket, assertion);
+ cacheAuthentication(request, authentication);
+ } catch (Exception e) {
+ throw new ServerAuthException("CAS ticket validation failed", e);
+ }
+ }
+ }
+
+ if (authentication != null) {
+ return authentication;
+ }
+ redirectToCas(request, response);
+ return Authentication.SEND_CONTINUE;
+ }
+
+ @Override
+ public boolean secureResponse(
+ final ServletRequest request,
+ final ServletResponse response,
+ final boolean mandatory,
+ final Authentication.User user) throws ServerAuthException {
+ return true;
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ if (ticketValidator == null) {
+ throw new RuntimeException("TicketValidator cannot be null");
+ }
+ if (serverNames == null) {
+ throw new RuntimeException("ServerNames cannot be null");
+ }
+ }
+
+ protected void clearCachedAuthentication(final String ticket) {
+ sessionMap.remove(ticket);
+ }
+
+ private void cacheAuthentication(final HttpServletRequest request, final CasAuthentication authentication) {
+ final HttpSession session = request.getSession(false);
+ if (session != null) {
+ session.setAttribute(CACHED_AUTHN_ATTRIBUTE, authentication);
+ sessionMap.put(authentication.getTicket(), session);
+ }
+ }
+
+ private CasAuthentication fetchCachedAuthentication(final HttpServletRequest request) {
+ final HttpSession session = request.getSession(false);
+ if (session != null) {
+ return (CasAuthentication) session.getAttribute(CACHED_AUTHN_ATTRIBUTE);
+ }
+ return null;
+ }
+
+ private String serviceUrl(final HttpServletRequest request, final HttpServletResponse response) {
+ return CommonUtils.constructServiceUrl(
+ request,
+ response,
+ null,
+ serverNames,
+ protocol.getServiceParameterName(),
+ protocol.getArtifactParameterName(),
+ true);
+ }
+
+ private void redirectToCas(
+ final HttpServletRequest request, final HttpServletResponse response) throws ServerAuthException {
+ try {
+ final String redirectUrl = CommonUtils.constructRedirectUrl(
+ casServerLoginUrl, protocol.getServiceParameterName(), serviceUrl(request, response), renew, false);
+ logger.debug("Redirecting to {}", redirectUrl);
+ response.sendRedirect(redirectUrl);
+ } catch (IOException e) {
+ logger.debug("Redirect to CAS failed with error: {}", e);
+ throw new ServerAuthException("Redirect to CAS failed", e);
+ }
+ }
+
+}
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasUserIdentity.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasUserIdentity.java
new file mode 100644
index 000000000..200e62614
--- /dev/null
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasUserIdentity.java
@@ -0,0 +1,66 @@
+package org.jasig.cas.client.jetty;
+
+import org.eclipse.jetty.server.UserIdentity;
+import org.jasig.cas.client.authentication.AttributePrincipal;
+import org.jasig.cas.client.validation.Assertion;
+
+import javax.security.auth.Subject;
+import java.security.Principal;
+import java.util.Collection;
+
+/**
+ * CAS user identity backed by assertion data.
+ *
+ * @author Marvin S. Addison
+ */
+public class CasUserIdentity implements UserIdentity {
+
+ /** CAS principal. */
+ private AttributePrincipal principal;
+
+ /** Assertion attribute containing role data. */
+ private String roleAttribute;
+
+
+ /**
+ * Creates a new instance from a CAS assertion containing principal information.
+ *
+ * @param assertion CAS assertion resulting from successful ticket validation.
+ * @param roleAttribute Principal attribute containing role data.
+ */
+ public CasUserIdentity(final Assertion assertion, final String roleAttribute) {
+ assert assertion != null : "Assertion cannot be null";
+ this.principal = assertion.getPrincipal();
+ this.roleAttribute = roleAttribute;
+ }
+
+ @Override
+ public Subject getSubject() {
+ final Subject subject = new Subject();
+ subject.getPrincipals().add(principal);
+ return subject;
+ }
+
+ @Override
+ public Principal getUserPrincipal() {
+ return principal;
+ }
+
+ @Override
+ public boolean isUserInRole(final String role, final Scope scope) {
+ if (roleAttribute != null) {
+ final Object value = principal.getAttributes().get(roleAttribute);
+ if (value instanceof Collection) {
+ return ((Collection) value).contains(role);
+ } else if (value instanceof String) {
+ return value.equals(role);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return principal.getName();
+ }
+}
diff --git a/cas-client-integration-jetty/src/test/java/org/jasig/cas/client/jetty/CasAuthenticatorTest.java b/cas-client-integration-jetty/src/test/java/org/jasig/cas/client/jetty/CasAuthenticatorTest.java
new file mode 100644
index 000000000..462f35300
--- /dev/null
+++ b/cas-client-integration-jetty/src/test/java/org/jasig/cas/client/jetty/CasAuthenticatorTest.java
@@ -0,0 +1,210 @@
+package org.jasig.cas.client.jetty;
+
+import org.apache.tomcat.InstanceManager;
+import org.apache.tomcat.SimpleInstanceManager;
+import org.eclipse.jetty.annotations.ServletContainerInitializersStarter;
+import org.eclipse.jetty.apache.jsp.JettyJasperInitializer;
+import org.eclipse.jetty.jsp.JettyJspServlet;
+import org.eclipse.jetty.plus.annotation.ContainerInitializer;
+import org.eclipse.jetty.security.ConstraintMapping;
+import org.eclipse.jetty.security.ConstraintSecurityHandler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.security.Constraint;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.jasig.cas.client.PublicTestHttpServer;
+import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.CharBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ * Unit test for {@link CasAuthenticator}.
+ *
+ * @author Marvin S. Addison
+ */
+public class CasAuthenticatorTest {
+
+ private static final Server server = new Server(8080);
+ private static final CasAuthenticator authenticator = new CasAuthenticator();
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ final WebAppContext context = new WebAppContext();
+ context.setContextPath("/webapp");
+ String workingDir = new File(".").getAbsolutePath();
+ workingDir = workingDir.substring(0, workingDir.length() - 2);
+ final String webappDir;
+ if (workingDir.endsWith("/cas-client-integration-jetty")) {
+ webappDir = workingDir + "/src/test/webapp";
+ } else {
+ webappDir = workingDir + "/cas-client-integration-jetty/src/test/webapp";
+ }
+ context.setWar(webappDir);
+
+
+ // JSP config from https://github.com/jetty-project/embedded-jetty-jsp/
+ System.setProperty("org.apache.jasper.compiler.disablejsr199", "false");
+ context.setAttribute("javax.servlet.context.tempdir", getScratchDir());
+ context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
+ ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/.*taglibs.*\\.jar$");
+ context.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
+ context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
+ context.addBean(new ServletContainerInitializersStarter(context), true);
+ context.addServlet(jspServletHolder(), "*.jsp");
+
+ // Wire up CAS authentication
+ authenticator.setServerNames("localhost:8080");
+ authenticator.setTicketValidator(new Cas20ServiceTicketValidator("http://localhost:8081/cas"));
+
+ // Configure security handling for webapp context
+ final ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
+ final Constraint constraint = new Constraint("CasRealm", Constraint.ANY_AUTH);
+ constraint.setAuthenticate(true);
+ final ConstraintMapping secureMapping = new ConstraintMapping();
+ secureMapping.setPathSpec("/secure.jsp");
+ secureMapping.setConstraint(constraint);
+ securityHandler.addConstraintMapping(secureMapping);
+ securityHandler.setAuthenticator(authenticator);
+ context.setSecurityHandler(securityHandler);
+
+ // Add webapp context and start the server
+ server.setHandler(context);
+ server.start();
+ }
+
+ @Test
+ public void testValidateRequestPublicPageNoTicket() throws Exception {
+ final HttpURLConnection uc = openConnection("http://localhost:8080/webapp/");
+ try {
+ assertEquals(200, uc.getResponseCode());
+ assertTrue(readOutput(uc).contains("Welcome everyone"));
+ } finally {
+ uc.disconnect();
+ }
+ }
+
+ @Test
+ public void testValidateRequestPublicPageWithTicket() throws Exception {
+ final HttpURLConnection uc = openConnection("http://localhost:8080/webapp/?ticket=ST-12345");
+ try {
+ assertEquals(200, uc.getResponseCode());
+ assertTrue(readOutput(uc).contains("Welcome everyone"));
+ } finally {
+ uc.disconnect();
+ }
+ }
+
+ @Test
+ public void testValidateRequestSecurePageNoTicket() throws Exception {
+ final HttpURLConnection uc = openConnection("http://localhost:8080/webapp/secure.jsp");
+ try {
+ assertEquals(302, uc.getResponseCode());
+ assertEquals(
+ "http://localhost:8081/cas/login?service=http%3A%2F%2Flocalhost%3A8080%2Fwebapp%2Fsecure.jsp",
+ uc.getHeaderField("Location"));
+ } finally {
+ uc.disconnect();
+ }
+ }
+
+ @Test
+ public void testValidateRequestSecurePageWithTicket() throws Exception {
+ final String successResponse = "" +
+ "" +
+ "bob" +
+ "" +
+ "";
+ final PublicTestHttpServer server = PublicTestHttpServer.instance(8081);
+ server.content = successResponse.getBytes(StandardCharsets.UTF_8);
+ final HttpURLConnection uc = openConnection("http://localhost:8080/webapp/secure.jsp?ticket=ST-12345");
+ try {
+ assertEquals(200, uc.getResponseCode());
+ assertTrue(readOutput(uc).contains("Hello bob"));
+ } finally {
+ uc.disconnect();
+ }
+ }
+
+ @AfterClass
+ public static void afterClass() throws Exception {
+ server.stop();
+ }
+
+ private String readOutput(final URLConnection connection) throws IOException {
+ final InputStreamReader reader = new InputStreamReader(connection.getInputStream());
+ final StringBuilder builder = new StringBuilder();
+ final CharBuffer buffer = CharBuffer.allocate(1024);
+ try {
+ while (reader.read(buffer) > 0) {
+ builder.append(buffer.flip());
+ buffer.clear();
+ }
+ } finally {
+ reader.close();
+ }
+ return builder.toString();
+ }
+
+ private static File getScratchDir() throws IOException
+ {
+ final File tempDir = new File(System.getProperty("java.io.tmpdir"));
+ final File scratchDir = new File(tempDir.toString(), "embedded-jetty-jsp");
+
+ if (!scratchDir.exists())
+ {
+ if (!scratchDir.mkdirs())
+ {
+ throw new IOException("Unable to create scratch directory: " + scratchDir);
+ }
+ }
+ return scratchDir;
+ }
+
+ /**
+ * Ensure the jsp engine is initialized correctly
+ */
+ private static List jspInitializers()
+ {
+ return Collections.singletonList(new ContainerInitializer(new JettyJasperInitializer(), null));
+ }
+
+ /**
+ * Create JSP Servlet (must be named "jsp")
+ */
+ private static ServletHolder jspServletHolder()
+ {
+ final ServletHolder holderJsp = new ServletHolder("jsp", JettyJspServlet.class);
+ holderJsp.setInitOrder(0);
+ holderJsp.setInitParameter("logVerbosityLevel", "DEBUG");
+ holderJsp.setInitParameter("fork", "false");
+ holderJsp.setInitParameter("xpoweredBy", "false");
+ holderJsp.setInitParameter("compilerTargetVM", "1.7");
+ holderJsp.setInitParameter("compilerSourceVM", "1.7");
+ holderJsp.setInitParameter("keepgenerated", "true");
+ return holderJsp;
+ }
+
+ private static HttpURLConnection openConnection(final String url) throws IOException {
+ final HttpURLConnection uc;
+ try {
+ uc = (HttpURLConnection) new URL(url).openConnection();
+ } catch (IOException e) {
+ throw new RuntimeException("Invalid URL: " + url, e);
+ }
+ uc.setInstanceFollowRedirects(false);
+ uc.connect();
+ return uc;
+ }
+}
\ No newline at end of file
diff --git a/cas-client-integration-jetty/src/test/resources/jetty/webapp.xml b/cas-client-integration-jetty/src/test/resources/jetty/webapp.xml
new file mode 100644
index 000000000..f3c4fc46f
--- /dev/null
+++ b/cas-client-integration-jetty/src/test/resources/jetty/webapp.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ localhost:8080
+
+
+ http://localhost:8081/cas
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cas-client-integration-jetty/src/test/webapp/index.jsp b/cas-client-integration-jetty/src/test/webapp/index.jsp
new file mode 100644
index 000000000..6d505bba0
--- /dev/null
+++ b/cas-client-integration-jetty/src/test/webapp/index.jsp
@@ -0,0 +1,9 @@
+
+
+
+
+ Welcome Page
+
+
Welcome everyone
+
+
\ No newline at end of file
diff --git a/cas-client-integration-jetty/src/test/webapp/secure.jsp b/cas-client-integration-jetty/src/test/webapp/secure.jsp
new file mode 100644
index 000000000..9add84ee4
--- /dev/null
+++ b/cas-client-integration-jetty/src/test/webapp/secure.jsp
@@ -0,0 +1,9 @@
+
+
+
+
+ Secure Page
+
+
Hello <%=request.getUserPrincipal()%>
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 75886fa02..99bfe0110 100644
--- a/pom.xml
+++ b/pom.xml
@@ -252,6 +252,7 @@
cas-client-integration-tomcat-commoncas-client-integration-tomcat-v6cas-client-integration-tomcat-v7
+ cas-client-integration-jetty
From b551113b53de2d923d6c22b4c6f650a1446ca441 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 11 Feb 2016 15:08:00 -0500
Subject: [PATCH 200/239] Issue #152 Use WeakReference to avoid resource leak.
We don't want to hold a reference to HttpSession objects in the
ticket-to-session mapping that would prevent orphaned or expired sessions
from being purged. WeakReference ensures that won't happen.
---
.../org/jasig/cas/client/jetty/CasAuthenticator.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
index 01c2c370d..14b359b46 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -38,6 +38,7 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
+import java.lang.ref.WeakReference;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -60,7 +61,8 @@ public class CasAuthenticator extends AbstractLifeCycle implements Authenticator
private final Logger logger = LoggerFactory.getLogger(CasAuthenticator.class);
/** Map of tickets to sessions. */
- private final ConcurrentMap sessionMap = new ConcurrentHashMap();
+ private final ConcurrentMap> sessionMap =
+ new ConcurrentHashMap>();
/** CAS ticket validator component. */
private TicketValidator ticketValidator;
@@ -203,14 +205,17 @@ protected void doStart() throws Exception {
}
protected void clearCachedAuthentication(final String ticket) {
- sessionMap.remove(ticket);
+ final WeakReference sessionRef = sessionMap.remove(ticket);
+ if (sessionRef != null && sessionRef.get() != null) {
+ sessionRef.get().removeAttribute(CACHED_AUTHN_ATTRIBUTE);
+ }
}
private void cacheAuthentication(final HttpServletRequest request, final CasAuthentication authentication) {
final HttpSession session = request.getSession(false);
if (session != null) {
session.setAttribute(CACHED_AUTHN_ATTRIBUTE, authentication);
- sessionMap.put(authentication.getTicket(), session);
+ sessionMap.put(authentication.getTicket(), new WeakReference(session));
}
}
From 707ee23da07a2bfa82bcb9bc4dce28f772116fc5 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 11 Feb 2016 15:12:39 -0500
Subject: [PATCH 201/239] Issue #152 Remove unused jetty-maven-plugin.
---
cas-client-integration-jetty/pom.xml | 35 +---------------------------
1 file changed, 1 insertion(+), 34 deletions(-)
diff --git a/cas-client-integration-jetty/pom.xml b/cas-client-integration-jetty/pom.xml
index 96a28ac7a..480acbe3b 100644
--- a/cas-client-integration-jetty/pom.xml
+++ b/cas-client-integration-jetty/pom.xml
@@ -13,43 +13,10 @@
Jasig CAS Client for Java - Jetty Container Integration
+
9.2.14.v20151106
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
org.jasig.cas.client
From 6051619fc858eafc685a751b638f4758d9023d18 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 12 Feb 2016 15:34:19 -0500
Subject: [PATCH 202/239] Issue #152 Fix multiple ticket validation attempt.
---
.../cas/client/jetty/CasAuthenticator.java | 34 +++++++++++--------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
index 14b359b46..0cb10a00d 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -162,22 +162,18 @@ public Authentication validateRequest(
return Authentication.UNAUTHENTICATED;
}
- String ticket;
- for (final Protocol protocol : Protocol.values()) {
- ticket = request.getParameter(protocol.getArtifactParameterName());
- if (ticket != null) {
- try {
- logger.debug("Attempting to validate {}", ticket);
- final Assertion assertion = ticketValidator.validate(ticket, serviceUrl(request, response));
- logger.debug("Successfully authenticated {}", assertion.getPrincipal());
- authentication = new CasAuthentication(this, ticket, assertion);
- cacheAuthentication(request, authentication);
- } catch (Exception e) {
- throw new ServerAuthException("CAS ticket validation failed", e);
- }
+ final String ticket = extractTicket(request);
+ if (ticket != null) {
+ try {
+ logger.debug("Attempting to validate {}", ticket);
+ final Assertion assertion = ticketValidator.validate(ticket, serviceUrl(request, response));
+ logger.debug("Successfully authenticated {}", assertion.getPrincipal());
+ authentication = new CasAuthentication(this, ticket, assertion);
+ cacheAuthentication(request, authentication);
+ } catch (Exception e) {
+ throw new ServerAuthException("CAS ticket validation failed", e);
}
}
-
if (authentication != null) {
return authentication;
}
@@ -251,4 +247,14 @@ private void redirectToCas(
}
}
+ private String extractTicket(final HttpServletRequest request) {
+ String ticket;
+ for (final Protocol protocol : Protocol.values()) {
+ ticket = request.getParameter(protocol.getArtifactParameterName());
+ if (ticket != null) {
+ return ticket;
+ }
+ }
+ return null;
+ }
}
From 3378c5741d11fb13431ff2a34356cc313c439f15 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 12 Feb 2016 16:20:56 -0500
Subject: [PATCH 203/239] Issue #152 Prevent dupe ticket validations.
The ticket parameter can linger in the URL after authentication.
Don't attempt ticket validation if we are already authenticated.
Fixes ticket validation failures on refresh and similar cases.
---
.../cas/client/jetty/CasAuthenticator.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
index 0cb10a00d..513ff55e4 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -155,15 +155,12 @@ public Authentication validateRequest(
final HttpServletResponse response = (HttpServletResponse) servletResponse;
CasAuthentication authentication = fetchCachedAuthentication(request);
- if (!mandatory) {
- if (authentication != null) {
- return authentication;
- }
- return Authentication.UNAUTHENTICATED;
+ if (authentication != null) {
+ return authentication;
}
final String ticket = extractTicket(request);
- if (ticket != null) {
+ if (ticket != null && mandatory) {
try {
logger.debug("Attempting to validate {}", ticket);
final Assertion assertion = ticketValidator.validate(ticket, serviceUrl(request, response));
@@ -176,9 +173,11 @@ public Authentication validateRequest(
}
if (authentication != null) {
return authentication;
+ } else if (mandatory) {
+ redirectToCas(request, response);
+ return Authentication.SEND_CONTINUE;
}
- redirectToCas(request, response);
- return Authentication.SEND_CONTINUE;
+ return Authentication.UNAUTHENTICATED;
}
@Override
@@ -208,7 +207,7 @@ protected void clearCachedAuthentication(final String ticket) {
}
private void cacheAuthentication(final HttpServletRequest request, final CasAuthentication authentication) {
- final HttpSession session = request.getSession(false);
+ final HttpSession session = request.getSession(true);
if (session != null) {
session.setAttribute(CACHED_AUTHN_ATTRIBUTE, authentication);
sessionMap.put(authentication.getTicket(), new WeakReference(session));
From 7fab8ef09123741212559b3926f02b18e20b7bc3 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 12 Feb 2016 16:40:05 -0500
Subject: [PATCH 204/239] Issue #152 Add working Jetty context config files.
---
.../src/test/resources/jetty/context-cas2.xml | 20 ++++++++++++++++++
.../test/resources/jetty/context-saml11.xml | 21 +++++++++++++++++++
.../src/test/resources/jetty/webapp.xml | 14 -------------
3 files changed, 41 insertions(+), 14 deletions(-)
create mode 100644 cas-client-integration-jetty/src/test/resources/jetty/context-cas2.xml
create mode 100644 cas-client-integration-jetty/src/test/resources/jetty/context-saml11.xml
delete mode 100644 cas-client-integration-jetty/src/test/resources/jetty/webapp.xml
diff --git a/cas-client-integration-jetty/src/test/resources/jetty/context-cas2.xml b/cas-client-integration-jetty/src/test/resources/jetty/context-cas2.xml
new file mode 100644
index 000000000..a7864966b
--- /dev/null
+++ b/cas-client-integration-jetty/src/test/resources/jetty/context-cas2.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ /
+ /webapps/yourapp
+
+
+
+ app.example.com
+
+
+ https://cas.example.com/cas
+
+
+
+
+
+
+
diff --git a/cas-client-integration-jetty/src/test/resources/jetty/context-saml11.xml b/cas-client-integration-jetty/src/test/resources/jetty/context-saml11.xml
new file mode 100644
index 000000000..5e1d5adc7
--- /dev/null
+++ b/cas-client-integration-jetty/src/test/resources/jetty/context-saml11.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ /
+ /webapps/yourapp
+
+
+
+ app.example.com
+ memberOf
+
+
+ https://cas.example.com/cas
+
+
+
+
+
+
+
diff --git a/cas-client-integration-jetty/src/test/resources/jetty/webapp.xml b/cas-client-integration-jetty/src/test/resources/jetty/webapp.xml
deleted file mode 100644
index f3c4fc46f..000000000
--- a/cas-client-integration-jetty/src/test/resources/jetty/webapp.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- localhost:8080
-
-
- http://localhost:8081/cas
-
-
-
-
-
-
\ No newline at end of file
From 75d3d3cd8240f880b54d2d7a4761b4db7cfeb81c Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Fri, 19 Feb 2016 10:43:15 -0500
Subject: [PATCH 205/239] Issue #152 Log authentication success at INFO.
---
.../main/java/org/jasig/cas/client/jetty/CasAuthenticator.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
index 513ff55e4..a9a3cfae2 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -164,7 +164,7 @@ public Authentication validateRequest(
try {
logger.debug("Attempting to validate {}", ticket);
final Assertion assertion = ticketValidator.validate(ticket, serviceUrl(request, response));
- logger.debug("Successfully authenticated {}", assertion.getPrincipal());
+ logger.info("Successfully authenticated {}", assertion.getPrincipal());
authentication = new CasAuthentication(this, ticket, assertion);
cacheAuthentication(request, authentication);
} catch (Exception e) {
From 645eb9fdd6874ec5757cc9fa948ce88d40489430 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 7 Mar 2016 07:42:31 -0500
Subject: [PATCH 206/239] Issue #152 Use CommonUtils for null checks.
---
.../java/org/jasig/cas/client/jetty/CasAuthentication.java | 5 +++--
.../java/org/jasig/cas/client/jetty/CasAuthenticator.java | 2 +-
.../java/org/jasig/cas/client/jetty/CasUserIdentity.java | 3 ++-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthentication.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthentication.java
index 0b8fb2a75..831ec7579 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthentication.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthentication.java
@@ -1,6 +1,7 @@
package org.jasig.cas.client.jetty;
import org.eclipse.jetty.security.UserAuthentication;
+import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.Assertion;
/**
@@ -26,8 +27,8 @@ public class CasAuthentication extends UserAuthentication {
*/
public CasAuthentication(final CasAuthenticator authenticator, final String ticket, final Assertion assertion) {
super(authenticator.getAuthMethod(), new CasUserIdentity(assertion, authenticator.getRoleAttribute()));
- assert ticket != null : "Ticket cannot be null";
- assert authenticator != null : "CasAuthenticator cannot be null";
+ CommonUtils.assertNotNull(ticket, "Ticket cannot be null");
+ CommonUtils.assertNotNull(authenticator, "CasAuthenticator cannot be null");
this.authenticator = authenticator;
this.ticket = ticket;
}
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
index a9a3cfae2..355e1d43c 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -89,7 +89,7 @@ public class CasAuthenticator extends AbstractLifeCycle implements Authenticator
* @param ticketValidator Ticket validator, MUST NOT be null.
*/
public void setTicketValidator(final TicketValidator ticketValidator) {
- assert ticketValidator != null : "TicketValidator cannot be null";
+ CommonUtils.assertNotNull(ticketValidator, "TicketValidator cannot be null");
if (ticketValidator instanceof AbstractUrlBasedTicketValidator) {
if (ticketValidator instanceof AbstractCasProtocolUrlBasedTicketValidator) {
protocol = Protocol.CAS2;
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasUserIdentity.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasUserIdentity.java
index 200e62614..aee4212ed 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasUserIdentity.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasUserIdentity.java
@@ -2,6 +2,7 @@
import org.eclipse.jetty.server.UserIdentity;
import org.jasig.cas.client.authentication.AttributePrincipal;
+import org.jasig.cas.client.util.CommonUtils;
import org.jasig.cas.client.validation.Assertion;
import javax.security.auth.Subject;
@@ -29,7 +30,7 @@ public class CasUserIdentity implements UserIdentity {
* @param roleAttribute Principal attribute containing role data.
*/
public CasUserIdentity(final Assertion assertion, final String roleAttribute) {
- assert assertion != null : "Assertion cannot be null";
+ CommonUtils.assertNotNull(assertion, "Assertion cannot be null");
this.principal = assertion.getPrincipal();
this.roleAttribute = roleAttribute;
}
From baa11f8996e2d233bfbb8b91d5e641e5ed149226 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 7 Mar 2016 07:45:50 -0500
Subject: [PATCH 207/239] Issue #152 Fix javadoc typo.
---
.../main/java/org/jasig/cas/client/jetty/CasAuthenticator.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
index 355e1d43c..45167ca1f 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -67,7 +67,7 @@ public class CasAuthenticator extends AbstractLifeCycle implements Authenticator
/** CAS ticket validator component. */
private TicketValidator ticketValidator;
- /** Space-delimited ist of server names. */
+ /** Space-delimited list of server names. */
private String serverNames;
/** CAS principal attribute containing role data. */
From c1c691dcbe5366e58ce292077b96cb5203e5253d Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Mon, 7 Mar 2016 07:51:25 -0500
Subject: [PATCH 208/239] Issue #152 Simplify ticket lookup.
---
.../jasig/cas/client/jetty/CasAuthenticator.java | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
index 45167ca1f..21d4c519e 100644
--- a/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
+++ b/cas-client-integration-jetty/src/main/java/org/jasig/cas/client/jetty/CasAuthenticator.java
@@ -159,7 +159,7 @@ public Authentication validateRequest(
return authentication;
}
- final String ticket = extractTicket(request);
+ final String ticket = request.getParameter(protocol.getArtifactParameterName());
if (ticket != null && mandatory) {
try {
logger.debug("Attempting to validate {}", ticket);
@@ -245,15 +245,4 @@ private void redirectToCas(
throw new ServerAuthException("Redirect to CAS failed", e);
}
}
-
- private String extractTicket(final HttpServletRequest request) {
- String ticket;
- for (final Protocol protocol : Protocol.values()) {
- ticket = request.getParameter(protocol.getArtifactParameterName());
- if (ticket != null) {
- return ticket;
- }
- }
- return null;
- }
}
From e209a32cbfacb4120f23b2149e43733b49c01503 Mon Sep 17 00:00:00 2001
From: Joe Schweitzer
Date: Thu, 17 Mar 2016 12:03:11 -0400
Subject: [PATCH 209/239] Return existing user if session is already
authenticated
---
.../cas/client/integration/atlassian/Jira44CasAuthenticator.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
index 999dc8f5f..2e5045076 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/Jira44CasAuthenticator.java
@@ -52,6 +52,7 @@ public Principal getUser(final HttpServletRequest request, final HttpServletResp
Principal existingUser = getUserFromSession(request);
if (existingUser != null) {
LOGGER.debug("Session found; user already logged in.");
+ return existingUser;
}
final HttpSession session = request.getSession();
From 3c5d77b55c4ae92a062a46492896c9d3392d633f Mon Sep 17 00:00:00 2001
From: BernhardLenz
Date: Mon, 28 Mar 2016 09:02:46 -0400
Subject: [PATCH 210/239] Added Tomcat client v8 to readme and notice files
---
NOTICE | 1 +
README.md | 53 +++++++++++++++----------
cas-client-integration-tomcat-v8/NOTICE | 2 +-
3 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/NOTICE b/NOTICE
index 1011bab71..cde51236d 100644
--- a/NOTICE
+++ b/NOTICE
@@ -39,6 +39,7 @@ This project includes:
Jasig CAS Client for Java - SAML Protocol Support under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 6.x Integration under Apache License Version 2.0
Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
+ Jasig CAS Client for Java - Tomcat 8.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
JavaMail API under Common Development and Distribution License (CDDL) v1.0
diff --git a/README.md b/README.md
index 29c66b743..637cfd34f 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,15 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```
+- Tomcat 8 is provided by this dependency:
+
+```xml
+
+ org.jasig.cas
+ cas-client-integration-tomcat-v8
+ ${java.cas.client.version}
+
+```
## Configuration
@@ -821,27 +830,27 @@ If you have any trouble, you can enable the log of cas in `jboss-logging.xml` by
```
-
-## Tomcat 6/7 Integration
+
+## Tomcat 6/7/8 Integration
The client supports container-based CAS authentication and authorization support for the Tomcat servlet container.
Suppose a single Tomcat container hosts multiple Web applications with similar authentication and authorization needs. Prior to Tomcat container support, each application would require a similar configuration of CAS servlet filters and authorization configuration in the `web.xml` servlet descriptor. Using the new container-based authentication/authorization feature, a single CAS configuration can be applied to the container and leveraged by all Web applications hosted by the container.
-CAS authentication support for Tomcat is based on the Tomcat-specific Realm component. The Realm component has a fairly broad surface area and RealmBase is provided as a convenient superclass for custom implementations; the CAS realm implementations derive from `RealmBase`. Unfortunately RealmBase and related components have proven to change over both major and minor number releases, which requires version-specific CAS components for integration. We have provided two packages with similar components with the hope of supporting all 6.x and 7.x versions. **No support for 5.x is provided.**
+CAS authentication support for Tomcat is based on the Tomcat-specific Realm component. The Realm component has a fairly broad surface area and RealmBase is provided as a convenient superclass for custom implementations; the CAS realm implementations derive from `RealmBase`. Unfortunately RealmBase and related components have proven to change over both major and minor number releases, which requires version-specific CAS components for integration. We have provided 3 packages with similar components with the hope of supporting all 6.x, 7.x and 8.x versions. **No support for 5.x is provided.**
### Component Overview
-In the following discussion of components, only the Tomcat 6.x components are mentioned. The Tomcat 7.0.x components have exactly the same name, but **are in the tomcat.v7 package**, e.g. `org.jasig.cas.client.tomcat.v7.Cas20CasAuthenticator`.
+In the following discussion of components, only the Tomcat 8.x components are mentioned. The Tomcat 7.0.x and 6.0.x components have exactly the same name, but **are in the tomcat.v7 and tomcat.v6 packages**, e.g. `org.jasig.cas.client.tomcat.v7.Cas20CasAuthenticator` or `org.jasig.cas.client.tomcat.v6.Cas20CasAuthenticator`.
#### Authenticators
Authenticators are responsible for performing CAS authentication using a particular protocol. All protocols supported by the Jasig Java CAS client are supported: CAS 1.0, CAS 2.0, and SAML 1.1. The following components provide protocol-specific support:
```
-org.jasig.cas.client.tomcat.v6.Cas10CasAuthenticator
-org.jasig.cas.client.tomcat.v6.Cas20CasAuthenticator
-org.jasig.cas.client.tomcat.v6.Cas20ProxyCasAuthenticator
-org.jasig.cas.client.tomcat.v6.Saml11Authenticator
+org.jasig.cas.client.tomcat.v8.Cas10CasAuthenticator
+org.jasig.cas.client.tomcat.v8.Cas20CasAuthenticator
+org.jasig.cas.client.tomcat.v8.Cas20ProxyCasAuthenticator
+org.jasig.cas.client.tomcat.v8.Saml11Authenticator
```
@@ -849,8 +858,8 @@ org.jasig.cas.client.tomcat.v6.Saml11Authenticator
In terms of CAS configuration, Tomcat realms serve as containers for users and role definitions. The roles defined in a Tomcat realm may be referenced in the web.xml servlet descriptor to define authorization constraints on Web applications hosted by the container. Two sources of user/role data are supported:
```
-org.jasig.cas.client.tomcat.v6.PropertiesCasRealm
-org.jasig.cas.client.tomcat.v6.AssertionCasRealm
+org.jasig.cas.client.tomcat.v8.PropertiesCasRealm
+org.jasig.cas.client.tomcat.v8.AssertionCasRealm
```
`PropertiesCasRealm` uses a Java properties file as a source of static user/role information. This component is conceptually similar to the `MemoryRealm` component that ships with Tomcat and defines user/role data via XML configuration. The PropertiesCasRealm is different in that it explicitly lacks support for passwords, which have no use with CAS.
@@ -865,15 +874,15 @@ A number of Tomcat valves are provided to handle functionality outside Realms an
Logout valves provide a way of destroying the CAS authentication state bound to the container for a particular user/session; the destruction of authenticated state is synonymous with logout for the container and its hosted applications. (Note this does not destroy the CAS SSO session.) The implementations provide various strategies to map a URI onto the state-destroying logout function.
```
-org.jasig.cas.client.tomcat.v6.StaticUriLogoutValve
-org.jasig.cas.client.tomcat.v6.RegexUriLogoutValve
+org.jasig.cas.client.tomcat.v8.StaticUriLogoutValve
+org.jasig.cas.client.tomcat.v8.RegexUriLogoutValve
```
##### SingleSignOutValve
-The `org.jasig.cas.client.tomcat.v6.SingleSignOutValve` allows the container to participate in CAS single sign-out. In particular this valve handles the SAML LogoutRequest message sent from the CAS server that is delivered when the CAS SSO session ends.
+The `org.jasig.cas.client.tomcat.v8.SingleSignOutValve` allows the container to participate in CAS single sign-out. In particular this valve handles the SAML LogoutRequest message sent from the CAS server that is delivered when the CAS SSO session ends.
##### ProxyCallbackValve
-The `org.jasig.cas.client.tomcat.v6.ProxyCallbackValve` provides a handler for watching request URIs for requests that contain a proxy callback request in support of the CAS 2.0 protocol proxy feature.
+The `org.jasig.cas.client.tomcat.v8.ProxyCallbackValve` provides a handler for watching request URIs for requests that contain a proxy callback request in support of the CAS 2.0 protocol proxy feature.
### Container Setup
@@ -903,11 +912,11 @@ Alternatively, CAS configuration can be applied to individual Web applications t
This example also configures the container for CAS single sign-out.
-->
@@ -926,11 +935,11 @@ Alternatively, CAS configuration can be applied to individual Web applications t
-->
@@ -948,11 +957,11 @@ The following example shows how to configure a Context for dynamic role data pro
The attribute used for role data is "memberOf".
-->
diff --git a/cas-client-integration-tomcat-v8/NOTICE b/cas-client-integration-tomcat-v8/NOTICE
index f5ce3c060..4348c0c9f 100644
--- a/cas-client-integration-tomcat-v8/NOTICE
+++ b/cas-client-integration-tomcat-v8/NOTICE
@@ -19,7 +19,7 @@ This project includes:
Jasig CAS Client for Java - Common Tomcat Integration Support under Apache License Version 2.0
Jasig CAS Client for Java - Core under Apache License Version 2.0
Jasig CAS Client for Java - SAML Protocol Support under Apache License Version 2.0
- Jasig CAS Client for Java - Tomcat 7.x Integration under Apache License Version 2.0
+ Jasig CAS Client for Java - Tomcat 8.x Integration under Apache License Version 2.0
Java Servlet API under CDDL + GPLv2 with classpath exception
JCL 1.1.1 implemented over SLF4J under MIT License
Joda-Time under Apache 2
From df932c90c4cb967e9edb1c1580cae6ba3fc7ee4a Mon Sep 17 00:00:00 2001
From: Carl Harris
Date: Fri, 13 May 2016 11:03:11 -0400
Subject: [PATCH 211/239] change git clone URL to reflect new org slug
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 637cfd34f..ce7106f6b 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ All client artifacts are published to Maven central. Depending on functionality,
## Build [](https://travis-ci.org/Jasig/java-cas-client)
```bash
-git clone git@github.com:Jasig/java-cas-client.git
+git clone git@github.com:apereo/java-cas-client.git
cd java-cas-client
mvn clean package
```
From cf9f7ca76e683b85fea4cd0790a2c008425b840a Mon Sep 17 00:00:00 2001
From: cobolgis
Date: Mon, 16 May 2016 16:04:12 +0200
Subject: [PATCH 212/239] Recommended fix for #167.
---
README.md | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index ce7106f6b..48fdc2166 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```xml
- org.jasig.cas
+ org.jasig.cas.clientcas-client-support-saml${java.cas.client.version}
@@ -46,7 +46,7 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```xml
- org.jasig.cas
+ org.jasig.cas.clientcas-client-support-distributed-ehcache${java.cas.client.version}
@@ -56,7 +56,7 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```xml
- org.jasig.cas
+ org.jasig.cas.clientcas-client-support-distributed-memcached${java.cas.client.version}
@@ -66,7 +66,7 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```xml
- org.jasig.cas
+ org.jasig.cas.clientcas-client-integration-atlassian${java.cas.client.version}
@@ -76,7 +76,7 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```xml
- org.jasig.cas
+ org.jasig.cas.clientcas-client-integration-jboss${java.cas.client.version}
@@ -86,7 +86,7 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```xml
- org.jasig.cas
+ org.jasig.cas.clientcas-client-integration-tomcat-v6${java.cas.client.version}
@@ -96,7 +96,7 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```xml
- org.jasig.cas
+ org.jasig.cas.clientcas-client-integration-tomcat-v7${java.cas.client.version}
@@ -106,7 +106,7 @@ files in the modules (`cas-client-integration-jboss` and `cas-client-support-dis
```xml
- org.jasig.cas
+ org.jasig.cas.clientcas-client-integration-tomcat-v8${java.cas.client.version}
From 13fa0d0a0e5471e25b1c4fc4f3380c6c37104b62 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Tue, 24 May 2016 07:53:15 -0400
Subject: [PATCH 213/239] Issue #152 Jetty integration docs.
---
README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/README.md b/README.md
index 48fdc2166..a5bc84447 100644
--- a/README.md
+++ b/README.md
@@ -976,6 +976,70 @@ The following example shows how to configure a Context for dynamic role data pro
```
+
+## Jetty Integration
+Since version 3.4.2, the Java CAS Client supports Jetty container integration via the following module:
+
+```xml
+
+ org.jasig.cas.client
+ cas-client-integration-jetty
+ ${cas-client.version}
+
+```
+
+Both programmatic (embedded) and context configuration are supported.
+
+### Jetty Embedded Configuration
+```
+# CAS configuration parameters
+String hostName = "app.example.com";
+String casServerBaseUrl = "cas.example.com/cas";
+String casRoleAttribute = "memberOf";
+boolean casRenew = false;
+int casTolerance = 5000;
+
+# Jetty wiring
+WebAppContext context = new WebAppContext("/path/to/context", "contextPath");
+context.setTempDirectory("/tmp/jetty/work"));
+context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
+SessionCookieConfig config = context.getSessionHandler().getSessionManager().getSessionCookieConfig();
+config.setHttpOnly(true);
+config.setSecure(true);
+Saml11TicketValidator validator = new Saml11TicketValidator(casServerBaseUrl);
+validator.setRenew(casRenew);
+validator.setTolerance(casTolerance);
+CasAuthenticator authenticator = new CasAuthenticator();
+authenticator.setRoleAttribute(casRoleAttribute);
+authenticator.setServerNames(hostName);
+authenticator.setTicketValidator(validator);
+context.getSecurityHandler().setAuthenticator(authenticator);
+```
+
+### Jetty Context Configuration
+```xml
+
+
+
+
+ /
+ /webapps/yourapp
+
+
+
+ app.example.com
+
+
+ https://cas.example.com/cas
+
+
+
+
+
+
+
+```
+
## Atlassian Integration
The clien includes Atlassian Confluence and JIRA support. Support is enabled by a custom CAS authenticator that extends the default authenticators.
From d35053b362f05b64d0fa3759b56625842fbf2e38 Mon Sep 17 00:00:00 2001
From: "Marvin S. Addison"
Date: Thu, 1 Sep 2016 13:22:01 -0400
Subject: [PATCH 214/239] Log proxy ticket returned from /proxy protocol
endpoint.
---
.../java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
index e80304a29..21c770b17 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/proxy/Cas20ProxyRetriever.java
@@ -94,7 +94,9 @@ public String getProxyTicketIdFor(final String proxyGrantingTicketId, final Stri
return null;
}
- return XmlUtils.getTextForElement(response, "proxyTicket");
+ final String ticket = XmlUtils.getTextForElement(response, "proxyTicket");
+ logger.debug("Got proxy ticket {}", ticket);
+ return ticket;
}
private URL constructUrl(final String proxyGrantingTicketId, final String targetService) {
From a1f85b9eb30620cfb44f59bde52469fb861472b9 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 7 Sep 2016 15:31:39 +0430
Subject: [PATCH 215/239] Let config keys log the name
---
.../org/jasig/cas/client/configuration/ConfigurationKey.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
index da6a3a19f..3e22b2e7b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKey.java
@@ -60,4 +60,9 @@ public String getName() {
public E getDefaultValue() {
return this.defaultValue;
}
+
+ @Override
+ public String toString() {
+ return getName();
+ }
}
From ad1ccbd64be54db0eb661080cd19b4122c08c5ed Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 7 Sep 2016 15:38:46 +0430
Subject: [PATCH 216/239] Minor code adjustments to CommonUtils to use
String.isEmpty()
---
.../java/org/jasig/cas/client/util/CommonUtils.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
index 639b3b48b..7a11e8e5b 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java
@@ -135,7 +135,7 @@ public static void assertFalse(final boolean cond, final String message) {
* @return true if its null or length of 0, false otherwise.
*/
public static boolean isEmpty(final String string) {
- return string == null || string.length() == 0;
+ return string == null || string.isEmpty();
}
/**
@@ -157,7 +157,7 @@ public static boolean isNotEmpty(final String string) {
* @return true if its blank, false otherwise.
*/
public static boolean isBlank(final String string) {
- return isEmpty(string) || string.trim().length() == 0;
+ return isEmpty(string) || string.trim().isEmpty();
}
/**
@@ -193,7 +193,7 @@ public static String constructRedirectUrl(final String casServerLoginUrl, final
* @param value the value to encode.
* @return the encoded value.
*/
- public static String urlEncode(String value) {
+ public static String urlEncode(final String value) {
try {
return URLEncoder.encode(value, "UTF-8");
} catch (final UnsupportedEncodingException e) {
@@ -228,7 +228,7 @@ public static void readAndRespondToProxyReceptorRequest(final HttpServletRequest
protected static String findMatchingServerName(final HttpServletRequest request, final String serverName) {
final String[] serverNames = serverName.split(" ");
- if (serverNames == null || serverNames.length == 0 || serverNames.length == 1) {
+ if (serverNames.length == 0 || serverNames.length == 1) {
return serverName;
}
@@ -323,7 +323,7 @@ public static String constructServiceUrl(final HttpServletRequest request, final
final URIBuilder originalRequestUrl = new URIBuilder(request.getRequestURL().toString(), encode);
originalRequestUrl.setParameters(request.getQueryString());
- URIBuilder builder = null;
+ final URIBuilder builder;
boolean containsScheme = true;
if (!serverName.startsWith("https://") && !serverName.startsWith("http://")) {
From 5e36559b15c3077253f6548bc9dd00c471a372a2 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 7 Sep 2016 15:47:04 +0430
Subject: [PATCH 217/239] Let assertion validity checks to be more flexible
when comparing dates.
---
.../java/org/jasig/cas/client/validation/AssertionImpl.java | 6 ++++++
.../org/jasig/cas/client/validation/AssertionImplTests.java | 5 +++++
2 files changed, 11 insertions(+)
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
index 86e286fd7..14064c126 100644
--- 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
@@ -101,26 +101,32 @@ public AssertionImpl(final AttributePrincipal principal, final Date validFromDat
CommonUtils.assertNotNull(this.attributes, "attributes cannot be null.");
}
+ @Override
public Date getAuthenticationDate() {
return this.authenticationDate;
}
+ @Override
public Date getValidFromDate() {
return this.validFromDate;
}
+ @Override
public Date getValidUntilDate() {
return this.validUntilDate;
}
+ @Override
public Map getAttributes() {
return this.attributes;
}
+ @Override
public AttributePrincipal getPrincipal() {
return this.principal;
}
+ @Override
public boolean isValid() {
if (this.validFromDate == null) {
return true;
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
index de6e8562e..b175523aa 100644
--- 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
@@ -49,6 +49,11 @@ public void testPrincipalConstructor() {
assertNull(assertion.getPrincipal().getProxyTicketFor("test"));
}
+ public void testAssertionValidity() throws Exception {
+ final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL, CONST_ATTRIBUTES);
+ assertTrue(assertion.isValid());
+ }
+
public void testCompleteConstructor() {
final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL, CONST_ATTRIBUTES);
From f404a2ae747fdd25cc923cd52472c5d2802bceba Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 7 Sep 2016 16:10:16 +0430
Subject: [PATCH 218/239] Handle date equality when checking for saml assertion
validity
---
.../java/org/jasig/cas/client/validation/AssertionImpl.java | 3 ++-
.../org/jasig/cas/client/validation/AssertionImplTests.java | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
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
index 14064c126..da40aba07 100644
--- 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
@@ -133,6 +133,7 @@ public boolean isValid() {
}
final Date now = new Date();
- return this.validFromDate.before(now) && (this.validUntilDate == null || this.validUntilDate.after(now));
+ return (this.validFromDate.before(now) || this.validFromDate.equals(now))
+ && (this.validUntilDate == null || this.validUntilDate.after(now) || this.validUntilDate.equals(now));
}
}
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
index b175523aa..335dbe686 100644
--- 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
@@ -18,6 +18,7 @@
*/
package org.jasig.cas.client.validation;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
@@ -50,7 +51,7 @@ public void testPrincipalConstructor() {
}
public void testAssertionValidity() throws Exception {
- final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL, CONST_ATTRIBUTES);
+ final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL, new Date(), new Date(), new Date(), CONST_ATTRIBUTES);
assertTrue(assertion.isValid());
}
From 5ce675434b944f465c3cb0ec0a63560f279f42a8 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 7 Sep 2016 16:12:34 +0430
Subject: [PATCH 219/239] Remove redundant groupId from POM defns
---
cas-client-core/pom.xml | 1 -
cas-client-integration-atlassian/pom.xml | 1 -
cas-client-integration-jboss/pom.xml | 1 -
cas-client-integration-jetty/pom.xml | 1 -
cas-client-integration-tomcat-common/pom.xml | 1 -
cas-client-integration-tomcat-v6/pom.xml | 1 -
cas-client-integration-tomcat-v7/pom.xml | 1 -
cas-client-integration-tomcat-v8/pom.xml | 1 -
cas-client-support-distributed-memcached/pom.xml | 1 -
cas-client-support-saml/pom.xml | 1 -
10 files changed, 10 deletions(-)
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index ea484e125..ead56f86d 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -5,7 +5,6 @@
cas-client4.0.0
- org.jasig.cas.clientcas-client-corejarJasig CAS Client for Java - Core
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index 0a36f5c2b..e9193cb4a 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -5,7 +5,6 @@
cas-client4.0.0
- org.jasig.cas.clientcas-client-integration-atlassianjarJasig CAS Client for Java - Atlassian Integration
diff --git a/cas-client-integration-jboss/pom.xml b/cas-client-integration-jboss/pom.xml
index 62561d528..b1cc9f87f 100644
--- a/cas-client-integration-jboss/pom.xml
+++ b/cas-client-integration-jboss/pom.xml
@@ -5,7 +5,6 @@
cas-client4.0.0
- org.jasig.cas.clientcas-client-integration-jbossjarJasig CAS Client for Java - JBoss Integration
diff --git a/cas-client-integration-jetty/pom.xml b/cas-client-integration-jetty/pom.xml
index 480acbe3b..c97cb1217 100644
--- a/cas-client-integration-jetty/pom.xml
+++ b/cas-client-integration-jetty/pom.xml
@@ -7,7 +7,6 @@
4.0.0
- org.jasig.cas.clientcas-client-integration-jettyjarJasig CAS Client for Java - Jetty Container Integration
diff --git a/cas-client-integration-tomcat-common/pom.xml b/cas-client-integration-tomcat-common/pom.xml
index 337ca4f0d..88e5eff4c 100644
--- a/cas-client-integration-tomcat-common/pom.xml
+++ b/cas-client-integration-tomcat-common/pom.xml
@@ -7,7 +7,6 @@
4.0.0
- org.jasig.cas.clientcas-client-integration-tomcat-commonjarJasig CAS Client for Java - Common Tomcat Integration Support
diff --git a/cas-client-integration-tomcat-v6/pom.xml b/cas-client-integration-tomcat-v6/pom.xml
index 15e34df49..e4e7a41fe 100644
--- a/cas-client-integration-tomcat-v6/pom.xml
+++ b/cas-client-integration-tomcat-v6/pom.xml
@@ -7,7 +7,6 @@
4.0.0
- org.jasig.cas.clientcas-client-integration-tomcat-v6jarJasig CAS Client for Java - Tomcat 6.x Integration
diff --git a/cas-client-integration-tomcat-v7/pom.xml b/cas-client-integration-tomcat-v7/pom.xml
index ea870cb22..5a3355c64 100644
--- a/cas-client-integration-tomcat-v7/pom.xml
+++ b/cas-client-integration-tomcat-v7/pom.xml
@@ -7,7 +7,6 @@
4.0.0
- org.jasig.cas.clientcas-client-integration-tomcat-v7jarJasig CAS Client for Java - Tomcat 7.x Integration
diff --git a/cas-client-integration-tomcat-v8/pom.xml b/cas-client-integration-tomcat-v8/pom.xml
index 531abde57..5dabb76e7 100644
--- a/cas-client-integration-tomcat-v8/pom.xml
+++ b/cas-client-integration-tomcat-v8/pom.xml
@@ -7,7 +7,6 @@
4.0.0
- org.jasig.cas.clientcas-client-integration-tomcat-v8jarJasig CAS Client for Java - Tomcat 8.x Integration
diff --git a/cas-client-support-distributed-memcached/pom.xml b/cas-client-support-distributed-memcached/pom.xml
index bdd79865b..e4eb1c2d6 100644
--- a/cas-client-support-distributed-memcached/pom.xml
+++ b/cas-client-support-distributed-memcached/pom.xml
@@ -7,7 +7,6 @@
4.0.0
- org.jasig.cas.clientjarcas-client-support-distributed-memcachedJasig CAS Client for Java - Distributed Proxy Storage Support:
diff --git a/cas-client-support-saml/pom.xml b/cas-client-support-saml/pom.xml
index ce40fd9d2..d42ce3d36 100644
--- a/cas-client-support-saml/pom.xml
+++ b/cas-client-support-saml/pom.xml
@@ -5,7 +5,6 @@
cas-client4.0.0
- org.jasig.cas.clientcas-client-support-samljarJasig CAS Client for Java - SAML Protocol Support
From c3589440f838582798e0560fd89085aec5ec5582 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Fri, 9 Sep 2016 16:14:06 +0430
Subject: [PATCH 220/239] Updated front-channel SLO handling
---
.../configuration/ConfigurationKeys.java | 1 -
.../client/session/SingleSignOutFilter.java | 7 +-
.../client/session/SingleSignOutHandler.java | 125 +++++-------------
...0ProxyReceivingTicketValidationFilter.java | 2 +-
.../session/SingleSignOutFilterTests.java | 54 ++++----
.../session/SingleSignOutHandlerTests.java | 1 -
.../client/tomcat/v6/SingleSignOutValve.java | 6 +-
.../client/tomcat/v7/SingleSignOutValve.java | 6 +-
.../client/tomcat/v8/SingleSignOutValve.java | 6 +-
9 files changed, 67 insertions(+), 141 deletions(-)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
index 14ec12062..109aadd19 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/configuration/ConfigurationKeys.java
@@ -77,6 +77,5 @@ public interface ConfigurationKeys {
ConfigurationKey ALLOWED_PROXY_CHAINS = new ConfigurationKey("allowedProxyChains", null);
ConfigurationKey> TICKET_VALIDATOR_CLASS = new ConfigurationKey>("ticketValidatorClass", null);
ConfigurationKey PROXY_CALLBACK_URL = new ConfigurationKey("proxyCallbackUrl", null);
- ConfigurationKey FRONT_LOGOUT_PARAMETER_NAME = new ConfigurationKey("frontLogoutParameterName", "SAMLRequest");
ConfigurationKey RELAY_STATE_PARAMETER_NAME = new ConfigurationKey("relayStateParameterName", "RelayState");
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
index 5720a6907..25d645c43 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutFilter.java
@@ -46,7 +46,6 @@ public void init(final FilterConfig filterConfig) throws ServletException {
if (!isIgnoreInitConfiguration()) {
setArtifactParameterName(getString(ConfigurationKeys.ARTIFACT_PARAMETER_NAME));
setLogoutParameterName(getString(ConfigurationKeys.LOGOUT_PARAMETER_NAME));
- setFrontLogoutParameterName(getString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME));
setRelayStateParameterName(getString(ConfigurationKeys.RELAY_STATE_PARAMETER_NAME));
setCasServerUrlPrefix(getString(ConfigurationKeys.CAS_SERVER_URL_PREFIX));
HANDLER.setArtifactParameterOverPost(getBoolean(ConfigurationKeys.ARTIFACT_PARAMETER_OVER_POST));
@@ -63,11 +62,7 @@ public void setArtifactParameterName(final String name) {
public void setLogoutParameterName(final String name) {
HANDLER.setLogoutParameterName(name);
}
-
- public void setFrontLogoutParameterName(final String name) {
- HANDLER.setFrontLogoutParameterName(name);
- }
-
+
public void setRelayStateParameterName(final String name) {
HANDLER.setRelayStateParameterName(name);
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
index de1358239..26932dbc5 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/session/SingleSignOutHandler.java
@@ -57,12 +57,9 @@ public final class SingleSignOutHandler {
/** The name of the artifact parameter. This is used to capture the session identifier. */
private String artifactParameterName = Protocol.CAS2.getArtifactParameterName();
- /** Parameter name that stores logout request for back channel SLO */
+ /** Parameter name that stores logout request for SLO */
private String logoutParameterName = ConfigurationKeys.LOGOUT_PARAMETER_NAME.getDefaultValue();
-
- /** Parameter name that stores logout request for front channel SLO */
- private String frontLogoutParameterName = ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue();
-
+
/** Parameter name that stores the state of the CAS server webflow for the callback */
private String relayStateParameterName = ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue();
@@ -75,7 +72,7 @@ public final class SingleSignOutHandler {
private List safeParameters;
- private LogoutStrategy logoutStrategy = isServlet30() ? new Servlet30LogoutStrategy() : new Servlet25LogoutStrategy();
+ private final LogoutStrategy logoutStrategy = isServlet30() ? new Servlet30LogoutStrategy() : new Servlet25LogoutStrategy();
public void setSessionMappingStorage(final SessionMappingStorage storage) {
this.sessionMappingStorage = storage;
@@ -97,7 +94,7 @@ public void setArtifactParameterName(final String name) {
}
/**
- * @param name Name of parameter containing CAS logout request message for back channel SLO.
+ * @param name Name of parameter containing CAS logout request message for SLO.
*/
public void setLogoutParameterName(final String name) {
this.logoutParameterName = name;
@@ -109,14 +106,7 @@ public void setLogoutParameterName(final String name) {
public void setCasServerUrlPrefix(final String casServerUrlPrefix) {
this.casServerUrlPrefix = casServerUrlPrefix;
}
-
- /**
- * @param name Name of parameter containing CAS logout request message for front channel SLO.
- */
- public void setFrontLogoutParameterName(final String name) {
- this.frontLogoutParameterName = name;
- }
-
+
/**
* @param name Name of parameter containing the state of the CAS server webflow.
*/
@@ -135,7 +125,6 @@ public synchronized void init() {
if (this.safeParameters == null) {
CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null.");
CommonUtils.assertNotNull(this.logoutParameterName, "logoutParameterName cannot be null.");
- CommonUtils.assertNotNull(this.frontLogoutParameterName, "frontLogoutParameterName cannot be null.");
CommonUtils.assertNotNull(this.sessionMappingStorage, "sessionMappingStorage cannot be null.");
CommonUtils.assertNotNull(this.relayStateParameterName, "relayStateParameterName cannot be null.");
CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
@@ -165,32 +154,25 @@ private boolean isTokenRequest(final HttpServletRequest request) {
}
/**
- * Determines whether the given request is a CAS back channel logout request.
- *
- * @param request HTTP request.
- *
- * @return True if request is logout request, false otherwise.
- */
- private boolean isBackChannelLogoutRequest(final HttpServletRequest request) {
- return "POST".equals(request.getMethod())
- && !isMultipartRequest(request)
- && CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName,
- this.safeParameters));
- }
-
- /**
- * Determines whether the given request is a CAS front channel logout request. Front Channel log out requests are only supported
- * when the 'casServerUrlPrefix' value is set.
+ * Determines whether the given request is a CAS logout request.
*
* @param request HTTP request.
*
* @return True if request is logout request, false otherwise.
*/
- private boolean isFrontChannelLogoutRequest(final HttpServletRequest request) {
- return "GET".equals(request.getMethod()) && CommonUtils.isNotBlank(this.casServerUrlPrefix)
- && CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.frontLogoutParameterName));
+ private boolean isLogoutRequest(final HttpServletRequest request) {
+ if ("POST".equalsIgnoreCase(request.getMethod())) {
+ return !isMultipartRequest(request)
+ && CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName,
+ this.safeParameters));
+ }
+
+ if ("GET".equalsIgnoreCase(request.getMethod())) {
+ return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.logoutParameterName, this.safeParameters));
+ }
+ return false;
}
-
+
/**
* Process a request regarding the SLO process: record the session or destroy it.
*
@@ -203,26 +185,15 @@ public boolean process(final HttpServletRequest request, final HttpServletRespon
logger.trace("Received a token request");
recordSession(request);
return true;
-
- } else if (isBackChannelLogoutRequest(request)) {
- logger.trace("Received a back channel logout request");
- destroySession(request);
- return false;
-
- } else if (isFrontChannelLogoutRequest(request)) {
- logger.trace("Received a front channel logout request");
+ }
+
+ if (isLogoutRequest(request)) {
+ logger.trace("Received a logout request");
destroySession(request);
- // redirection url to the CAS server
- final String redirectionUrl = computeRedirectionToServer(request);
- if (redirectionUrl != null) {
- CommonUtils.sendRedirect(response, redirectionUrl);
- }
return false;
-
- } else {
- logger.trace("Ignoring URI for logout: {}", request.getRequestURI());
- return true;
- }
+ }
+ logger.trace("Ignoring URI for logout: {}", request.getRequestURI());
+ return true;
}
/**
@@ -245,7 +216,7 @@ private void recordSession(final HttpServletRequest request) {
try {
this.sessionMappingStorage.removeBySessionById(session.getId());
} catch (final Exception e) {
- // ignore if the session is already marked as invalid. Nothing we can do!
+ // ignore if the session is already marked as invalid. Nothing we can do!
}
sessionMappingStorage.addSessionById(token, session);
}
@@ -286,16 +257,17 @@ private String uncompressLogoutMessage(final String originalMessage) {
* @param request HTTP request containing a CAS logout message.
*/
private void destroySession(final HttpServletRequest request) {
- final String logoutMessage;
- // front channel logout -> the message needs to be base64 decoded + decompressed
- if (isFrontChannelLogoutRequest(request)) {
- logoutMessage = uncompressLogoutMessage(CommonUtils.safeGetParameter(request,
- this.frontLogoutParameterName));
- } else {
- logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName, this.safeParameters);
+ String logoutMessage = CommonUtils.safeGetParameter(request, this.logoutParameterName, this.safeParameters);
+ if (CommonUtils.isBlank(logoutMessage)) {
+ logger.error("Could not locate logout message of the request from {}", this.logoutParameterName);
+ return;
}
+
+ if (!logoutMessage.contains("SessionIndex")) {
+ logoutMessage = uncompressLogoutMessage(logoutMessage);
+ }
+
logger.trace("Logout request:\n{}", logoutMessage);
-
final String token = XmlUtils.getTextForElement(logoutMessage, "SessionIndex");
if (CommonUtils.isNotBlank(token)) {
final HttpSession session = this.sessionMappingStorage.removeSessionByMappingId(token);
@@ -314,33 +286,6 @@ private void destroySession(final HttpServletRequest request) {
}
}
- /**
- * Compute the redirection url to the CAS server when it's a front channel SLO
- * (depending on the relay state parameter).
- *
- * @param request The HTTP request.
- * @return the redirection url to the CAS server.
- */
- private String computeRedirectionToServer(final HttpServletRequest request) {
- final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName);
- // if we have a state value -> redirect to the CAS server to continue the logout process
- if (CommonUtils.isNotBlank(relayStateValue)) {
- final StringBuilder buffer = new StringBuilder();
- buffer.append(casServerUrlPrefix);
- if (!this.casServerUrlPrefix.endsWith("/")) {
- buffer.append("/");
- }
- buffer.append("logout?_eventId=next&");
- buffer.append(this.relayStateParameterName);
- buffer.append("=");
- buffer.append(CommonUtils.urlEncode(relayStateValue));
- final String redirectUrl = buffer.toString();
- logger.debug("Redirection url to the CAS server: {}", redirectUrl);
- return redirectUrl;
- }
- return null;
- }
-
private boolean isMultipartRequest(final HttpServletRequest request) {
return request.getContentType() != null && request.getContentType().toLowerCase().startsWith("multipart");
}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 5fe133715..22cb8302e 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -54,7 +54,7 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
TOLERANCE.getName(), IGNORE_PATTERN.getName(), IGNORE_URL_PATTERN_TYPE.getName(), HOSTNAME_VERIFIER.getName(), HOSTNAME_VERIFIER_CONFIG.getName(),
EXCEPTION_ON_VALIDATION_FAILURE.getName(), REDIRECT_AFTER_VALIDATION.getName(), USE_SESSION.getName(), SECRET_KEY.getName(), CIPHER_ALGORITHM.getName(), PROXY_RECEPTOR_URL.getName(),
PROXY_GRANTING_TICKET_STORAGE_CLASS.getName(), MILLIS_BETWEEN_CLEAN_UPS.getName(), ACCEPT_ANY_PROXY.getName(), ALLOWED_PROXY_CHAINS.getName(), TICKET_VALIDATOR_CLASS.getName(),
- PROXY_CALLBACK_URL.getName(), FRONT_LOGOUT_PARAMETER_NAME.getName(), RELAY_STATE_PARAMETER_NAME.getName()
+ PROXY_CALLBACK_URL.getName(), RELAY_STATE_PARAMETER_NAME.getName()
};
/**
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
index 93fd66515..1a4f4e405 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
@@ -84,32 +84,32 @@ public void backChannelRequest() throws IOException, ServletException {
assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
}
- @Test
- public void frontChannelRequest() throws IOException, ServletException {
- final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
- request.setParameter(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
- request.setQueryString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage);
- request.setMethod("GET");
- final MockHttpSession session = new MockHttpSession();
- SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
- filter.doFilter(request, response, filterChain);
- assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
- assertNull(response.getRedirectedUrl());
- }
+// @Test
+// public void frontChannelRequest() throws IOException, ServletException {
+// final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+// request.setParameter(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
+// request.setQueryString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage);
+// request.setMethod("GET");
+// final MockHttpSession session = new MockHttpSession();
+// SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
+// filter.doFilter(request, response, filterChain);
+// assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
+// assertNull(response.getRedirectedUrl());
+// }
- @Test
- public void frontChannelRequestRelayState() throws IOException, ServletException {
- final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
- request.setParameter(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
- request.setParameter(ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue(), RELAY_STATE);
- request.setQueryString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage + "&" +
- ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE);
- request.setMethod("GET");
- final MockHttpSession session = new MockHttpSession();
- SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
- filter.doFilter(request, response, filterChain);
- assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
- assertEquals(CAS_SERVER_URL_PREFIX + "/logout?_eventId=next&" +
- ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE, response.getRedirectedUrl());
- }
+// @Test
+// public void frontChannelRequestRelayState() throws IOException, ServletException {
+// final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+// request.setParameter(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
+// request.setParameter(ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue(), RELAY_STATE);
+// request.setQueryString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage + "&" +
+// ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE);
+// request.setMethod("GET");
+// final MockHttpSession session = new MockHttpSession();
+// SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
+// filter.doFilter(request, response, filterChain);
+// assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
+// assertEquals(CAS_SERVER_URL_PREFIX + "/logout?_eventId=next&" +
+// ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE, response.getRedirectedUrl());
+// }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
index 365a25ea5..661cb616c 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
@@ -52,7 +52,6 @@ public final class SingleSignOutHandlerTests {
public void setUp() throws Exception {
handler = new SingleSignOutHandler();
handler.setLogoutParameterName(LOGOUT_PARAMETER_NAME);
- handler.setFrontLogoutParameterName(FRONT_LOGOUT_PARAMETER_NAME);
handler.setRelayStateParameterName(RELAY_STATE_PARAMETER_NAME);
handler.setArtifactParameterName(ARTIFACT_PARAMETER_NAME);
handler.setCasServerUrlPrefix(URL);
diff --git a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
index 9941651a8..00c63dc4b 100644
--- a/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v6/src/main/java/org/jasig/cas/client/tomcat/v6/SingleSignOutValve.java
@@ -51,11 +51,7 @@ public void setArtifactParameterName(final String name) {
public void setLogoutParameterName(final String name) {
this.handler.setLogoutParameterName(name);
}
-
- public void setFrontLogoutParameterName(final String name) {
- this.handler.setFrontLogoutParameterName(name);
- }
-
+
public void setRelayStateParameterName(final String name) {
this.handler.setRelayStateParameterName(name);
}
diff --git a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
index 62ac2149b..e7cd85d1e 100644
--- a/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v7/src/main/java/org/jasig/cas/client/tomcat/v7/SingleSignOutValve.java
@@ -55,11 +55,7 @@ public void setArtifactParameterName(final String name) {
public void setLogoutParameterName(final String name) {
this.handler.setLogoutParameterName(name);
}
-
- public void setFrontLogoutParameterName(final String name) {
- this.handler.setFrontLogoutParameterName(name);
- }
-
+
public void setRelayStateParameterName(final String name) {
this.handler.setRelayStateParameterName(name);
}
diff --git a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/SingleSignOutValve.java b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/SingleSignOutValve.java
index 02fe955f2..de775274f 100644
--- a/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/SingleSignOutValve.java
+++ b/cas-client-integration-tomcat-v8/src/main/java/org/jasig/cas/client/tomcat/v8/SingleSignOutValve.java
@@ -55,11 +55,7 @@ public void setArtifactParameterName(final String name) {
public void setLogoutParameterName(final String name) {
this.handler.setLogoutParameterName(name);
}
-
- public void setFrontLogoutParameterName(final String name) {
- this.handler.setFrontLogoutParameterName(name);
- }
-
+
public void setRelayStateParameterName(final String name) {
this.handler.setRelayStateParameterName(name);
}
From 2ca6503a0f406f6db42643e6c0df5113e618c42a Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Fri, 9 Sep 2016 16:22:32 +0430
Subject: [PATCH 221/239] Fixed test cases
---
.../session/SingleSignOutFilterTests.java | 52 +++++++++----------
.../session/SingleSignOutHandlerTests.java | 20 +++----
2 files changed, 33 insertions(+), 39 deletions(-)
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
index 1a4f4e405..a5af91aa3 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutFilterTests.java
@@ -84,32 +84,30 @@ public void backChannelRequest() throws IOException, ServletException {
assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
}
-// @Test
-// public void frontChannelRequest() throws IOException, ServletException {
-// final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
-// request.setParameter(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
-// request.setQueryString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage);
-// request.setMethod("GET");
-// final MockHttpSession session = new MockHttpSession();
-// SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
-// filter.doFilter(request, response, filterChain);
-// assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
-// assertNull(response.getRedirectedUrl());
-// }
+ @Test
+ public void frontChannelRequest() throws IOException, ServletException {
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+ request.setParameter(ConfigurationKeys.LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
+ request.setQueryString(ConfigurationKeys.LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage);
+ request.setMethod("GET");
+ final MockHttpSession session = new MockHttpSession();
+ SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
+ filter.doFilter(request, response, filterChain);
+ assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
+ assertNull(response.getRedirectedUrl());
+ }
-// @Test
-// public void frontChannelRequestRelayState() throws IOException, ServletException {
-// final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
-// request.setParameter(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
-// request.setParameter(ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue(), RELAY_STATE);
-// request.setQueryString(ConfigurationKeys.FRONT_LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage + "&" +
-// ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE);
-// request.setMethod("GET");
-// final MockHttpSession session = new MockHttpSession();
-// SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
-// filter.doFilter(request, response, filterChain);
-// assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
-// assertEquals(CAS_SERVER_URL_PREFIX + "/logout?_eventId=next&" +
-// ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE, response.getRedirectedUrl());
-// }
+ @Test
+ public void frontChannelRequestRelayState() throws IOException, ServletException {
+ final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
+ request.setParameter(ConfigurationKeys.LOGOUT_PARAMETER_NAME.getDefaultValue(), logoutMessage);
+ request.setParameter(ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue(), RELAY_STATE);
+ request.setQueryString(ConfigurationKeys.LOGOUT_PARAMETER_NAME.getDefaultValue() + "=" + logoutMessage + "&" +
+ ConfigurationKeys.RELAY_STATE_PARAMETER_NAME.getDefaultValue() + "=" + RELAY_STATE);
+ request.setMethod("GET");
+ final MockHttpSession session = new MockHttpSession();
+ SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().addSessionById(TICKET, session);
+ filter.doFilter(request, response, filterChain);
+ assertNull(SingleSignOutFilter.getSingleSignOutHandler().getSessionMappingStorage().removeSessionByMappingId(TICKET));
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
index 661cb616c..164a3626a 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/session/SingleSignOutHandlerTests.java
@@ -31,7 +31,6 @@
/**
* @author Matt Brown
- * @version $Revision$ $Date$
* @since 3.2.1
*/
public final class SingleSignOutHandlerTests {
@@ -39,9 +38,8 @@ public final class SingleSignOutHandlerTests {
private final static String ANOTHER_PARAMETER = "anotherParameter";
private final static String TICKET = "ST-xxxxxxxx";
private final static String URL = "http://mycasserver";
- private final static String LOGOUT_PARAMETER_NAME = "logoutRequest2";
- private final static String FRONT_LOGOUT_PARAMETER_NAME = "SAMLRequest2";
- private final static String RELAY_STATE_PARAMETER_NAME = "RelayState2";
+ private final static String LOGOUT_PARAMETER_NAME = "logoutRequest";
+ private final static String RELAY_STATE_PARAMETER_NAME = "RelayState";
private final static String ARTIFACT_PARAMETER_NAME = "ticket2";
private SingleSignOutHandler handler;
@@ -142,8 +140,8 @@ public void frontChannelLogoutFailsIfBadParameter() {
@Test
public void frontChannelLogoutFailsIfNoSessionIndex() {
final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage("");
- request.setParameter(FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
- request.setQueryString(FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
+ request.setParameter(LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setQueryString(LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
@@ -154,8 +152,8 @@ public void frontChannelLogoutFailsIfNoSessionIndex() {
@Test
public void frontChannelLogoutOK() {
final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
- request.setParameter(FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
- request.setQueryString(FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
+ request.setParameter(LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setQueryString(LOGOUT_PARAMETER_NAME + "=" + logoutMessage);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
@@ -167,15 +165,13 @@ public void frontChannelLogoutOK() {
@Test
public void frontChannelLogoutRelayStateOK() {
final String logoutMessage = LogoutMessageGenerator.generateFrontChannelLogoutMessage(TICKET);
- request.setParameter(FRONT_LOGOUT_PARAMETER_NAME, logoutMessage);
+ request.setParameter(LOGOUT_PARAMETER_NAME, logoutMessage);
request.setParameter(RELAY_STATE_PARAMETER_NAME, TICKET);
- request.setQueryString(FRONT_LOGOUT_PARAMETER_NAME + "=" + logoutMessage + "&" + RELAY_STATE_PARAMETER_NAME + "=" + TICKET);
+ request.setQueryString(LOGOUT_PARAMETER_NAME + "=" + logoutMessage + "&" + RELAY_STATE_PARAMETER_NAME + "=" + TICKET);
request.setMethod("GET");
final MockHttpSession session = new MockHttpSession();
handler.getSessionMappingStorage().addSessionById(TICKET, session);
assertFalse(handler.process(request, response));
assertTrue(session.isInvalid());
- assertEquals(URL + "/logout?_eventId=next&" + RELAY_STATE_PARAMETER_NAME + "=" + TICKET,
- response.getRedirectedUrl());
}
}
From 3f7d7e93092545a5d84bcdeaaf844a5ed6964356 Mon Sep 17 00:00:00 2001
From: eghm
Date: Thu, 15 Sep 2016 13:57:11 -1000
Subject: [PATCH 222/239] Log an error message if CAS principle has no
corresponding Confluence principle.
---
.../integration/atlassian/ConfluenceCasAuthenticator.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
index a705ede56..1e06f7ae5 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
@@ -59,6 +59,11 @@ public Principal getUser(final HttpServletRequest request, final HttpServletResp
if (assertion != null) {
final Principal p = getUser(assertion.getPrincipal().getName());
+ // user doesn't exist
+ if (p == null) {
+ LOGGER.error("Principal is null for " + assertion.getPrincipal().getName());
+ }
+
LOGGER.debug("Logging in [{}] from CAS.", p.getName());
session.setAttribute(LOGGED_IN_KEY, p);
From 7e994b37b999cccd9557c36f5b9ddc94411e4497 Mon Sep 17 00:00:00 2001
From: eghm
Date: Mon, 19 Sep 2016 10:14:22 -1000
Subject: [PATCH 223/239] Use parameterized log statement when logging CAS only
principle.
---
.../integration/atlassian/ConfluenceCasAuthenticator.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
index 1e06f7ae5..23212c38b 100644
--- a/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
+++ b/cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/ConfluenceCasAuthenticator.java
@@ -61,7 +61,7 @@ public Principal getUser(final HttpServletRequest request, final HttpServletResp
// user doesn't exist
if (p == null) {
- LOGGER.error("Principal is null for " + assertion.getPrincipal().getName());
+ LOGGER.error("Principal is null for ", assertion.getPrincipal().getName());
}
LOGGER.debug("Logging in [{}] from CAS.", p.getName());
From 3a02f3d592b81b3c1e28f99d6e33cd0164f9b47c Mon Sep 17 00:00:00 2001
From: lizhixiang
Date: Thu, 5 Jan 2017 12:16:16 +0800
Subject: [PATCH 224/239] add setter to ignoreUrlPatternMatcherStrategyClass,
with purpose of injecting UrlPatternMatcherStrategy to AuthenticationFilter
by Spring IOC
---
.../cas/client/authentication/AuthenticationFilter.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
index d5e7fe452..f460c8824 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/authentication/AuthenticationFilter.java
@@ -212,4 +212,10 @@ private boolean isRequestUrlExcluded(final HttpServletRequest request) {
final String requestUri = urlBuffer.toString();
return this.ignoreUrlPatternMatcherStrategyClass.matches(requestUri);
}
+
+ public final void setIgnoreUrlPatternMatcherStrategyClass(
+ final UrlPatternMatcherStrategy ignoreUrlPatternMatcherStrategyClass) {
+ this.ignoreUrlPatternMatcherStrategyClass = ignoreUrlPatternMatcherStrategyClass;
+ }
+
}
From 4cb1eb49468c99764d88d926dcb58edea85a67fa Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Tue, 25 Apr 2017 09:28:10 -0700
Subject: [PATCH 225/239] Fix formatting issues with the markdown title
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a5bc84447..ebdfe9f5b 100644
--- a/README.md
+++ b/README.md
@@ -229,7 +229,7 @@ The SAML 1.1 `AuthenticationFilter` is what detects whether a user needs to be a
| `encodeServiceUrl ` | Whether the client should auto encode the service url. Defaults to `true` | No
-####org.jasig.cas.client.validation.Cas10TicketValidationFilter
+#### org.jasig.cas.client.validation.Cas10TicketValidationFilter
Validates tickets using the CAS 1.0 Protocol.
```xml
From c00627c2441a8167d98eadbedcae4a03b7d009f1 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 17 May 2017 15:04:42 -0700
Subject: [PATCH 226/239] allow extension points for JSON validation parsing.
add filter and validator
---
.../validation/Cas20ProxyTicketValidator.java | 6 ++-
.../Cas20ServiceTicketValidator.java | 18 ++++++--
...nProxyReceivingTicketValidationFilter.java | 33 +++++++++++++++
.../Cas30JsonServiceTicketValidator.java | 41 +++++++++++++++++++
4 files changed, 94 insertions(+), 4 deletions(-)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonProxyReceivingTicketValidationFilter.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonServiceTicketValidator.java
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
index c97cf216c..bf10e5cab 100644
--- 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
@@ -52,7 +52,7 @@ protected String getUrlSuffix() {
protected void customParseResponse(final String response, final Assertion assertion)
throws TicketValidationException {
- final List proxies = XmlUtils.getTextForElements(response, "proxy");
+ final List proxies = parseProxiesFromResponse(response);
if (proxies == null) {
throw new InvalidProxyChainTicketValidationException(
@@ -85,6 +85,10 @@ protected void customParseResponse(final String response, final Assertion assert
throw new InvalidProxyChainTicketValidationException("Invalid proxy chain: " + proxies.toString());
}
+ protected List parseProxiesFromResponse(final String response) {
+ return XmlUtils.getTextForElements(response, "proxy");
+ }
+
public final void setAcceptAnyProxy(final boolean acceptAnyProxy) {
this.acceptAnyProxy = acceptAnyProxy;
}
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
index 9ecc5b850..e45e50c7e 100644
--- 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
@@ -78,14 +78,14 @@ protected String getUrlSuffix() {
}
protected final Assertion parseResponseFromServer(final String response) throws TicketValidationException {
- final String error = XmlUtils.getTextForElement(response, "authenticationFailure");
+ final String error = parseAuthenticationFailureFromResponse(response);
if (CommonUtils.isNotBlank(error)) {
throw new TicketValidationException(error);
}
- final String principal = XmlUtils.getTextForElement(response, "user");
- final String proxyGrantingTicketIou = XmlUtils.getTextForElement(response, "proxyGrantingTicket");
+ final String principal = parsePrincipalFromResponse(response);
+ final String proxyGrantingTicketIou = parseProxyGrantingTicketFromResponse(response);
final String proxyGrantingTicket;
if (CommonUtils.isBlank(proxyGrantingTicketIou) || this.proxyGrantingTicketStorage == null) {
@@ -113,6 +113,18 @@ protected final Assertion parseResponseFromServer(final String response) throws
return assertion;
}
+ protected String parseProxyGrantingTicketFromResponse(final String response) {
+ return XmlUtils.getTextForElement(response, "proxyGrantingTicket");
+ }
+
+ protected String parsePrincipalFromResponse(final String response) {
+ return XmlUtils.getTextForElement(response, "user");
+ }
+
+ protected String parseAuthenticationFailureFromResponse(final String response) {
+ return XmlUtils.getTextForElement(response, "authenticationFailure");
+ }
+
/**
* Default attribute parsing of attributes that look like the following:
* <cas:attributes>
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonProxyReceivingTicketValidationFilter.java
new file mode 100644
index 000000000..3d8a41ac7
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonProxyReceivingTicketValidationFilter.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at the following location:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jasig.cas.client.validation;
+
+/**
+ * Creates either a Cas30JsonServiceTicketValidator to validate tickets.
+ *
+ * @author Misagh Moayyed
+ */
+public class Cas30JsonProxyReceivingTicketValidationFilter extends Cas30ProxyReceivingTicketValidationFilter {
+
+ public Cas30JsonProxyReceivingTicketValidationFilter() {
+ super();
+ this.defaultServiceTicketValidatorClass = Cas30JsonServiceTicketValidator.class;
+ this.defaultProxyTicketValidatorClass = Cas30JsonServiceTicketValidator.class;
+ }
+}
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonServiceTicketValidator.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonServiceTicketValidator.java
new file mode 100644
index 000000000..39b0fc65e
--- /dev/null
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonServiceTicketValidator.java
@@ -0,0 +1,41 @@
+package org.jasig.cas.client.validation;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This is {@link Cas30JsonServiceTicketValidator}.
+ *
+ * @author Misagh Moayyed
+ */
+public class Cas30JsonServiceTicketValidator extends Cas30ProxyTicketValidator {
+ public Cas30JsonServiceTicketValidator(final String casServerUrlPrefix) {
+ super(casServerUrlPrefix);
+ getCustomParameters().put("format", "JSON");
+ }
+
+ @Override
+ protected List parseProxiesFromResponse(final String response) {
+ return super.parseProxiesFromResponse(response);
+ }
+
+ @Override
+ protected String parseProxyGrantingTicketFromResponse(final String response) {
+ return super.parseProxyGrantingTicketFromResponse(response);
+ }
+
+ @Override
+ protected String parsePrincipalFromResponse(final String response) {
+ return super.parsePrincipalFromResponse(response);
+ }
+
+ @Override
+ protected String parseAuthenticationFailureFromResponse(final String response) {
+ return super.parseAuthenticationFailureFromResponse(response);
+ }
+
+ @Override
+ protected Map extractCustomAttributes(final String xml) {
+ return super.extractCustomAttributes(xml);
+ }
+}
From 6f353a954d33059c93e62fe47ce538a07c7f5d05 Mon Sep 17 00:00:00 2001
From: Misagh Moayyed
Date: Wed, 17 May 2017 15:59:20 -0700
Subject: [PATCH 227/239] allow extension points for JSON validation parsing.
add filter and validator
---
cas-client-core/pom.xml | 5 +
.../validation/Cas20ProxyTicketValidator.java | 4 +-
.../Cas20ServiceTicketValidator.java | 2 +-
.../Cas30JsonServiceTicketValidator.java | 41 ---------
.../Cas30ServiceTicketValidator.java | 2 +-
...nProxyReceivingTicketValidationFilter.java | 6 +-
.../json/Cas30JsonProxyTicketValidator.java | 26 ++++++
.../json/Cas30JsonServiceTicketValidator.java | 51 ++++++++++
.../json/JsonValidationResponseParser.java | 49 ++++++++++
.../json/TicketValidationJsonResponse.java | 92 +++++++++++++++++++
pom.xml | 6 ++
11 files changed, 237 insertions(+), 47 deletions(-)
delete mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas30JsonServiceTicketValidator.java
rename cas-client-core/src/main/java/org/jasig/cas/client/validation/{ => json}/Cas30JsonProxyReceivingTicketValidationFilter.java (84%)
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/json/Cas30JsonProxyTicketValidator.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/json/Cas30JsonServiceTicketValidator.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/json/JsonValidationResponseParser.java
create mode 100644 cas-client-core/src/main/java/org/jasig/cas/client/validation/json/TicketValidationJsonResponse.java
diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index ead56f86d..9d5ceae62 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -35,6 +35,11 @@
true