davsclaus opened a new pull request, #3177:
URL: https://github.com/apache/camel-kamelets/pull/3177

   Part of #3170: `redis-sink` and `redis-source` can log in to Redis and 
connect with TLS. Until now they could only connect with no password and no TLS.
   
   ### New options
   
   All are optional, and when they are not set the Kamelets behave as before.
   
   | Option | Kamelets | What it does |
   |---|---|---|
   | `username` | both | The Redis ACL user. A credential. |
   | `password` | both | `format: password`, a credential. |
   | `ssl` | both | Connects with TLS. The certificate chain and the host name 
are checked; the certificate must be trusted by Java. Default `false`. |
   | `database` | sink | The database number. Default `0`. The source does not 
get it, because pub/sub channels are shared by all databases; a test confirmed 
that. |
   
   ### How it works
   
   camel-spring-redis has no endpoint options for a password or TLS. Both 
templates now declare a Spring Data Redis `JedisConnectionFactory` bean and 
pass it as `connectionFactory`.
   
   - `spring-data-redis` and `jedis` already come with `camel:spring-redis`, so 
no dependency is added.
   - The `serializer` option still applies.
   - `password` and `useSsl` use setters of `JedisConnectionFactory` that are 
deprecated but still present. The supported alternative, 
`RedisStandaloneConfiguration.setPassword`, takes a `RedisPassword` object, 
which Camel cannot convert from a string.
   
   The "Good to know" paragraphs say how to log in and use TLS. The 
`redis-source` partial page no longer says there is no login option.
   
   ### Verification
   
   Tested with Camel JBang against Redis 7.4 in Docker. Each route set and got 
a key with the sink, and published to a channel the source subscribed to.
   
   | Case | Result |
   |---|---|
   | Password set | Works |
   | ACL user, password `p@ss,w"rd#1 x`, database 5 | Works; the key is in 
database 5 |
   | No password against a server that needs one | Fails with `NOAUTH`, and no 
key is stored |
   | Wrong password | Fails with `WRONGPASS` |
   | Server without password, new options unset | Works, with the same output 
as the Kamelets from `main` |
   | TLS, CA trusted | Works |
   | TLS, CA not trusted | Fails: `PKIX path building failed` |
   | TLS, wrong host name | Fails: `no subject alternative names` |
   | TLS server, `ssl` unset | Fails, as before |
   
   Fourteen passwords with special characters (comma, quotes, `#`, space, `+`, 
`&`, `%`, `)`, `}`, `@`) all logged in when set as Kamelet parameters.
   
   `./mvnw clean install` passed twice, the first time with `-DskipTests`.
   
   ### Not covered
   
   - Sentinel and Cluster
   - Client certificates
   - A trust store set from the Kamelet; a private CA needs the JVM trust store 
properties
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to