Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Route(Constants.ConfigurationRoute)] // Important! This is the OpenID Connect magic.
[Consumes("application/json")]
[Produces("application/json")]
[ApiController]
public class ConfigurationController : ControllerBase
{
[HttpGet]
public IActionResult GetConfiguration()
{
// Ensure token and keys requests use the same cluster as this request
var requestedUrlBase = $"{Request.Scheme}://{Request.Host}/";
var configuration = new OpenIdConnectConfiguration
{
Issuer = Constants.Issuer,
TokenEndpoint = requestedUrlBase + Constants.TokenRoute,
JwksUri = requestedUrlBase + Constants.KeysRoute,
};
return Ok(configuration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment