You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Charles Moulliard (JIRA)" <ji...@apache.org> on 2010/12/07 16:55:08 UTC

[jira] Created: (CAMEL-3401) camel-jetty component does not work when authentication is enable

camel-jetty component does not work when authentication is enable
-----------------------------------------------------------------

                 Key: CAMEL-3401
                 URL: https://issues.apache.org/jira/browse/CAMEL-3401
             Project: Camel
          Issue Type: Bug
    Affects Versions: 2.5.0
         Environment: Apache Karaf 2.1-SNAPSHOT
            Reporter: Charles Moulliard


I try to use camel-jetty in a camel route usign LDAP authentication. The authentication mechanisms of Jetty works fine as I'm able to authenticate a LDAP user from the web page but the camel route is not called.

Here is the camel route

{code}
    <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">

        <route>
            <from uri="jetty:http://localhost:8080/services?handlers=securityHandler&amp;matchOnUriPrefix=true"/>
            <onException>
                <exception>java.lang.Exception</exception>
                <!-- we can set the redelivery policy here as well -->
                <redeliveryPolicy maximumRedeliveries="1"/>
                <handled>
                    <constant>true</constant>
                </handled>
                <transform>
                    <simple>Due to something went wrong</simple>
                </transform>
                <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
                    <simple>500</simple>
                </setHeader>
            </onException>

            <bean ref="responseBean"/>
        </route>
    </camelContext>
{code}

REMARK : the camel route works fine when authentication is disabled

and the error

{code}
14:56:31,587 | WARN  | 0-98 - /services | log                              | .eclipse.jetty.util.log.Slf4jLog   40 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | /services: java.lang.NullPointerException
14:56:31,587 | DEBUG | 0-98 - /services | log                              | .eclipse.jetty.util.log.Slf4jLog   80 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | EXCEPTION 
java.lang.NullPointerException
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:489)[68:org.eclipse.jetty.security:7.1.6.v20100715]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)[67:org.eclipse.jetty.server:7.1.6.v20100715]
	at org.eclipse.jetty.server.Server.handle(Server.java:347)[67:org.eclipse.jetty.server:7.1.6.v20100715]

{code}

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


[jira] Closed: (CAMEL-3401) camel-jetty component does not work when authentication is enable

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Moulliard closed CAMEL-3401.
------------------------------------

    Resolution: Fixed

Problem solved with last JAAS module of Karaf and workaround exist (adding an IdentityService in the spring xml file)

> camel-jetty component does not work when authentication is enable
> -----------------------------------------------------------------
>
>                 Key: CAMEL-3401
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3401
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.5.0
>         Environment: Apache Karaf 2.1-SNAPSHOT
>            Reporter: Charles Moulliard
>
> I try to use camel-jetty in a camel route usign LDAP authentication. The authentication mechanisms of Jetty works fine as I'm able to authenticate a LDAP user from the web page but the camel route is not called.
> Here is the camel route
> {code}
>     <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
>         <route>
>             <from uri="jetty:http://localhost:8080/services?handlers=securityHandler&amp;matchOnUriPrefix=true"/>
>             <onException>
>                 <exception>java.lang.Exception</exception>
>                 <!-- we can set the redelivery policy here as well -->
>                 <redeliveryPolicy maximumRedeliveries="1"/>
>                 <handled>
>                     <constant>true</constant>
>                 </handled>
>                 <transform>
>                     <simple>Due to something went wrong</simple>
>                 </transform>
>                 <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
>                     <simple>500</simple>
>                 </setHeader>
>             </onException>
>             <bean ref="responseBean"/>
>         </route>
>     </camelContext>
> {code}
> REMARK : the camel route works fine when authentication is disabled
> and the error
> {code}
> 14:56:31,587 | WARN  | 0-98 - /services | log                              | .eclipse.jetty.util.log.Slf4jLog   40 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | /services: java.lang.NullPointerException
> 14:56:31,587 | DEBUG | 0-98 - /services | log                              | .eclipse.jetty.util.log.Slf4jLog   80 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | EXCEPTION 
> java.lang.NullPointerException
> 	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:489)[68:org.eclipse.jetty.security:7.1.6.v20100715]
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)[67:org.eclipse.jetty.server:7.1.6.v20100715]
> 	at org.eclipse.jetty.server.Server.handle(Server.java:347)[67:org.eclipse.jetty.server:7.1.6.v20100715]
> {code}

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


[jira] Commented: (CAMEL-3401) camel-jetty component does not work when authentication is enable

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12968959#action_12968959 ] 

Willem Jiang commented on CAMEL-3401:
-------------------------------------

@Charles
How did you setup the security handler to make the LDAP works for the webpage?
Camel manages the connector and handlers itself In the camel-jetty component, so you may need to some way to make sure the security handler is configured rightly. 

> camel-jetty component does not work when authentication is enable
> -----------------------------------------------------------------
>
>                 Key: CAMEL-3401
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3401
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.5.0
>         Environment: Apache Karaf 2.1-SNAPSHOT
>            Reporter: Charles Moulliard
>
> I try to use camel-jetty in a camel route usign LDAP authentication. The authentication mechanisms of Jetty works fine as I'm able to authenticate a LDAP user from the web page but the camel route is not called.
> Here is the camel route
> {code}
>     <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
>         <route>
>             <from uri="jetty:http://localhost:8080/services?handlers=securityHandler&amp;matchOnUriPrefix=true"/>
>             <onException>
>                 <exception>java.lang.Exception</exception>
>                 <!-- we can set the redelivery policy here as well -->
>                 <redeliveryPolicy maximumRedeliveries="1"/>
>                 <handled>
>                     <constant>true</constant>
>                 </handled>
>                 <transform>
>                     <simple>Due to something went wrong</simple>
>                 </transform>
>                 <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
>                     <simple>500</simple>
>                 </setHeader>
>             </onException>
>             <bean ref="responseBean"/>
>         </route>
>     </camelContext>
> {code}
> REMARK : the camel route works fine when authentication is disabled
> and the error
> {code}
> 14:56:31,587 | WARN  | 0-98 - /services | log                              | .eclipse.jetty.util.log.Slf4jLog   40 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | /services: java.lang.NullPointerException
> 14:56:31,587 | DEBUG | 0-98 - /services | log                              | .eclipse.jetty.util.log.Slf4jLog   80 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | EXCEPTION 
> java.lang.NullPointerException
> 	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:489)[68:org.eclipse.jetty.security:7.1.6.v20100715]
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)[67:org.eclipse.jetty.server:7.1.6.v20100715]
> 	at org.eclipse.jetty.server.Server.handle(Server.java:347)[67:org.eclipse.jetty.server:7.1.6.v20100715]
> {code}

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


[jira] Commented: (CAMEL-3401) camel-jetty component does not work when authentication is enable

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969231#action_12969231 ] 

Charles Moulliard commented on CAMEL-3401:
------------------------------------------

@Willem,

Of course that the security is enabled and works !

{code}
    <bean id="loginService" class="org.eclipse.jetty.plus.jaas.JAASLoginService">
        <property name="name" value="ldap"/>
        <property name="loginModuleName" value="ldap"/>
        <property name="roleClassNames">
            <list>
                <value>org.apache.karaf.jaas.modules.RolePrincipal</value>
            </list>
        </property>
    </bean>

    <bean id="constraint" class="org.eclipse.jetty.http.security.Constraint">
        <property name="name" value="BASIC"/>
        <property name="roles" value="system"/>
        <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>
{code}

I don t know if this is related or not but during camel starting up, the following WARN is generated I have checked the doc of Jetty and I don t know how to setup IdentityService for JAAS authentication

