Re: porting netty-tcnative to tomcat-native

2015-06-15 Thread jean-frederic clere

On 06/15/2015 08:25 AM, Mark Thomas wrote:

On 15/06/2015 06:55, jean-frederic clere wrote:

Hi,

The netty-tcnative is based on the 1.1.x so the porting taking more than
excepted.


Are you going to be able to commit this in multiple commits or is it
going to be one big commit?


A big commit it probably more easy, I have a huge diff that I am 
reviewing, but I will try to cut in piece like ssl.c (and depencencies), 
sslcontext.c etc (if possible).


Picking the  netty-tcnative commits one by one would take a lot more 
time. (And 
https://github.com/netty/netty-tcnative/commit/c788f64138946f15b8fb8f53d067ccf0fb9699af 
is a big commit).





I would like some comments on the class caching for performances like in
ssl.c:
+++
 TCN_FREE_CSTRING(engine);
+
+/* Cache the byte[].class for performance reasons */
+clazz = (*e)->FindClass(e, "[B");
+byteArrayClass = (jclass) (*e)->NewGlobalRef(e, clazz);
+
+/* Cache the String.class for performance reasons */
+sClazz = (*e)->FindClass(e, "java/lang/String");
+stringClass = (jclass) (*e)->NewGlobalRef(e, sClazz);
+
  return (jint)APR_SUCCESS;
  }
+++

Should I just put or have a flag in configure for it?


I can't see a reason this would need to be optional. Either it helps
performance (in which case it should be in) or it is an unnecessary
optimisation (in which case it shouldn't be in at all).

I took a quick look at ssl.c and I didn't see a lot of lookups for those
classes? Does the netty code add some or am I missing something?


It seems they are used in etPeerCertChain() and getCiphers() only, if 
someone uses client certificates than might make sense.


Cheers

Jean-Frederic

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



Re: porting netty-tcnative to tomcat-native

2015-06-15 Thread Mark Thomas
On 15/06/2015 09:35, jean-frederic clere wrote:
> On 06/15/2015 08:25 AM, Mark Thomas wrote:
>> On 15/06/2015 06:55, jean-frederic clere wrote:
>>> Hi,
>>>
>>> The netty-tcnative is based on the 1.1.x so the porting taking more than
>>> excepted.
>>
>> Are you going to be able to commit this in multiple commits or is it
>> going to be one big commit?
> 
> A big commit it probably more easy, I have a huge diff that I am
> reviewing, but I will try to cut in piece like ssl.c (and depencencies),
> sslcontext.c etc (if possible).
> 
> Picking the  netty-tcnative commits one by one would take a lot more
> time. (And
> https://github.com/netty/netty-tcnative/commit/c788f64138946f15b8fb8f53d067ccf0fb9699af
> is a big commit).
> 
>>
>>> I would like some comments on the class caching for performances like in
>>> ssl.c:
>>> +++
>>>  TCN_FREE_CSTRING(engine);
>>> +
>>> +/* Cache the byte[].class for performance reasons */
>>> +clazz = (*e)->FindClass(e, "[B");
>>> +byteArrayClass = (jclass) (*e)->NewGlobalRef(e, clazz);
>>> +
>>> +/* Cache the String.class for performance reasons */
>>> +sClazz = (*e)->FindClass(e, "java/lang/String");
>>> +stringClass = (jclass) (*e)->NewGlobalRef(e, sClazz);
>>> +
>>>   return (jint)APR_SUCCESS;
>>>   }
>>> +++
>>>
>>> Should I just put or have a flag in configure for it?
>>
>> I can't see a reason this would need to be optional. Either it helps
>> performance (in which case it should be in) or it is an unnecessary
>> optimisation (in which case it shouldn't be in at all).
>>
>> I took a quick look at ssl.c and I didn't see a lot of lookups for those
>> classes? Does the netty code add some or am I missing something?
> 
> It seems they are used in etPeerCertChain() and getCiphers() only, if
> someone uses client certificates than might make sense.

Those will get called more than once so no objection to caching those
classes here.

Mark


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



Re: porting netty-tcnative to tomcat-native

2015-06-15 Thread Rémy Maucherat
2015-06-15 10:42 GMT+02:00 Mark Thomas :

> > It seems they are used in etPeerCertChain() and getCiphers() only, if
> > someone uses client certificates than might make sense.
>
> Those will get called more than once so no objection to caching those
> classes here.
>
> No prooblem with adding that "cahching" but I don't think it will make a
real performance difference.

Rémy


[GitHub] tomcat-native pull request: Port Netty-tc-native code to tomcat-na...

2015-06-15 Thread jfclere
GitHub user jfclere opened a pull request:

https://github.com/apache/tomcat-native/pull/2

Port Netty-tc-native code to tomcat-native

That PR to merge https://github.com/netty/netty-tcnative/ back to 
tomcat-native.
Note that the netty uses the code from 1.1.x and I am porting it to trunk.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jfclere/tomcat-native trunk

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/tomcat-native/pull/2.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2


commit b9116331e453faed281fcc35d571c36d7cdc5b61
Author: Jean-Frederic Clere 
Date:   2015-06-15T10:31:59Z

A netty-tc-native modifications.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



Re: JASPIC Implementation pointers

2015-06-15 Thread Fjodor Vershinin
Hi, all!
Here is my report for previous week. I'd ported JASPIC api classes and
implemented skeleton for JASPIC support. The skeleton was implemented using
plan proposed by Mark. It contains very basic AuthConfigFactory, callback
handler's, and JaspicAuthenticator. I did some hacking on weekend with
Arjan's suite, tried to execute some tests on current implementation and
seems it works.
You can have a look at latest code in this branch
https://github.com/fjodorver/tomcat/tree/feature/jaspic-implementation.
However, I have faced some open problems.
One is about picking up existing AuthenticatorBase for extending with
JASPIC stuff. It looks like extending this class is good solution, because
it contains a lot of security logic, such as  I am not sure that I must
implement it by myself, because it's out of JASPIC scope. Could you confirm
that?

Second question is about integrating and replacing current authentication
mechanisms with JASPIC modules. From my current point of view, I would
implement that by registering providers at context initialization, for
example in ContextConfig.authenticatorConfig(). We can register different
providers depending on context's login config, or use the same provider,
which returns different authentication modules. Anyway, we need to
implement some custom logic in authenticatorConfig() method. My current
proposal is to implement special management for jaspic authentication
methods, for example JASPIC-BASIC and JASPIC-DIGEST would use the same
JaspicAuthenticator, however they are handled by different JASPIC modules.
Whenever all methods be ported to JASPIC platform we can remove "JASPIC"
string from authentication methods, and then we can handle all
authentication types the same way.

Third problem is JAAS subjects. I use special callback in order to bind
principal and group callbacks into tomcat's principal. Is it correct
solution, or I need to build  JAAS subject, and then convert it into
Tomcat's principal?

Currently, I want to proceed with second question in order to port BASIC
authentication to JASPIC platform, but I need confirmation that I am moving
in right direction.

Thanks,
Fjodor

2015-06-11 11:38 GMT+03:00 Mark Thomas :

> (primarily for Fjodor but feel free to comment as you see fit)
>
> Consensus to date is that a Valve will be the best integration point.
>
> Given that the implementation will need access to Tomcat's internals,
> I'd suggest either use the existing org.apache.catalina.authenticator
> package or create a new org.apache.catalina.jaspic package
>
> I can think of a couple of different ways for you to get started. Feel
> free pick one (or more) of these or choose your own.
>
> 1. AuthConfigFactory
>- Create the Tomcat specific AuthConfigFactoryImpl (just stub out
>  the methods to start with
>- Fix the various issues with AuthConfigFactory
>- Replace the stubs with actual implementations and provide any
>  additional supporting code as you go.
>
> 2. Authenticator
>- Create a JaspicAuthenticator class (will need to be a Valve).
>- To start just have the Valve pass the request/response down the
>  pipeline
>- Register a new web.xml authentication method "JASPIC-BASIC" and
>  link it to the new Valve the same way the BasicAuthenticator is
>  linked to the "BASIC" authenticaton method.
>- Implement BASIC auth using the JASPIC API, providing any necessary
>  supporting code as you go.
>- Keep in mind that this Valve is going to have to support any
>  JASPIC authentication module but don't worry too much about
>  getting Valve architecture right first time. You can always
>  refactor things later
>
> As always, if you have any questions feel free to ask them on the dev list.
>
> Mark
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


removing empty stubs in tc-native trunk

2015-06-15 Thread jean-frederic clere

Hi,

We have  empty stubs in tc-native when openssl isn't detected, are those 
still needed?


With NIO and NIO2 connectors we don't need native when we aren't using SSL.

Comments?

Cheers

Jean-Frederic

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



Re: removing empty stubs in tc-native trunk

2015-06-15 Thread Mark Thomas
On 15/06/2015 12:27, jean-frederic clere wrote:
> Hi,
> 
> We have  empty stubs in tc-native when openssl isn't detected, are those
> still needed?

Yes, if we want to be able to support the APR/native connector without
OpenSSL.

> With NIO and NIO2 connectors we don't need native when we aren't using SSL.
> 
> Comments?

I don't know how useful APR/native is without OpenSSL. I suspect not very.

I'm not against dropping the stubs but it probably needs wider
consultation that just the dev list.

Mark


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



svn commit: r1685556 - /tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 11:36:01 2015
New Revision: 1685556

URL: http://svn.apache.org/r1685556
Log:
Make it possible to run unit tests in parallel using new threads attribute of 
Ant's JUnit task

Modified:
tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java

Modified: tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java?rev=1685556&r1=168&r2=1685556&view=diff
==
--- tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java Mon Jun 
15 11:36:01 2015
@@ -17,8 +17,12 @@
 package org.apache.catalina.startup;
 
 import java.io.File;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.LogManager;
 
 import static org.junit.Assert.fail;
 
@@ -27,6 +31,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 
+import org.apache.juli.ClassLoaderLogManager;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 
@@ -97,10 +102,12 @@ public abstract class LoggingBaseTest {
 @Before
 public void setUp() throws Exception {
 // Create catalina.base directory
-tempDir = new File(System.getProperty("tomcat.test.temp", 
"output/tmp"));
-if (!tempDir.mkdirs() && !tempDir.isDirectory()) {
-fail("Unable to create temporary directory for test");
+File tempBase = new File(System.getProperty("tomcat.test.temp", 
"output/tmp"));
+if (!tempBase.mkdirs() && !tempBase.isDirectory()) {
+fail("Unable to create base temporary directory for tests");
 }
+Path tempBasePath = 
FileSystems.getDefault().getPath(tempBase.getAbsolutePath());
+tempDir = Files.createTempDirectory(tempBasePath, "test").toFile();
 
 System.setProperty("catalina.base", tempDir.getAbsolutePath());
 
@@ -121,5 +128,13 @@ public abstract class LoggingBaseTest {
 ExpandWar.delete(file);
 }
 deleteOnTearDown.clear();
+
+LogManager logManager = LogManager.getLogManager();
+if (logManager instanceof ClassLoaderLogManager) {
+((ClassLoaderLogManager) logManager).shutdown();
+} else {
+logManager.reset();
+}
+ExpandWar.deleteDir(tempDir);
 }
 }



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



Re: removing empty stubs in tc-native trunk

2015-06-15 Thread jean-frederic clere

On 06/15/2015 01:32 PM, Mark Thomas wrote:

On 15/06/2015 12:27, jean-frederic clere wrote:

Hi,

We have  empty stubs in tc-native when openssl isn't detected, are those
still needed?


Yes, if we want to be able to support the APR/native connector without
OpenSSL.


With NIO and NIO2 connectors we don't need native when we aren't using SSL.

Comments?


I don't know how useful APR/native is without OpenSSL. I suspect not very.

I'm not against dropping the stubs but it probably needs wider
consultation that just the dev list.


OK I will keep and add missing (if any) in my port.

Cheers

Jean-Frederic



Mark


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





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



Re: removing empty stubs in tc-native trunk

2015-06-15 Thread Rémy Maucherat
2015-06-15 13:32 GMT+02:00 Mark Thomas :

> On 15/06/2015 12:27, jean-frederic clere wrote:
> > Hi,
> >
> > We have  empty stubs in tc-native when openssl isn't detected, are those
> > still needed?
>
> Yes, if we want to be able to support the APR/native connector without
> OpenSSL.
>
> > With NIO and NIO2 connectors we don't need native when we aren't using
> SSL.
> >
> > Comments?
>
> I don't know how useful APR/native is without OpenSSL. I suspect not very.
>
> I'm not against dropping the stubs but it probably needs wider
> consultation that just the dev list.
>
> It was probably an export thing originally, maybe for the Windows build. I
don't really remember. Anyway, I don't think it is useful at all, Linux
builds from distributions have it, etc.

Rémy


Re: removing empty stubs in tc-native trunk

2015-06-15 Thread Mark Thomas
On 15/06/2015 12:39, jean-frederic clere wrote:
> On 06/15/2015 01:32 PM, Mark Thomas wrote:
>> On 15/06/2015 12:27, jean-frederic clere wrote:
>>> Hi,
>>>
>>> We have  empty stubs in tc-native when openssl isn't detected, are those
>>> still needed?
>>
>> Yes, if we want to be able to support the APR/native connector without
>> OpenSSL.
>>
>>> With NIO and NIO2 connectors we don't need native when we aren't
>>> using SSL.
>>>
>>> Comments?
>>
>> I don't know how useful APR/native is without OpenSSL. I suspect not
>> very.
>>
>> I'm not against dropping the stubs but it probably needs wider
>> consultation that just the dev list.
> 
> OK I will keep and add missing (if any) in my port.

If it is a lot of work (for possibly no benefit) I wouldn't object to
them being removed.


Cheers,

Mark


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



Multi-threaded unit tests

2015-06-15 Thread Mark Thomas
I have been experimenting with the free Azure credits that come with the
MSDN subscription Microsoft kindly offers to all Apache committers to
use for their ASF work.

I have been looking at options for making the unit tests run faster.

All the figures below are for running the trunk unit tests on a fully
updated Ubuntu 14.04 LTS instance.


A2 Basic 233:53 tests on hdd, with code coverage, 1 thread
D2   120:57 tests on hdd, with code coverage, 1 thread
D2   119:53 tests on ssd, with code coverage, 1 thread
D232:16 tests on hdd, no code coverage,   2 threads
D223:24 tests on hdd, no code coverage,   4 threads

(Both A2 and D2 boxes have 2 cores. D2 have 60% faster processors).

I'll be testing larger instance with more cores later.

So far, I think it is safe to draw the following conclusions:
- code coverage is expensive
- code coverage (as currently configured) requires single thread
  execution (more on this below)
- 1 test thread per core definitely gives better performance
- 2 test threads per core gives even better performance

Where the limit is for threads per core is TBD.

I've already fixed the unit tests (I think) so parallel running is
possible. I'll be adding a threads option to build.xml shortly. It will
default to 1 and I'll add a comment to build.properties.default not to
increase it above 1 if code coverage is enabled (I might try and detect
and handle that case). Once I have data on threads vs cores I'll add
that too.

The reason code coverage doesn't work with the junit threads option is
that cobertura serialises the coverage data between tests. If we
partitioned the tests (e.g. by name) and configured separated coverage
data files for each partition (merging them at the end) then cobertura
would be OK. Sensibly partitioning the tests is more effort than I have
time for at the moment so I am going with the simple option.

Mark

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



svn commit: r1685562 - in /tomcat/tc8.0.x/trunk: java/org/apache/tomcat/websocket/WsSession.java java/org/apache/tomcat/websocket/WsWebSocketContainer.java test/org/apache/tomcat/websocket/TestWsWebSo

2015-06-15 Thread remm
Author: remm
Date: Mon Jun 15 12:04:06 2015
New Revision: 1685562

URL: http://svn.apache.org/r1685562
Log:
Port fix for 57974: Key the open session map on the endpoint instance rather 
than endpoint class.

Modified:
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java

tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java

tomcat/tc8.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1685562&r1=1685561&r2=1685562&view=diff
==
--- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java 
(original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java Mon 
Jun 15 12:04:06 2015
@@ -416,7 +416,7 @@ public class WsSession implements Sessio
 @Override
 public Set getOpenSessions() {
 checkState();
-return webSocketContainer.getOpenSessions(localEndpoint.getClass());
+return webSocketContainer.getOpenSessions(localEndpoint);
 }
 
 

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1685562&r1=1685561&r2=1685562&view=diff
==
--- 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
(original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
Mon Jun 15 12:04:06 2015
@@ -115,7 +115,7 @@ public class WsWebSocketContainer
 private final Object asynchronousChannelGroupLock = new Object();
 
 private final Log log = LogFactory.getLog(WsWebSocketContainer.class);
-private final Map, Set> endpointSessionMap =
+private final Map> endpointSessionMap =
 new HashMap<>();
 private final Map sessions = new 
ConcurrentHashMap<>();
 private final Object endPointSessionMapLock = new Object();
@@ -402,8 +402,6 @@ public class WsWebSocketContainer
 
 protected void registerSession(Endpoint endpoint, WsSession wsSession) {
 
-Class endpointClazz = endpoint.getClass();
-
 if (!wsSession.isOpen()) {
 // The session was closed during onOpen. No need to register it.
 return;
@@ -412,10 +410,10 @@ public class WsWebSocketContainer
 if (endpointSessionMap.size() == 0) {
 BackgroundProcessManager.getInstance().register(this);
 }
-Set wsSessions = endpointSessionMap.get(endpointClazz);
+Set wsSessions = endpointSessionMap.get(endpoint);
 if (wsSessions == null) {
 wsSessions = new HashSet<>();
-endpointSessionMap.put(endpointClazz, wsSessions);
+endpointSessionMap.put(endpoint, wsSessions);
 }
 wsSessions.add(wsSession);
 }
@@ -425,14 +423,12 @@ public class WsWebSocketContainer
 
 protected void unregisterSession(Endpoint endpoint, WsSession wsSession) {
 
-Class endpointClazz = endpoint.getClass();
-
 synchronized (endPointSessionMapLock) {
-Set wsSessions = endpointSessionMap.get(endpointClazz);
+Set wsSessions = endpointSessionMap.get(endpoint);
 if (wsSessions != null) {
 wsSessions.remove(wsSession);
 if (wsSessions.size() == 0) {
-endpointSessionMap.remove(endpointClazz);
+endpointSessionMap.remove(endpoint);
 }
 }
 if (endpointSessionMap.size() == 0) {
@@ -443,7 +439,7 @@ public class WsWebSocketContainer
 }
 
 
-Set getOpenSessions(Class endpoint) {
+Set getOpenSessions(Endpoint endpoint) {
 HashSet result = new HashSet<>();
 synchronized (endPointSessionMapLock) {
 Set sessions = endpointSessionMap.get(endpoint);

Modified: 
tomcat/tc8.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java?rev=1685562&r1=1685561&r2=1685562&view=diff
==
--- 
tomcat/tc8.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
 Mon Jun 15 12:04:06 2015
@@ -47,13 +47,15 @@ import javax.websocket.server.ServerEndp
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Test;
-
 import org.apache.catalina.Context;
 import org.apache.

Re: Multi-threaded unit tests

2015-06-15 Thread Mark Thomas
On 15/06/2015 13:02, Mark Thomas wrote:
> I have been experimenting with the free Azure credits that come with the
> MSDN subscription Microsoft kindly offers to all Apache committers to
> use for their ASF work.
> 
> I have been looking at options for making the unit tests run faster.
> 
> All the figures below are for running the trunk unit tests on a fully
> updated Ubuntu 14.04 LTS instance.
> 
> 
> A2 Basic 233:53 tests on hdd, with code coverage, 1 thread
> D2   120:57 tests on hdd, with code coverage, 1 thread
> D2   119:53 tests on ssd, with code coverage, 1 thread
> D232:16 tests on hdd, no code coverage,   2 threads
> D223:24 tests on hdd, no code coverage,   4 threads

Any higher than 2 threads per core there is a risk that tests experience
IO timeouts.

I'm going to recommend 1 thread per core.

The other factor here is that multi-threaded tests requires ant 1.9.5
onwards.

Mark


> 
> (Both A2 and D2 boxes have 2 cores. D2 have 60% faster processors).
> 
> I'll be testing larger instance with more cores later.
> 
> So far, I think it is safe to draw the following conclusions:
> - code coverage is expensive
> - code coverage (as currently configured) requires single thread
>   execution (more on this below)
> - 1 test thread per core definitely gives better performance
> - 2 test threads per core gives even better performance
> 
> Where the limit is for threads per core is TBD.
> 
> I've already fixed the unit tests (I think) so parallel running is
> possible. I'll be adding a threads option to build.xml shortly. It will
> default to 1 and I'll add a comment to build.properties.default not to
> increase it above 1 if code coverage is enabled (I might try and detect
> and handle that case). Once I have data on threads vs cores I'll add
> that too.
> 
> The reason code coverage doesn't work with the junit threads option is
> that cobertura serialises the coverage data between tests. If we
> partitioned the tests (e.g. by name) and configured separated coverage
> data files for each partition (merging them at the end) then cobertura
> would be OK. Sensibly partitioning the tests is more effort than I have
> time for at the moment so I am going with the simple option.
> 
> Mark
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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



svn commit: r1685570 - in /tomcat/tc7.0.x/trunk: java/org/apache/tomcat/websocket/WsSession.java java/org/apache/tomcat/websocket/WsWebSocketContainer.java test/org/apache/tomcat/websocket/TestWsWebSo

2015-06-15 Thread remm
Author: remm
Date: Mon Jun 15 12:33:59 2015
New Revision: 1685570

URL: http://svn.apache.org/r1685570
Log:
Port r1685562 57974: Key the open session map on the endpoint instance rather 
than endpoint class.

Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java

tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1685570&r1=1685569&r2=1685570&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsSession.java Mon 
Jun 15 12:33:59 2015
@@ -393,7 +393,7 @@ public class WsSession implements Sessio
 @Override
 public Set getOpenSessions() {
 checkState();
-return webSocketContainer.getOpenSessions(localEndpoint.getClass());
+return webSocketContainer.getOpenSessions(localEndpoint);
 }
 
 

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1685570&r1=1685569&r2=1685570&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
Mon Jun 15 12:33:59 2015
@@ -115,8 +115,8 @@ public class WsWebSocketContainer
 private final Object asynchronousChannelGroupLock = new Object();
 
 private final Log log = LogFactory.getLog(WsWebSocketContainer.class);
-private final Map, Set> endpointSessionMap =
-new HashMap, Set>();
+private final Map> endpointSessionMap =
+new HashMap>();
 private final Map sessions = new 
ConcurrentHashMap();
 private final Object endPointSessionMapLock = new Object();
 
@@ -424,8 +424,6 @@ public class WsWebSocketContainer
 
 protected void registerSession(Endpoint endpoint, WsSession wsSession) {
 
-Class endpointClazz = endpoint.getClass();
-
 if (!wsSession.isOpen()) {
 // The session was closed during onOpen. No need to register it.
 return;
@@ -434,10 +432,10 @@ public class WsWebSocketContainer
 if (endpointSessionMap.size() == 0) {
 BackgroundProcessManager.getInstance().register(this);
 }
-Set wsSessions = endpointSessionMap.get(endpointClazz);
+Set wsSessions = endpointSessionMap.get(endpoint);
 if (wsSessions == null) {
 wsSessions = new HashSet();
-endpointSessionMap.put(endpointClazz, wsSessions);
+endpointSessionMap.put(endpoint, wsSessions);
 }
 wsSessions.add(wsSession);
 }
@@ -447,14 +445,12 @@ public class WsWebSocketContainer
 
 protected void unregisterSession(Endpoint endpoint, WsSession wsSession) {
 
-Class endpointClazz = endpoint.getClass();
-
 synchronized (endPointSessionMapLock) {
-Set wsSessions = endpointSessionMap.get(endpointClazz);
+Set wsSessions = endpointSessionMap.get(endpoint);
 if (wsSessions != null) {
 wsSessions.remove(wsSession);
 if (wsSessions.size() == 0) {
-endpointSessionMap.remove(endpointClazz);
+endpointSessionMap.remove(endpoint);
 }
 }
 if (endpointSessionMap.size() == 0) {
@@ -465,7 +461,7 @@ public class WsWebSocketContainer
 }
 
 
-Set getOpenSessions(Class endpoint) {
+Set getOpenSessions(Endpoint endpoint) {
 HashSet result = new HashSet();
 synchronized (endPointSessionMapLock) {
 Set sessions = endpointSessionMap.get(endpoint);

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java?rev=1685570&r1=1685569&r2=1685570&view=diff
==
--- 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
 Mon Jun 15 12:33:59 2015
@@ -49,7 +49,6 @@ import javax.websocket.server.ServerEndp
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Test;
-
 import org.apache.catalina.

[Bug 57974] getOpenSessions() bug

2015-06-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974

Remy Maucherat  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Remy Maucherat  ---
r1685562 included in 8.0.24
r1685570 included in 7.0.63

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



[Bug 58031] Posting data exceeding maxPostSize should result in HTTP 413.

2015-06-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58031

Christopher L. Simons  changed:

   What|Removed |Added

   Target Milestone|-   |default
Product|Tomcat 9|Tomcat 6
  Component|Catalina|Catalina

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



SSLSocket.getALPN()

2015-06-15 Thread jean-frederic clere

Hi,

We are using SSLSocket.getALPN() but in fact that belongs to SSL 
according to the C code, should we move that to SSL and use the 
netty-tc-native code there?


SSL.getAlpnSelected() would do the trick,

Cheers

Jean-Frederic

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



Re: SSLSocket.getALPN()

2015-06-15 Thread Mark Thomas
On 15/06/2015 15:17, jean-frederic clere wrote:
> Hi,
> 
> We are using SSLSocket.getALPN() but in fact that belongs to SSL
> according to the C code, should we move that to SSL and use the
> netty-tc-native code there?

I don't understand. ALPN is negotiated per socket and all the per socket
methods are in SSLSocket.

What is the justification for moving it?

Mark


> SSL.getAlpnSelected() would do the trick,
> 
> Cheers
> 
> Jean-Frederic
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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



Re: SSLSocket.getALPN()

2015-06-15 Thread jean-frederic clere

On 06/15/2015 04:25 PM, Mark Thomas wrote:

On 15/06/2015 15:17, jean-frederic clere wrote:

Hi,

We are using SSLSocket.getALPN() but in fact that belongs to SSL
according to the C code, should we move that to SSL and use the
netty-tc-native code there?


I don't understand. ALPN is negotiated per socket and all the per socket
methods are in SSLSocket.

What is the justification for moving it?


None... I am starting to think that SSL.getAlpnSelected() might not be 
working the way I though. I will keep both method and leave a note in 
getAlpnSelected().


Cheers

Jean-Frederic

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



svn commit: r1685591 - in /tomcat/trunk: BUILDING.txt build.properties.default build.xml webapps/docs/changelog.xml

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 14:48:44 2015
New Revision: 1685591

URL: http://svn.apache.org/r1685591
Log:
Update the minimum Ant version 1.9.5 and enable parallel running of junit tests

Modified:
tomcat/trunk/BUILDING.txt
tomcat/trunk/build.properties.default
tomcat/trunk/build.xml
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/BUILDING.txt
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/BUILDING.txt?rev=1685591&r1=1685590&r2=1685591&view=diff
==
--- tomcat/trunk/BUILDING.txt (original)
+++ tomcat/trunk/BUILDING.txt Mon Jun 15 14:48:44 2015
@@ -64,12 +64,9 @@ source distribution, do the following:
 into which you installed the JDK release.
 
 
-(2) Install Apache Ant version 1.9.3 or later on your computer.
+(2) Install Apache Ant version 1.9.5 or later on your computer.
 
-Note: Ant 1.9.4 has a regression and cannot be used for Tomcat's
-release build (Ant bug 56641).
-
- 1. If Apache Ant version 1.9.3 or later is already installed on your
+ 1. If Apache Ant version 1.9.5 or later is already installed on your
 computer, skip to (3).
 
  2. Download a binary distribution of Ant from:

Modified: tomcat/trunk/build.properties.default
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/build.properties.default?rev=1685591&r1=1685590&r2=1685591&view=diff
==
--- tomcat/trunk/build.properties.default (original)
+++ tomcat/trunk/build.properties.default Mon Jun 15 14:48:44 2015
@@ -41,6 +41,12 @@ test.haltonfailure=false
 # Activate AccessLog during testing
 test.accesslog=false
 
+# Number of parallel threads to use for testing. The recommended value is one
+# thread per core.
+# Note: Cobertura code coverage currently requires this to be set to 1. Setting
+#   a value above one will disable code coverage if enabled.
+test.threads=1
+
 # Note the Cobertura code coverage tool is GPLv2 licensed
 test.cobertura=false
 

Modified: tomcat/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=1685591&r1=1685590&r2=1685591&view=diff
==
--- tomcat/trunk/build.xml (original)
+++ tomcat/trunk/build.xml Mon Jun 15 14:48:44 2015
@@ -1432,7 +1432,8 @@
   
+haltonfailure="${test.haltonfailure}"
+threads="${test.threads}" >
 
 
 
@@ -1482,15 +1483,39 @@
 
   
 
-  
+  
+
+  
+
+
+  
+
+
+
+  
+  
+
+  
+
+
+  
+
+  
 
 
   
 
   
 
-  
+
+  
+
+  
 
 
@@ -1533,7 +1558,7 @@
 
   
 
-  
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1685591&r1=1685590&r2=1685591&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Jun 15 14:48:44 2015
@@ -91,6 +91,15 @@
   
 
   
+  
+
+  
+Support the use of the threads attribute on Ant's
+junit task. Note that using this with a value of greater than one will
+disbale Cobertura code coverage. (markt)
+  
+
+  
 
 
 



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



Re: JASPIC Implementation pointers

2015-06-15 Thread Mark Thomas
On 15/06/2015 12:14, Fjodor Vershinin wrote:
> Hi, all!
> Here is my report for previous week. I'd ported JASPIC api classes and
> implemented skeleton for JASPIC support. The skeleton was implemented using
> plan proposed by Mark. It contains very basic AuthConfigFactory, callback
> handler's, and JaspicAuthenticator. I did some hacking on weekend with
> Arjan's suite, tried to execute some tests on current implementation and
> seems it works.
> You can have a look at latest code in this branch
> https://github.com/fjodorver/tomcat/tree/feature/jaspic-implementation.

I'll start working through those patches, reviewing them and integrating
them into trunk.

> However, I have faced some open problems.
> One is about picking up existing AuthenticatorBase for extending with
> JASPIC stuff. It looks like extending this class is good solution, because
> it contains a lot of security logic, such as  I am not sure that I must
> implement it by myself, because it's out of JASPIC scope. Could you confirm
> that?

Such as? You will need to be more specific.

> Second question is about integrating and replacing current authentication
> mechanisms with JASPIC modules. From my current point of view, I would
> implement that by registering providers at context initialization, for
> example in ContextConfig.authenticatorConfig(). We can register different
> providers depending on context's login config, or use the same provider,
> which returns different authentication modules. Anyway, we need to
> implement some custom logic in authenticatorConfig() method. My current
> proposal is to implement special management for jaspic authentication
> methods, for example JASPIC-BASIC and JASPIC-DIGEST would use the same
> JaspicAuthenticator, however they are handled by different JASPIC modules.
> Whenever all methods be ported to JASPIC platform we can remove "JASPIC"
> string from authentication methods, and then we can handle all
> authentication types the same way.

What is the question?

> Third problem is JAAS subjects. I use special callback in order to bind
> principal and group callbacks into tomcat's principal. Is it correct
> solution, or I need to build  JAAS subject, and then convert it into
> Tomcat's principal?

I don't see any reason to build a JAAS subject (at the moment). Do you?

> Currently, I want to proceed with second question in order to port BASIC
> authentication to JASPIC platform, but I need confirmation that I am moving
> in right direction.

The current direction looks good to me. I'll add any detailed comments
to the commits as I review them.

Mark


> 
> Thanks,
> Fjodor
> 
> 2015-06-11 11:38 GMT+03:00 Mark Thomas :
> 
>> (primarily for Fjodor but feel free to comment as you see fit)
>>
>> Consensus to date is that a Valve will be the best integration point.
>>
>> Given that the implementation will need access to Tomcat's internals,
>> I'd suggest either use the existing org.apache.catalina.authenticator
>> package or create a new org.apache.catalina.jaspic package
>>
>> I can think of a couple of different ways for you to get started. Feel
>> free pick one (or more) of these or choose your own.
>>
>> 1. AuthConfigFactory
>>- Create the Tomcat specific AuthConfigFactoryImpl (just stub out
>>  the methods to start with
>>- Fix the various issues with AuthConfigFactory
>>- Replace the stubs with actual implementations and provide any
>>  additional supporting code as you go.
>>
>> 2. Authenticator
>>- Create a JaspicAuthenticator class (will need to be a Valve).
>>- To start just have the Valve pass the request/response down the
>>  pipeline
>>- Register a new web.xml authentication method "JASPIC-BASIC" and
>>  link it to the new Valve the same way the BasicAuthenticator is
>>  linked to the "BASIC" authenticaton method.
>>- Implement BASIC auth using the JASPIC API, providing any necessary
>>  supporting code as you go.
>>- Keep in mind that this Valve is going to have to support any
>>  JASPIC authentication module but don't worry too much about
>>  getting Valve architecture right first time. You can always
>>  refactor things later
>>
>> As always, if you have any questions feel free to ask them on the dev list.
>>
>> Mark
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>>
>>
> 


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



buildbot failure in ASF Buildbot on tomcat-trunk

2015-06-15 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
ASF Buildbot. Full details are available at:
http://ci.apache.org/builders/tomcat-trunk/builds/1383

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1685591
Blamelist: markt

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




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



Re: buildbot failure in ASF Buildbot on tomcat-trunk

2015-06-15 Thread Mark Thomas
On 15/06/2015 15:56, build...@apache.org wrote:
> The Buildbot has detected a new failure on builder tomcat-trunk while 
> building ASF Buildbot. Full details are available at:
> http://ci.apache.org/builders/tomcat-trunk/builds/1383
> 
> Buildbot URL: http://ci.apache.org/
> 
> Buildslave for this Build: silvanus_ubuntu
> 
> Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
> triggered this build
> Build Source Stamp: [branch tomcat/trunk] 1685591
> Blamelist: markt
> 
> BUILD FAILED: failed compile_1

I need to update ant on the build slave.

Mark


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



svn commit: r1685593 - /tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 15:10:18 2015
New Revision: 1685593

URL: http://svn.apache.org/r1685593
Log:
Trivial Javadoc commit to test CI system

Modified:
tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java

Modified: tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java?rev=1685593&r1=1685592&r2=1685593&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java Mon Jun 
15 15:10:18 2015
@@ -126,9 +126,10 @@ public class JMXAccessorTask extends Bas
 // - Properties
 
 /**
- * The name used at remote MbeanServer
+ * Get the name used at remote MbeanServer.
+ *
+ * @return the name used at remote MbeanServer
  */
-
 public String getName() {
 return (this.name);
 }



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



Re: JASPIC Implementation pointers

2015-06-15 Thread Fjodor Vershinin
2015-06-15 17:53 GMT+03:00 Mark Thomas :

> On 15/06/2015 12:14, Fjodor Vershinin wrote:
> > Hi, all!
> > Here is my report for previous week. I'd ported JASPIC api classes and
> > implemented skeleton for JASPIC support. The skeleton was implemented
> using
> > plan proposed by Mark. It contains very basic AuthConfigFactory, callback
> > handler's, and JaspicAuthenticator. I did some hacking on weekend with
> > Arjan's suite, tried to execute some tests on current implementation and
> > seems it works.
> > You can have a look at latest code in this branch
> > https://github.com/fjodorver/tomcat/tree/feature/jaspic-implementation.
>
> I'll start working through those patches, reviewing them and integrating
> them into trunk.
>
> > However, I have faced some open problems.
> > One is about picking up existing AuthenticatorBase for extending with
> > JASPIC stuff. It looks like extending this class is good solution,
> because
> > it contains a lot of security logic, such as  I am not sure that I must
> > implement it by myself, because it's out of JASPIC scope. Could you
> confirm
> > that?
>
> Such as? You will need to be more specific.

For example, it decides if security constraints should be applied or not,
validates principles and roles and so on.


> > Second question is about integrating and replacing current authentication
> > mechanisms with JASPIC modules. From my current point of view, I would
> > implement that by registering providers at context initialization, for
> > example in ContextConfig.authenticatorConfig(). We can register different
> > providers depending on context's login config, or use the same provider,
> > which returns different authentication modules. Anyway, we need to
> > implement some custom logic in authenticatorConfig() method. My current
> > proposal is to implement special management for jaspic authentication
> > methods, for example JASPIC-BASIC and JASPIC-DIGEST would use the same
> > JaspicAuthenticator, however they are handled by different JASPIC
> modules.
> > Whenever all methods be ported to JASPIC platform we can remove "JASPIC"
> > string from authentication methods, and then we can handle all
> > authentication types the same way.
>
> What is the question?

Question is that correct? Or can I feel free to remove old auth mechanisms
from there?


>
> > Third problem is JAAS subjects. I use special callback in order to bind
> > principal and group callbacks into tomcat's principal. Is it correct
> > solution, or I need to build  JAAS subject, and then convert it into
> > Tomcat's principal?
>
> I don't see any reason to build a JAAS subject (at the moment). Do you?
>
Neither me. May be Arjan can share some thoughts on this.

>
> > Currently, I want to proceed with second question in order to port BASIC
> > authentication to JASPIC platform, but I need confirmation that I am
> moving
> > in right direction.
>
> The current direction looks good to me. I'll add any detailed comments
> to the commits as I review them.
>
> Mark
>
> --
Thanks,
Fjodor


Re: JASPIC Implementation pointers

2015-06-15 Thread Mark Thomas
On 15/06/2015 16:42, Fjodor Vershinin wrote:
> 2015-06-15 17:53 GMT+03:00 Mark Thomas :
> 
>> On 15/06/2015 12:14, Fjodor Vershinin wrote:
>>> Hi, all!
>>> Here is my report for previous week. I'd ported JASPIC api classes and
>>> implemented skeleton for JASPIC support. The skeleton was implemented
>> using
>>> plan proposed by Mark. It contains very basic AuthConfigFactory, callback
>>> handler's, and JaspicAuthenticator. I did some hacking on weekend with
>>> Arjan's suite, tried to execute some tests on current implementation and
>>> seems it works.
>>> You can have a look at latest code in this branch
>>> https://github.com/fjodorver/tomcat/tree/feature/jaspic-implementation.
>>
>> I'll start working through those patches, reviewing them and integrating
>> them into trunk.
>>
>>> However, I have faced some open problems.
>>> One is about picking up existing AuthenticatorBase for extending with
>>> JASPIC stuff. It looks like extending this class is good solution,
>> because
>>> it contains a lot of security logic, such as  I am not sure that I must
>>> implement it by myself, because it's out of JASPIC scope. Could you
>> confirm
>>> that?
>>
>> Such as? You will need to be more specific.
> 
> For example, it decides if security constraints should be applied or not,
> validates principles and roles and so on.

Integrating JASPIC into Tomccat is in scope and all of that comes under
that heading.

I'd expect the JaspicAuthenticator to extend Authenticator base to start
with. Once all the authenticators are implemented through JASIC then the
AuthenticatorBase and JaspicAuthenticator may end up merging. (No point
having a super class that is only ever going to be extended by one class.)

>>> Second question is about integrating and replacing current authentication
>>> mechanisms with JASPIC modules. From my current point of view, I would
>>> implement that by registering providers at context initialization, for
>>> example in ContextConfig.authenticatorConfig(). We can register different
>>> providers depending on context's login config, or use the same provider,
>>> which returns different authentication modules. Anyway, we need to
>>> implement some custom logic in authenticatorConfig() method. My current
>>> proposal is to implement special management for jaspic authentication
>>> methods, for example JASPIC-BASIC and JASPIC-DIGEST would use the same
>>> JaspicAuthenticator, however they are handled by different JASPIC
>> modules.
>>> Whenever all methods be ported to JASPIC platform we can remove "JASPIC"
>>> string from authentication methods, and then we can handle all
>>> authentication types the same way.
>>
>> What is the question?
> 
> Question is that correct? Or can I feel free to remove old auth mechanisms
> from there?

The general direction looks good. Keep the old ones and the new ones in
parallel for now.

Mark

>>> Third problem is JAAS subjects. I use special callback in order to bind
>>> principal and group callbacks into tomcat's principal. Is it correct
>>> solution, or I need to build  JAAS subject, and then convert it into
>>> Tomcat's principal?
>>
>> I don't see any reason to build a JAAS subject (at the moment). Do you?
>>
> Neither me. May be Arjan can share some thoughts on this.
> 
>>
>>> Currently, I want to proceed with second question in order to port BASIC
>>> authentication to JASPIC platform, but I need confirmation that I am
>> moving
>>> in right direction.
>>
>> The current direction looks good to me. I'll add any detailed comments
>> to the commits as I review them.
>>
>> Mark
>>
>> --
> Thanks,
> Fjodor
> 


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



buildbot success in ASF Buildbot on tomcat-trunk

2015-06-15 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building ASF Buildbot. Full details are available at:
http://ci.apache.org/builders/tomcat-trunk/builds/1384

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1685593
Blamelist: markt

Build succeeded!

Sincerely,
 -The Buildbot




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



svn commit: r1685633 - /tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 17:16:11 2015
New Revision: 1685633

URL: http://svn.apache.org/r1685633
Log:
Extracted method for getting factory class name
Patch by fjodorver

Modified:
tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java

Modified: 
tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java?rev=1685633&r1=1685632&r2=1685633&view=diff
==
--- tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java 
(original)
+++ tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java 
Mon Jun 15 17:16:11 2015
@@ -21,6 +21,7 @@ import java.security.Permission;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.security.Security;
 import java.security.SecurityPermission;
 import java.util.Map;
 
@@ -66,24 +67,15 @@ public abstract class AuthConfigFactory
 public static synchronized AuthConfigFactory getFactory() {
 checkPermission(getFactorySecurityPermission);
 if (factory == null) {
-String className = AccessController.doPrivileged(new 
PrivilegedAction() {
-@Override
-public String run() {
-return 
java.security.Security.getProperty(DEFAULT_FACTORY_SECURITY_PROPERTY);
-}
-});
-if (className == null) {
-className = DEFAULT_JASPI_AUTHCONFIGFACTORYIMPL;
-}
+final String className = getFactoryClassName();
 try {
-final String finalClassName = className;
 factory = AccessController.doPrivileged(
 new PrivilegedExceptionAction() {
 @Override
 public AuthConfigFactory run() throws 
ClassNotFoundException,
 InstantiationException, IllegalAccessException {
 // TODO Review this
-Class clazz = Class.forName(finalClassName, true, 
contextClassLoader);
+Class clazz = Class.forName(className, true, 
contextClassLoader);
 return (AuthConfigFactory) clazz.newInstance();
 }
 });
@@ -134,6 +126,21 @@ public abstract class AuthConfigFactory
 }
 }
 
+private static String getFactoryClassName() {
+String className = AccessController.doPrivileged(new 
PrivilegedAction() {
+@Override
+public String run() {
+return Security.getProperty(DEFAULT_FACTORY_SECURITY_PROPERTY);
+}
+});
+
+if (className != null) {
+return className;
+}
+
+return DEFAULT_JASPI_AUTHCONFIGFACTORYIMPL;
+}
+
 public static interface RegistrationContext {
 
 String getMessageLayer();



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



svn commit: r1685637 - /tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 17:22:05 2015
New Revision: 1685637

URL: http://svn.apache.org/r1685637
Log:
Trivial clean-up.
Based on a patch by fjodorver

Modified:
tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java

Modified: 
tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java?rev=1685637&r1=1685636&r2=1685637&view=diff
==
--- tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java 
(original)
+++ tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java 
Mon Jun 15 17:22:05 2015
@@ -66,30 +66,33 @@ public abstract class AuthConfigFactory
 
 public static synchronized AuthConfigFactory getFactory() {
 checkPermission(getFactorySecurityPermission);
-if (factory == null) {
-final String className = getFactoryClassName();
-try {
-factory = AccessController.doPrivileged(
-new PrivilegedExceptionAction() {
-@Override
-public AuthConfigFactory run() throws 
ClassNotFoundException,
-InstantiationException, IllegalAccessException {
-// TODO Review this
-Class clazz = Class.forName(className, true, 
contextClassLoader);
-return (AuthConfigFactory) clazz.newInstance();
-}
-});
-} catch (PrivilegedActionException e) {
-Exception inner = e.getException();
-if (inner instanceof InstantiationException) {
-throw (SecurityException) new 
SecurityException("AuthConfigFactory error:"
-+ 
inner.getCause().getMessage()).initCause(inner.getCause());
-} else {
-throw (SecurityException) new SecurityException(
-"AuthConfigFactory error: " + 
inner).initCause(inner);
+if (factory != null) {
+return factory;
+}
+
+final String className = getFactoryClassName();
+try {
+factory = AccessController.doPrivileged(
+new PrivilegedExceptionAction() {
+@Override
+public AuthConfigFactory run() throws ClassNotFoundException,
+InstantiationException, IllegalAccessException {
+// TODO Review this
+Class clazz = Class.forName(className, true, 
contextClassLoader);
+return (AuthConfigFactory) clazz.newInstance();
 }
+});
+} catch (PrivilegedActionException e) {
+Exception inner = e.getException();
+if (inner instanceof InstantiationException) {
+throw (SecurityException) new 
SecurityException("AuthConfigFactory error:" +
+
inner.getCause().getMessage()).initCause(inner.getCause());
+} else {
+throw (SecurityException) new SecurityException(
+"AuthConfigFactory error: " + inner).initCause(inner);
 }
 }
+
 return factory;
 }
 



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



[Bug 58031] Posting data exceeding maxPostSize should result in HTTP 413.

2015-06-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58031

Christopher L. Simons  changed:

   What|Removed |Added

 CC||christopherleesimons@gmail.
   ||com

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



[Bug 58031] Posting data exceeding maxPostSize should result in HTTP 413.

2015-06-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58031

Christopher L. Simons  changed:

   What|Removed |Added

  Attachment #32821|Initial draft of patch to   |Initial draft of patch,
description|set status as 413 when  |created against trunk.
   |maxPostSize is exceeded.|

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



svn commit: r1685671 - in /tomcat/trunk/java/org/apache/catalina/authenticator/jaspic: ./ AuthConfigFactoryImpl.java

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 21:17:50 2015
New Revision: 1685671

URL: http://svn.apache.org/r1685671
Log:
Add stubbed out AuthConfigFactory implementation.
Patch by fjodorver

Added:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/

tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
   (with props)

Added: 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java?rev=1685671&view=auto
==
--- 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
 (added)
+++ 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
 Mon Jun 15 21:17:50 2015
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.authenticator.jaspic;
+
+import java.util.Map;
+
+import javax.security.auth.message.config.AuthConfigFactory;
+import javax.security.auth.message.config.AuthConfigProvider;
+import javax.security.auth.message.config.RegistrationListener;
+
+public class AuthConfigFactoryImpl extends AuthConfigFactory {
+
+@Override
+public AuthConfigProvider getConfigProvider(String layer, String 
appContext,
+RegistrationListener listener) {
+return null;
+}
+
+@Override
+@SuppressWarnings("rawtypes") // JASPIC API uses raw types
+public String registerConfigProvider(String className, Map properties, 
String layer,
+String appContext, String description) {
+return null;
+}
+
+@Override
+public String registerConfigProvider(AuthConfigProvider provider, String 
layer,
+String appContext, String description) {
+return null;
+}
+
+@Override
+public boolean removeRegistration(String registrationID) {
+return false;
+}
+
+@Override
+public String[] detachListener(RegistrationListener listener, String 
layer, String appContext) {
+return null;
+}
+
+@Override
+public String[] getRegistrationIDs(AuthConfigProvider provider) {
+return null;
+}
+
+@Override
+public RegistrationContext getRegistrationContext(String registrationID) {
+return null;
+}
+
+@Override
+public void refresh() {
+
+}
+}

Propchange: 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
--
svn:eol-style = native



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



svn commit: r1685673 - in /tomcat/trunk/java/org/apache/catalina: authenticator/jaspic/JaspicAuthenticator.java startup/Authenticators.properties

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 21:20:17 2015
New Revision: 1685673

URL: http://svn.apache.org/r1685673
Log:
Add stubbed out JaspicAuthenticator implementation.
Patch by fjodorver

Added:

tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java
   (with props)
Modified:
tomcat/trunk/java/org/apache/catalina/startup/Authenticators.properties

Added: 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java?rev=1685673&view=auto
==
--- 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java
 (added)
+++ 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java
 Mon Jun 15 21:20:17 2015
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.authenticator.jaspic;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.Authenticator;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.valves.ValveBase;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+public class JaspicAuthenticator extends ValveBase implements Authenticator {
+
+private static final Log log = 
LogFactory.getLog(JaspicAuthenticator.class);
+
+@Override
+public boolean authenticate(Request request, HttpServletResponse response) 
throws IOException {
+return true;
+}
+
+@Override
+public void login(String userName, String password, Request request) 
throws ServletException {
+
+}
+
+@Override
+public void logout(Request request) {
+
+}
+
+@Override
+public void invoke(Request request, Response response) throws IOException, 
ServletException {
+getNext().invoke(request, response);
+}
+}

Propchange: 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java
--
svn:eol-style = native

Modified: 
tomcat/trunk/java/org/apache/catalina/startup/Authenticators.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Authenticators.properties?rev=1685673&r1=1685672&r2=1685673&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/Authenticators.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Authenticators.properties Mon 
Jun 15 21:20:17 2015
@@ -18,4 +18,5 @@ CLIENT-CERT=org.apache.catalina.authenti
 DIGEST=org.apache.catalina.authenticator.DigestAuthenticator
 FORM=org.apache.catalina.authenticator.FormAuthenticator
 NONE=org.apache.catalina.authenticator.NonLoginAuthenticator
-SPNEGO=org.apache.catalina.authenticator.SpnegoAuthenticator
\ No newline at end of file
+SPNEGO=org.apache.catalina.authenticator.SpnegoAuthenticator
+JASPIC-BASIC=org.apache.catalina.authenticator.jaspic.JaspicAuthenticator
\ No newline at end of file



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



svn commit: r1685674 - in /tomcat/trunk/java: javax/security/auth/message/config/AuthConfigFactory.java org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 21:34:00 2015
New Revision: 1685674

URL: http://svn.apache.org/r1685674
Log:
Initial AuthConfigFactory implementation.
Patch by fjodorver

Modified:
tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java

tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java

Modified: 
tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java?rev=1685674&r1=1685673&r2=1685674&view=diff
==
--- tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java 
(original)
+++ tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java 
Mon Jun 15 21:34:00 2015
@@ -46,7 +46,7 @@ public abstract class AuthConfigFactory
 new SecurityPermission(PROVIDER_REGISTRATION_PERMISSION_NAME);
 
 private static final String DEFAULT_JASPI_AUTHCONFIGFACTORYIMPL =
-"org.apache.geronimo.components.jaspi.AuthConfigFactoryImpl";
+"org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl";
 
 private static AuthConfigFactory factory;
 private static ClassLoader contextClassLoader;

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java?rev=1685674&r1=1685673&r2=1685674&view=diff
==
--- 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
 (original)
+++ 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
 Mon Jun 15 21:34:00 2015
@@ -16,6 +16,9 @@
  */
 package org.apache.catalina.authenticator.jaspic;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.security.auth.message.config.AuthConfigFactory;
@@ -24,47 +27,145 @@ import javax.security.auth.message.confi
 
 public class AuthConfigFactoryImpl extends AuthConfigFactory {
 
+private Map configProviders = new HashMap<>();
+
+
 @Override
 public AuthConfigProvider getConfigProvider(String layer, String 
appContext,
 RegistrationListener listener) {
-return null;
+
+String registrationKey = getRegistrationKey(layer, appContext);
+
+ConfigProviderInfo provider = configProviders.get(registrationKey);
+if (provider == null) {
+provider = configProviders.get(getRegistrationKey(null, 
appContext));
+}
+if (provider == null) {
+provider = configProviders.get(getRegistrationKey(layer, null));
+}
+if (provider == null) {
+provider = configProviders.get(getRegistrationKey(null, null));
+}
+if (provider == null) {
+return null;
+}
+
+if (listener != null) {
+provider.addListener(listener);
+}
+
+return provider.getAuthConfigProvider();
 }
 
+
 @Override
 @SuppressWarnings("rawtypes") // JASPIC API uses raw types
 public String registerConfigProvider(String className, Map properties, 
String layer,
 String appContext, String description) {
-return null;
+throw new IllegalStateException("Not implemented yet!");
 }
 
+
 @Override
 public String registerConfigProvider(AuthConfigProvider provider, String 
layer,
 String appContext, String description) {
-return null;
+
+String registrationId = getRegistrationKey(layer, appContext);
+ConfigProviderInfo providerInfo =
+new ConfigProviderInfo(provider, true, layer, appContext, 
description);
+configProviders.put(registrationId, providerInfo);
+return registrationId;
 }
 
+
 @Override
 public boolean removeRegistration(String registrationID) {
-return false;
+return configProviders.remove(registrationID) != null;
 }
 
+
 @Override
 public String[] detachListener(RegistrationListener listener, String 
layer, String appContext) {
 return null;
 }
 
+
 @Override
 public String[] getRegistrationIDs(AuthConfigProvider provider) {
 return null;
 }
 
+
 @Override
 public RegistrationContext getRegistrationContext(String registrationID) {
-return null;
+return configProviders.get(registrationID);
 }
 
+
 @Override
 public void refresh() {
 
 }
+
+
+private String getRegistrationKey(String layer, String appContext) {
+return layer + "/" + appContext;
+}
+
+
+private static class ConfigProviderInfo implements 
AuthConfigFactory.RegistrationContext {
+private final AuthConfigProvide

svn commit: r1685678 - in /tomcat/trunk/java/org/apache/catalina/authenticator/jaspic: JaspicAuthenticator.java JaspicCallbackHandler.java MessageInfoImpl.java PrincipalGroupCallback.java

2015-06-15 Thread markt
Author: markt
Date: Mon Jun 15 22:11:10 2015
New Revision: 1685678

URL: http://svn.apache.org/r1685678
Log:
Implemented very basic JASPIC support with ability to register providers 
Patch by fjodorver

Added:

tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicCallbackHandler.java
   (with props)

tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/MessageInfoImpl.java 
  (with props)

tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/PrincipalGroupCallback.java
   (with props)
Modified:

tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java?rev=1685678&r1=1685677&r2=1685678&view=diff
==
--- 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java
 (original)
+++ 
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/JaspicAuthenticator.java
 Mon Jun 15 22:11:10 2015
@@ -17,38 +17,120 @@
 package org.apache.catalina.authenticator.jaspic;
 
 import java.io.IOException;
+import java.security.Principal;
+import java.util.Map;
 
+import javax.security.auth.Subject;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.config.AuthConfigFactory;
+import javax.security.auth.message.config.AuthConfigProvider;
+import javax.security.auth.message.config.ServerAuthConfig;
+import javax.security.auth.message.config.ServerAuthContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.catalina.Authenticator;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.authenticator.AuthenticatorBase;
 import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-import org.apache.catalina.valves.ValveBase;
+
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 
-public class JaspicAuthenticator extends ValveBase implements Authenticator {
+public class JaspicAuthenticator extends AuthenticatorBase {
 
 private static final Log log = 
LogFactory.getLog(JaspicAuthenticator.class);
 
+private static final String AUTH_TYPE = "JASPIC";
+private static final String MESSAGE_LAYER = "HttpServlet";
+
+private JaspicCallbackHandler callbackHandler;
+private Subject serviceSubject;
+
+@SuppressWarnings("rawtypes")
+private Map authProperties = null;
+
+
+@Override
+protected synchronized void startInternal() throws LifecycleException {
+super.startInternal();
+callbackHandler = new JaspicCallbackHandler(container.getRealm());
+serviceSubject = new Subject();
+}
+
+
 @Override
 public boolean authenticate(Request request, HttpServletResponse response) 
throws IOException {
-return true;
+MessageInfo messageInfo = new MessageInfoImpl(request, response, true);
+AuthConfigFactory factory = AuthConfigFactory.getFactory();
+String appContext = request.getLocalName() + " " + 
request.getContextPath();
+
+AuthConfigProvider configProvider =
+factory.getConfigProvider(MESSAGE_LAYER, appContext, null);
+ServerAuthConfig authConfig = getAuthConfig(appContext, 
configProvider);
+String authContextId = authConfig.getAuthContextID(messageInfo);
+
+ServerAuthContext authContext = null;
+authContext = getAuthContext(authConfig, authContextId, 
authProperties, authContext);
+AuthStatus authStatus = validateRequest(messageInfo, authContext);
+
+if (authStatus == AuthStatus.SUCCESS) {
+Principal principal = callbackHandler.getPrincipal();
+if (principal != null) {
+register(request, response, principal, AUTH_TYPE, null, null);
+}
+return true;
+}
+
+return false;
+}
+
+
+private AuthStatus validateRequest(MessageInfo messageInfo, 
ServerAuthContext authContext) {
+Subject clientSubject = new Subject();
+try {
+return authContext.validateRequest(messageInfo, clientSubject, 
serviceSubject);
+} catch (AuthException e) {
+throw new IllegalStateException(e);
+}
+}
+
+
+@SuppressWarnings("rawtypes")
+private ServerAuthContext getAuthContext(ServerAuthConfig authConfig, 
String authContextId,
+Map authProperties, ServerAuthContext authContext) {
+try {
+return authConfig.getAuthContext(authContextId, serviceSubject, 
authProperties);
+} catch (AuthException e) {
+throw new IllegalStateException(e);
+}
 }
 
+

svn commit: r1685713 - in /tomcat/site/trunk: docs/doap_Tomcat.rdf docs/index.html xdocs/doap_Tomcat.rdf xdocs/index.xml

2015-06-15 Thread violetagg
Author: violetagg
Date: Tue Jun 16 06:06:28 2015
New Revision: 1685713

URL: http://svn.apache.org/r1685713
Log:
Update the list of technologies that are implemented by Apache Tomcat.

Modified:
tomcat/site/trunk/docs/doap_Tomcat.rdf
tomcat/site/trunk/docs/index.html
tomcat/site/trunk/xdocs/doap_Tomcat.rdf
tomcat/site/trunk/xdocs/index.xml

Modified: tomcat/site/trunk/docs/doap_Tomcat.rdf
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/doap_Tomcat.rdf?rev=1685713&r1=1685712&r2=1685713&view=diff
==
--- tomcat/site/trunk/docs/doap_Tomcat.rdf (original)
+++ tomcat/site/trunk/docs/doap_Tomcat.rdf Tue Jun 16 06:06:28 2015
@@ -27,12 +27,15 @@
 Apache Tomcat
 http://tomcat.apache.org/"; />
 http://tomcat.apache.org"; />
-A Java Servlet and JavaServer Pages specifications 
implementation.
+A Java Servlet, JavaServer Pages, Java Expression
+Language and Java WebSocket specifications implementation.
 Apache Tomcat is a web server that is an open source software
-implementation of the Java Servlet and JavaServer Pages technologies.
-The Java Servlet and JavaServer Pages specifications are developed under
-the Java Community Process. Apache Tomcat is developed in an open and
-participatory environment and released under the Apache License version 2.
+implementation of the Java Servlet, JavaServer Pages, Java Expression
+Language and Java WebSocket technologies. The Java Servlet, JavaServer
+Pages, Java Expression Language and Java WebSocket specifications are
+developed under the Java Community Process. Apache Tomcat is developed
+in an open and participatory environment and released under the Apache
+License version 2.
 
 Apache Tomcat is intended to be a collaboration of the best-of-breed
 developers from around the world. We invite you to participate in this open

Modified: tomcat/site/trunk/docs/index.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/index.html?rev=1685713&r1=1685712&r2=1685713&view=diff
==
--- tomcat/site/trunk/docs/index.html (original)
+++ tomcat/site/trunk/docs/index.html Tue Jun 16 06:06:28 2015
@@ -200,9 +200,10 @@
 
 
 
-Apache Tomcat™ is an open source software implementation of the Java 
Servlet
-and JavaServer Pages technologies. The Java Servlet and JavaServer Pages
-specifications are developed under the
+Apache Tomcat™ is an open source software implementation of the Java
+Servlet, JavaServer Pages, Java Expression Language and Java WebSocket
+technologies. The Java Servlet, JavaServer Pages, Java Expression Language and
+Java WebSocket specifications are developed under the
 http://jcp.org/en/introduction/overview"; rel="nofollow">Java Community
 Process.
 

Modified: tomcat/site/trunk/xdocs/doap_Tomcat.rdf
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/doap_Tomcat.rdf?rev=1685713&r1=1685712&r2=1685713&view=diff
==
--- tomcat/site/trunk/xdocs/doap_Tomcat.rdf (original)
+++ tomcat/site/trunk/xdocs/doap_Tomcat.rdf Tue Jun 16 06:06:28 2015
@@ -27,12 +27,15 @@
 Apache Tomcat
 http://tomcat.apache.org/"; />
 http://tomcat.apache.org"; />
-A Java Servlet and JavaServer Pages specifications 
implementation.
+A Java Servlet, JavaServer Pages, Java Expression
+Language and Java WebSocket specifications implementation.
 Apache Tomcat is a web server that is an open source software
-implementation of the Java Servlet and JavaServer Pages technologies.
-The Java Servlet and JavaServer Pages specifications are developed under
-the Java Community Process. Apache Tomcat is developed in an open and
-participatory environment and released under the Apache License version 2.
+implementation of the Java Servlet, JavaServer Pages, Java Expression
+Language and Java WebSocket technologies. The Java Servlet, JavaServer
+Pages, Java Expression Language and Java WebSocket specifications are
+developed under the Java Community Process. Apache Tomcat is developed
+in an open and participatory environment and released under the Apache
+License version 2.
 
 Apache Tomcat is intended to be a collaboration of the best-of-breed
 developers from around the world. We invite you to participate in this open

Modified: tomcat/site/trunk/xdocs/index.xml
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/index.xml?rev=1685713&r1=1685712&r2=1685713&view=diff
==
--- tomcat/site/trunk/xdocs/index.xml (original)
+++ tomcat/site/trunk/xdocs/index.xml Tue Jun 16 06:06:28 2015
@@ -13,9 +13,10 @@
 
 
 
-Apache Tomcat™ is an open source software implementation of the Java 
Servlet
-and JavaServer Pages technologies. The Jav