-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom pipeline #8
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
//app.Use((context, next) =>
//{
// IAntiforgery antiforgery = app.Services.GetServices().FirstOrDefault();
// var user = context.User.Identity.Name;
// if (context.Request.Path.Value.Equals("/"))
// {
// return next(context);
// }
// if (!context.Request.Path.Value.EndsWith("login", StringComparison.InvariantCultureIgnoreCase))
// {
// var theaders = context.Request.Headers["X-CSRF-TOKEN-HEADER"];
// string theader = "";
// if (theaders.Count() > 0)
// {
// theader = theaders[0];
// }
// System.Diagnostics.Debug.WriteLine($"Path={context.Request.Path.Value} User={user}, Token={theader}");
// try
// {
// antiforgery.ValidateRequestAsync(context);
// }
// catch (AntiforgeryValidationException ex)
// {
// context.Response.StatusCode = 400;
// System.Diagnostics.Debug.WriteLine($"Invalid antiforgery token: {ex.Message}");
// throw new BadHttpRequestException($"Invalid antiforgery token: {ex.Message}");
// }
// }
// var tokens = antiforgery.GetAndStoreTokens(context);
// System.Diagnostics.Debug.WriteLine($"Path={context.Request.Path.Value} User={user}, NewToken={tokens.RequestToken}");
// context.Response.Cookies.Append("XSRF-TOKEN", tokens.RequestToken, new CookieOptions() { HttpOnly = false });
// return next(context);
//});
The text was updated successfully, but these errors were encountered: