This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Camel Security
Skip to end of metadata
Go to start of metadata

Camel Security

Camel offers robust & comprehensive security on routes at the

  • Payload Level (XMLSecurity, Crypto)
  • Component Level (Jetty, CXF, Netty, MINA, CometD, JMS)
  • Route Level (Shiro and Spring Security)

For more details on the various security options, please check out

Design Notes for Camel Security

There are some requirements about implementing a security mechanism in camel, in this way we can make sure the authenticated exchange can be sent to a certain authorized endpoints.

User story

As camel route may not provides GUI or other interface for user to type their username and password, camel doesn't implement the authentication itself. We just delegate the authentication to other framework, and make sure the exchange is set with authenticated information. User can use JAAS or other security framework to implement the authentication himself.

Here are lots of security framework which supports different kind of authorizations, we should support different kind of configuration about setting the access control on the security check point. In camel we can provide DSL to set the authorization policy on the endpoints, when the authenticated exchange send to the endpoint, camel just checks the authenticated information with the authorization policy to determine if the exchange has the right to access this endpoint. If not, the exchange will be rejected with a security exception.


Before sending the exchange into the camel route, we need to make sure the authentication information is stored into the exchange property. We could add the authentication on the Jetty consumer with basic http authentication, but in most case we just implement the authentication on the camel route client, and the client should store the authentication instance into the exchange before sending it to the endpoints of camel route.

To support Spring Security framework we can store the authentication instance of Spring security with Exchange.AUTHENTICATION as the key into the exchange property, if we want to support other security framework, we could also store other framework's authentication information into the exchange .


To provide the access control on the endpoint, we can leverage the Policy Definition to inject the AuthorizationPolicy instance with the access control configuration at the runtime. In this way user can configure the different authorizationPolicy which based on different security framework with Spring or Java DSL easily.

Lets take the spring security as an example, authorizationPolicy will be used to verify exchange with the authentication information to check if the exchange authentication has the right role to access the endpoint.

<beans xmlns=""


        <security:authentication-manager id=authenticationManager>
		    <security:user name="jimi" password="jimispassword" authorities="ROLE_USER, ROLE_ADMIN"/>
		    <security:user name="bob" password="bobspassword" authorities="ROLE_USER"/>

	<bean id="accessDecisionManager" class="">
		<property name="allowIfAllAbstainDecisions" value="true"/>
		<property name="decisionVoters">
				<bean class=""/>

        <authorizationPolicy id="admin" access="ROLE_ADMIN" 

       <camelContext id="camel" xmlns="">
           <from uri="direct:start"/>
           <policy ref="admin"/>
           <to uri="direct:security-endpoint"/>

Spring Security integration

camel-core should know nothing about Spring Security, the AuthorizationPolicy and the spring customer parser are the part of camel-spring-security module, we just need to implement the access control with the help of Spring Security framework in the AuthorizationPolicy.


We could configure the policy on camel endpoint with regular express
More friendly authentication API which can plugin to the other endpoint

  • No labels