Skip to content

fix: log at debug when openid scope not included#3727

Merged
strehle merged 1 commit intocloudfoundry:developfrom
mikeroda:logging/openid-missing
Feb 8, 2026
Merged

fix: log at debug when openid scope not included#3727
strehle merged 1 commit intocloudfoundry:developfrom
mikeroda:logging/openid-missing

Conversation

@mikeroda
Copy link
Copy Markdown
Contributor

  • Should be able to request an access token without openid scope (i.e. ID token not requested) and not log an info-level message. Make the log debug instead.

- Should be able to request an access token without openid scope
(i.e. ID token not requested) and not log an info-level message.
Make the log debug instead.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts logging behavior so requesting an access token without the openid scope no longer emits an info-level log when an ID token is not applicable.

Changes:

  • Downgrades the “openid missing” message in IdTokenGranter from info to debug.
  • Updates the related test to temporarily set the Log4j root level to DEBUG so the message can still be observed during assertions.

Reviewed changes

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

File Description
server/src/main/java/org/cloudfoundry/identity/uaa/oauth/openid/IdTokenGranter.java Changes the missing-openid log from INFO to DEBUG.
uaa/src/test/java/org/cloudfoundry/identity/uaa/oauth/UaaTokenServicesTests.java Adjusts test logging setup to capture DEBUG logs and restore the original root level.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 186 to 190
LoggerContext context = (LoggerContext) LogManager.getContext(false);
originalLevel = context.getRootLogger().getLevel();
Configurator.setRootLevel(DEBUG);
context.getRootLogger().addAppender(appender);
}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test sets the root logger level to DEBUG and adds an appender to the root logger, which can capture a lot of unrelated debug output and makes the assertion less targeted. Consider attaching the appender to the specific logger (e.g., org.cloudfoundry.identity.uaa.oauth.openid.IdTokenGranter) and/or filtering events by event.getLoggerName(), and capture LogEvents so you can assert the log level is DEBUG (so the test actually validates the INFO→DEBUG change).

Copilot uses AI. Check for mistakes.
@@ -189,6 +195,7 @@ void removeAppender() {
if (appender != null) {
context.getRootLogger().removeAppender(appender);
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removeAppender() restores the root level but doesn't stop the AbstractAppender. Stopping it (e.g., appender.stop()) after removal helps avoid lingering resources/threads and matches the lifecycle implied by appender.start() in the setup.

Suggested change
context.getRootLogger().removeAppender(appender);
context.getRootLogger().removeAppender(appender);
appender.stop();

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@strehle strehle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from my side ok if you dont want the id token

@strehle strehle requested review from duanemay and fhanik January 28, 2026 16:47
@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Foundational Infrastructure Working Group Jan 29, 2026
@strehle strehle merged commit 97bca9c into cloudfoundry:develop Feb 8, 2026
39 of 40 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants