[fixed formatting]
Hi,
I will try with with "cxf-rs.auth".
In the meantime, I found out @Module's could also return EjbModule which lets
me configure an OpenejbJar like this:
@Module
public EjbModule ejbModule() {
EjbJar ejbJar = new EjbJar();
EnterpriseBean bean = ejbJar.addEnterpriseBean(new
StatelessBean(MyService.class));
OpenejbJar openejbJar = new OpenejbJar();
EjbDeployment deployment = openejbJar.addEjbDeployment(new
EjbDeployment(bean));
deployment.addProperty("webservice.security.authMethod", "BASIC");
return new EjbModule(ejbJar, openejbJar);
}
This makes me think that the documentation about the valid return types for
ApplicationComposer @Module's
(http://tomee.apache.org/examples-trunk/application-composer/README.html)
should be adapted to include all types present in
ApplicationComposers.MODULE_TYPES.
Regards,
Xavier
> From: [email protected]
> To: [email protected]
> Subject: RE: ApplicationComposer and secured WebService
> Date: Wed, 14 May 2014 08:49:14 +0200
>
> Hi,
> I will try with with "cxf-rs.auth".
> In the meantime, I found out @Module's could also return EjbModule which lets
> me configure an OpenejbJar like this:
> @Modulepublic EjbModule ejbModule() { EjbJar ejbJar = new EjbJar();
> EnterpriseBean bean = ejbJar.addEnterpriseBean(new
> StatelessBean(MyService.class)); OpenejbJar openejbJar = new OpenejbJar();
> EjbDeployment deployment = openejbJar.addEjbDeployment(new
> EjbDeployment(bean));
> deployment.addProperty("webservice.security.authMethod", "BASIC"); return new
> EjbModule(ejbJar, openejbJar);}
> This makes me think that the documentation about the valid return types for
> ApplicationComposer @Module's
> (http://tomee.apache.org/examples-trunk/application-composer/README.html)
> should be adapted to include all types present in
> ApplicationComposers.MODULE_TYPES.
> Regards,
> Xavier
>> Date: Tue, 13 May 2014 23:12:48 -0700
>> Subject: Re: ApplicationComposer and secured WebService
>> From: [email protected]
>> To: [email protected]
>>
>> Try adding a method annotated with @Configuration and add the following as
>> the content
>> final Properties p = new Properties();
>> p.setProperty("cxf-rs.auth", "BASIC");
>> return p;
>>
>>
>> That should work
>> --
>> Jean-Louis Monteiro
>> http://twitter.com/jlouismonteiro
>> http://www.tomitribe.com
>>
>>
>> On Fri, May 9, 2014 at 6:19 AM, Xavier Dury <[email protected]> wrote:
>>
>>> Hi,
>>> I am using ApplicationComposer to test an EJB exposed as a WebService.
>>> My service is secured with @RolesAllowed and I would like to use BASIC
>>> authentication or disable security for the test.
>>> As I don't know how to disable security, I tried to activate BASIC
>>> authentication (with groups/user.properties).
>>> To do that, I would either need:- an openejb-jar.xml with the proper
>>> config, but then I don't know how to include this file in my @Module
>>> EjbJar;- or configure BASIC authentication on my @Module EnterpriseBean,
>>> but then I don't see any method on StatelessBean that can do that.
>>> Does anybody have an idea how to do that?
>>> The only way that works is by using EjbContainerRunner (which deploys
>>> everything including openejb-jar.xml) but as I would like to use some
>>> mocks, I would prefer using ApplicationComposerRunner instead.
>>> Thanks,
>>> Xavier
>>>
>>>
>>>
>>>
>