In my example I configure /etc/jetty.xml file to use JAAS
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
<Set name="name">karaf</Set>
<Set name="loginModuleName">karaf</Set>
<Set name="roleClassNames">
<Array type="java.lang.String">
<Item>org.apache.karaf.jaas.modules.RolePrincipal</Item>
</Array>
</Set>
</New>
</Arg>
</Call>
and my web.xml like that
<!-- to authenticate the user -->
<security-constraint>
<web-resource-collection>
<web-resource-name>A Protected Page</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>user</role-name>
<role-name>moderator</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>karaf</realm-name>
</login-config>
On Mon, Feb 14, 2011 at 3:54 PM, Ioannis Canellos <[email protected]> wrote:
> My guess is that if you are getting classloading exception that you are
> using classes that you are not supposed to or you are trying to deploy a
> custom realm from within your war.
> If you see the example I sent you, the web application make no reference to
> karaf specific classes.
>
> I didn't use a special kind of packaging. I created the realm using
> blueprint xml which I dropped in the deploy folder. And I also created a war
> osgi bundle.
>
>
>
> On Mon, Feb 14, 2011 at 4:45 PM, Charles Moulliard
> <[email protected]>wrote:
>
>> If I don't import them, I get classloading exception.
>>
>> How have you packaged and deployed your project as defined on your blog ?
>>
>>
>> On Mon, Feb 14, 2011 at 3:11 PM, Ioannis Canellos <[email protected]>
>> wrote:
>> > Halo Charles,
>> >
>> > You don't need to import those in order to use jaas in web applications.
>> >
>> >
>> > On Mon, Feb 14, 2011 at 3:56 PM, Charles Moulliard <[email protected]
>> >wrote:
>> >
>> >> Hi,
>> >>
>> >> Is there a trick when we deploy a WAR/WAB on apache karaf to avoid
>> >> that we must import the following packages in the bundle to allow JAAS
>> >> authentication with Karaf ?
>> >>
>> >> org.apache.karaf.jaas.modules,
>> >> org.eclipse.jetty.plus.jaas,
>> >>
>> >> Regards,
>> >>
>> >> Charles Moulliard
>> >>
>> >> Sr. Principal Solution Architect - FuseSource
>> >> Apache Committer
>> >>
>> >> Blog : http://cmoulliard.blogspot.com
>> >> Twitter : http://twitter.com/cmoulliard
>> >> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>> >> Skype: cmoulliard
>> >>
>> >
>> >
>> >
>> > --
>> > *Ioannis Canellos*
>> > http://iocanel.blogspot.com
>> >
>> > Integration Engineer @ Upstream S.A. <http://www.upstreamsystems.com>
>> >
>>
>
>
>
> --
> *Ioannis Canellos*
> http://iocanel.blogspot.com
>
> Integration Engineer @ Upstream S.A. <http://www.upstreamsystems.com>
>