Author: olamy Date: Wed Jan 30 10:41:12 2013 New Revision: 1440338 URL: http://svn.apache.org/viewvc?rev=1440338&view=rev Log: [MTOMCAT-190] Client Certificate settings for connector
Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java?rev=1440338&r1=1440337&r2=1440338&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java (original) +++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java Wed Jan 30 10:41:12 2013 @@ -344,14 +344,14 @@ public abstract class AbstractRunMojo protected File contextFile; /** - * The default context file to check for if contextFile not configured. - * If no contextFile configured and the below default not present, no - * contextFile will be sent to Tomcat, resulting in the latter's default - * context configuration being used instead. - */ - @Parameter( defaultValue = "${project.build.directory}/${project.build.finalName}/META-INF/context.xml", - readonly = true ) - private File defaultContextFile; + * The default context file to check for if contextFile not configured. + * If no contextFile configured and the below default not present, no + * contextFile will be sent to Tomcat, resulting in the latter's default + * context configuration being used instead. + */ + @Parameter( defaultValue = "${project.build.directory}/${project.build.finalName}/META-INF/context.xml", + readonly = true ) + private File defaultContextFile; /** * The protocol to run the Tomcat server on. @@ -445,6 +445,12 @@ public abstract class AbstractRunMojo @Parameter protected String[] aliases; + /** + * enable client authentication for https (if configured) + */ + @Parameter( property = "maven.tomcat.https.clientAuth", defaultValue = "false" ) + protected boolean clientAuth = false; + // ---------------------------------------------------------------------- // Fields // ---------------------------------------------------------------------- @@ -549,14 +555,14 @@ public abstract class AbstractRunMojo if ( overriddenContextFile != null && overriddenContextFile.exists() ) { standardContext = parseContextFile( overriddenContextFile ); - } - else if (defaultContextFile.exists()) + } + else if ( defaultContextFile.exists() ) { standardContext = parseContextFile( defaultContextFile ); } - if (standardContext != null) - { + if ( standardContext != null ) + { if ( standardContext.getPath() != null ) { contextPath = standardContext.getPath(); @@ -589,14 +595,14 @@ public abstract class AbstractRunMojo { // here, send file to Tomcat for it to complain if missing context.setConfigFile( overriddenContextFile.toURI().toURL() ); - } - else if (defaultContextFile.exists()) + } + else if ( defaultContextFile.exists() ) { // here, only sending default file if it indeed exists // otherwise Tomcat will create a default context - context.setConfigFile( defaultContextFile.toURI().toURL() ); + context.setConfigFile( defaultContextFile.toURI().toURL() ); } - + if ( classLoaderClass != null ) { loader.setLoaderClass( classLoaderClass ); @@ -1023,6 +1029,11 @@ public abstract class AbstractRunMojo { httpsConnector.setAttribute( "keystoreType", keystoreType ); } + + if ( clientAuth ) + { + httpsConnector.setAttribute( "clientAuth", clientAuth ); + } embeddedTomcat.getEngine().getService().addConnector( httpsConnector ); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org