Skip to content

Issue #SBCOSS-00: Migrate Keycloak config to config-based approach and fix ClassCastException in managedUsers#212

Merged
pallakartheekreddy merged 6 commits intoSunbird-Lern:release-8.0.0from
chethann007:delete-job-fix
Aug 14, 2025
Merged

Issue #SBCOSS-00: Migrate Keycloak config to config-based approach and fix ClassCastException in managedUsers#212
pallakartheekreddy merged 6 commits intoSunbird-Lern:release-8.0.0from
chethann007:delete-job-fix

Conversation

@chethann007
Copy link
Collaborator

@chethann007 chethann007 commented Aug 13, 2025

Summary

This PR refactors and stabilizes the user-deletion-cleanup Flink Job by:

Refactor

  • Migrating Keycloak configuration from environment variables to a centralized UserDeletionCleanupConfig.
  • Replacing hardcoded environment variable references in KeyCloakConnectionProvider with config-based properties.
  • Updating KeyCloakConnectionProvider constructor to accept UserDeletionCleanupConfig.
  • Using a configuration value for connection pool size instead of a hardcoded string.
  • Grouping Keycloak-related configuration properties for better organization and maintainability.

Fix

  • Handling ClassCastException in managedUsers method with proper type checking.
  • Correcting deletionStatus assignment in UserDeletionCleanupFunction for accurate audit tracking.
  • Adding logging for URL and response status during the user deletion process for better traceability.

Chore

  • Adding Maven Shade Plugin configuration for packaging the job into a single executable JAR.

Description by Korbit AI

What change is being made?

Migrate Keycloak configuration to a config-based approach and resolve a ClassCastException in the managedUsers function within the user deletion cleanup module.

Why are these changes being made?

The Keycloak configuration previously depended on environment variables, which was less efficient and hard to manage. Transitioning to a config-based setup enhances maintainability and scalability. Additionally, handling potential ClassCastException in managedUsers ensures smoother and more robust data processing when user deletion cleanup jobs are executed.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

- Add comprehensive Keycloak configuration section to UserDeletionCleanupConfig
- Replace hardcoded environment variable references with config-based properties in KeyCloakConnectionProvider
- Update KeyCloakConnectionProvider constructor to accept UserDeletionCleanupConfig
- Use config value for connection pool size instead of hardcoded string
- Fix deletionStatus assignment in UserDeletionCleanupFunction for proper audit tracking
- Add logging for URL and response status in user deletion process
- Group Keycloak-related configuration properties for better organization
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Security Exposed Sensitive Keycloak Credentials in Memory ▹ view
Functionality Unsafe List Type Casting ▹ view
Documentation Insufficient Keycloak Configuration Context ▹ view ✅ Fix detected
Readability Mismatched Config Keys and Variable Names ▹ view
Files scanned
File Path Reviewed
user-org-jobs/user-deletion-cleanup/src/main/scala/org/sunbird/job/deletioncleanup/domain/Event.scala
user-org-jobs/user-deletion-cleanup/src/main/scala/org/sunbird/job/deletioncleanup/task/UserDeletionCleanupConfig.scala
user-org-jobs/user-deletion-cleanup/src/main/scala/org/sunbird/job/deletioncleanup/util/KeyCloakConnectionProvider.scala
user-org-jobs/user-deletion-cleanup/src/main/scala/org/sunbird/job/deletioncleanup/functions/UserDeletionCleanupFunction.scala

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the user-deletion-cleanup Flink job to improve configuration management and fix runtime errors. It migrates Keycloak configuration from environment variables to a centralized config-based approach and addresses a ClassCastException in the managedUsers method.

  • Centralized Keycloak configuration in UserDeletionCleanupConfig class
  • Fixed ClassCastException with proper type checking in Event.managedUsers method
  • Corrected variable assignment issues in deletion status tracking

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
KeyCloakConnectionProvider.scala Updated constructor to accept config object and replaced environment variable calls with config properties
UserDeletionCleanupConfig.scala Added Keycloak configuration properties with centralized management
UserDeletionCleanupFunction.scala Fixed deletion status assignment and updated Keycloak provider instantiation
Event.scala Enhanced managedUsers method with robust type checking to handle ClassCastException
pom.xml Added Maven Shade Plugin configuration for executable JAR packaging

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pallakartheekreddy pallakartheekreddy merged commit b9be252 into Sunbird-Lern:release-8.0.0 Aug 14, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants