Skip to content

Commit 2ca16da

Browse files
committed
Cleanup
1 parent 9b6ce87 commit 2ca16da

File tree

8 files changed

+15
-34
lines changed

8 files changed

+15
-34
lines changed

src/Hosting/TestHost/src/AsyncStreamWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal AsyncStreamWrapper(Stream inner, Func<bool> allowSynchronousIO)
3131

3232
public override void Flush()
3333
{
34-
// Not bocking Flush because things like StreamWriter.Dispose() always call it.
34+
// Not blocking Flush because things like StreamWriter.Dispose() always call it.
3535
_inner.Flush();
3636
}
3737

src/Security/Authentication/test/CookieTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ public async Task CanSpecifyAndShareDataProtector()
13021302
app.Use(async (context, next) =>
13031303
{
13041304
var result = await context.AuthenticateAsync("Cookies");
1305-
await Describe(context.Response, result);
1305+
await DescribeAsync(context.Response, result);
13061306
});
13071307
})
13081308
.ConfigureServices(services => services.AddAuthentication().AddCookie("Cookies", o =>
@@ -1478,12 +1478,12 @@ private static TestServer CreateServerWithServices(Action<IServiceCollection> co
14781478
}
14791479
else if (req.Path == new PathString("/me"))
14801480
{
1481-
await Describe(res, AuthenticateResult.Success(new AuthenticationTicket(context.User, new AuthenticationProperties(), CookieAuthenticationDefaults.AuthenticationScheme)));
1481+
await DescribeAsync(res, AuthenticateResult.Success(new AuthenticationTicket(context.User, new AuthenticationProperties(), CookieAuthenticationDefaults.AuthenticationScheme)));
14821482
}
14831483
else if (req.Path.StartsWithSegments(new PathString("/me"), out remainder))
14841484
{
14851485
var ticket = await context.AuthenticateAsync(remainder.Value.Substring(1));
1486-
await Describe(res, ticket);
1486+
await DescribeAsync(res, ticket);
14871487
}
14881488
else if (req.Path == new PathString("/testpath") && testpath != null)
14891489
{
@@ -1510,7 +1510,7 @@ private static TestServer CreateServerWithServices(Action<IServiceCollection> co
15101510
return server;
15111511
}
15121512

1513-
private static Task Describe(HttpResponse res, AuthenticateResult result)
1513+
private static Task DescribeAsync(HttpResponse res, AuthenticateResult result)
15141514
{
15151515
res.StatusCode = 200;
15161516
res.ContentType = "text/xml";

src/Security/Authentication/test/DynamicSchemeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private static TestServer CreateServer(Action<IServiceCollection> configureServi
145145
{
146146
var name = (remainder.Value.Length > 0) ? remainder.Value.Substring(1) : null;
147147
var result = await context.AuthenticateAsync(name);
148-
await res.Describe(result?.Ticket?.Principal);
148+
await res.DescribeAsync(result?.Ticket?.Principal);
149149
}
150150
else if (req.Path.StartsWithSegments(new PathString("/remove"), out remainder))
151151
{

src/Security/Authentication/test/GoogleTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,26 +1177,26 @@ private static TestServer CreateServer(Action<GoogleOptions> configureOptions, F
11771177
{
11781178
var result = await context.AuthenticateAsync(TestExtensions.CookieAuthenticationScheme);
11791179
var tokens = result.Properties.GetTokens();
1180-
await res.Describe(tokens);
1180+
await res.DescribeAsync(tokens);
11811181
}
11821182
else if (req.Path == new PathString("/me"))
11831183
{
1184-
await res.Describe(context.User);
1184+
await res.DescribeAsync(context.User);
11851185
}
11861186
else if (req.Path == new PathString("/authenticate"))
11871187
{
11881188
var result = await context.AuthenticateAsync(TestExtensions.CookieAuthenticationScheme);
1189-
await res.Describe(result.Principal);
1189+
await res.DescribeAsync(result.Principal);
11901190
}
11911191
else if (req.Path == new PathString("/authenticateGoogle"))
11921192
{
11931193
var result = await context.AuthenticateAsync("Google");
1194-
await res.Describe(result?.Principal);
1194+
await res.DescribeAsync(result?.Principal);
11951195
}
11961196
else if (req.Path == new PathString("/authenticateFacebook"))
11971197
{
11981198
var result = await context.AuthenticateAsync("Facebook");
1199-
await res.Describe(result?.Principal);
1199+
await res.DescribeAsync(result?.Principal);
12001200
}
12011201
else if (req.Path == new PathString("/unauthorized"))
12021202
{

src/Security/Authentication/test/MicrosoftAccountTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ private static TestServer CreateServer(Action<MicrosoftAccountOptions> configure
270270
}
271271
else if (req.Path == new PathString("/me"))
272272
{
273-
await res.Describe(context.User);
273+
await res.DescribeAsync(context.User);
274274
}
275275
else if (req.Path == new PathString("/signIn"))
276276
{

src/Security/Authentication/test/PolicyTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ private static TestServer CreateServer(Action<IServiceCollection> configure = nu
469469
{
470470
var name = (remainder.Value.Length > 0) ? remainder.Value.Substring(1) : null;
471471
var result = await context.AuthenticateAsync(name);
472-
await res.Describe(result?.Ticket?.Principal);
472+
await res.DescribeAsync(result?.Ticket?.Principal);
473473
}
474474
else
475475
{

src/Security/Authentication/test/TestExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static async Task<Transaction> SendAsync(this TestServer server, string u
4646
return transaction;
4747
}
4848

49-
public static Task Describe(this HttpResponse res, ClaimsPrincipal principal)
49+
public static Task DescribeAsync(this HttpResponse res, ClaimsPrincipal principal)
5050
{
5151
res.StatusCode = 200;
5252
res.ContentType = "text/xml";
@@ -65,7 +65,7 @@ public static Task Describe(this HttpResponse res, ClaimsPrincipal principal)
6565
return res.Body.WriteAsync(xmlBytes, 0, xmlBytes.Length);
6666
}
6767

68-
public static Task Describe(this HttpResponse res, IEnumerable<AuthenticationToken> tokens)
68+
public static Task DescribeAsync(this HttpResponse res, IEnumerable<AuthenticationToken> tokens)
6969
{
7070
res.StatusCode = 200;
7171
res.ContentType = "text/xml";

src/Security/CookiePolicy/test/TestExtensions.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,5 @@ public static async Task<Transaction> SendAsync(this TestServer server, string u
4545
}
4646
return transaction;
4747
}
48-
49-
public static void Describe(this HttpResponse res, ClaimsPrincipal principal)
50-
{
51-
res.StatusCode = 200;
52-
res.ContentType = "text/xml";
53-
var xml = new XElement("xml");
54-
if (principal != null)
55-
{
56-
foreach (var identity in principal.Identities)
57-
{
58-
xml.Add(identity.Claims.Select(claim =>
59-
new XElement("claim", new XAttribute("type", claim.Type),
60-
new XAttribute("value", claim.Value),
61-
new XAttribute("issuer", claim.Issuer))));
62-
}
63-
}
64-
var xmlBytes = Encoding.UTF8.GetBytes(xml.ToString());
65-
res.Body.Write(xmlBytes, 0, xmlBytes.Length);
66-
}
6748
}
6849
}

0 commit comments

Comments
 (0)