Skip to content

Add reactive logout handler support - #2194

Open
sdelamo wants to merge 6 commits into
5.1.xfrom
paperclip/mng-279-reactive-logout-handler
Open

Add reactive logout handler support#2194
sdelamo wants to merge 6 commits into
5.1.xfrom
paperclip/mng-279-reactive-logout-handler

Conversation

@sdelamo

@sdelamo sdelamo commented May 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Add ReactiveLogoutHandler<I, O> as an additive public logout extension point returning a cold single-result publisher.
  • Add a reactive /logout controller that is selected when a reactive handler bean exists while preserving the synchronous controller for sync-only applications.
  • Cover reactive completion waiting, sync-only compatibility, reactive-over-sync precedence, GET-disabled and GET-allowed behavior, POST content-type handling, unauthenticated logout, and logout docs.

Release Metadata

  • Target branch: 5.1.x
  • Release target: 5.1.0
  • Type label: type: enhancement
  • Selected Micronaut organization project: 5.1.0 Release (Throw an error if multiple annotations are used. #147). Live project association could not be applied from this run because GitHub rejected project mutation without the project token scope.

Fixes #1879.

Verification

  • ./gradlew :micronaut-security:test --tests 'io.micronaut.security.endpoints.ReactiveLogoutControllerTest'
  • ./gradlew :micronaut-security:japiCmp :micronaut-security:spotlessJavaCheck :micronaut-security:checkstyleMain :micronaut-security:checkstyleTest

Both verification commands passed in clean worktree /tmp/mng-279-sonar-fix.LyzI6H for the final PR head c7f65afb16. GitHub checks are also passing, including SonarCloud Code Analysis.

PR Assets

No rendered output, image, PDF, log archive, or generated artifact changed in a way that requires a PR-visible asset.


✨ This message was AI-generated using gpt-5.5

Copilot AI review requested due to automatic review settings May 22, 2026 10:19
@sdelamo sdelamo added the type: enhancement New feature or request label May 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends Micronaut Security with a reactive logout extension point and controller, while also adding an opt-in configuration to make role comparisons case-insensitive across authorization checks.

Changes:

  • Introduce ReactiveLogoutHandler<I, O> and a ReactiveLogoutController that is selected when a reactive handler bean exists (with precedence over the synchronous handler).
  • Add micronaut.security.roles-case-sensitive configuration, wiring it into DefaultRolesFinder to support case-insensitive role matching when disabled.
  • Add/adjust documentation and tests covering reactive logout behavior and the new roles-case-sensitivity configuration.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/docs/guide/securityConfiguration.adoc Documents the new roles-case-sensitive configuration option.
src/main/docs/guide/endpoints/logout/logoutHandler.adoc Documents ReactiveLogoutHandler usage and precedence.
src/main/docs/guide/endpoints/logout.adoc Updates logout endpoint docs for reactive handler support and behavior.
security/src/main/java/io/micronaut/security/handlers/ReactiveLogoutHandler.java Adds new reactive logout handler public API.
security/src/main/java/io/micronaut/security/endpoints/ReactiveLogoutController.java Adds reactive /logout controller that delegates to ReactiveLogoutHandler.
security/src/main/java/io/micronaut/security/endpoints/LogoutController.java Disables the sync controller when a ReactiveLogoutHandler bean is present.
security/src/main/java/io/micronaut/security/token/DefaultRolesFinder.java Implements optional case-insensitive role matching based on security configuration.
security/src/main/java/io/micronaut/security/config/SecurityConfiguration.java Adds isRolesCaseSensitive() to the security configuration contract.
security/src/main/java/io/micronaut/security/config/SecurityConfigurationProperties.java Adds/binds rolesCaseSensitive configuration property.
security/src/test/java/io/micronaut/security/endpoints/ReactiveLogoutControllerTest.java Tests reactive controller selection, completion waiting, and endpoint behaviors.
security/src/test/groovy/io/micronaut/security/rules/ConfigurationInterceptUrlMapRuleSpec.groovy Adds coverage for case sensitivity in intercept-url-map role comparisons.
security/src/test/groovy/io/micronaut/security/config/SecurityConfigurationPropertiesSpec.groovy Adds configuration binding test for roles-case-sensitive.
security/src/test/groovy/io/micronaut/security/authorization/SecuredRolesCaseInsensitiveConfigurationSpec.groovy Tests case-insensitive behavior for @Secured and SecurityService.hasRole.

Comment thread src/main/docs/guide/securityConfiguration.adoc Outdated
Comment thread security/src/main/java/io/micronaut/security/handlers/ReactiveLogoutHandler.java Outdated
@sdelamo
sdelamo force-pushed the paperclip/mng-279-reactive-logout-handler branch from 25471a4 to b47f236 Compare May 22, 2026 10:36
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
69.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Reactive LogoutHandler

2 participants