parent
27d89ccb30
commit
f2df7a8603
|
|
@ -27,6 +27,12 @@
|
|||
<version>${opensaml.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -56,6 +62,12 @@
|
|||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -88,7 +100,7 @@
|
|||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<spring.version>2.5.6.SEC01</spring.version>
|
||||
<spring.version>3.1.3.RELEASE</spring.version>
|
||||
<opensaml.version>2.5.1-1</opensaml.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -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 @@ import java.util.Map;
|
|||
* @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 class AttributePrincipalImpl extends SimplePrincipal implements Attribute
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,11 +73,11 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
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 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
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 class AuthenticationFilter extends AbstractCasFilter {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 final class DefaultGatewayResolverImpl implements GatewayResolver {
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -45,14 +45,14 @@ import javax.security.auth.callback.UnsupportedCallbackException;
|
|||
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<TicketCredential,Assertion> ASSERTION_CACHE = new HashMap<TicketCredential,Assertion>();
|
||||
|
||||
/** 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 class CasLoginModule implements LoginModule {
|
|||
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 @@ public class CasLoginModule implements LoginModule {
|
|||
}
|
||||
|
||||
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 class CasLoginModule implements LoginModule {
|
|||
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 class CasLoginModule implements LoginModule {
|
|||
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 class CasLoginModule implements LoginModule {
|
|||
// 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 class CasLoginModule implements LoginModule {
|
|||
}
|
||||
|
||||
public final boolean logout() throws LoginException {
|
||||
log.debug("Performing logout.");
|
||||
logger.debug("Performing logout.");
|
||||
|
||||
if (!preLogout()) {
|
||||
return false;
|
||||
|
|
@ -478,7 +470,7 @@ public class CasLoginModule implements LoginModule {
|
|||
// Remove all CAS credentials
|
||||
removeCredentialsOfType(TicketCredential.class);
|
||||
|
||||
log.info("Logout succeeded.");
|
||||
logger.info("Logout succeeded.");
|
||||
|
||||
postLogout();
|
||||
return true;
|
||||
|
|
@ -520,14 +512,14 @@ public class CasLoginModule implements LoginModule {
|
|||
|
||||
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 @@ public class CasLoginModule implements LoginModule {
|
|||
* 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<Map.Entry<TicketCredential, Assertion>> iter = ASSERTION_CACHE.entrySet().iterator();
|
||||
final Calendar cutoff = Calendar.getInstance();
|
||||
cutoff.setTimeInMillis(System.currentTimeMillis() - this.cacheTimeoutUnit.toMillis(this.cacheTimeout));
|
||||
|
|
@ -595,9 +585,7 @@ public class CasLoginModule implements LoginModule {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 final class Cas20ProxyRetriever implements ProxyRetriever {
|
|||
final String error = XmlUtils.getTextForElement(response, "proxyFailure");
|
||||
|
||||
if (CommonUtils.isNotEmpty(error)) {
|
||||
log.debug(error);
|
||||
logger.debug(error);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ import java.util.*;
|
|||
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 @@ import org.jasig.cas.client.util.CommonUtils;
|
|||
*/
|
||||
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 final class ProxyGrantingTicketStorageImpl implements ProxyGrantingTicket
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String,String> ID_TO_SESSION_KEY_MAPPING = new HashMap<String,String>();
|
||||
|
||||
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 final class HashMapBackedSessionMappingStorage implements SessionMappingS
|
|||
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ package org.jasig.cas.client.session;
|
|||
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 @@ import java.util.List;
|
|||
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 final class SingleSignOutHandler {
|
|||
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 final class SingleSignOutHandler {
|
|||
*/
|
||||
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 final class SingleSignOutHandler {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import javax.naming.NamingException;
|
|||
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 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
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 @@ public abstract class AbstractConfigurationFilter implements Filter {
|
|||
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 @@ public abstract class AbstractConfigurationFilter implements Filter {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ public abstract class AbstractUrlBasedTicketValidator implements TicketValidator
|
|||
protected final String constructValidationUrl(final String ticket, final String serviceUrl) {
|
||||
final Map<String,String> urlParameters = new HashMap<String,String>();
|
||||
|
||||
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 @@ public abstract class AbstractUrlBasedTicketValidator implements TicketValidator
|
|||
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 abstract class AbstractUrlBasedTicketValidator implements TicketValidator
|
|||
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -531,7 +531,11 @@
|
|||
<exclusion>
|
||||
<groupId>jndi</groupId>
|
||||
<artifactId>jndi</artifactId>
|
||||
</exclusion>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
49
pom.xml
49
pom.xml
|
|
@ -162,24 +162,10 @@ NwXMoqnmqmUUnosrspqmmmmmmUUnosrspqmmmmmmUUA1jJ
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.1</version>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>logkit</groupId>
|
||||
<artifactId>logkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>avalon-framework</groupId>
|
||||
<artifactId>avalon-framework</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
|
@ -189,19 +175,20 @@ NwXMoqnmqmUUnosrspqmmmmmmUUnosrspqmmmmmmUUA1jJ
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<modules>
|
||||
<module>cas-client-core</module>
|
||||
<module>cas-client-integration-atlassian</module>
|
||||
<module>cas-client-integration-jboss</module>
|
||||
<module>cas-client-support-distributed-ehcache</module>
|
||||
<module>cas-client-support-distributed-memcached</module>
|
||||
<module>cas-client-integration-tomcat-common</module>
|
||||
<module>cas-client-integration-tomcat-v6</module>
|
||||
<module>cas-client-integration-tomcat-v7</module>
|
||||
</modules>
|
||||
<modules>
|
||||
<module>cas-client-core</module>
|
||||
<module>cas-client-integration-atlassian</module>
|
||||
<module>cas-client-integration-jboss</module>
|
||||
<module>cas-client-support-distributed-ehcache</module>
|
||||
<module>cas-client-support-distributed-memcached</module>
|
||||
<module>cas-client-integration-tomcat-common</module>
|
||||
<module>cas-client-integration-tomcat-v6</module>
|
||||
<module>cas-client-integration-tomcat-v7</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<ehcache.version>2.2.0</ehcache.version>
|
||||
<clover.version>3.0.2</clover.version>
|
||||
</properties>
|
||||
<properties>
|
||||
<ehcache.version>2.2.0</ehcache.version>
|
||||
<clover.version>3.0.2</clover.version>
|
||||
<slf4j.version>1.7.1</slf4j.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue