Skip to content

Commit

Permalink
Throw exception if Configuration to make it easier to quicly detect t…
Browse files Browse the repository at this point in the history
…his issue.
  • Loading branch information
dstenroejl committed Aug 2, 2024
1 parent d50818e commit ed77319
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public static IServiceCollection AddJwtBearerAuthenticationForIsolatedWorker(thi
// won't perform at call to get the configurations (Issuer and Keys) and then 'configuration' will be null.
options.TokenValidationParameters.IssuerValidatorUsingConfiguration = (issuer, token, _, configuration) =>
{
if (configuration == null)
throw new InvalidOperationException("The 'Configuration' is null. Either JwtBearer dependencies are missing or we could not retrieve the 'Configuration' from the configured metadata address.");
if (!string.Equals(configuration.Issuer, issuer, StringComparison.Ordinal))
throw new SecurityTokenInvalidIssuerException { InvalidIssuer = issuer };

Expand Down

0 comments on commit ed77319

Please sign in to comment.