Не удалось загрузить http: // localhost: 5000/.well-известный/openid-configuration: no 'Заголовок Control-allow-wallow-oC#

Место общения программистов C#
Ответить Пред. темаСлед. тема
Anonymous
 Не удалось загрузить http: // localhost: 5000/.well-известный/openid-configuration: no 'Заголовок Control-allow-wallow-o

Сообщение Anonymous »

Я новичок в IdentityServer4, недавно я видел образец QuickStart8, предоставленный командой IdentityServer, в этот 3 -й проект включены 1. IdentityServer
2. API 3.client Все работают нормально в браузере, когда я развернулся в IIS, они не работают должным образом, он показывает ошибку, как ... < /p>

< /p>

impscript javcript ... < /p>

Пожалуйста, помогите мне с этим вопросом.

Код: Выделить всё

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace Api
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvcCore()
.AddAuthorization()
.AddJsonFormatters();
services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:5000";
options.RequireHttpsMetadata = false;

options.ApiName = "api1";
});

services.AddCors(options =>
{
// this defines a CORS policy called "default"
options.AddPolicy("default", policy =>
{
policy.WithOrigins("http://localhost:5003")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
}

public void Configure(IApplicationBuilder app)
{
app.UseCors("default");

app.UseAuthentication();

app.UseMvc();
}
}
< /code>

} < /p>

[b] api (контроллер идентификации) < /strong> < /p>

[Route("[controller]")]
[Authorize]
public class IdentityController : ControllerBase
{
[HttpGet]
public IActionResult Get()
{
return new JsonResult(from c in User.Claims select new { c.Type, c.Value });
}
}
< /code>

 QuickStartidentityServer (startup.cs) < /strong> < /p>

 public class Startup
{

public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();

string connectionString = @"Data Source=DOTNET-Foo;Initial Catalog=IdentityServer4;Integrated Security=True";
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;

// configure identity server with in-memory stores, keys, clients and scopes
services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddTestUsers(Config.GetUsers())
// this adds the config data from DB (clients, resources)
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder =>
builder.UseSqlServer(connectionString,
sql => sql.MigrationsAssembly(migrationsAssembly));
});
// this adds the operational data from DB (codes, tokens, consents)
//.AddOperationalStore(options =>
//{
//    options.ConfigureDbContext = builder =>
//        builder.UseSqlServer(connectionString,
//            sql => sql.MigrationsAssembly(migrationsAssembly));

//    // this enables automatic token cleanup.  this is optional.
//    options.EnableTokenCleanup = true;
//    options.TokenCleanupInterval = 30;
//});

services.AddAuthentication()
.AddGoogle("Google", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;

options.ClientId = "434483408261-55tc8n0cs4ff1fe21ea8df2o443v2iuc.apps.googleusercontent.com";
options.ClientSecret = "3gcoTrEDPPJ0ukn_aYYT6PWo";
})
.AddOpenIdConnect("oidc", "OpenID Connect", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.SignOutScheme = IdentityServerConstants.SignoutScheme;

options.Authority = "https://demo.identityserver.io/";
options.ClientId = "implicit";

options.TokenValidationParameters = new TokenValidationParameters
{
NameClaimType = "name",
RoleClaimType = "role"
};
});

}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
// IdentityServerDatabaseInitialization.InitializeDatabase(app);
}
app.UseIdentityServer();
app.UseStaticFiles();
app.UseMvcWithDefaultRoute();
}
}
Я не могу получить доступ к http: // localhost: 5000/.well-known/openid-configuration [/b]



Подробнее здесь: https://stackoverflow.com/questions/515 ... n-no-acces
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C#»