Почему `IdSrv` генерирует исключение `EncryptedTokenDecryptionFailedException` при ответе WS Federation POST на issue/hrd?

Я пытаюсь настроить федеративную аутентификацию, используя Thinktecture.IdentityServer V. 2.

У меня есть веб-сайт, настроенный как проверяющая сторона, и этот сайт настроен на отсрочку аутентификации до /issue/hrd на сервере идентификации. Кажется, это работает так, как ожидалось.

Кроме того, я добавил поставщика удостоверений (ADFS) на сервер удостоверений через страницы администрирования IdSrv. Поставщик удостоверений настроен с

  • идентификатор
  • отображаемое имя
  • это включено
  • обнаружение домашней сферы включено
  • В качестве типа выбран WSStar
  • конечная точка WS-Federation заполняется
  • отпечаток эмитента заполнен

Поставщик удостоверений настроен так, чтобы доверять моему серверу удостоверений.

Когда веб-сайту (RP) требуется аутентификация, он перенаправляется на сервер идентификации, который далее перенаправляется на поставщика идентификации, и я получаю экран входа в систему поставщика идентификации и могу войти в систему, но HTTP POST обратно к /issue/hrd на сервере идентификации не работает с следующее исключение:

ID4022: The key needed to decrypt the encrypted security token could not be resolved. Ensure that the SecurityTokenResolver is populated with the required key. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.IdentityModel.Tokens.EncryptedTokenDecryptionFailedException: ID4022: The key needed to decrypt the encrypted security token could not be resolved. Ensure that the SecurityTokenResolver is populated with the required key.

Source Error: 


 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 



[EncryptedTokenDecryptionFailedException: ID4022: The key needed to decrypt the encrypted security token could not be resolved. Ensure that the SecurityTokenResolver is populated with the required key.]
   System.IdentityModel.Tokens.Saml2SecurityTokenHandler.CreatePlaintextReaderFromEncryptedData(XmlDictionaryReader reader, SecurityTokenResolver serviceTokenResolver, SecurityTokenSerializer keyInfoSerializer, Collection`1 clauses, EncryptingCredentials& encryptingCredentials) +1042914
   System.IdentityModel.Tokens.Saml2SecurityTokenHandler.ReadAssertion(XmlReader reader) +422
   System.IdentityModel.Tokens.Saml2SecurityTokenHandler.ReadToken(XmlReader reader) +71
   System.IdentityModel.Tokens.SecurityTokenHandlerCollection.ReadToken(XmlReader reader) +114
   System.IdentityModel.Services.TokenReceiver.ReadToken(String tokenXml, XmlDictionaryReaderQuotas readerQuotas, FederationConfiguration federationConfiguration) +356

[SecurityTokenException: ID1044: An encrypted security token was received at the relying party which could not be decrypted. Configure the relying party with a suitable decryption certificate. Current relying party decryption certificate info:
No Certificate Configured]
   System.IdentityModel.Services.TokenReceiver.ReadToken(String tokenXml, XmlDictionaryReaderQuotas readerQuotas, FederationConfiguration federationConfiguration) +1218
   Thinktecture.IdentityServer.Protocols.WSFederation.HrdController.ProcessWSFedResponse() +218
   lambda_method(Closure , ControllerBase , Object[] ) +79
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +261
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +34
   System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +124
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +839035
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +839035
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +839035
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +839035
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +15
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +33
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +839620
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +28
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288



--------------------------------------------------------------------------------

person Christian Horsdal    schedule 04.03.2014    source источник


Ответы (2)


Похоже, вы настроили своего внешнего поставщика удостоверений для шифрования токенов.

Сейчас мы не занимаемся расшифровкой токенов. Если для вас это важно — открывайте тикеты на github.

person leastprivilege    schedule 05.03.2014
comment
Спасибо. Я проверю, так ли это. - person Christian Horsdal; 06.03.2014

возможно, вы забыли настроить в своем клиенте в разделе конфигурации microsoft.identityModel/service ваш сертификат для расшифровки зашифрованного файла cookie:

  <serviceCertificate>
            <certificateReference
                        findValue="{Thumbprint}"
                   storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
         </serviceCertificate>
person David R.    schedule 09.12.2014