mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
Added calls to add Data Protection to the dotnet new IdentityServer templates
This commit is contained in:
parent
2d947f263f
commit
8cd926d4e3
5 changed files with 30 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ using Duende.IdentityServer;
|
|||
using IdentityServerTemplate.Pages.Admin.ApiScopes;
|
||||
using IdentityServerTemplate.Pages.Admin.Clients;
|
||||
using IdentityServerTemplate.Pages.Admin.IdentityScopes;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
|
@ -137,6 +138,11 @@ internal static class HostingExtensions
|
|||
_ = builder.Services.AddTransient<ApiScopeRepository>();
|
||||
}
|
||||
|
||||
// Add `.PersistKeysTo…()` and `.ProtectKeysWith…()` calls
|
||||
// See more at https://docs.duendesoftware.com/general/data-protection
|
||||
_ = builder.Services.AddDataProtection()
|
||||
.SetApplicationName("IdentityServer");
|
||||
|
||||
// this adds the necessary config for the portal page
|
||||
_ = builder.Services.AddTransient<Pages.Portal.ClientRepository>();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System.Globalization;
|
|||
using Duende.IdentityServer;
|
||||
using IdentityServerHost.Data;
|
||||
using IdentityServerHost.Models;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
|
@ -96,6 +97,11 @@ internal static class HostingExtensions
|
|||
};
|
||||
});
|
||||
|
||||
// Add `.PersistKeysTo…()` and `.ProtectKeysWith…()` calls
|
||||
// See more at https://docs.duendesoftware.com/general/data-protection
|
||||
_ = builder.Services.AddDataProtection()
|
||||
.SetApplicationName("IdentityServer");
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Serilog;
|
||||
using Serilog.Filters;
|
||||
|
||||
|
|
@ -51,6 +52,11 @@ internal static class HostingExtensions
|
|||
.AddInMemoryClients(Config.Clients)
|
||||
.AddLicenseSummary();
|
||||
|
||||
// Add `.PersistKeysTo…()` and `.ProtectKeysWith…()` calls
|
||||
// See more at https://docs.duendesoftware.com/general/data-protection
|
||||
_ = builder.Services.AddDataProtection()
|
||||
.SetApplicationName("IdentityServer");
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using IdentityServerHost.Pages;
|
|||
using IdentityServerHost.Pages.Admin.ApiScopes;
|
||||
using IdentityServerHost.Pages.Admin.Clients;
|
||||
using IdentityServerHost.Pages.Admin.IdentityScopes;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
|
@ -121,6 +122,11 @@ internal static class HostingExtensions
|
|||
_ = builder.Services.AddTransient<ApiScopeRepository>();
|
||||
}
|
||||
|
||||
// Add `.PersistKeysTo…()` and `.ProtectKeysWith…()` calls
|
||||
// See more at https://docs.duendesoftware.com/general/data-protection
|
||||
_ = builder.Services.AddDataProtection()
|
||||
.SetApplicationName("IdentityServer");
|
||||
|
||||
// if you want to use server-side sessions: https://blog.duendesoftware.com/posts/20220406_session_management/
|
||||
// then enable it
|
||||
//isBuilder.AddServerSideSessions();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Globalization;
|
||||
using Duende.IdentityServer;
|
||||
using IdentityServerHost.Pages;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Serilog;
|
||||
using Serilog.Filters;
|
||||
|
|
@ -101,6 +102,11 @@ internal static class HostingExtensions
|
|||
};
|
||||
});
|
||||
|
||||
// Add `.PersistKeysTo…()` and `.ProtectKeysWith…()` calls
|
||||
// See more at https://docs.duendesoftware.com/general/data-protection
|
||||
_ = builder.Services.AddDataProtection()
|
||||
.SetApplicationName("IdentityServer");
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue