You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ol...@apache.org on 2013/01/30 11:41:13 UTC

svn commit: r1440338 - /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1440338 - /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java

Posted by Olivier Lamy <ol...@apache.org>.
I will fix that.
Thanks for review !

2013/1/30 Konstantin Kolinko <kn...@gmail.com>:
> 2013/1/30  <ol...@apache.org>:
>> 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
>>
>> +    /**
>> +     * enable client authentication for https (if configured)
>> +     */
>> +    @Parameter( property = "maven.tomcat.https.clientAuth", defaultValue = "false" )
>> +    protected boolean clientAuth = false;
>> +
>
> 1. Why is it boolean? Tomcat 7 setting is a String with possible
> values of "true", "false" and "want".
>
> http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#SSL_Support_-_BIO_and_NIO
>
> 2. If you are going to provide similar support for an APR connector,
> the setting name appears to be "SSLVerifyClient" with its own set of
> possible values.
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1440338 - /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/1/30  <ol...@apache.org>:
> 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
>
> +    /**
> +     * enable client authentication for https (if configured)
> +     */
> +    @Parameter( property = "maven.tomcat.https.clientAuth", defaultValue = "false" )
> +    protected boolean clientAuth = false;
> +

1. Why is it boolean? Tomcat 7 setting is a String with possible
values of "true", "false" and "want".

http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#SSL_Support_-_BIO_and_NIO

2. If you are going to provide similar support for an APR connector,
the setting name appears to be "SSLVerifyClient" with its own set of
possible values.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org