Skip to content

Conversation

@tuplle
Copy link
Member

@tuplle tuplle commented Nov 4, 2025

Description

Implements connectio for Redi Sentinel deployments and enables SSL configuration for Redis communication. It redefines the Engine properties for Redis for additional Redis Sentinel configuration.

Implements NAE-2246

Dependencies

No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

Configuration where tested on two Redis deployments on local and DEV kubernetes cluster, with and without Redis Sentinel. For deployment, bitnami helm chart of Redis were used.

Test Configuration

Name Tested on
OS Linux (Arch Linux)
Runtime OpenJDK 21
Dependency Manager Maven 3
Framework version
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @machacjozef
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

  • Refactor
    • Session settings reorganized under a dedicated session subsection; session namespace handling relocated to the new session property path.
  • New Features
    • Added Redis Sentinel support and optional SSL for Redis connections.
    • Session indexing and session-limit/filter flags now use the nested session configuration and updated session namespace from application settings.

machacjozef and others added 3 commits October 23, 2025 10:20
- Updated parent POM version from `7.0.0-RC8.1` to `7.0.0-RC9` across all module POM files.
- Introduced properties for Redis Sentinel and SSL configurations to improve connectivity options and security.
- Updated session and security management to use enhanced Redis configuration structure.
- Refactored Redis property handling and connection factory creation for better maintainability and support of new features.
- add ssl configuration for redis client
@tuplle tuplle self-assigned this Nov 4, 2025
@tuplle tuplle added improvement A change that improves on an existing feature breaking change Fix or feature that would cause existing functionality doesn't work as expected labels Nov 4, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Walkthrough

Nest session-related Redis properties under a new session object, add Redis Sentinel and SSL support for Jedis connection configuration, and update callers and annotations to use the new nested session properties and revised session namespace key.

Changes

Cohort / File(s) Summary
Redis property restructuring
application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java
Converted RedisProperties to a plain class with prefix netgrif.engine.data.redis. Added nested EngineRedisSessionProperties (session) and RedisSentinelProperties. Moved session flags (enabledLimitSession, maxSession, enabledFilter) into session. Added ssl flag and changed default port to RedisNode.DEFAULT_PORT.
Session configuration (Jedis)
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java
Added sentinel-aware and standalone Jedis connection factory creation (redisSentinelConfiguration(), standaloneRedisConfiguration()), jedisClientConfiguration() for optional SSL, credential validation helper, and sentinel node parsing with logging.
Call-site updates & namespace change
application-engine/src/main/java/com/netgrif/application/engine/configuration/AbstractSecurityConfiguration.java,
application-engine/src/main/java/com/netgrif/application/engine/manager/service/SessionManagerService.java,
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfigurationStaticEnabled.java,
application-engine/src/main/resources/application.yaml
Replaced top-level Redis property access with nested session accessors (e.g., getSession().isEnabledLimitSession(), getSession().getMaxSession(), getSession().isEnabledFilter()). Updated session namespace usage and @EnableRedisIndexedHttpSession namespace expression to use netgrif.engine.data.redis.session.namespace. Moved namespace property to redis.session.namespace in application.yaml. Minor formatting newline added.
Session manager key update
application-engine/src/main/java/com/netgrif/application/engine/manager/service/SessionManagerService.java
Adjusted Redis principal-name index key construction to use redisProperties.getSession().getNamespace() instead of the previous namespace location.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant SessionConfig
    participant DataProps
    participant JedisFactory

    Caller->>SessionConfig: request JedisConnectionFactory
    SessionConfig->>DataProps: getRedisProperties()
    DataProps-->>SessionConfig: RedisProperties (includes .session)

    alt sentinel.master configured
        SessionConfig->>SessionConfig: redisSentinelConfiguration()
        Note right of SessionConfig `#D6EAF8`: parse sentinel nodes\nuse sentinel master + credentials
        SessionConfig->>JedisFactory: build with RedisSentinelConfiguration + JedisClientConfiguration
    else standalone
        SessionConfig->>SessionConfig: standaloneRedisConfiguration()
        Note right of SessionConfig `#FDEBD0`: use host/port + optional credentials
        SessionConfig->>JedisFactory: build with RedisStandaloneConfiguration + JedisClientConfiguration
    end

    alt ssl enabled
        SessionConfig->>JedisFactory: enable SSL in JedisClientConfiguration
    end

    JedisFactory-->>SessionConfig: configured JedisConnectionFactory
    SessionConfig-->>Caller: return factory
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay extra attention to:
    • DataConfigurationProperties.java — config prefix change, nested session wiring, moved fields, default port and ssl semantics.
    • SessionConfiguration.java — sentinel parsing, credential handling, JedisClientConfiguration SSL toggle, and factory construction correctness.
    • Call sites and annotation (AbstractSecurityConfiguration.java, SessionManagerService.java, SessionConfigurationStaticEnabled.java, application.yaml) — ensure all property access updated to .getSession() and namespace expression/property are consistent.

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: adding Redis TLS support and Redis Sentinel configuration, which are the primary objectives reflected throughout the changeset.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added the Medium label Nov 4, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f11efc and a73853f.

📒 Files selected for processing (4)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/AbstractSecurityConfiguration.java (2 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java (3 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java (6 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/manager/service/SessionManagerService.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: Build
  • GitHub Check: task-list-completed
🔇 Additional comments (11)
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java (3)

34-40: LGTM! Conditional logic is sound.

The conditional selection between Sentinel and standalone configurations based on master name is appropriate and handles both null and empty string cases correctly.


81-86: LGTM! SSL configuration is clean and correct.

The conditional SSL configuration logic is straightforward and appropriate.


8-11: LGTM! New imports are necessary and used.

The added imports support the new Sentinel configuration functionality and are all utilized in the code.

Also applies to: 18-18

application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java (5)

18-18: LGTM! Import is necessary for the new Redis constants.

The RedisNode import is used for DEFAULT_PORT and DEFAULT_SENTINEL_PORT constants in the Redis configuration.


109-111: LGTM! Namespace access correctly updated to nested session property.

The namespace is now properly accessed via the nested session property, aligning with the broader Redis properties restructuring.


664-664: LGTM! Good use of constants and new SSL flag.

Using RedisNode.DEFAULT_PORT instead of a magic number improves maintainability. The addition of the ssl flag enables secure Redis connections.

Also applies to: 684-684


751-770: LGTM! Session properties class is well-structured.

The EngineRedisSessionProperties class correctly extends RedisSessionProperties and properly uses @EqualsAndHashCode(callSuper = true) to handle inheritance. The added fields for session limiting and filtering are clearly defined.


651-651: Review comment is incorrect—the configuration structure does not match the claimed breaking change.

The review comment incorrectly claims the prefix changed from netgrif.engine.session to netgrif.engine.data.redis. However, verification of the codebase shows:

  1. No "netgrif.engine.session" prefix exists – Search found zero references to this prefix anywhere in the Java codebase.
  2. Actual structureRedisProperties uses prefix netgrif.engine.data.redis with session configuration as a nested property (accessed via redis.getSession()).
  3. Correct configuration – Users configure netgrif.engine.data.redis.host and netgrif.engine.data.redis.session.* properties, not netgrif.engine.session.host.

The migration examples provided in the original comment are misleading and do not reflect actual configuration changes.

Likely an incorrect or invalid review comment.

application-engine/src/main/java/com/netgrif/application/engine/manager/service/SessionManagerService.java (1)

31-31: LGTM! Namespace access correctly updated for nested session property.

The Redis username key construction now correctly accesses the namespace via redisProperties.getSession().getNamespace(), aligning with the restructured Redis configuration.

application-engine/src/main/java/com/netgrif/application/engine/configuration/AbstractSecurityConfiguration.java (2)

223-228: LGTM! Session configuration correctly updated to use nested properties.

The session limit configuration now correctly accesses isEnabledLimitSession() and getMaxSession() via the nested session property, aligning with the restructured Redis configuration.


232-235: LGTM! Filter configuration correctly updated to use nested properties.

The filter configuration now correctly accesses isEnabledFilter() via the nested session property, aligning with the restructured Redis configuration.

@tuplle tuplle changed the title Nae 2246 [NAE-2246] Enable Redis TLS & Configure Redis Sentinel Nov 4, 2025
- Introduced `DEFAULT_SENTINEL_NODE` constant for default node configuration.
- Added a helper method `hasCredentials` to improve credential checks.
- Refactored sentinel node parsing to handle edge cases with better logging.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a73853f and ed71275.

📒 Files selected for processing (2)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java (3 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java (6 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-04T11:09:31.264Z
Learnt from: renczesstefan
Repo: netgrif/application-engine PR: 350
File: application-engine/src/main/java/com/netgrif/application/engine/startup/runner/SuperCreatorRunner.java:56-63
Timestamp: 2025-09-04T11:09:31.264Z
Learning: In SuperCreatorRunner.java, when creating a user with PasswordCredential via setCredential("password", passwordCredential), there's no need to also call setPassword() as it would be redundant - the PasswordCredential already contains the password information needed by UserServiceImpl.createUser(), and both setPassword() and setCredential() ultimately reference the same credential system.

Applied to files:

  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java
📚 Learning: 2025-09-04T11:09:31.264Z
Learnt from: renczesstefan
Repo: netgrif/application-engine PR: 350
File: application-engine/src/main/java/com/netgrif/application/engine/startup/runner/SuperCreatorRunner.java:56-63
Timestamp: 2025-09-04T11:09:31.264Z
Learning: In SuperCreatorRunner.java, when creating a user with PasswordCredential via setCredential("password", passwordCredential), there's no need to also call setPassword() as it would be redundant - the PasswordCredential already contains the password information needed by UserServiceImpl.createUser().

Applied to files:

  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java
🧬 Code graph analysis (1)
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java (1)
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfigurationStaticEnabled.java (1)
  • Configuration (11-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: Build
  • GitHub Check: task-list-completed

- Corrected Redis session namespace property to align with enhanced configuration standards.
- Ensured consistency across static and non-static session configurations.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed71275 and ffdbcc0.

📒 Files selected for processing (2)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java (3 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfigurationStaticEnabled.java (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-04T11:09:31.264Z
Learnt from: renczesstefan
Repo: netgrif/application-engine PR: 350
File: application-engine/src/main/java/com/netgrif/application/engine/startup/runner/SuperCreatorRunner.java:56-63
Timestamp: 2025-09-04T11:09:31.264Z
Learning: In SuperCreatorRunner.java, when creating a user with PasswordCredential via setCredential("password", passwordCredential), there's no need to also call setPassword() as it would be redundant - the PasswordCredential already contains the password information needed by UserServiceImpl.createUser(), and both setPassword() and setCredential() ultimately reference the same credential system.

Applied to files:

  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java
📚 Learning: 2025-09-04T11:09:31.264Z
Learnt from: renczesstefan
Repo: netgrif/application-engine PR: 350
File: application-engine/src/main/java/com/netgrif/application/engine/startup/runner/SuperCreatorRunner.java:56-63
Timestamp: 2025-09-04T11:09:31.264Z
Learning: In SuperCreatorRunner.java, when creating a user with PasswordCredential via setCredential("password", passwordCredential), there's no need to also call setPassword() as it would be redundant - the PasswordCredential already contains the password information needed by UserServiceImpl.createUser().

Applied to files:

  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java
🧬 Code graph analysis (1)
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java (2)
application-engine/src/main/java/com/netgrif/application/engine/manager/service/SessionManagerService.java (1)
  • Slf4j (20-71)
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfigurationStaticEnabled.java (1)
  • Configuration (11-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test
  • GitHub Check: task-list-completed
🔇 Additional comments (6)
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfiguration.java (6)

5-5: LGTM!

The new imports and @Slf4j annotation are properly added to support Redis Sentinel configuration, SSL enablement, and logging of node parsing failures.

Also applies to: 9-10, 12-12, 19-19, 21-21


36-42: LGTM!

The routing logic correctly discriminates between Sentinel and standalone modes based on the presence of a configured master name. The implementation is null-safe and provides clear separation between the two configuration paths.


44-54: LGTM!

The standalone Redis configuration is well-structured with appropriate defaults (localhost, DEFAULT_PORT), optional credential handling via the hasCredentials() helper, and SSL support through the shared jedisClientConfiguration() method.


56-80: LGTM!

The Sentinel configuration properly handles master and sentinel node setup with appropriate fallback for node parsing failures. The implementation correctly supports separate credentials for master and sentinel nodes, which is important for production deployments. The try-catch approach with logging on line 63 provides good visibility for troubleshooting configuration issues.


82-87: LGTM!

The SSL configuration method is clean and correctly shared between standalone and Sentinel configurations, ensuring consistent SSL behavior across both deployment modes.


89-92: LGTM!

The credential validation helper eliminates code duplication and uses isBlank() for more robust validation (catches null, empty, and whitespace-only strings). This addresses the refactoring suggested in the past review comments.

@machacjozef machacjozef changed the base branch from release/7.0.0-rev9 to release/7.0.0-rev8 November 9, 2025 11:12
# Conflicts:
#	application-engine/pom.xml
#	nae-object-library/pom.xml
#	nae-spring-core-adapter/pom.xml
#	nae-user-ce/pom.xml
#	nae-user-common/pom.xml
#	pom.xml
renczesstefan
renczesstefan previously approved these changes Nov 10, 2025
- Updated Redis session namespace initialization to handle default blank or null cases more effectively.
- Aligned application properties and session configuration with the updated namespace standards.
- Ensured consistency between YAML configuration and Java annotations.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffdbcc0 and 652a6b7.

📒 Files selected for processing (3)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfigurationStaticEnabled.java (1 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java (6 hunks)
  • application-engine/src/main/resources/application.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-20T11:44:44.907Z
Learnt from: machacjozef
Repo: netgrif/application-engine PR: 367
File: application-engine/src/main/resources/application.yaml:24-24
Timestamp: 2025-10-20T11:44:44.907Z
Learning: In the netgrif/application-engine project, the correction of the Elasticsearch task index name from "_taks" to "_task" in application.yaml was approved by maintainer machacjozef, indicating that any data migration concerns for this typo fix are handled separately or not applicable to their deployment scenario.

Applied to files:

  • application-engine/src/main/resources/application.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test
🔇 Additional comments (1)
application-engine/src/main/java/com/netgrif/application/engine/configuration/SessionConfigurationStaticEnabled.java (1)

12-12: Namespace placeholder alignment looks good.

The annotation now pulls from the same netgrif.engine.data.redis.session.namespace property as the runtime configuration, so both paths stay in sync.

Comment on lines +109 to 112
String namespace = redis.getSession().getNamespace();
if (namespace == null || namespace.isBlank() || "spring:session".equals(namespace)) {
redis.getSession().setNamespace("spring:session:" + databaseName);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid double spring:session prefix in fallback.

Now that EnableRedisIndexedHttpSession already expands the namespace as spring:session:${...}, this fallback still prepends spring:session: when the bound value is the parent default (spring:session). In configs that omit netgrif.engine.data.redis.session.namespace, you’ll end up with spring:session:spring:session:<dbName>, so the static session config and the runtime repository will read/write different keys. Please leave the fallback as the bare suffix (e.g., set it to databaseName) and let the annotation (and any other callers) add the spring:session: prefix exactly once.

🤖 Prompt for AI Agents
In
application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java
around lines 109 to 112, the fallback currently prepends "spring:session:"
producing duplicates when the bound value equals the parent default
"spring:session"; change the fallback to set only the bare databaseName (i.e.,
set namespace to databaseName) so the framework/annotation can apply the
"spring:session:" prefix exactly once, leaving the conditional logic
(null/blank/"spring:session") intact.

@tuplle tuplle requested a review from renczesstefan November 10, 2025 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Fix or feature that would cause existing functionality doesn't work as expected improvement A change that improves on an existing feature Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants