Compare commits
44 Commits
cas-client
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
c516025070 | |
|
|
71e71f15ff | |
|
|
448b08c43c | |
|
|
06f87f85fc | |
|
|
f2c44b7e74 | |
|
|
94d81c32ba | |
|
|
a96a13c630 | |
|
|
06f3ebc7c2 | |
|
|
0dce0aa69e | |
|
|
8a665e1cb1 | |
|
|
dce1a94d9a | |
|
|
76fb6a4f9c | |
|
|
8d38080354 | |
|
|
be803939d8 | |
|
|
af1bbb2f32 | |
|
|
c5a5a9961b | |
|
|
6e2fbec2a4 | |
|
|
638c2d6fe4 | |
|
|
efd6dbb491 | |
|
|
905ce61e82 | |
|
|
3ba892e482 | |
|
|
62cc93399f | |
|
|
cd67d874a2 | |
|
|
46381476e9 | |
|
|
d2538f378d | |
|
|
f14d836e03 | |
|
|
e2e4ea9fa1 | |
|
|
df89820368 | |
|
|
3005cc8607 | |
|
|
e0374d61ac | |
|
|
360ff59ddd | |
|
|
59f42b7edf | |
|
|
409bd553ba | |
|
|
3ec16e8aaf | |
|
|
08bedcf889 | |
|
|
da7ff03cff | |
|
|
5aaf09b3e4 | |
|
|
fd176bc1a7 | |
|
|
9f09c15673 | |
|
|
e4c1df0280 | |
|
|
a00064d1d8 | |
|
|
21d5f37322 | |
|
|
872fc49fb7 | |
|
|
18c79fcf00 |
|
|
@ -27,8 +27,8 @@ pull_request_rules:
|
|||
- label=dependencies
|
||||
actions:
|
||||
merge:
|
||||
method: merge
|
||||
strict: true
|
||||
method: squash
|
||||
strict: false
|
||||
delete_head_branch:
|
||||
- name: automatic merge by renovate
|
||||
conditions:
|
||||
|
|
@ -39,6 +39,6 @@ pull_request_rules:
|
|||
- label=dependencies
|
||||
actions:
|
||||
merge:
|
||||
method: merge
|
||||
strict: true
|
||||
method: squash
|
||||
strict: false
|
||||
delete_head_branch:
|
||||
|
|
|
|||
13
README.md
13
README.md
|
|
@ -723,6 +723,7 @@ cas.validation-type=SAML
|
|||
|
||||
### Available optional properties
|
||||
|
||||
* `cas.single-logout.enabled`
|
||||
* `cas.authentication-url-patterns`
|
||||
* `cas.validation-url-patterns`
|
||||
* `cas.request-wrapper-url-patterns`
|
||||
|
|
@ -793,7 +794,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 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.
|
||||
The `SingleSignOutFilter` can affect character encoding. This becomes most obvious when used in conjunction with applications such as Atlassian Confluence. It's 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
|
||||
|
||||
|
|
@ -801,12 +802,10 @@ The `SingleSignOutFilter` can affect character encoding. This becomes most obvio
|
|||
|----------|-------|-----------
|
||||
| `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
|
||||
| `logoutCallbackPath` | The path which is expected to receive logout callback requests from the CAS server. This is necessary if your app needs access to the raw input stream when handling form posts. If not configured, the default behavior will check every form post for a logout parameter. | No
|
||||
| `casServerUrlPrefix` | URL to root of CAS Web application context. | Yes
|
||||
|
||||
<a name="cas-protocol"></a>
|
||||
#### CAS Protocol
|
||||
|
|
@ -815,10 +814,6 @@ The `SingleSignOutFilter` can affect character encoding. This becomes most obvio
|
|||
<filter>
|
||||
<filter-name>CAS Single Sign Out Filter</filter-name>
|
||||
<filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>casServerUrlPrefix</param-name>
|
||||
<param-value>https://cas.example.com/cas</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
...
|
||||
<filter-mapping>
|
||||
|
|
@ -842,10 +837,6 @@ The `SingleSignOutFilter` can affect character encoding. This becomes most obvio
|
|||
<param-name>artifactParameterName</param-name>
|
||||
<param-value>SAMLart</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>casServerUrlPrefix</param-name>
|
||||
<param-value>https://cas.example.com/cas</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
...
|
||||
<filter-mapping>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
<artifactId>cas-client</artifactId>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -82,6 +82,10 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
|
||||
private UrlPatternMatcherStrategy ignoreUrlPatternMatcherStrategyClass = null;
|
||||
|
||||
private String internalIp = null;
|
||||
|
||||
private static final String X_REAL_IP = "x-real-ip";
|
||||
|
||||
private static final Map<String, Class<? extends UrlPatternMatcherStrategy>> PATTERN_MATCHER_TYPES =
|
||||
new HashMap<String, Class<? extends UrlPatternMatcherStrategy>>();
|
||||
|
||||
|
|
@ -115,6 +119,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
setRenew(getBoolean(ConfigurationKeys.RENEW));
|
||||
setGateway(getBoolean(ConfigurationKeys.GATEWAY));
|
||||
setMethod(getString(ConfigurationKeys.METHOD));
|
||||
setInternalIp(getString(ConfigurationKeys.INTERNAL_IP));
|
||||
|
||||
final String ignorePattern = getString(ConfigurationKeys.IGNORE_PATTERN);
|
||||
final String ignoreUrlPatternType = getString(ConfigurationKeys.IGNORE_URL_PATTERN_TYPE);
|
||||
|
|
@ -169,6 +174,12 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
final HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
final HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
|
||||
if (isInternalRequest(request)) {
|
||||
logger.debug("Request is ignored [internal].");
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRequestUrlExcluded(request)) {
|
||||
logger.debug("Request is ignored.");
|
||||
filterChain.doFilter(request, response);
|
||||
|
|
@ -231,10 +242,24 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
this.casServerLoginUrl = casServerLoginUrl;
|
||||
}
|
||||
|
||||
public void setInternalIp(String internalIp) {
|
||||
this.internalIp = internalIp;
|
||||
}
|
||||
|
||||
public final void setGatewayStorage(final GatewayResolver gatewayStorage) {
|
||||
this.gatewayStorage = gatewayStorage;
|
||||
}
|
||||
|
||||
private boolean isInternalRequest(final HttpServletRequest request) {
|
||||
if (this.internalIp == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String realIp = request.getHeader(X_REAL_IP);
|
||||
|
||||
return this.internalIp.equals(realIp);
|
||||
}
|
||||
|
||||
private boolean isRequestUrlExcluded(final HttpServletRequest request) {
|
||||
if (this.ignoreUrlPatternMatcherStrategyClass == null) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public interface ConfigurationKeys {
|
|||
*/
|
||||
@Deprecated
|
||||
ConfigurationKey<Boolean> DISABLE_XML_SCHEMA_VALIDATION = new ConfigurationKey<Boolean>("disableXmlSchemaValidation", Boolean.FALSE);
|
||||
ConfigurationKey<String> INTERNAL_IP = new ConfigurationKey<String>("internalIp", null);
|
||||
ConfigurationKey<String> IGNORE_PATTERN = new ConfigurationKey<String>("ignorePattern", null);
|
||||
ConfigurationKey<String> IGNORE_URL_PATTERN_TYPE = new ConfigurationKey<String>("ignoreUrlPatternType", "REGEX");
|
||||
ConfigurationKey<Class<? extends HostnameVerifier>> HOSTNAME_VERIFIER = new ConfigurationKey<Class<? extends HostnameVerifier>>("hostnameVerifier", null);
|
||||
|
|
|
|||
|
|
@ -18,16 +18,6 @@
|
|||
*/
|
||||
package org.jasig.cas.client.util;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
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;
|
||||
|
|
@ -37,6 +27,23 @@ import org.jasig.cas.client.validation.ProxyListEditor;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Common utilities so that we don't need to include Commons Lang.
|
||||
*
|
||||
|
|
@ -61,19 +68,20 @@ public final class CommonUtils {
|
|||
|
||||
private static final String SERVICE_PARAMETER_NAMES;
|
||||
|
||||
private CommonUtils() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
static {
|
||||
final Set<String> serviceParameterSet = new HashSet<String>(4);
|
||||
for (final Protocol protocol : Protocol.values()) {
|
||||
serviceParameterSet.add(protocol.getServiceParameterName());
|
||||
}
|
||||
SERVICE_PARAMETER_NAMES = serviceParameterSet.toString()
|
||||
.replaceAll("\\[|\\]", "")
|
||||
.replaceAll("\\s", "");
|
||||
.replaceAll("\\[|\\]", "")
|
||||
.replaceAll("\\s", "");
|
||||
}
|
||||
|
||||
private CommonUtils() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the object is null or not. If it is, throw an exception and
|
||||
* display the message.
|
||||
|
|
@ -183,15 +191,30 @@ public final class CommonUtils {
|
|||
* @return the fully constructed redirect url.
|
||||
*/
|
||||
public static String constructRedirectUrl(final String casServerLoginUrl, final String serviceParameterName,
|
||||
final String serviceUrl, final boolean renew, final boolean gateway, final String method) {
|
||||
final String serviceUrl, final boolean renew, final boolean gateway, final String method) {
|
||||
return casServerLoginUrl + (casServerLoginUrl.contains("?") ? "&" : "?") + serviceParameterName + "="
|
||||
+ urlEncode(serviceUrl) + (renew ? "&renew=true" : "") + (gateway ? "&gateway=true" : "")
|
||||
+ (method != null ? "&method=" + method : "");
|
||||
+ urlEncode(serviceUrl) + (renew ? "&renew=true" : "") + (gateway ? "&gateway=true" : "")
|
||||
+ (method != null ? "&method=" + method : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct redirect url to a CAS server.
|
||||
*
|
||||
* @param casServerLoginUrl the cas server login url
|
||||
* @param serviceParameterName the service parameter name
|
||||
* @param serviceUrl the service url
|
||||
* @param renew the renew
|
||||
* @param gateway the gateway
|
||||
* @return the string
|
||||
*/
|
||||
public static String constructRedirectUrl(final String casServerLoginUrl, final String serviceParameterName,
|
||||
final String serviceUrl, final boolean renew, final boolean gateway) {
|
||||
return constructRedirectUrl(casServerLoginUrl, serviceParameterName, serviceUrl, renew, gateway, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Url encode a value using UTF-8 encoding.
|
||||
*
|
||||
*
|
||||
* @param value the value to encode.
|
||||
* @return the encoded value.
|
||||
*/
|
||||
|
|
@ -204,8 +227,8 @@ public final class CommonUtils {
|
|||
}
|
||||
|
||||
public static void readAndRespondToProxyReceptorRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final ProxyGrantingTicketStorage proxyGrantingTicketStorage)
|
||||
throws IOException {
|
||||
final HttpServletResponse response, final ProxyGrantingTicketStorage proxyGrantingTicketStorage)
|
||||
throws IOException {
|
||||
final String proxyGrantingTicketIou = request.getParameter(PARAM_PROXY_GRANTING_TICKET_IOU);
|
||||
|
||||
final String proxyGrantingTicket = request.getParameter(PARAM_PROXY_GRANTING_TICKET);
|
||||
|
|
@ -216,12 +239,12 @@ public final class CommonUtils {
|
|||
}
|
||||
|
||||
LOGGER.debug("Received proxyGrantingTicketId [{}] for proxyGrantingTicketIou [{}]", proxyGrantingTicket,
|
||||
proxyGrantingTicketIou);
|
||||
proxyGrantingTicketIou);
|
||||
|
||||
proxyGrantingTicketStorage.save(proxyGrantingTicketIou, proxyGrantingTicket);
|
||||
|
||||
LOGGER.debug("Successfully saved proxyGrantingTicketId [{}] for proxyGrantingTicketIou [{}]",
|
||||
proxyGrantingTicket, proxyGrantingTicketIou);
|
||||
proxyGrantingTicket, proxyGrantingTicketIou);
|
||||
|
||||
response.getWriter().write("<?xml version=\"1.0\"?>");
|
||||
response.getWriter().write("<casClient:proxySuccess xmlns:casClient=\"http://www.yale.edu/tp/casClient\" />");
|
||||
|
|
@ -254,7 +277,7 @@ public final class CommonUtils {
|
|||
|
||||
return serverNames[0];
|
||||
}
|
||||
|
||||
|
||||
private static boolean requestIsOnStandardPort(final HttpServletRequest request) {
|
||||
final int serverPort = request.getServerPort();
|
||||
return serverPort == 80 || serverPort == 443;
|
||||
|
|
@ -281,7 +304,7 @@ public final class CommonUtils {
|
|||
final String service, final String serverNames,
|
||||
final String artifactParameterName, final boolean encode) {
|
||||
return constructServiceUrl(request, response, service, serverNames, SERVICE_PARAMETER_NAMES
|
||||
, artifactParameterName, encode);
|
||||
, artifactParameterName, encode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -301,8 +324,8 @@ public final class CommonUtils {
|
|||
* @return the service url to use.
|
||||
*/
|
||||
public static String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response,
|
||||
final String service, final String serverNames, final String serviceParameterName,
|
||||
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;
|
||||
}
|
||||
|
|
@ -330,10 +353,10 @@ public final class CommonUtils {
|
|||
for (final URIBuilder.BasicNameValuePair pair : originalRequestUrl.getQueryParams()) {
|
||||
final String name = pair.getName();
|
||||
if (!name.equals(artifactParameterName) && !serviceParameterNames.contains(name)) {
|
||||
if (name.contains("&") || name.contains("=") ){
|
||||
if (name.contains("&") || name.contains("=")) {
|
||||
final URIBuilder encodedParamBuilder = new URIBuilder();
|
||||
encodedParamBuilder.setParameters(name);
|
||||
for (final URIBuilder.BasicNameValuePair pair2 :encodedParamBuilder.getQueryParams()){
|
||||
for (final URIBuilder.BasicNameValuePair pair2 : encodedParamBuilder.getQueryParams()) {
|
||||
final String name2 = pair2.getName();
|
||||
if (!name2.equals(artifactParameterName) && !serviceParameterNames.contains(name2)) {
|
||||
builder.addParameter(name2, pair2.getValue());
|
||||
|
|
@ -369,13 +392,13 @@ public final class CommonUtils {
|
|||
* @return the value of the parameter.
|
||||
*/
|
||||
public static String safeGetParameter(final HttpServletRequest request, final String parameter,
|
||||
final List<String> parameters) {
|
||||
final List<String> parameters) {
|
||||
if ("POST".equals(request.getMethod()) && parameters.contains(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);
|
||||
.getParameter(parameter);
|
||||
}
|
||||
|
||||
public static String safeGetParameter(final HttpServletRequest request, final String parameter) {
|
||||
|
|
@ -392,11 +415,11 @@ public final class CommonUtils {
|
|||
*/
|
||||
@Deprecated
|
||||
public static String getResponseFromServer(final String constructedUrl, final String encoding) {
|
||||
try {
|
||||
try {
|
||||
return getResponseFromServer(new URL(constructedUrl), DEFAULT_URL_CONNECTION_FACTORY, encoding);
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
|
@ -413,8 +436,8 @@ public final class CommonUtils {
|
|||
* @return the response.
|
||||
*/
|
||||
public static String getResponseFromServer(final URL constructedUrl, final HttpURLConnectionFactory factory,
|
||||
final String encoding) {
|
||||
|
||||
final String encoding) {
|
||||
|
||||
HttpURLConnection conn = null;
|
||||
InputStreamReader in = null;
|
||||
try {
|
||||
|
|
@ -434,13 +457,13 @@ public final class CommonUtils {
|
|||
|
||||
return builder.toString();
|
||||
} catch (final RuntimeException e) {
|
||||
throw e;
|
||||
throw e;
|
||||
} catch (final SSLException e) {
|
||||
LOGGER.error("SSL error getting response from host: {} : Error Message: {}", constructedUrl.getHost(), e.getMessage(), e);
|
||||
throw new RuntimeException(e);
|
||||
} catch (final IOException e) {
|
||||
LOGGER.error("Error getting response from host: [{}] with path: [{}] and protocol: [{}] Error Message: {}",
|
||||
constructedUrl.getHost(), constructedUrl.getPath(), constructedUrl.getProtocol(), e.getMessage(), e);
|
||||
constructedUrl.getHost(), constructedUrl.getPath(), constructedUrl.getProtocol(), e.getMessage(), e);
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
closeQuietly(in);
|
||||
|
|
@ -574,11 +597,11 @@ public final class CommonUtils {
|
|||
case 1: {
|
||||
final char ch0 = str.charAt(0);
|
||||
if (ch0 == 'y' || ch0 == 'Y' ||
|
||||
ch0 == 't' || ch0 == 'T') {
|
||||
ch0 == 't' || ch0 == 'T') {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (ch0 == 'n' || ch0 == 'N' ||
|
||||
ch0 == 'f' || ch0 == 'F') {
|
||||
ch0 == 'f' || ch0 == 'F') {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
break;
|
||||
|
|
@ -587,11 +610,11 @@ public final class CommonUtils {
|
|||
final char ch0 = str.charAt(0);
|
||||
final char ch1 = str.charAt(1);
|
||||
if ((ch0 == 'o' || ch0 == 'O') &&
|
||||
(ch1 == 'n' || ch1 == 'N') ) {
|
||||
(ch1 == 'n' || ch1 == 'N')) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if ((ch0 == 'n' || ch0 == 'N') &&
|
||||
(ch1 == 'o' || ch1 == 'O') ) {
|
||||
(ch1 == 'o' || ch1 == 'O')) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
break;
|
||||
|
|
@ -601,13 +624,13 @@ public final class CommonUtils {
|
|||
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') ) {
|
||||
(ch1 == 'e' || ch1 == 'E') &&
|
||||
(ch2 == 's' || ch2 == 'S')) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if ((ch0 == 'o' || ch0 == 'O') &&
|
||||
(ch1 == 'f' || ch1 == 'F') &&
|
||||
(ch2 == 'f' || ch2 == 'F') ) {
|
||||
(ch1 == 'f' || ch1 == 'F') &&
|
||||
(ch2 == 'f' || ch2 == 'F')) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
break;
|
||||
|
|
@ -618,9 +641,9 @@ public final class CommonUtils {
|
|||
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') ) {
|
||||
(ch1 == 'r' || ch1 == 'R') &&
|
||||
(ch2 == 'u' || ch2 == 'U') &&
|
||||
(ch3 == 'e' || ch3 == 'E')) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
@ -632,10 +655,10 @@ public final class CommonUtils {
|
|||
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') ) {
|
||||
(ch1 == 'a' || ch1 == 'A') &&
|
||||
(ch2 == 'l' || ch2 == 'L') &&
|
||||
(ch3 == 's' || ch3 == 'S') &&
|
||||
(ch4 == 'e' || ch4 == 'E')) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
break;
|
||||
|
|
@ -691,7 +714,7 @@ public final class CommonUtils {
|
|||
* @return the int represented by the string, or the default if conversion fails
|
||||
*/
|
||||
public static int toInt(final String str, final int defaultValue) {
|
||||
if(str == null) {
|
||||
if (str == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0-SNAPSHOT</version>
|
||||
<version>3.6.1</version>
|
||||
<artifactId>cas-client</artifactId>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
<artifactId>cas-client</artifactId>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<properties>
|
||||
<!-- Note Jetty 9.2.x is the last version to support Java SE 7 -->
|
||||
<jetty.version>9.4.21.v20190926</jetty.version>
|
||||
<jetty.version>9.4.25.v20191220</jetty.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-catalina</artifactId>
|
||||
<version>7.0.96</version>
|
||||
<version>7.0.99</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-catalina</artifactId>
|
||||
<version>8.5.46</version>
|
||||
<version>8.5.50</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
@ -50,14 +50,14 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>8.5.46</version>
|
||||
<version>8.5.50</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-catalina</artifactId>
|
||||
<version>8.5.46</version>
|
||||
<version>8.5.50</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
<name>Jasig CAS Client for Java - Tomcat 9.0.x Integration</name>
|
||||
|
||||
<properties>
|
||||
<tomcat.version>9.0.26</tomcat.version>
|
||||
<tomcat.version>9.0.30</tomcat.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>Jasig CAS Client for Java - Distributed Proxy Storage Support: EhCache
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
<artifactId>cas-client</artifactId>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<version>2.10.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
<artifactId>cas-client</artifactId>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -58,6 +58,15 @@
|
|||
<artifactId>spring-context</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
<version>${springboot.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
|
|
@ -74,6 +83,6 @@
|
|||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<springboot.version>2.1.9.RELEASE</springboot.version>
|
||||
<springboot.version>2.2.2.RELEASE</springboot.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ package org.jasig.cas.client.boot.configuration;
|
|||
|
||||
import org.jasig.cas.client.authentication.AuthenticationFilter;
|
||||
import org.jasig.cas.client.authentication.Saml11AuthenticationFilter;
|
||||
import org.jasig.cas.client.session.SingleSignOutFilter;
|
||||
import org.jasig.cas.client.session.SingleSignOutHttpSessionListener;
|
||||
import org.jasig.cas.client.util.AssertionThreadLocalFilter;
|
||||
import org.jasig.cas.client.util.HttpServletRequestWrapperFilter;
|
||||
import org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter;
|
||||
|
|
@ -29,8 +31,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -40,6 +44,7 @@ import java.util.Collection;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* Configuration class providing default CAS client infrastructure filters.
|
||||
|
|
@ -199,4 +204,25 @@ public class CasClientConfiguration {
|
|||
}
|
||||
this.casClientConfigurer = configurers.iterator().next();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "cas", value = "single-logout.enabled", havingValue = "true")
|
||||
public FilterRegistrationBean casSingleSignOutFilter() {
|
||||
final FilterRegistrationBean singleSignOutFilter = new FilterRegistrationBean();
|
||||
singleSignOutFilter.setFilter(new SingleSignOutFilter());
|
||||
Map<String,String> initParameters = new HashMap<>(1);
|
||||
initParameters.put("casServerUrlPrefix", configProps.getServerUrlPrefix());
|
||||
singleSignOutFilter.setInitParameters(initParameters);
|
||||
singleSignOutFilter.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||
return singleSignOutFilter;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "cas", value = "single-logout.enabled", havingValue = "true")
|
||||
public ServletListenerRegistrationBean<EventListener> casSingleSignOutListener(){
|
||||
ServletListenerRegistrationBean<EventListener> singleSignOutListener = new ServletListenerRegistrationBean<>();
|
||||
singleSignOutListener.setListener(new SingleSignOutHttpSessionListener());
|
||||
singleSignOutListener.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||
return singleSignOutListener;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,6 +115,24 @@ public class CasClientConfigurationProperties {
|
|||
|
||||
private Boolean skipTicketValidation = false;
|
||||
|
||||
private SingleLogout singleLogout;
|
||||
|
||||
public static class SingleLogout{
|
||||
/**
|
||||
* whether to receive the single logout request from cas server.
|
||||
*/
|
||||
private boolean enabled = false;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getServerUrlPrefix() {
|
||||
return serverUrlPrefix;
|
||||
}
|
||||
|
|
@ -242,4 +260,13 @@ public class CasClientConfigurationProperties {
|
|||
public void setSkipTicketValidation(final Boolean skipTicketValidation) {
|
||||
this.skipTicketValidation = skipTicketValidation;
|
||||
}
|
||||
|
||||
public SingleLogout getSingleLogout() {
|
||||
return singleLogout;
|
||||
}
|
||||
|
||||
public void setSingleLogout(SingleLogout singleLogout) {
|
||||
this.singleLogout = singleLogout;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
20
pom.xml
20
pom.xml
|
|
@ -26,7 +26,7 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
<connection>scm:git:git@github.com:apereo/java-cas-client.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:apereo/java-cas-client.git</developerConnection>
|
||||
<url>https://github.com/apereo/java-cas-client</url>
|
||||
<tag>cas-client-3.6.0</tag>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<inceptionYear>2006</inceptionYear>
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${basedir}/assembly.xml</descriptor>
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
|
|
@ -144,8 +144,8 @@
|
|||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.mycila.maven-license-plugin</groupId>
|
||||
<artifactId>maven-license-plugin</artifactId>
|
||||
<groupId>com.mycila</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<header>src/licensing/header.txt</header>
|
||||
<skipExistingHeaders>true</skipExistingHeaders>
|
||||
|
|
@ -268,7 +268,7 @@
|
|||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk15on</artifactId>
|
||||
<version>1.63</version>
|
||||
<version>1.64</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -309,10 +309,10 @@
|
|||
</modules>
|
||||
|
||||
<properties>
|
||||
<spring.version>5.2.0.RELEASE</spring.version>
|
||||
<spring.version>5.2.2.RELEASE</spring.version>
|
||||
<ehcache.version>2.6.11</ehcache.version>
|
||||
<clover.version>3.0.2</clover.version>
|
||||
<slf4j.version>1.7.28</slf4j.version>
|
||||
<jackson.version>2.10.0</jackson.version>
|
||||
<slf4j.version>1.7.30</slf4j.version>
|
||||
<jackson.version>2.10.1</jackson.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue