|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using IdentityServer4.Configuration; |
|
|
|
using IdentityServer4.Services; |
|
|
|
using IdentityServer4.Stores; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
@ -71,13 +72,7 @@ public class AbpIdentityServerDomainModule : AbpModule |
|
|
|
var configuration = services.GetConfiguration(); |
|
|
|
var builderOptions = services.ExecutePreConfiguredActions<AbpIdentityServerBuilderOptions>(); |
|
|
|
|
|
|
|
var identityServerBuilder = services.AddIdentityServer(options => |
|
|
|
{ |
|
|
|
options.Events.RaiseErrorEvents = true; |
|
|
|
options.Events.RaiseInformationEvents = true; |
|
|
|
options.Events.RaiseFailureEvents = true; |
|
|
|
options.Events.RaiseSuccessEvents = true; |
|
|
|
}); |
|
|
|
var identityServerBuilder = AddIdentityServer(services, builderOptions); |
|
|
|
|
|
|
|
if (builderOptions.AddDeveloperSigningCredential) |
|
|
|
{ |
|
|
|
@ -110,6 +105,37 @@ public class AbpIdentityServerDomainModule : AbpModule |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static IIdentityServerBuilder AddIdentityServer(IServiceCollection services, AbpIdentityServerBuilderOptions abpIdentityServerBuilderOptions) |
|
|
|
{ |
|
|
|
services.Configure<IdentityServerOptions>(options => |
|
|
|
{ |
|
|
|
options.Events.RaiseErrorEvents = true; |
|
|
|
options.Events.RaiseInformationEvents = true; |
|
|
|
options.Events.RaiseFailureEvents = true; |
|
|
|
options.Events.RaiseSuccessEvents = true; |
|
|
|
}); |
|
|
|
|
|
|
|
var identityServerBuilder = services.AddIdentityServerBuilder() |
|
|
|
.AddRequiredPlatformServices() |
|
|
|
.AddCoreServices() |
|
|
|
.AddDefaultEndpoints() |
|
|
|
.AddPluggableServices() |
|
|
|
.AddValidators() |
|
|
|
.AddResponseGenerators() |
|
|
|
.AddDefaultSecretParsers() |
|
|
|
.AddDefaultSecretValidators(); |
|
|
|
|
|
|
|
if (abpIdentityServerBuilderOptions.AddIdentityServerCookieAuthentication) |
|
|
|
{ |
|
|
|
identityServerBuilder.AddCookieAuthentication(); |
|
|
|
} |
|
|
|
|
|
|
|
// provide default in-memory implementation, not suitable for most production scenarios
|
|
|
|
identityServerBuilder.AddInMemoryPersistedGrants(); |
|
|
|
|
|
|
|
return identityServerBuilder; |
|
|
|
} |
|
|
|
|
|
|
|
public override void PostConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
OneTimeRunner.Run(() => |
|
|
|
|