Provider-agnostic identity SPI for Spring Boot WebFlux — one reactive
IdpAdaptercontract, a ready-to-use REST controller, and built-in metrics, with pluggable Keycloak, AWS Cognito, Azure AD and internal-DB adapters.
- Overview
- Features
- Requirements
- Installation
- Quick Start
- Configuration
- REST API
- Observability
- Documentation
- Contributing
- License
Firefly Framework IDP is the core identity-provider abstraction of the Firefly ecosystem. It defines a single reactive port — the IdpAdapter interface — that standardizes authentication, token, user, role, scope and session operations across heterogeneous identity backends such as Keycloak, AWS Cognito, Azure AD or a local database, so application code never depends on a specific vendor SDK.
Beyond the contract, this module ships the shared infrastructure every adapter reuses, so you wire it once and swap providers with a single property:
- A complete set of request/response DTOs (
LoginRequest,TokenResponse,CreateUserRequest,IntrospectionResponse,MfaChallengeResponse,SessionInfo, and more) covering the full IDP surface. - A ready-to-use reactive
IdpController(auto-mounted under/idp) that exposes everyIdpAdapteroperation over HTTP — it is registered automatically byIdpWebAutoConfigurationas soon as anIdpAdapterbean is present in a reactive web application. - Cross-cutting
IdpMetrics(Micrometer) auto-configured viaIdpObservabilityAutoConfiguration, giving uniform authentication, token and error metrics regardless of which provider is active.
The concrete provider is selected at runtime with the firefly.idp.provider property; each adapter activates itself with @ConditionalOnProperty(name = "firefly.idp.provider", havingValue = "<provider>"). You depend on this core plus exactly one provider adapter.
| Provider value | Adapter module | Backend |
|---|---|---|
keycloak |
fireflyframework-idp-keycloak |
Keycloak Admin API + token endpoint |
cognito |
fireflyframework-idp-aws-cognito |
AWS Cognito User Pools |
azure-ad |
fireflyframework-idp-azure-ad |
Microsoft Entra ID (Azure AD) |
internal-db |
fireflyframework-idp-internal-db |
Local database-backed identity store |
- Reactive
IdpAdapterSPI — a singleMono-based contract for every IDP operation, designed for Spring WebFlux. - Full authentication lifecycle —
login,refresh,logout, tokenintrospect(RFC 7662) and OIDCgetUserInfo. - User management — create, update, delete users, change/reset password, plus a default
registerUserself-service flow that delegates tocreateUser. - Multi-factor authentication —
mfaChallenge/mfaVerifycontracts for provider-backed MFA. - Roles & scopes — create roles and scopes, assign/remove roles, and read a user's effective roles.
- Session management — list active sessions, revoke a session, and revoke refresh tokens.
- Drop-in REST controller —
IdpControllerexposes all of the above under/idpwith zero boilerplate, auto-configured only when anIdpAdapterbean exists in a reactive web app. - Built-in observability —
IdpMetricsrecords authentication counts/latency, tokens issued/refreshed and errors, tagged byprovider. - Vendor-neutral DTOs — a complete, validated DTO surface (
jakarta.validation) shared by all adapters. - Pluggable by property — switch providers with
firefly.idp.providerand a single dependency swap; no code changes.
- Java 21+ (Java 25 recommended)
- Spring Boot 3.x
- Maven 3.9+
- A reactive web stack (Spring WebFlux) to expose the bundled
IdpController - One IDP provider adapter on the classpath (Keycloak, AWS Cognito, Azure AD or internal-DB) plus its backing service (e.g. a running Keycloak instance or AWS Cognito User Pool)
Add the core abstraction together with exactly one provider adapter. The version is managed by the Firefly parent/BOM, so you can omit it:
<dependencies>
<!-- Core IDP abstraction (this module) -->
<dependency>
<groupId>org.fireflyframework</groupId>
<artifactId>fireflyframework-idp</artifactId>
</dependency>
<!-- Choose one provider adapter -->
<dependency>
<groupId>org.fireflyframework</groupId>
<artifactId>fireflyframework-idp-keycloak</artifactId>
</dependency>
</dependencies>If you are not inheriting the Firefly parent, pin the version explicitly:
<dependency>
<groupId>org.fireflyframework</groupId>
<artifactId>fireflyframework-idp</artifactId>
<version>26.05.08</version>
</dependency>1. Select a provider in application.yaml:
firefly:
idp:
provider: keycloak # keycloak | cognito | azure-ad | internal-dbWith the chosen adapter on the classpath, its IdpAdapter bean is auto-configured and the IdpController is mounted under /idp automatically — no code required to expose the standard IDP REST API.
2. Or consume the IdpAdapter directly from your own services:
import org.fireflyframework.idp.adapter.IdpAdapter;
import org.fireflyframework.idp.dtos.*;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
@Service
public class AuthService {
private final IdpAdapter idp;
public AuthService(IdpAdapter idp) {
this.idp = idp;
}
public Mono<ResponseEntity<TokenResponse>> login(String username, String password) {
LoginRequest request = LoginRequest.builder()
.username(username)
.password(password)
.build();
return idp.login(request);
}
public Mono<ResponseEntity<CreateUserResponse>> register(RegisterUserRequest request) {
return idp.registerUser(request);
}
}Because every operation returns a Reactor Mono, the adapter composes cleanly into reactive WebFlux pipelines.
This core module exposes a single property under the firefly.idp prefix; provider-specific keys (e.g. firefly.idp.keycloak.*, firefly.idp.cognito.*) are documented by each adapter module.
firefly:
idp:
provider: keycloak # REQUIRED — selects the active adapter (no default; @NotBlank)
observability:
metrics:
enabled: true # default true — gates IdpMetrics registration| Property | Default | Description |
|---|---|---|
firefly.idp.provider |
(none, required) | Selects the active IDP adapter. One of keycloak, cognito, azure-ad, internal-db. Validated as @NotBlank via IdpProperties. |
firefly.observability.metrics.enabled |
true |
When true (or absent), registers the IdpMetrics bean. Set to false to disable IDP metrics. |
Auto-configuration entry points (META-INF/spring/...AutoConfiguration.imports):
IdpWebAutoConfiguration— registersIdpControllerwhen anIdpAdapterbean exists and the app is a reactive web application (@ConditionalOnWebApplication(REACTIVE)); also enablesIdpProperties.IdpObservabilityAutoConfiguration— registersIdpMetricswhen a MicrometerMeterRegistryis present and metrics are enabled.
When the IdpController is auto-mounted, the following endpoints are exposed under /idp:
| Method | Path | Operation |
|---|---|---|
POST |
/idp/login |
Authenticate and obtain tokens |
POST |
/idp/refresh |
Refresh an access token |
POST |
/idp/logout |
Logout / revoke tokens |
GET |
/idp/introspect |
Introspect an access token (RFC 7662) |
GET |
/idp/userinfo |
OIDC user info for an access token |
POST |
/idp/register |
Self-service user registration |
POST |
/idp/revoke-refresh-token |
Revoke a refresh token |
POST |
/idp/admin/users |
Create a user |
PUT |
/idp/admin/users |
Update a user |
DELETE |
/idp/admin/users/{userId} |
Delete a user |
POST |
/idp/admin/password |
Change a user's password |
POST |
/idp/admin/password/reset |
Trigger a password reset |
POST |
/idp/admin/mfa/challenge |
Initiate an MFA challenge |
POST |
/idp/admin/mfa/verify |
Verify an MFA challenge |
GET |
/idp/admin/users/{userId}/sessions |
List active sessions |
DELETE |
/idp/admin/sessions/{sessionId} |
Revoke a session |
GET |
/idp/admin/users/{userId}/roles |
Read a user's roles |
POST |
/idp/admin/roles |
Create roles |
POST |
/idp/admin/scopes |
Create a scope |
POST |
/idp/admin/users/roles/assign |
Assign roles to a user |
POST |
/idp/admin/users/roles/remove |
Remove roles from a user |
IdpMetrics (auto-configured) records, all tagged by provider:
firefly.idp.authentications— total auth attempts, taggedstatus=success|failurefirefly.idp.authentication.duration— authentication latency timerfirefly.idp.token.issued— tokens issued, taggedtoken.typefirefly.idp.token.refreshed— token refreshesfirefly.idp.errors— failed IDP operations, taggedoperation,error.type
Adapters wrap their authentication calls with IdpMetrics.timedAuthentication(provider, mono) to get success/failure counters and the latency timer for free.
- Firefly Framework documentation hub and module catalog: github.com/fireflyframework
- Provider adapters: Keycloak · AWS Cognito · Azure AD · Internal DB
Contributions are welcome. Please read the CONTRIBUTING.md guide for details on our code of conduct, development process, and how to submit pull requests.
Copyright 2024-2026 Firefly Software Foundation.
Licensed under the Apache License, Version 2.0. See LICENSE for details.