Skip to content

Polish logging in OAuth2ClientAuthenticationFilter #2025

@gmazza

Description

@gmazza

Expected Behavior
This logging message in OAuth2ClientAuthenticationFilter.doFilterInternal():

if (this.logger.isTraceEnabled()) {
this.logger.trace(LogMessage.format("Client authentication failed: %s", ex.getError()), ex);
}

is critical for me, because I control both the auth server and clients, and I need to know if there is something wrong with the client's credentials. (It has turned out that passwords containing a percent symbol cannot be used as in client secrets, which may be another issue, but not the point of this ticket I'm creating.). For me, this would be an ERROR.

I lower the logging on just this class to trace so I can find out about any client credential problems, but the problem with that is that this class also logs at DEBUG
"Set SecurityContextHolder authentication to OAuth2ClientAuthenticationToken", 100,000's of times a day, something I don't need in the logs.

Recommend raising the Client authentication failed error message to at least INFO level, or something above the "Set SecurityContextHolder authentication..." message, so we can get the Client authentication failed messages without getting bombarded with the other message.

Client authentication failing is a frequently critical issue, and if the calls fail without that message users are frequently clueless where else the problem would be.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions