Skip to content

Instantly share code, notes, and snippets.

@chriskuech
Created April 1, 2020 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriskuech/b95afc3c51b02d4b2f131e61f7bb0956 to your computer and use it in GitHub Desktop.
Save chriskuech/b95afc3c51b02d4b2f131e61f7bb0956 to your computer and use it in GitHub Desktop.
[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