Apache Camel Security
Apache Camel is unsecured by default. Before deploying to production, security must be explicitly enabled at one or more layers.
Security Layers
Camel provides four layers of security. Use only what is necessary -- avoid redundant encryption when transport security already covers the payload.
1. Endpoint Security
Secures the transport between Camel and external systems.
- Provides peer authentication (and sometimes authorization) at the transport level
- Configuration varies by transport type:
- JMS / ActiveMQ: SSL/TLS and JAAS for client-to-broker and broker-to-broker
- Jetty: HTTP Basic Authentication and SSL/TLS
- Use the JSSE Utility (Camel 2.8+) to configure SSL/TLS across components
2. Payload Security
Encrypts and decrypts message payloads using marshal() and unmarshal() operations.
- Use
camel-cryptofor symmetric encryption with any JCE algorithm - Use XMLSecurity data format for XML payloads
- Payload encryption alone does not provide authentication or authorization
- Skip payload encryption when transport-level TLS is already active (avoid double encryption)
3. Route Security
Provides authentication and authorization within Camel route processing.
- Centralizes auth logic rather than implementing it per transport
- Handles auth errors with Camel's error handling framework
- Supported policy providers:
- Apache Shiro
- Spring Security
4. Configuration Security
Protects sensitive values in configuration files (passwords, API keys).
- Use the Jasypt component to encrypt property values
- Camel automatically decrypts at runtime using the configured Jasypt password
- Never store secrets in plaintext in property files committed to version control
Implementation Checklist
- [ ] At least one security layer is enabled before production deployment
- [ ] Endpoint TLS is configured for all external-facing transports
- [ ] JSSE Utility is used for SSL/TLS configuration
- [ ] Payload encryption is used only when transport encryption is insufficient
- [ ] Route security (Shiro or Spring Security) provides auth for route processing
- [ ] Sensitive configuration values are encrypted with Jasypt
- [ ] No plaintext secrets in property files or source control
- [ ] Redundant encryption layers are avoided (no double encryption)