[ 
https://issues.apache.org/jira/browse/KARAF-296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935862#action_12935862
 ] 

Achim Nierbeck commented on KARAF-296:
--------------------------------------

Got it working with standard jetty.xml :)

{code}
<Call name="addBean">
      <Arg>
        <New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
          <Set name="name">karaf</Set>
          <Set name="loginModuleName">karaf</Set>
        </New>
      </Arg>
    </Call>
{code}

Does it :)

Needed to supply the following bundles: 

org.eclipse.jetty.plus (7.1.6.v20100715)
org.apache.geronimo.specs.geronimo-jta_1.1_spec (1.1.1)
org.eclipse.jetty.jndi (7.1.6.v20100715)
javax.mail (1.4.3)
org.eclipse.jetty.webapp (7.1.6.v20100715)

This ended up with the following issue 
http://issues.ops4j.org/browse/PAXWEB-221
but the login dialog poped-up.

> Issue with Jetty JAAS and Karaf
> -------------------------------
>
>                 Key: KARAF-296
>                 URL: https://issues.apache.org/jira/browse/KARAF-296
>             Project: Karaf
>          Issue Type: Bug
>            Reporter: Charles Moulliard
>         Attachments: jetty.xml, realm.properties
>
>
> When Jetty Security (JAAS) is configurated to use Karaf realm, the following 
> error is generated :
> {code}
> 07:36:10,917 | WARN  | qtp1759402480-81 | log                              | 
> .eclipse.jetty.util.log.Slf4jLog   50 | 36 - org.eclipse.jetty.util - 
> 7.1.6.v20100715 | EXCEPTION 
> javax.security.auth.login.LoginException: Invalid null input: name
>       at 
> javax.security.auth.login.LoginContext.init(LoginContext.java:229)[:1.6.0_22]
>       at 
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)[:1.6.0_22]
>       at 
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)[:1.6.0_22]
>       at 
> org.eclipse.jetty.plus.jaas.JAASLoginService.login(JAASLoginService.java:201)[76:org.eclipse.jetty.plus:7.1.6.v20100715]
>       at 
> org.eclipse.jetty.security.authentication.BasicAuthenticator.validateRequest(BasicAuthenticator.java:75)[41:org.eclipse.jetty.security:7.1.6.v20100715]
>       at 
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:416)[41:org.eclipse.jetty.security:7.1.6.v20100715]
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)[40:org.eclipse.jetty.server:7.1.6.v20100715]
> {code}
> To reproduce it on Karaf, add the following bundles
> {code}
> features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.5.0/xml/features
> features:install spring-dm
> features:install camel
> features:install camel-jetty
> osgi:install -s mvn:javax.mail/mail/1.4.3
> features:install camel-jpa
> osgi:install -s mvn:org.eclipse.jetty/jetty-plus/7.1.6.v20100715
> osgi:install -s mvn:org.eclipse.jetty/jetty-jndi/7.1.6.v20100715
> {code}
> and deploy the camel route
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xmlns:cxf="http://camel.apache.org/schema/cxf";
>       xmlns:camel="http://camel.apache.org/schema/spring"; 
> xmlns:context="http://www.springframework.org/schema/context";
>       xsi:schemaLocation="
>        http://www.springframework.org/schema/beans 
>          http://www.springframework.org/schema/beans/spring-beans.xsd
>          http://www.springframework.org/schema/context
>          http://www.springframework.org/schema/context/spring-context.xsd
>          http://camel.apache.org/schema/cxf 
>          http://camel.apache.org/schema/cxf/camel-cxf.xsd
>          http://camel.apache.org/schema/spring 
>          http://camel.apache.org/schema/spring/camel-spring.xsd";>
>     <!-- Jetty Security handling
>     <bean id="loginService" 
> class="org.eclipse.jetty.security.HashLoginService">
>         <property name="name" value="karaf" />
>         <property name="config" value="./etc/users.properties" />
>     </bean> -->
>     <bean id="loginService" 
> class="org.eclipse.jetty.plus.jaas.JAASLoginService">
>         <property name="name" value="karaf" />
>         <!-- <property name="loginModuleName" value="karaf" /> -->
>     </bean>
>     <bean id="constraint" class="org.eclipse.jetty.http.security.Constraint">
>         <property name="name" value="BASIC"/>
>         <property name="roles" value="admin"/>
>         <property name="authenticate" value="true"/>
>     </bean>
>     <bean id="constraintMapping" 
> class="org.eclipse.jetty.security.ConstraintMapping">
>         <property name="constraint" ref="constraint"/>
>         <property name="pathSpec" value="/*"/>
>     </bean>
>     <bean id="securityHandler" 
> class="org.eclipse.jetty.security.ConstraintSecurityHandler">
>         <property name="authenticator">
>             <bean 
> class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/>
>         </property>
>         <property name="constraintMappings">
>             <list>
>                 <ref bean="constraintMapping"/>
>             </list>
>         </property>
>         <property name="loginService" ref="loginService" />
>         <property name="strict" value="false" /> 
>     </bean>
>       <camelContext xmlns="http://camel.apache.org/schema/spring";>
>         <route>
>             <from 
> uri="jetty:http://localhost:9001/fe/proxy?handlers=securityHandler"/>
>             <to 
> uri="log:fr.rsi.fe.proxy.router?showAll=true&amp;multiline=true"/>
>         </route>      
>       </camelContext>
>       
>       
> </beans>
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to