CASC-33
Tomcat 6.x support for container-based CAS authentication. Minor changes to 7.x support for consistency.
This commit is contained in:
parent
704f1b8a67
commit
ce46854baa
|
|
@ -10,8 +10,6 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jasig.cas.client.authentication.AttributePrincipal;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
|
||||
|
|
@ -30,9 +28,6 @@ import org.jasig.cas.client.util.CommonUtils;
|
|||
public class AssertionCasRealmDelegate implements CasRealm {
|
||||
/** Default role attribute name */
|
||||
public static final String DEFAULT_ROLE_NAME = "role";
|
||||
|
||||
/** Log instance */
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
/** Name of the role attribute in the principal's attributes */
|
||||
private String roleAttributeName = DEFAULT_ROLE_NAME;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ import java.util.Properties;
|
|||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -35,6 +37,9 @@ import org.jasig.cas.client.util.CommonUtils;
|
|||
*
|
||||
*/
|
||||
public class PropertiesCasRealmDelegate implements CasRealm {
|
||||
/** Log instance */
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
/** Path to backing properties file */
|
||||
private String propertiesFilePath;
|
||||
|
||||
|
|
@ -57,7 +62,8 @@ public class PropertiesCasRealmDelegate implements CasRealm {
|
|||
file = new File(System.getProperty("catalina.base"), propertiesFilePath);
|
||||
}
|
||||
CommonUtils.assertTrue(file.exists(), "File not found " + file);
|
||||
CommonUtils.assertTrue(file.canRead(), "Cannot read " + file);
|
||||
CommonUtils.assertTrue(file.canRead(), "Cannot read " + file);
|
||||
log.debug("Loading users/roles from " + file);
|
||||
final Properties properties = new Properties();
|
||||
try {
|
||||
properties.load(new BufferedInputStream(new FileInputStream(file)));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>cas-client</artifactId>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<version>3.1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<artifactId>cas-client-integration-tomcat-v6</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>JA-SIG CAS Client for Java - Tomcat 6.x Integration</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<artifactId>cas-client-integration-tomcat-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>catalina</artifactId>
|
||||
<version>6.0.29</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jasig.cas.client</groupId>
|
||||
<artifactId>cas-client-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
package org.jasig.cas.client.tomcat.v7;
|
||||
|
||||
import org.apache.catalina.Lifecycle;
|
||||
import org.apache.catalina.LifecycleEvent;
|
||||
import org.apache.catalina.LifecycleException;
|
||||
import org.apache.catalina.LifecycleListener;
|
||||
|
|
@ -56,6 +55,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.log.debug("Starting...");
|
||||
final Realm realm = this.context.getRealm();
|
||||
if (!(realm instanceof CasRealm)) {
|
||||
throw new LifecycleException("Expected CasRealm but got " + realm.getInfo());
|
||||
|
|
@ -139,7 +139,8 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
|
||||
/** {@inheritDoc} */
|
||||
public void lifecycleEvent(final LifecycleEvent event) {
|
||||
if (Lifecycle.AFTER_START_EVENT.equals(event.getType())) {
|
||||
if (AFTER_START_EVENT.equals(event.getType())) {
|
||||
this.log.debug("Processing lifecycle event " + AFTER_START_EVENT);
|
||||
this.delegate.setTicketValidator(getTicketValidator());
|
||||
this.delegate.setArtifactParameterName(getArtifactParameterName());
|
||||
this.delegate.setServiceParameterName(getServiceParameterName());
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import java.io.IOException;
|
|||
* @version $Revision$ $Date$
|
||||
* @since 3.1.12
|
||||
*/
|
||||
public abstract class AbstractLogoutValveBase extends ValveBase {
|
||||
public abstract class AbstractLogoutValve extends ValveBase {
|
||||
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ import java.util.regex.Pattern;
|
|||
* @version $Revision$ $Date$
|
||||
* @since 3.1.12
|
||||
*/
|
||||
public final class RegExpBasedLogoutValue extends AbstractLogoutValveBase {
|
||||
public final class RegExpBasedLogoutValve extends AbstractLogoutValve {
|
||||
|
||||
private String regexpUri;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ import org.jasig.cas.client.util.CommonUtils;
|
|||
* @version $Revision$ $Date$
|
||||
* @since 3.1.12
|
||||
*/
|
||||
public final class UrlBasedLogoutValve extends AbstractLogoutValveBase {
|
||||
public final class UrlBasedLogoutValve extends AbstractLogoutValve {
|
||||
|
||||
private String logoutUri;
|
||||
|
||||
|
|
|
|||
1
pom.xml
1
pom.xml
|
|
@ -140,6 +140,7 @@
|
|||
<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>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue