Skip to content

Comments

feat(EM-39): Implement Spring Security Foundation and Authentication Configuration#39

Open
devin-ai-integration[bot] wants to merge 2 commits intofeat/microservices-migrationfrom
devin/1771369622-em39-security-lib
Open

feat(EM-39): Implement Spring Security Foundation and Authentication Configuration#39
devin-ai-integration[bot] wants to merge 2 commits intofeat/microservices-migrationfrom
devin/1771369622-em39-security-lib

Conversation

@devin-ai-integration
Copy link

@devin-ai-integration devin-ai-integration bot commented Feb 17, 2026

feat(EM-39): Implement Spring Security Foundation and Authentication Configuration

Summary

Enhances libs/ftgo-security-lib/ with a working Spring Security 6.x foundation: wires SecurityExceptionHandler into FtgoSecurityConfiguration for JSON 401/403 responses, updates JwtTokenProvider to the jjwt 0.12.x API, adds security deps to the version catalog, and adds 31 integration/unit tests covering the security filter chain, CORS, CSRF, JWT, and exception handling.

Key changes:

  • gradle/platform/libs.versions.toml — added jjwt, spring-security versions; jjwt-api/impl/jackson, spring-security-test libraries; spring-security bundle
  • FtgoSecurityConfiguration — wired SecurityExceptionHandler as authenticationEntryPoint and accessDeniedHandler
  • JwtTokenProvider — migrated from deprecated jjwt 0.11.x API (parserBuilder/setSubject/signWith(key, alg)) to 0.12.x API (parser/subject/signWith(key))
  • build.gradle — fixed tasks.named('test')test for Gradle 4.10.2 compatibility; added spring-boot-starter-web test dep for MockMvc
  • .github/workflows/shared-libs-ci.yml — added dedicated build-ftgo-security-lib job using JDK 17 with path-based trigger
  • 5 new test classes (31 tests total)

Note: ftgo-security-lib is intentionally not included in the root settings.gradle. The monolith build uses JDK 8 (Gradle 4.10.2), and this lib requires JDK 17 (Spring Boot 3.x / Jakarta EE). It builds standalone via the new CI job (cd libs/ftgo-security-lib && ../../gradlew compileJava test), consistent with the pattern for other new libs under libs/.

Updates since last revision

  • Removed ftgo-security-lib from settings.gradle to fix CI failure (Could not target platform: 'Java SE 12' using tool chain: 'JDK 8 (1.8)'). The root monolith CI uses JDK 8, which cannot compile Java 17 code.
  • Added a dedicated build-ftgo-security-lib job in shared-libs-ci.yml that uses JDK 17 and triggers on changes to libs/ftgo-security-lib/**.

Review & Testing Checklist for Human

  • New CI job verification: The build-ftgo-security-lib job in shared-libs-ci.yml was just added and has not yet been observed to pass. Verify it runs successfully with JDK 17 and that the standalone build path (cd libs/ftgo-security-lib && ../../gradlew compileJava test) works in the CI runner environment.
  • SecurityExceptionHandler dual instantiation: The handler is created via new SecurityExceptionHandler() in FtgoSecurityConfiguration while the class still has @Component. This means Spring will also create a bean. Verify this dual-instantiation path is acceptable or if @Component should be removed.
  • CORS config: FtgoCorsConfigurationSource allows all origins (*) with credentials (true). Confirm this is acceptable for the target environment (dev/staging/prod).
  • Standalone build isolation: Since the security lib is not in settings.gradle, it is not compiled or tested as part of the root multi-project build. Any future integration issues between this lib and root project configuration won't be caught by the monolith CI jobs.

Test Plan

  1. Verify the new build-ftgo-security-lib CI job passes on this PR
  2. Locally: cd libs/ftgo-security-lib && JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 ../../gradlew compileJava test — all 31 tests should pass
  3. Verify monolith CI still passes (JDK 8 build should not attempt to compile security-lib)

Notes

  • Link to Devin run: https://app.devin.ai/sessions/78e0b5a8222d4cafa37164ab24e7f9f9
  • Requested by: @mbatchelor81
  • All tests pass locally with JDK 17
  • The jjwt 0.12.x API changes are breaking: parserBuilder()parser(), setSubject()subject(), parseClaimsJws()parseSignedClaims(), getBody()getPayload()
  • The standalone build approach (not in settings.gradle) matches the pattern for ftgo-common-lib and other new libs under libs/, which also have || echo "Library not yet wired into settings.gradle" fallback logic in their CI jobs.

…configuration

- Add spring-security-test, jjwt deps to version catalog (libs.versions.toml)
- Include ftgo-security-lib in settings.gradle with projectDir mapping
- Wire SecurityExceptionHandler into FtgoSecurityConfiguration for JSON 401/403 responses
- Update JwtTokenProvider to use jjwt 0.12.x API (parser/verifyWith/parseSignedClaims)
- Add test dependencies (spring-boot-starter-web, spring-security-test) for integration tests
- Create comprehensive integration tests:
  - FtgoSecurityConfigurationIntegrationTest (actuator, CORS, CSRF, session, auth)
  - SecurityExceptionHandlerTest (401/403 JSON responses)
  - FtgoCorsConfigurationSourceTest (origins, methods, headers, credentials)
  - JwtTokenProviderTest (generate, validate, parse, reject invalid)
  - JwtAuthenticationFilterTest (auth flow, missing/invalid tokens)

Co-Authored-By: mason.batchelor@cognition.ai <masonbatchelor81@gmail.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- Remove ftgo-security-lib from settings.gradle to avoid JDK 8 compilation
  failure in monolith CI (consistent with other new libs pattern)
- Add dedicated build-ftgo-security-lib job in shared-libs-ci.yml using JDK 17
- Add ftgo-security-lib path filter to detect-changes job

Co-Authored-By: mason.batchelor@cognition.ai <masonbatchelor81@gmail.com>
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.

0 participants