{code}
18:38:41,711 | DEBUG | ExtenderThread-4 | log                              | .eclipse.jetty.util.log.Slf4jLog   70 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | STARTED org.eclipse.jetty.plus.jaas.JAASLoginService@2433cf0f
18:38:41,711 | WARN  | ExtenderThread-4 | log                              | .eclipse.jetty.util.log.Slf4jLog   40 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | FAILED ConstraintSecurityHandler@617ce686: java.lang.IllegalStateException: No IdentityService for org.eclipse.jetty.security.authentication.BasicAuthenticator@455ef45a in ConstraintSecurityHandler@617ce686
18:38:41,711 | DEBUG | ExtenderThread-4 | log                              | .eclipse.jetty.util.log.Slf4jLog   80 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | EXCEPTION 
java.lang.IllegalStateException: No IdentityService for org.eclipse.jetty.security.authentication.BasicAuthenticator@455ef45a in ConstraintSecurityHandler@617ce686
	at org.eclipse.jetty.security.authentication.LoginAuthenticator.setConfiguration(LoginAuthenticator.java:37)[68:org.eclipse.jetty.security:7.1.6.v20100715]
	at org.eclipse.jetty.security.SecurityHandler.doStart(SecurityHandler.java:333)[68:org.eclipse.jetty.security:7.1.6.v20100715]
	at org.eclipse.jetty.security.ConstraintSecurityHandler.doStart(ConstraintSecurityHandler.java:229)[68:org.eclipse.jetty.security:7.1.6.v20100715]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)[61:org.eclipse.jetty.util:7.1.6.v20100715]
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)[67:org.eclipse.jetty.server:7.1.6.v20100715]
	at org.eclipse.jetty.server.Server.doStart(Server.java:242)[67:org.eclipse.jetty.server:7.1.6.v20100715]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)[61:org.eclipse.jetty.util:7.1.6.v20100715]
	at org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:233)[73:org.apache.camel.camel-jetty:2.5.0]
	at org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:148)[60:org.apache.camel.camel-http:2.5.0]
	at org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)[60:org.apache.camel.camel-http:2.5.0]

{code}


> camel-jetty component does not work when authentication is enable
> -----------------------------------------------------------------
>
>                 Key: CAMEL-3401
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3401
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.5.0
>         Environment: Apache Karaf 2.1-SNAPSHOT
>            Reporter: Charles Moulliard
>
> I try to use camel-jetty in a camel route usign LDAP authentication. The authentication mechanisms of Jetty works fine as I'm able to authenticate a LDAP user from the web page but the camel route is not called.
> Here is the camel route
> {code}
>     <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
>         <route>
>             <from uri="jetty:http://localhost:8080/services?handlers=securityHandler&amp;matchOnUriPrefix=true"/>
>             <onException>
>                 <exception>java.lang.Exception</exception>
>                 <!-- we can set the redelivery policy here as well -->
>                 <redeliveryPolicy maximumRedeliveries="1"/>
>                 <handled>
>                     <constant>true</constant>
>                 </handled>
>                 <transform>
>                     <simple>Due to something went wrong</simple>
>                 </transform>
>                 <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
>                     <simple>500</simple>
>                 </setHeader>
>             </onException>
>             <bean ref="responseBean"/>
>         </route>
>     </camelContext>
> {code}
> REMARK : the camel route works fine when authentication is disabled
> and the error
> {code}
> 14:56:31,587 | WARN  | 0-98 - /services | log                              | .eclipse.jetty.util.log.Slf4jLog   40 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | /services: java.lang.NullPointerException
> 14:56:31,587 | DEBUG | 0-98 - /services | log                              | .eclipse.jetty.util.log.Slf4jLog   80 | 61 - org.eclipse.jetty.util - 7.1.6.v20100715 | EXCEPTION 
> java.lang.NullPointerException
> 	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:489)[68:org.eclipse.jetty.security:7.1.6.v20100715]
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)[67:org.eclipse.jetty.server:7.1.6.v20100715]
> 	at org.eclipse.jetty.server.Server.handle(Server.java:347)[67:org.eclipse.jetty.server:7.1.6.v20100715]
> {code}

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