1 write to HttpContext
Microsoft.AspNetCore.Antiforgery.Test (1)
DefaultAntiforgeryTest.cs (1)
1518
HttpContext
= httpContext,
92 references to HttpContext
Microsoft.AspNetCore.Antiforgery.Test (92)
DefaultAntiforgeryTest.cs (92)
143
var tokenset = antiforgery.GetTokens(context.
HttpContext
);
180
var tokenset = antiforgery.GetTokens(context.
HttpContext
);
200
var tokenset = antiforgery.GetTokens(context.
HttpContext
);
235
var tokenset = antiforgery.GetTokens(context.
HttpContext
);
265
var tokenSet = antiforgery.GetAndStoreTokens(context.
HttpContext
);
298
var tokenSet = antiforgery.GetAndStoreTokens(context.
HttpContext
);
311
Assert.Equal("no-cache, no-store", context.
HttpContext
.Response.Headers.CacheControl);
312
Assert.Equal("no-cache", context.
HttpContext
.Response.Headers.Pragma);
326
context.
HttpContext
.Response.Headers.CacheControl = "public";
329
var tokenSet = antiforgery.GetAndStoreTokens(context.
HttpContext
);
342
Assert.Equal("no-cache, no-store", context.
HttpContext
.Response.Headers.CacheControl);
343
Assert.Equal("no-cache", context.
HttpContext
.Response.Headers.Pragma);
361
context.
HttpContext
.RequestServices = services.BuildServiceProvider();
363
context.
HttpContext
.Response.Headers[headerName] = headerValue;
366
antiforgery.GetAndStoreTokens(context.
HttpContext
);
367
return context.
HttpContext
.Response.Headers[headerName].ToString();
457
var tokenSet = antiforgery.GetAndStoreTokens(context.
HttpContext
);
491
var tokenSet = antiforgery.GetAndStoreTokens(context.
HttpContext
);
504
Assert.Equal("no-cache, no-store", context.
HttpContext
.Response.Headers.CacheControl);
505
Assert.Equal("no-cache", context.
HttpContext
.Response.Headers.Pragma);
529
.Setup(t => t.SaveCookieToken(context.
HttpContext
, "serialized-cookie-token-from-context"))
533
var tokenset = antiforgery.GetAndStoreTokens(context.
HttpContext
);
539
t => t.SaveCookieToken(context.
HttpContext
, "serialized-cookie-token-from-context"),
578
var tokenset = antiforgery.GetAndStoreTokens(context.
HttpContext
);
608
context.
HttpContext
,
617
var result = await antiforgery.IsRequestValidAsync(context.
HttpContext
);
637
context.
HttpContext
.Request.Method = "POST";
642
context.
HttpContext
,
652
var result = await antiforgery.IsRequestValidAsync(context.
HttpContext
);
677
context.
HttpContext
.Request.Method = "POST";
682
context.
HttpContext
,
692
var result = await antiforgery.IsRequestValidAsync(context.
HttpContext
);
716
context.
HttpContext
.Request.Method = httpMethod;
721
context.
HttpContext
,
731
var result = await antiforgery.IsRequestValidAsync(context.
HttpContext
);
737
context.
HttpContext
,
753
context.
HttpContext
.Request.Method = httpMethod;
758
context.
HttpContext
,
768
var result = await antiforgery.IsRequestValidAsync(context.
HttpContext
);
785
context.
HttpContext
,
795
() => antiforgery.ValidateRequestAsync(context.
HttpContext
));
817
context.
HttpContext
,
827
await antiforgery.ValidateRequestAsync(context.
HttpContext
);
852
.Setup(s => s.GetRequestTokensAsync(context.
HttpContext
))
859
() => antiforgery.ValidateRequestAsync(context.
HttpContext
));
876
.Setup(s => s.GetRequestTokensAsync(context.
HttpContext
))
883
() => antiforgery.ValidateRequestAsync(context.
HttpContext
));
898
context.
HttpContext
.Request.ContentType = "application/json";
902
.Setup(s => s.GetRequestTokensAsync(context.
HttpContext
))
909
() => antiforgery.ValidateRequestAsync(context.
HttpContext
));
924
context.
HttpContext
.Request.ContentType = "application/x-www-form-urlencoded";
928
.Setup(s => s.GetRequestTokensAsync(context.
HttpContext
))
935
() => antiforgery.ValidateRequestAsync(context.
HttpContext
));
958
context.
HttpContext
,
968
await antiforgery.ValidateRequestAsync(context.
HttpContext
);
997
context.
HttpContext
.Response.Headers["X-Frame-Options"] = expectedHeaderValue;
1000
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1003
var xFrameOptions = context.
HttpContext
.Response.Headers["X-Frame-Options"];
1023
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1026
Assert.Equal("no-cache, no-store", context.
HttpContext
.Response.Headers["Cache-Control"]);
1027
Assert.Equal("no-cache", context.
HttpContext
.Response.Headers["Pragma"]);
1046
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1049
Assert.Equal("no-cache, no-store", context.
HttpContext
.Response.Headers["Cache-Control"]);
1050
Assert.Equal("no-cache", context.
HttpContext
.Response.Headers["Pragma"]);
1067
context.
HttpContext
.Response.Headers["Cache-Control"] = "public";
1070
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1073
Assert.Equal("no-cache, no-store", context.
HttpContext
.Response.Headers["Cache-Control"]);
1074
Assert.Equal("no-cache", context.
HttpContext
.Response.Headers["Pragma"]);
1100
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1103
var xFrameOptions = context.
HttpContext
.Response.Headers["X-Frame-Options"];
1136
.Setup(t => t.SaveCookieToken(context.
HttpContext
, "serialized-cookie-token-from-context"))
1140
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1146
t => t.SaveCookieToken(context.
HttpContext
, "serialized-cookie-token-from-context"),
1180
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1221
var nullTokenStore = GetTokenStore(context.
HttpContext
, testTokenSet, false);
1223
context.
HttpContext
,
1228
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1258
var nullTokenStore = GetTokenStore(context.
HttpContext
, testTokenSet, false);
1260
context.
HttpContext
,
1265
context.
HttpContext
.Features.Set<IHttpResponseFeature>(testResponse);
1266
context.
HttpContext
.Response.Headers["Cache-Control"] = "public";
1270
antiforgery.SetCookieTokenAndHeader(context.
HttpContext
);
1272
Assert.Equal("public", context.
HttpContext
.Response.Headers["Cache-Control"]);
1292
context.
HttpContext
.RequestServices = services.BuildServiceProvider();
1296
var tokenSet = antiforgery.GetAndStoreTokens(context.
HttpContext
);
1330
context.
HttpContext
.RequestServices = services.BuildServiceProvider();
1332
context.
HttpContext
.Response.Headers[headerName] = headerValue;
1335
var tokenSet = antiforgery.GetAndStoreTokens(context.
HttpContext
);
1364
context.
HttpContext
.RequestServices = services.BuildServiceProvider();
1366
context.
HttpContext
.Response.Headers[headerName] = headerValue;
1369
var tokenSet = antiforgery.GetAndStoreTokens(context.
HttpContext
);
1423
context.
HttpContext
,