Created
November 19, 2013 00:40
-
-
Save OdeToCode/7538117 to your computer and use it in GitHub Desktop.
Restrict OWIN CORS to Token endpoint.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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