IdentityServer4를 IdentityServer3.AccessTokenValidation (v2.13.0) 웹 API로 설정했습니다. 어쩌면 키가 509x 인증서가 아니기 때문일 수도 있습니다.IdentityServer3 AccessTokenValidation을 사용하는 IdentityServer4
웹 API가 IdentityServer4로 인증되지 않는 것이 문제입니다.
WEB API를 startup.cs
public void Configuration(IAppBuilder app)
{
app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "http://identity.positive.local:5000",
RequiredScopes = new[] { "odbc" }
});
}
IdentityServer4 Startup.cs (http://identity.positive.local:5000)
services.AddIdentityServer()
.AddSigningCredential(key)
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients());
IdentityServer4 Config.cs (http://identity.positive.local:5000)
public class Config
{
public static IEnumerable<IdentityResource> GetIdentityResources()
{
return new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
};
}
public static IEnumerable<ApiResource> GetApiResources()
{
return new List<ApiResource>
{
new ApiResource("api", "POSI_Master-API"),
new ApiResource("odbc", "POSI_Odbc-API")
};
}
public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
new Client
{
ClientId = "js",
ClientName = "JavaScript Client",
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RequireConsent = false,
RedirectUris = { "http://products.positive.local/auth" },
PostLogoutRedirectUris = { "http://products.positive.local" },
AllowedCorsOrigins = { "http://products.positive.local" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"api",
"odbc"
},
}
};
}
}
}
,691 363,210
편집 : 던져
예외 : 'System.Reflection.ReflectionTypeLoadException' 가 mscorlib.dll의 iisexpress.exe 경고에 0 : Microsoft.IdentityModel.Protocol 메시지 = '에서 유형을 가져 오는 동안 을 던져 예외'. 확장, 버전 = 1.0.40306.1554, culture = 중립 PublicKeyToken = 31bf3856ad364e35 '.', Exception = System.Reflection.ReflectionTypeLoadException : 요청한 형식 중 하나 이상을 로드 할 수 없습니다. 자세한 내용은 LoaderExceptions 속성을 검색하십시오. System.Web.Http.Tracing.Tracers.DefaultHttpControllerTypeResolverTracer.GetTypesAndTrace에서 System.Reflection.Assembly.GetTypes()에서 System.Reflection.RuntimeModule.GetTypes()에서 System.Reflection.RuntimeModule.GetTypes (RuntimeModule 모듈)에서 시도 수동 4.3.1 System.Net.Http하는 업데이트 - (조립 조립)
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="IdentityModel" version="1.13.1" targetFramework="net452" />
<package id="IdentityServer3.AccessTokenValidation" version="2.14.0" targetFramework="net452" />
<package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Cors" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Tracing" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net452" />
<package id="Microsoft.IdentityModel.Logging" version="1.1.3" targetFramework="net452" />
<package id="Microsoft.IdentityModel.Protocol.Extensions" version="1.0.4.403061554" targetFramework="net452" />
<package id="Microsoft.IdentityModel.Tokens" version="5.1.3" targetFramework="net452" />
<package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Owin.Security.Jwt" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
<package id="System.IdentityModel.Tokens.Jwt" version="5.1.3" targetFramework="net452" />
<package id="System.Net.Http" version="4.3.1" targetFramework="net452" />
</packages>
로그는 무엇을 말합니까? webapi 프로젝트에서 콘솔/디버그 로깅을 사용할 수 있습니까? – Lutando
원인이 될 수있는 예외가 추가되었습니다. –