Gerald Kallas created CAMEL-14990:
-------------------------------------

             Summary: camel-jetty consumer auth w/ different paths and security 
handlers don't work
                 Key: CAMEL-14990
                 URL: https://issues.apache.org/jira/browse/CAMEL-14990
             Project: Camel
          Issue Type: Bug
          Components: camel-jetty
    Affects Versions: 3.0.1
            Reporter: Gerald Kallas


I've created to Blueprint DSLs. The 1st one works as expected w/ basic auth.

{code:xml}
...
        <!-- set security constraints -->
        <bean id="constraint_TSTISP001" 
class="org.eclipse.jetty.util.security.Constraint">
                <property name="name" value="BASIC"/>
                <property name="authenticate" value="true"/>
                <property name="roles">
                        <list>
                                <value>TSTISP001</value>
                        </list>
                </property>
        </bean>

        <bean id="constraintMapping_TSTISP001" 
class="org.eclipse.jetty.security.ConstraintMapping">
                <property name="constraint" ref="constraint_TSTISP001"/>
                <property name="pathSpec" value="/hello1"/>
        </bean>

        <bean id="securityHandler_TSTISP001" 
class="org.eclipse.jetty.security.ConstraintSecurityHandler">
                <property name="loginService">
                        <bean 
class="org.eclipse.jetty.security.HashLoginService">
                                <property name="config" 
value="/opt/apache-karaf/etc/TSTISP001.properties"/>
                        </bean>
                </property>
                <property name="authenticator">
                        <bean 
class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/>
                </property>
                <property name="constraintMappings">
                        <list>
                                <ref 
component-id="constraintMapping_TSTISP001"/>
                        </list>
                </property>
        </bean>

        <camelContext xmlns="http://camel.apache.org/schema/blueprint"; 
streamCache="true" useBreadcrumb="true">

                <route id="isp.route.user.TSTISP001">

                        <from 
uri="jetty:http://0.0.0.0:8182/hello1?handlers=securityHandler_TSTISP001"; />
...
{code}

The property file TSTISP001.properties looks like

{code:xml}
username1=password1,TSTISP001
{code}

After deploying a 2nd Blueprint DSL like

{code:xml}
...
        <!-- set security constraints -->
        <bean id="constraint_TSTISP002" 
class="org.eclipse.jetty.util.security.Constraint">
                <property name="name" value="BASIC"/>
                <property name="authenticate" value="true"/>
                <property name="roles">
                        <list>
                                <value>TSTISP002</value>
                        </list>
                </property>
        </bean>

        <bean id="constraintMapping_TSTISP002" 
class="org.eclipse.jetty.security.ConstraintMapping">
                <property name="constraint" ref="constraint_TSTISP002"/>
                <property name="pathSpec" value="/hello2"/>
        </bean>

        <bean id="securityHandler_TSTISP002" 
class="org.eclipse.jetty.security.ConstraintSecurityHandler">
                <property name="loginService">
                        <bean 
class="org.eclipse.jetty.security.HashLoginService">
                                <property name="config" 
value="/opt/apache-karaf/etc/TSTISP002.properties"/>
                        </bean>
                </property>
                <property name="authenticator">
                        <bean 
class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/>
                </property>
                <property name="constraintMappings">
                        <list>
                                <ref 
component-id="constraintMapping_TSTISP002"/>
                        </list>
                </property>
        </bean>
        
        <camelContext xmlns="http://camel.apache.org/schema/blueprint"; 
streamCache="true" useBreadcrumb="true">

                <route>

                        <from 
uri="jetty:http://0.0.0.0:8182/hello2?handlers=securityHandler_TSTISP002"; />
...
{code}

with the corresponding TSTISP002.properties

{code:xml}
username2=password2,TSTISP002
{code}

the 2nd route works as expected.

The 1st route doesn't have any authentication anymore.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to