parent
105bd17b61
commit
06ccec017d
|
|
@ -77,6 +77,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
|
|||
// Do not continue up filter chain
|
||||
return;
|
||||
} else {
|
||||
log.trace("Ignoring URI " + request.getRequestURI());
|
||||
logger.trace("Ignoring URI {}", request.getRequestURI());
|
||||
}
|
||||
|
||||
filterChain.doFilter(servletRequest, servletResponse);
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public final class SingleSignOutHandler {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ import java.util.*;
|
|||
*/
|
||||
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 final class CommonUtils {
|
|||
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("<?xml version=\"1.0\"?>");
|
||||
response.getWriter().write("<casClient:proxySuccess xmlns:casClient=\"http://www.yale.edu/tp/casClient\" />");
|
||||
}
|
||||
|
|
@ -275,9 +266,7 @@ public final class CommonUtils {
|
|||
|
||||
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 final class CommonUtils {
|
|||
}
|
||||
|
||||
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 final class CommonUtils {
|
|||
*/
|
||||
public static String safeGetParameter(final HttpServletRequest request, final String parameter, final List<String> 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 final class CommonUtils {
|
|||
}
|
||||
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 final class CommonUtils {
|
|||
try {
|
||||
response.sendRedirect(url);
|
||||
} catch (final Exception e) {
|
||||
LOG.warn(e.getMessage(), e);
|
||||
LOGGER.warn(e.getMessage(), 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.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 final class DelegatingFilter implements Filter {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ import javax.servlet.ServletRequest;
|
|||
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 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
public final class ErrorRedirectFilter implements Filter {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final List<ErrorHolder> errors = new ArrayList<ErrorHolder>();
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public final class ErrorRedirectFilter implements Filter {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,17 +107,17 @@ public final class HttpServletRequestWrapperFilter extends AbstractConfiguration
|
|||
|
||||
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 final class HttpServletRequestWrapperFilter extends AbstractConfiguration
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 final class XmlUtils {
|
|||
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 final class XmlUtils {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,9 +90,9 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
*/
|
||||
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 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
|
||||
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 abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
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 abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ import javax.net.ssl.HostnameVerifier;
|
|||
*/
|
||||
public abstract class AbstractUrlBasedTicketValidator implements TicketValidator {
|
||||
|
||||
/**
|
||||
* Commons Logging instance.
|
||||
*/
|
||||
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
|
|||
try {
|
||||
CommonUtils.readAndRespondToProxyReceptorRequest(request, response, this.proxyGrantingTicketStorage);
|
||||
} catch (final RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
logger.error(e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public class Cas20ServiceTicketValidator extends AbstractCasProtocolUrlBasedTick
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ public class Saml11TicketValidationFilter extends AbstractTicketValidationFilter
|
|||
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");
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator
|
|||
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 @@ public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,12 @@
|
|||
<scope>provided</scope>
|
||||
<type>jar</type>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ 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;
|
||||
|
|
@ -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 final class Jira44CasAuthenticator extends JiraSeraphAuthenticator {
|
|||
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 final class Jira44CasAuthenticator extends JiraSeraphAuthenticator {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ 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;
|
||||
|
|
@ -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 @@ public final class JiraCasAuthenticator extends DefaultAuthenticator {
|
|||
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 final class JiraCasAuthenticator extends DefaultAuthenticator {
|
|||
|
||||
// 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 final class JiraCasAuthenticator extends DefaultAuthenticator {
|
|||
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 final class JiraCasAuthenticator extends DefaultAuthenticator {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
<groupId>javax.security</groupId>
|
||||
<artifactId>jacc</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
|||
|
|
@ -63,17 +63,17 @@ public final class WebAuthenticationFilter extends AbstractCasFilter {
|
|||
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 final class WebAuthenticationFilter extends AbstractCasFilter {
|
|||
// 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);
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ import javax.servlet.http.HttpServletRequest;
|
|||
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 @@ import org.jasig.cas.client.validation.Assertion;
|
|||
*/
|
||||
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 abstract class AbstractLogoutHandler implements LogoutHandler {
|
|||
|
||||
/** {@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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ import javax.servlet.http.HttpServletRequest;
|
|||
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 @@ import org.jasig.cas.client.validation.TicketValidator;
|
|||
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 class AuthenticatorDelegate {
|
|||
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 class AuthenticatorDelegate {
|
|||
}
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ import java.io.IOException;
|
|||
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 @@ import org.jasig.cas.client.util.CommonUtils;
|
|||
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 class PropertiesCasRealmDelegate implements CasRealm {
|
|||
}
|
||||
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)));
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ import org.apache.catalina.authenticator.AuthenticatorBase;
|
|||
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 @@ import java.security.Principal;
|
|||
*/
|
||||
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 abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
/** {@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());
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ package org.jasig.cas.client.tomcat.v6;
|
|||
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 <code>Realm</code> implementation for all CAS realms.
|
||||
|
|
@ -36,7 +36,7 @@ import org.jasig.cas.client.tomcat.CasRealm;
|
|||
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} */
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import org.apache.catalina.LifecycleException;
|
|||
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 <code>Valve</code> implementation for valves that need Catalina lifecycle
|
||||
|
|
@ -38,7 +38,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
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 abstract class AbstractLifecycleValve extends ValveBase implements Lifecy
|
|||
|
||||
/** {@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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public abstract class AbstractLogoutValve extends AbstractLifecycleValve {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -54,6 +54,6 @@ public class Cas10CasAuthenticator extends AbstractCasAuthenticator {
|
|||
super.start();
|
||||
this.ticketValidator = new Cas10TicketValidator(getCasServerUrlPrefix());
|
||||
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
|
||||
log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,6 @@ public final class Cas20CasAuthenticator extends AbstractCasAuthenticator {
|
|||
this.ticketValidator.setProxyGrantingTicketStorage(ProxyCallbackValve.getProxyGrantingTicketStorage());
|
||||
this.ticketValidator.setRenew(isRenew());
|
||||
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
|
||||
this.log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,6 @@ public final class Cas20ProxyCasAuthenticator extends AbstractCasAuthenticator {
|
|||
this.ticketValidator.setEncoding(getEncoding());
|
||||
}
|
||||
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
|
||||
this.log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class PropertiesCasRealm extends AbstractCasRealm {
|
|||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.delegate.readProperties();
|
||||
this.log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@ public final class ProxyCallbackValve extends AbstractLifecycleValve {
|
|||
} 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public final class RegexUriLogoutValve extends AbstractLogoutValve {
|
|||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.logoutHandler.init();
|
||||
this.log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class Saml11Authenticator extends AbstractAuthenticator {
|
|||
}
|
||||
this.ticketValidator.setRenew(isRenew());
|
||||
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
|
||||
this.log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
protected TicketValidator getTicketValidator() {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class SingleSignOutValve extends AbstractLifecycleValve implements Sessio
|
|||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
handler.init();
|
||||
log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
@ -78,7 +78,7 @@ public class SingleSignOutValve extends AbstractLifecycleValve implements Sessio
|
|||
// 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 @@ public class SingleSignOutValve extends AbstractLifecycleValve implements Sessio
|
|||
/** {@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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public final class StaticUriLogoutValve extends AbstractLogoutValve {
|
|||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.logoutHandler.init();
|
||||
this.log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ import org.apache.catalina.Realm;
|
|||
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 @@ import java.security.Principal;
|
|||
*/
|
||||
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 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
|
||||
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 abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
/** {@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 abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ package org.jasig.cas.client.tomcat.v7;
|
|||
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 @@ import java.io.IOException;
|
|||
*/
|
||||
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 abstract class AbstractLogoutValve extends ValveBase {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ 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.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 @@ public final class ProxyCallbackValve extends ValveBase {
|
|||
} 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public final class RegexUriLogoutValve extends AbstractLogoutValve {
|
|||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.logoutHandler.init();
|
||||
this.log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ 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.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 @@ import org.jasig.cas.client.session.SingleSignOutHandler;
|
|||
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 @@ public class SingleSignOutValve extends ValveBase implements SessionListener {
|
|||
// 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 @@ public class SingleSignOutValve extends ValveBase implements SessionListener {
|
|||
/** {@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 class SingleSignOutValve extends ValveBase implements SessionListener {
|
|||
/** {@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.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public final class StaticUriLogoutValve extends AbstractLogoutValve {
|
|||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.logoutHandler.init();
|
||||
this.log.info("Startup completed.");
|
||||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -24,21 +24,11 @@
|
|||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache-core</artifactId>
|
||||
<version>${ehcache.version}</version>
|
||||
<scope>compile</scope>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -23,12 +23,8 @@ import net.sf.ehcache.Cache;
|
|||
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 final class EhcacheBackedProxyGrantingTicketStorageImpl extends AbstractE
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
24
pom.xml
24
pom.xml
|
|
@ -151,6 +151,30 @@ NwXMoqnmqmUUnosrspqmmmmmmUUnosrspqmmmmmmUUA1jJ
|
|||
|
||||
</plugin>
|
||||
-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-banned-dependencies</id>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<bannedDependencies>
|
||||
<excludes>
|
||||
<exclude>commons-logging</exclude>
|
||||
<exclude>cglib:cglib</exclude>
|
||||
</excludes>
|
||||
</bannedDependencies>
|
||||
</rules>
|
||||
<fail>true</fail>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue