Server Auth Module (SAM) and osgi bundles
I have a simple war deployed as a bundle (wab) and I want to configure SAM for it.
So I followed the instructions (http://download.oracle.com/docs/cd/E19798-01/821-1752/gizel/index.html), wrote a custom SAM, defined it in my domain.xml and configured sun-web.xml in my war. I packaged my sam in a jar and put under domain/domain1/lib.
This works fine in simple war (i.e - all requests go through my sam).
This doesn't work for a bundle. I can see this warning in the log "jmac.provider_unable_to_load_authmodule", with no detailed exception. I googled it and it is thrown upon failure to instantiate the auth module using class.forName.
The solution that worked for me was to add my custom sam to the bundle's WEB-INF/lib (and add the corresponding entry in the manifest's classpath entry). The problem is that it's not ideal because it means that I need to copy my sam (and all its depenencies...) to each of the wars I want to use it in. Idealy, it should be located in some main lib which is accessible by all bundles.
My question is what are the alternatives and what is the recommended way do it when using bundles?