Skip to content

Commit bb189dd

Browse files
committed
Re-introduced UseIdentityManager extension method
1 parent df07ab1 commit bb189dd

7 files changed

Lines changed: 28 additions & 44 deletions

File tree

src/Hosts/Hosts.CookieAuthentication/Properties/launchSettings.json

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "http://localhost:60759",
7-
"sslPort": 0
8-
}
9-
},
102
"profiles": {
11-
"IIS Express": {
12-
"commandName": "IISExpress",
13-
"launchBrowser": true,
14-
"environmentVariables": {
15-
"ASPNETCORE_ENVIRONMENT": "Development"
16-
}
17-
},
18-
"HostWithLocalAuth": {
3+
"Hosts.CookieAuthentication": {
194
"commandName": "Project",
205
"launchBrowser": true,
216
"applicationUrl": "http://localhost:5000",

src/Hosts/Hosts.CookieAuthentication/Startup.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
using System;
22
using Hosts.Shared.InMemory;
3-
using IdentityManager2.Assets;
43
using Microsoft.AspNetCore.Builder;
5-
using Microsoft.AspNetCore.Http;
64
using Microsoft.Extensions.DependencyInjection;
7-
using Microsoft.Extensions.FileProviders;
85

96
namespace Hosts.CookieAuthentication
107
{
@@ -42,15 +39,10 @@ public void Configure(IApplicationBuilder app)
4239
app.UseAuthentication();
4340
app.UseAuthorization();
4441

45-
app.UseFileServer(new FileServerOptions
46-
{
47-
RequestPath = new PathString("/assets"),
48-
FileProvider = new EmbeddedFileProvider(typeof(EmbeddedHtmlResult).Assembly, "IdentityManager2.Assets")
49-
});
42+
app.UseIdentityManager();
5043

5144
app.UseEndpoints(x =>
5245
{
53-
//x.MapIdentityManager("/idm");
5446
x.MapDefaultControllerRoute();
5547
});
5648
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"profiles": {
3-
"Host": {
3+
"Hosts.LosthostAuthentication": {
44
"commandName": "Project",
5-
/*"launchBrowser": true,*/
5+
"launchBrowser": true,
6+
"applicationUrl": "http://localhost:5000",
67
"environmentVariables": {
78
"ASPNETCORE_ENVIRONMENT": "Development"
8-
},
9-
"applicationUrl": "http://localhost:5000/"
9+
}
1010
}
1111
}
1212
}

src/Hosts/Hosts.LosthostAuthentication/Startup.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
using Microsoft.Extensions.DependencyInjection;
33
using System;
44
using Hosts.Shared.InMemory;
5-
using IdentityManager2.Assets;
6-
using Microsoft.AspNetCore.Http;
7-
using Microsoft.Extensions.FileProviders;
85

96
namespace Hosts.LosthostAuthentication
107
{
@@ -32,15 +29,10 @@ public void Configure(IApplicationBuilder app)
3229
app.UseAuthentication();
3330
app.UseAuthorization();
3431

35-
app.UseFileServer(new FileServerOptions
36-
{
37-
RequestPath = new PathString("/assets"),
38-
FileProvider = new EmbeddedFileProvider(typeof(EmbeddedHtmlResult).Assembly, "IdentityManager2.Assets")
39-
});
32+
app.UseIdentityManager();
4033

4134
app.UseEndpoints(x =>
4235
{
43-
//x.MapIdentityManager("/idm");
4436
x.MapDefaultControllerRoute();
4537
});
4638
}

src/IdentityManager2/Assets/EmbeddedHtmlResult.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace IdentityManager2.Assets
99
{
10-
// TODO: internal
11-
public class EmbeddedHtmlResult : IActionResult
10+
internal class EmbeddedHtmlResult : IActionResult
1211
{
1312
private readonly string path;
1413
private readonly string file;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using IdentityManager2.Assets;
2+
using Microsoft.AspNetCore.Http;
3+
using Microsoft.Extensions.FileProviders;
4+
5+
namespace Microsoft.AspNetCore.Builder
6+
{
7+
public static class IdentityManagerApplicationBuilderExtensions
8+
{
9+
public static IApplicationBuilder UseIdentityManager(this IApplicationBuilder app)
10+
{
11+
app.UseFileServer(new FileServerOptions
12+
{
13+
RequestPath = new PathString("/assets"),
14+
FileProvider = new EmbeddedFileProvider(typeof(EmbeddedHtmlResult).Assembly, "IdentityManager2.Assets")
15+
});
16+
17+
return app;
18+
}
19+
}
20+
}

src/IdentityManager2/IdentityManager2.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,4 @@
6666
</EmbeddedResource>
6767
</ItemGroup>
6868

69-
<ItemGroup>
70-
<Folder Include="Configuration\Hosting\" />
71-
</ItemGroup>
72-
7369
</Project>

0 commit comments

Comments
 (0)