Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

JwtBearerHandler logs the provided token when SecurityTokenValidators are not able to read the token #34233

Closed
vh-vahan opened this issue Jul 9, 2021 · 1 comment
Labels
area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer

Comments

@vh-vahan
Copy link

vh-vahan commented Jul 9, 2021

I can see the following being logged -
Bearer was not authenticated. Failure message: No SecurityTokenValidator available for token: "the provided access token"

JwtBearerHandler returns this error here when none of the SecurityTokenValidators can handle the provided token

return AuthenticateResult.Fail("No SecurityTokenValidator available for token: " + token ?? "[null]");

and the AuthenticationHandler logs the error -

Logger.AuthenticationSchemeNotAuthenticatedWithFailure(Scheme.Name, result.Failure.Message);

_authenticationSchemeNotAuthenticatedWithFailure = LoggerMessage.Define<string, string>(

_authenticationSchemeNotAuthenticatedWithFailure = LoggerMessage.Define<string, string>( eventId: new EventId(7, "AuthenticationSchemeNotAuthenticatedWithFailure"), logLevel: LogLevel.Information, formatString: "{AuthenticationScheme} was not authenticated. Failure message: {FailureMessage}");

Seeing that it contains PII wondering if the token should be removed from the logged message.

@Tratcher Tratcher added the area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer label Jul 9, 2021
@blowdart
Copy link
Contributor

Addressed in #35246

@ghost ghost locked as resolved and limited conversation to collaborators Sep 12, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer
Projects
None yet
Development

No branches or pull requests

3 participants