Skip to content

Conversation

@senthalan
Copy link
Contributor

@senthalan senthalan commented Oct 15, 2025

Part of #456

Further identified concerns created as separate git issue #550

This pull request introduces a significant refactor and centralization of OAuth service initialization, with a particular focus on the JWKS (JSON Web Key Set) service. The changes include consolidating OAuth service setup into a new oauth package, refactoring the JWKS service for better modularity, and updating related configuration and tests. This improves maintainability, testability, and aligns the codebase with modern dependency injection patterns.

Centralized OAuth Service Initialization:

  • Added a new internal/oauth/init.go file with an Initialize function that centralizes the setup and route registration for all OAuth-related services, including JWKS, token, introspection, and grant handlers. This replaces the previous scattered, legacy service initialization in servicemanager.go. [1] [2]

JWKS Service Refactor:

  • Refactored the JWKS service into the internal/oauth/jwks package, merging sub-packages (constants, handler, model) into a single package and updating all related code and tests to use the new structure. The JWKS service is now initialized via jwks.Initialize, and the handler and service types have been renamed and simplified. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Configuration and Dependency Injection Improvements:

  • Updated servicemanager.go to use the new centralized OAuth initialization and removed direct registration of OAuth-related services, paving the way for improved dependency injection and future refactoring. [1] [2]

Mock and Test Configuration Updates:

  • Updated .mockery.public.yml and .mockery.private.yml to reflect package renames and the new structure for mocks, consolidating mock directories and removing obsolete entries. [1] [2] [3] [4]

These changes streamline OAuth service management, improve code organization, and prepare the codebase for further enhancements.

@senthalan senthalan force-pushed the refactor-oauth branch 3 times, most recently from aa08863 to f3de580 Compare October 18, 2025 18:44
@codecov
Copy link

codecov bot commented Oct 18, 2025

Codecov Report

❌ Patch coverage is 93.42105% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.50%. Comparing base (0ae7a70) to head (7b5b5cf).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
backend/internal/oauth/oauth2/authz/handler.go 86.95% 3 Missing and 3 partials ⚠️
backend/internal/oauth/oauth2/authz/store.go 90.00% 3 Missing ⚠️
...al/oauth/oauth2/granthandlers/authorizationcode.go 90.00% 2 Missing ⚠️
backend/internal/oauth/jwks/handler.go 75.00% 1 Missing ⚠️
backend/internal/oauth/jwks/service.go 92.30% 1 Missing ⚠️
backend/internal/oauth/oauth2/authz/init.go 90.90% 1 Missing ⚠️
...nternal/oauth/oauth2/granthandlers/refreshtoken.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #520      +/-   ##
==========================================
- Coverage   60.63%   60.50%   -0.14%     
==========================================
  Files         147      149       +2     
  Lines       19097    19076      -21     
==========================================
- Hits        11580    11541      -39     
- Misses       6188     6208      +20     
+ Partials     1329     1327       -2     
Flag Coverage Δ
backend-combined-postgres 51.92% <78.50%> (-0.07%) ⬇️
backend-combined-sqlite 51.92% <78.50%> (-0.07%) ⬇️
backend-integration-postgres 51.92% <78.50%> (-0.07%) ⬇️
backend-integration-sqlite 51.92% <78.50%> (-0.07%) ⬇️
backend-unit 18.46% <61.40%> (-0.35%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ThaminduDilshan ThaminduDilshan merged commit 1081eeb into asgardeo:main Oct 21, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants