Logging changes to help confirm functionality of logout valves.
Fix typo in regular expression-based logout valve class name.
This commit is contained in:
Marvin S. Addison 2010-09-21 15:52:16 +00:00
parent b99b45d1ba
commit 4bd7b522cb
11 changed files with 36 additions and 10 deletions

View File

@ -8,6 +8,8 @@ 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;
/**
@ -18,6 +20,10 @@ import org.jasig.cas.client.tomcat.CasRealm;
*
*/
public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
/** Logger instance */
protected final Log log = LogFactory.getLog(getClass());
/** {@inheritDoc} */
public Principal authenticate(final Principal p) {
return getDelegate().authenticate(p);

View File

@ -8,6 +8,7 @@ package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
@ -24,21 +25,29 @@ import java.io.IOException;
public abstract class AbstractLogoutValve extends AbstractLifecycleValve {
public final void invoke(final Request request, final Response response) throws IOException, ServletException {
if (!isLogoutRequest(request)) {
log.debug("Current request URI [ " + request.getRequestURI() + "] is not a logout request.");
this.log.debug("URI is not a logout request: " + request.getRequestURI());
getNext().invoke(request, response);
return;
}
this.log.debug("Processing logout request from CAS server.");
Assertion assertion = null;
final HttpSession httpSession = request.getSession(false);
if (httpSession != null) {
httpSession.removeAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
assertion = (Assertion) httpSession.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
if (assertion != null) {
httpSession.removeAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
}
}
if (assertion != null) {
this.log.info("Succesfully logged out " + assertion.getPrincipal());
} else {
this.log.info("Session already ended.");
}
final String redirectUrl = constructRedirectUrl(request);
if (redirectUrl != null) {
response.sendRedirect(redirectUrl);
}

View File

@ -5,6 +5,7 @@
*/
package org.jasig.cas.client.tomcat.v6;
import org.apache.catalina.LifecycleException;
import org.jasig.cas.client.tomcat.AssertionCasRealmDelegate;
import org.jasig.cas.client.tomcat.CasRealm;
@ -20,6 +21,12 @@ import org.jasig.cas.client.tomcat.CasRealm;
*/
public class AssertionCasRealm extends AbstractCasRealm {
private final AssertionCasRealmDelegate delegate = new AssertionCasRealmDelegate();
/** {@inheritDoc} */
public void start() throws LifecycleException {
super.start();
this.log.info("Startup completed.");
}
/**
* @param name Name of the attribute in the principal that contains role data.

View File

@ -33,6 +33,6 @@ public class Cas10CasAuthenticator extends AbstractCasAuthenticator {
super.start();
this.ticketValidator = new Cas10TicketValidator(getCasServerUrlPrefix());
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
this.log.debug("Startup completed.");
this.log.info("Startup completed.");
}
}

View File

@ -39,6 +39,6 @@ public final class Cas20CasAuthenticator extends AbstractCasAuthenticator {
this.ticketValidator.setProxyGrantingTicketStorage(ProxyCallbackValve.getProxyGrantingTicketStorage());
this.ticketValidator.setRenew(isRenew());
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
this.log.debug("Startup completed.");
this.log.info("Startup completed.");
}
}

View File

@ -54,6 +54,6 @@ public final class Cas20ProxyCasAuthenticator extends AbstractCasAuthenticator {
this.ticketValidator.setEncoding(getEncoding());
}
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
this.log.debug("Startup completed.");
this.log.info("Startup completed.");
}
}

View File

@ -38,6 +38,7 @@ public class PropertiesCasRealm extends AbstractCasRealm {
public void start() throws LifecycleException {
super.start();
delegate.readProperties();
this.log.info("Startup completed.");
}
/** {@inheritDoc} */

View File

@ -57,6 +57,7 @@ public final class ProxyCallbackValve extends AbstractLifecycleValve {
} catch (final Exception e) {
throw new LifecycleException(e);
}
this.log.info("Startup completed.");
}
public void invoke(final Request request, final Response response) throws IOException, ServletException {

View File

@ -19,7 +19,7 @@ import java.util.regex.Pattern;
* @version $Revision$ $Date$
* @since 3.1.12
*/
public final class RegExpBasedLogoutValue extends AbstractLogoutValve {
public final class RegExpBasedLogoutValve extends AbstractLogoutValve {
private String regexpUri;
@ -45,6 +45,7 @@ public final class RegExpBasedLogoutValue extends AbstractLogoutValve {
} catch (final Exception e) {
throw new LifecycleException(e);
}
this.log.info("Startup completed.");
}
protected boolean isLogoutRequest(final Request request) {

View File

@ -43,7 +43,7 @@ public class Saml11Authenticator extends AbstractAuthenticator {
}
this.ticketValidator.setRenew(isRenew());
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
this.log.debug("Startup completed.");
this.log.info("Startup completed.");
}
protected TicketValidator getTicketValidator() {

View File

@ -48,6 +48,7 @@ public final class UrlBasedLogoutValve extends AbstractLogoutValve {
} catch (final IllegalArgumentException e) {
throw new LifecycleException(e);
}
this.log.info("Startup completed.");
}
protected boolean isLogoutRequest(final Request request) {