Skip to content

refactor: hexagonal architecture remediation — IDP adapter selection#7

Merged
casc84ab merged 2 commits into
developfrom
feature/hexagonal-architecture-remediation
Feb 13, 2026
Merged

refactor: hexagonal architecture remediation — IDP adapter selection#7
casc84ab merged 2 commits into
developfrom
feature/hexagonal-architecture-remediation

Conversation

@ancongui
Copy link
Copy Markdown
Contributor

@ancongui ancongui commented Feb 12, 2026

Summary

  • IDP Core: Created IdpProperties with firefly.idp.provider discriminator, IdpWebAutoConfiguration with @ConditionalOnBean(IdpAdapter.class), and moved IdpController to core
  • Keycloak: Rewrote KeycloakAutoConfiguration with @ConditionalOnProperty(firefly.idp.provider=keycloak) + @ConditionalOnClass(Keycloak.class), removed stereotype annotations from 6 classes, folded CorsConfig
  • Cognito: Rewrote CognitoConfiguration as @AutoConfiguration, removed @ComponentScan, standardized prefix to firefly.idp.cognito, created .imports file
  • Internal-DB: Rewrote InternalDbIdpConfiguration as @AutoConfiguration, removed @ComponentScan, standardized prefix to firefly.idp.internal-db, created .imports file
  • All adapters now activate purely via application.yml — no POM changes needed to switch providers

Architecture Pattern

Each adapter follows the reference pattern:

@AutoConfiguration
@ConditionalOnClass(ProviderSDK.class)
@ConditionalOnProperty(name = "firefly.idp.provider", havingValue = "keycloak")
@EnableConfigurationProperties(ProviderProperties.class)
public class ProviderAutoConfiguration {
    @Bean @ConditionalOnMissingBean
    public IdpAdapter idpAdapter(...) { ... }
}

Configuration

firefly:
  idp:
    provider: keycloak  # or cognito, internal-db
    keycloak:
      server-url: https://...
      realm: myrealm

Test Plan

  • All 4 modules compile successfully
  • Start application with firefly.idp.provider=keycloak — verify only Keycloak beans load
  • Start with firefly.idp.provider=cognito — verify only Cognito beans load
  • Start with no provider set — verify no IDP beans load
  • Verify @ConditionalOnMissingBean allows bean overrides

Part of the Firefly Framework hexagonal architecture remediation.

- Add firefly.idp.provider discriminator for runtime adapter selection
- Rewrite auto-configuration with @ConditionalOnProperty + @ConditionalOnClass
- Remove @componentscan in favor of explicit @bean methods
- Remove @Service/@component from adapter implementation classes
- Standardize property namespace under firefly.idp.*
- Create/update .imports files for Spring Boot 3.x auto-configuration
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
Comment thread src/main/java/org/fireflyframework/idp/web/IdpController.java Fixed
@ancongui ancongui requested a review from casc84ab February 12, 2026 22:05
…alerts

Controller methods should be thin delegates — access logging belongs
in a cross-cutting WebFilter or interceptor, not scattered across
individual endpoints where user-supplied values risk log injection.
@casc84ab casc84ab merged commit 8086f30 into develop Feb 13, 2026
4 checks passed
@casc84ab casc84ab deleted the feature/hexagonal-architecture-remediation branch February 13, 2026 09:08
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