Skip to content

Instantly share code, notes, and snippets.

@OdeToCode
Created November 19, 2013 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save OdeToCode/7538117 to your computer and use it in GitHub Desktop.
Save OdeToCode/7538117 to your computer and use it in GitHub Desktop.
Restrict OWIN CORS to Token endpoint.
app.UseCors(new CorsOptions()
{
PolicyProvider = new CorsPolicyProvider()
{
PolicyResolver = request =>
{
if (request.Path.StartsWithSegments(new PathString("/token")))
{
return Task.FromResult(new CorsPolicy { AllowAnyOrigin = true });
}
return Task.FromResult<CorsPolicy>(null);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment