Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14990

camel-jetty consumers w/ different security handlers on different paths and same port don't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Not A Bug
    • 3.0.1
    • None
    • camel-jetty
    • None
    • Unknown

    Description

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

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
      		   xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
      		   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      		   xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
      		   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
      
      	<!-- 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" />
      ...
      

      The property file TSTISP001.properties looks like

      username1=password1,TSTISP001
      

      After deploying a 2nd Blueprint DSL like

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
      		   xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
      		   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      		   xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
      		   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
      
      	<!-- 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" />
      ...
      

      with the corresponding TSTISP002.properties file

      username2=password2,TSTISP002
      

      the 2nd route works as expected.

      The 1st route doesn't have any authentication anymore after the deployment of the 1st route.

      A platform restart doesn't help. The 2nd route started of both has authentication, the 1st one is loosing the authentication.

      Attachments

        Activity

          People

            Unassigned Unassigned
            catshout Gerald Kallas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: