Esempio n. 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication();

            var builder = services.AddIdentityServer(options =>
            {
                options.IssuerUri = "https://idsvr4";

                options.Events = new EventsOptions
                {
                    RaiseErrorEvents       = true,
                    RaiseFailureEvents     = true,
                    RaiseInformationEvents = true,
                    RaiseSuccessEvents     = true
                };
            });

            builder.AddInMemoryClients(Clients.Get());
            builder.AddInMemoryIdentityResources(Scopes.GetIdentityScopes());
            builder.AddInMemoryApiResources(Scopes.GetApiScopes());
            builder.AddTestUsers(Users.Get());

            builder.AddDeveloperSigningCredential(persistKey: false);

            builder.AddExtensionGrantValidator <ExtensionGrantValidator>();
            builder.AddExtensionGrantValidator <ExtensionGrantValidator2>();
            builder.AddExtensionGrantValidator <NoSubjectExtensionGrantValidator>();
            builder.AddExtensionGrantValidator <DynamicParameterExtensionGrantValidator>();

            builder.AddProfileService <CustomProfileService>();

            builder.AddSecretParser <JwtBearerClientAssertionSecretParser>();
            builder.AddSecretValidator <PrivateKeyJwtSecretValidator>();
            builder.AddSecretValidator <ConfirmationSecretValidator>();

            // add a custom token request validator if set
            if (CustomTokenRequestValidator != null)
            {
                builder.Services.AddTransient(r => CustomTokenRequestValidator);
            }
        }