Skip to content

Commit

Permalink
fix(server): add slash at the end of authority entry in discovery doc…
Browse files Browse the repository at this point in the history
…ument
  • Loading branch information
thomashilzendegen authored and gingters committed Jan 31, 2024
1 parent 9b4decb commit 58eb222
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,16 @@ private Uri BuildBaseUri(HttpRequest request)
=> new Uri($"{request.Scheme}://{request.Host}{request.PathBase}", UriKind.Absolute);

/// <summary>
/// Gets the authority from the configured <see cref="JwtBearerOptions"/>.
/// Gets the authority from the configured <see cref="JwtBearerOptions"/> with a slash at the end.
/// </summary>
/// <returns>The base url of the Identity Provider</returns>
/// <returns>The base url of the Identity Provider (including a slash at the end).</returns>
protected virtual string? GetAuthority()
=> _serviceProvider.GetService<IOptionsSnapshot<JwtBearerOptions>>()?.Get(Constants.DefaultAuthenticationScheme)
{
var authority = _serviceProvider.GetService<IOptionsSnapshot<JwtBearerOptions>>()
?.Get(Constants.DefaultAuthenticationScheme)
?.Authority;
if (authority == null) return null;

return authority.EndsWith("/") ? authority : $"{authority}/";
}
}

0 comments on commit 58eb222

Please sign in to comment.