users@glassfish.java.net

Re: Server Auth Module (SAM) and osgi bundles

From: Kumar Jayanti <v.b.kumar.jayanti_at_oracle.com>
Date: Mon, 11 Apr 2011 11:52:18 +0530

On 09-Apr-2011, at 10:55 AM, Sahoo wrote:

> Kumar,
>
> Do we use thread's context class loader to load the authmodule?

yes.


>
> Karo,
>
> Can you deploy the custom SAM jar an OSGi bundle in glassfish/modules so that you don't have to package it in every wab? Please configure the OSGi metadata of your sam bundle to export the packages containing classes that are loaded by the security module.

Can we suggest <InstanceRoot>/autodeploy/bundles instead ?.

regards,
kumar
>
> Thanks,
> Sahoo
> On Wednesday 06 April 2011 03:01 AM, forums_at_java.net wrote:
>> I have a simple war deployed as a bundle (wab) and I want to configure SAM
>> for it.
>> So I followed the instructions here [1] , 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?
>> Thanks
>>
>>
>>
>> [1] http://download.oracle.com/docs/cd/E19798-01/821-1752/gizel/index.html
>>
>> --
>>
>> [Message sent by forum member 'Karo']
>>
>> View Post: http://forums.java.net/node/789008
>>
>>
>