Ejemplo 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);
            }
        }
Ejemplo n.º 2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication();

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

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

            builder.AddInMemoryClients(Clients.Get());
            builder.AddInMemoryScopes(Scopes.Get());

            services.AddTransient <IResourceOwnerPasswordValidator, CustomResponseResourceOwnerValidator>();
            builder.AddExtensionGrantValidator <CustomResponseExtensionGrantValidator>();
        }