IdentityServer3 및 External Providers에서 이상한 동작이 나타납니다. 나는 누군가가 내가 놓친 명백한 것을 지적 할 수 있기를 바라고있다.IdentityServer3, Azure Active Directory 외부 공급자, 메시지 = '작업이 반환되었습니다.'System.Web.Http.Results.Unauthorized ''
요약
먼저 외부 로그인 요청은 요청 만 기록을 통해 볼 수 아래의 오류를 반환하고 결과를 기다리지 브라우저를 설정합니다. 브라우저에서 요청을 취소하고 즉시 버튼을 다시 누르면 의도 한대로 작동하고 브라우저가 외부 로그인 화면으로 전송됩니다.
나는 푸른 Active Directory를 활용, 확인할 수있는 나뿐만 아니라 일부 참조 및 설명서에 따라 IDSrv3 구성한
구성.
var wsFedOptions = new WsFederationPluginOptions(options);
wsFedOptions.Factory.Register(new Registration<IEnumerable<RelyingParty>>(RelyingParties.Get()));
wsFedOptions.Factory.RelyingPartyService = new Registration<IRelyingPartyService>(typeof(InMemoryRelyingPartyService));
app.UseWsFederationPlugin(wsFedOptions);
var aad = new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "AzureAd",
Caption = "Azure AD",
SignInAsAuthenticationType = signInAsType,
PostLogoutRedirectUri = Settings.LogoutRedirect,
Authority = Settings.AADAuthority,
ClientId = Settings.AADClientId,
RedirectUri = Settings.AADRedirectUrl
};
app.UseOpenIdConnectAuthentication(aad);
로그인보기에는 예상대로 위의 캡션 (Azure AD)으로 외부 로그인 단추가 표시됩니다. 이 버튼을 처음 클릭하면 브라우저가 호스트를 기다리고 있습니다 ...
로그에 다음 오류가 발견되었습니다.
iisexpress.exe Information: 0 : 2017-04-05 08:28:09.708 -05:00 [Information] External login requested for provider: "AzureAd"
iisexpress.exe Information: 0 : 2017-04-05 08:28:09.714 -05:00 [Information] Triggering challenge for external identity provider
LibLog Information: 0 : [2017-04-05T13:28:09.7176576Z] Level=Info, Kind=End, Category='System.Web.Http.Action', Id=800000ad-0002-fb00-b63f-84710c7967bb, Message='Action returned 'System.Web.Http.Results.UnauthorizedResult'', Operation=ReflectedHttpActionDescriptor.ExecuteAsync
LibLog Information: 0 : [2017-04-05T13:28:09.7206611Z] Level=Info, Kind=End, Category='System.Web.Http.Action', Id=800000ad-0002-fb00-b63f-84710c7967bb, Operation=ApiControllerActionInvoker.InvokeActionAsync, Status=401 (Unauthorized)
LibLog Information: 0 : [2017-04-05T13:28:09.7216630Z] Level=Info, Kind=Begin, Category='System.Web.Http.Filters', Id=800000ad-0002-fb00-b63f-84710c7967bb, Message='Action filter for 'LoginExternal(String signin, String provider)'', Operation=NoCacheAttribute.OnActionExecutedAsync, Status=401 (Unauthorized)
LibLog Information: 0 : [2017-04-05T13:28:09.7226640Z] Level=Info, Kind=End, Category='System.Web.Http.Filters', Id=800000ad-0002-fb00-b63f-84710c7967bb, Operation=NoCacheAttribute.OnActionExecutedAsync, Status=401 (Unauthorized)
LibLog Information: 0 : [2017-04-05T13:28:09.7226640Z] Level=Info, Kind=Begin, Category='System.Web.Http.Filters', Id=800000ad-0002-fb00-b63f-84710c7967bb, Message='Action filter for 'LoginExternal(String signin, String provider)'', Operation=SecurityHeadersAttribute.OnActionExecutedAsync, Status=401 (Unauthorized)
LibLog Information: 0 : [2017-04-05T13:28:09.7236655Z] Level=Info, Kind=End, Category='System.Web.Http.Filters', Id=800000ad-0002-fb00-b63f-84710c7967bb, Operation=SecurityHeadersAttribute.OnActionExecutedAsync, Status=401 (Unauthorized)
LibLog Information: 0 : [2017-04-05T13:28:09.7246669Z] Level=Info, Kind=End, Category='System.Web.Http.Controllers', Id=800000ad-0002-fb00-b63f-84710c7967bb, Operation=AuthenticationController.ExecuteAsync, Status=401 (Unauthorized)
LibLog Information: 0 : [2017-04-05T13:28:09.7251836Z] Level=Info, Kind=End, Category='System.Web.Http.MessageHandlers', Id=800000ad-0002-fb00-b63f-84710c7967bb, Operation=PassiveAuthenticationMessageHandler.SendAsync, Status=401 (Unauthorized)
LibLog Information: 0 : [2017-04-05T13:28:09.7261856Z] Level=Info, Kind=End, Category='System.Web.Http.MessageHandlers', Id=800000ad-0002-fb00-b63f-84710c7967bb, Operation=DependencyScopeHandler.SendAsync, Status=401 (Unauthorized)
LibLog Information: 0 : [2017-04-05T13:28:09.7271879Z] Sending response, Status=401 (Unauthorized), Method=GET, Url=https://localhost:44396/identity/external?provider=AzureAd&signin=2d92dd18a6106c9b029eb8742d4117a1, Id=800000ad-0002-fb00-b63f-84710c7967bb, Message='Content-type='none', content-length=unknown'
브라우저는 계속해서 로컬 호스트에서 무기한 대기합니다. 요청을 중지하고 즉시 단추를 다시 누르면 모든 것이 의도 한대로 작동합니다.
오류가 라인 (330) 직전 context.Authentication에서 IDSrv3 AuthenticatioinController.cs에서 일어나는 것으로 보이는 OpenIdAuthenticationOptions에 관리자를 추가
OpenIdConnectConfiguration
을 대체https://github.com/IdentityServer/IdentityServer3/blob/master/source/Host.Configuration/Extensions/SyncConfigurationManager.cs
.Challenget (authProp, provider)이 메서드는 Unauthorized()를 즉시 반환합니다. –