2013-06-29 2 views
0

업데이트 : 구성에 오류가 없었습니다! 그 오류는 내가 인증서를 놓쳤다는 것이 었습니다. 이제이 오류가 발생합니다. ID2057 : 개인 키가없는 인증서에 대해 X509SigningCredentials 인스턴스를 생성 할 수 없습니다. Parameternamn :이 가이드 다음은 CustomSTS을 만들려고 노력 :IdentityManager (사용자 지정 STS)

스피 토큰 : Chris Klug

내가 URL을 사용하여 IIS 7에 내 customSTS를 실행하면 : http://identitymanager.dev/ 모든 작품. 로그인하여 customSTS의 홈 컨트롤러로 리디렉션됩니다.

하지만 문제는 내 의존 응용 프로그램을 사용할 때입니다.

그것은이 URL로 리디렉션 :

http://identitymanager.dev/?wa=wsignin1.0&wtrealm=http%3a%2f%2fIdentityManager.dev%2f&wctx=rm%3d0%26id%3dpassive%26ru%3d%252f&wct=2013-06-29T20%3a54%3a41Z&wreply=http%3a%2f%2fIdentityManager.dev%2f

그리고 난이 오류 MSG를 얻을 : 없음 인증서 주체 이름 CN에 대한 발견되지 않았다 = IdentityManager.dev

일을 나는 mmc.exe를 확인할 때 IdentityManager.dev (내 사용자 계정의 경우)라는 이름의 인증서가 있습니다.

스택 트레이스 : 여기 Stacktrace

가 customSTS 내 Web.config의이다 : 여기

<?xml version="1.0" encoding="utf-8"?> 
<EntityDescriptor ID="_70a250d5-e3e1-494a-a392-7ed1736f3180" entityID="http://IdentityManager.dev/" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"> 
    <RoleDescriptor xsi:type="fed:SecurityTokenServiceType" protocolSupportEnumeration="http://docs.oasis-open.org/wsfed/federation/200706" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706"> 
    <KeyDescriptor use="signing"> 
     <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> 
     <X509Data> 
      <X509Certificate><!--- My Cert code here --></X509Certificate> 
     </X509Data> 
     </KeyInfo> 
    </KeyDescriptor> 
    <ContactPerson contactType="administrative"> 
     <GivenName>Stefan Karlsson</GivenName> 
    </ContactPerson> 
    <fed:ClaimTypesOffered> 
     <auth:ClaimType Uri="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" Optional="true" xmlns:auth="http://docs.oasis-open.org/wsfed/authorization/200706"> 
     <auth:DisplayName>Name</auth:DisplayName> 
     <auth:Description>The name of the subject.</auth:Description> 
     </auth:ClaimType> 
     <auth:ClaimType Uri="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" Optional="true" xmlns:auth="http://docs.oasis-open.org/wsfed/authorization/200706"> 
     <auth:DisplayName>Role</auth:DisplayName> 
     <auth:Description>The role of the subject.</auth:Description> 
     </auth:ClaimType> 
    </fed:ClaimTypesOffered> 
    <fed:SecurityTokenServiceEndpoint> 
     <EndpointReference xmlns="http://www.w3.org/2005/08/addressing"> 
     <Address>http://IdentityManager.dev/</Address> 
     </EndpointReference> 
    </fed:SecurityTokenServiceEndpoint> 
    <fed:PassiveRequestorEndpoint> 
     <EndpointReference xmlns="http://www.w3.org/2005/08/addressing"> 
     <Address>http://IdentityManager.dev/</Address> 
     </EndpointReference> 
    </fed:PassiveRequestorEndpoint> 
    </RoleDescriptor> 
</EntityDescriptor> 

그리고 여기

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <appSettings> 
    <add key="IssuerName" value="http://IdentityManager.dev/" /> 
    <add key="SigningCertificateName" value="cn=IdentityManager.dev" /> 
    <add key="EncryptionCertificate" value="" /> 
    <add key="webpages:Version" value="2.0.0.0" /> 
    <add key="webpages:Enabled" value="false" /> 
    <add key="PreserveLoginUrl" value="true" /> 
    <add key="ClientValidationEnabled" value="true" /> 
    <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
    </appSettings> 
    <system.web> 
    <httpRuntime targetFramework="4.5" /> 
    <compilation debug="true" targetFramework="4.5" /> 
    <authentication mode="Forms"> 
     <forms loginUrl="~/Account/Login" timeout="2880" /> 
    </authentication> 
    <authorization> 
     <deny users="?" /> 
    </authorization> 
    <pages> 
     <namespaces> 
     <add namespace="System.Web.Helpers" /> 
     <add namespace="System.Web.Mvc" /> 
     <add namespace="System.Web.Mvc.Ajax" /> 
     <add namespace="System.Web.Mvc.Html" /> 
     <add namespace="System.Web.Routing" /> 
     <add namespace="System.Web.WebPages" /> 
     </namespaces> 
    </pages> 
    </system.web> 
    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false" /> 
    </system.webServer> 
</configuration> 

그리고 내 FederationMetaData입니다 내 사랑하는 ap P는 Web.config의 :

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
    <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
    </configSections> 
    <appSettings> 
    <add key="webpages:Version" value="2.0.0.0" /> 
    <add key="webpages:Enabled" value="false" /> 
    <add key="PreserveLoginUrl" value="true" /> 
    <add key="ClientValidationEnabled" value="true" /> 
    <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
    <add key="ida:FederationMetadataLocation" value="http://IdentityManager.dev/FederationMetadata/2007-06/FederationMetadata.xml" /> 
    <add key="ida:Issuer" value="http://IdentityManager.dev/" /> 
    <add key="ida:ProviderSelection" value="productionSTS" /> 
    </appSettings> 
    <location path="FederationMetadata"> 
    <system.web> 
     <authorization> 
     <allow users="*" /> 
     </authorization> 
    </system.web> 
    </location> 
    <system.web> 
    <authorization> 
     <deny users="?" /> 
    </authorization> 
    <authentication mode="None" /> 
    <httpRuntime targetFramework="4.5" requestValidationMode="4.5" /> 
    <compilation debug="true" targetFramework="4.5" /> 
    <pages> 
     <namespaces> 
     <add namespace="System.Web.Helpers" /> 
     <add namespace="System.Web.Mvc" /> 
     <add namespace="System.Web.Mvc.Ajax" /> 
     <add namespace="System.Web.Mvc.Html" /> 
     <add namespace="System.Web.Routing" /> 
     <add namespace="System.Web.WebPages" /> 
     </namespaces> 
    </pages> 
    </system.web> 
    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <modules> 
     <remove name="FormsAuthentication" /> 
     <add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /> 
     <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /> 
    </modules> 
    <handlers> 
     <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /> 
     <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> 
     <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> 
     <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> 
     <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> 
     <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 
    </handlers> 
    </system.webServer> 
    <system.identityModel> 
    <identityConfiguration> 
     <audienceUris> 
     <add value="http://localhost:2093/" /> 
     </audienceUris> 
     <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     <trustedIssuers> 
     <!--<add thumbprint="1C3A3728344BCC7E812A54B95C49BE7840132DD8" name="https://humanytest.accesscontrol.windows.net/" />--> 
      <add thumbprint="7796E0E0B576EBC2406E6BE8A259318E3761C759" name="http://IdentityManager.dev/" /> 
     </trustedIssuers> 
     </issuerNameRegistry> 
     <certificateValidation certificateValidationMode="None" /> 
    </identityConfiguration> 
    </system.identityModel> 
    <system.identityModel.services> 
    <federationConfiguration> 
     <cookieHandler requireSsl="false" /> 
     <wsFederation passiveRedirectEnabled="true" issuer="http://IdentityManager.dev/" realm="http://localhost:2093/" reply="http://localhost:2093/" requireHttps="false" /> 
    </federationConfiguration> 
    </system.identityModel.services> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
</configuration> 

의지 FederationMetaData : 이제

<?xml version="1.0" encoding="utf-8"?> 
<EntityDescriptor ID="_8d7c3e01-5bc5-4719-9863-0b687aa54cd8" entityID="http://IdentityManager.dev/FederationMetadata/2007-06/FederationMetadata.xml/" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"> 
    <RoleDescriptor xsi:type="fed:ApplicationServiceType" xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706" protocolSupportEnumeration="http://docs.oasis-open.org/wsfed/federation/200706" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <fed:TargetScopes> 
     <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> 
     <wsa:Address>http://identitymanager.dev/FederationMetadata/2007-06/FederationMetadata.xml/</wsa:Address> 
     </wsa:EndpointReference> 
     <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> 
     <wsa:Address>http://localhost:2093/</wsa:Address> 
     </wsa:EndpointReference> 
    </fed:TargetScopes> 
    <fed:PassiveRequestorEndpoint> 
     <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> 
     <wsa:Address>http://identitymanager.dev/FederationMetadata/2007-06/FederationMetadata.xml/</wsa:Address> 
     </wsa:EndpointReference> 
    </fed:PassiveRequestorEndpoint> 
    </RoleDescriptor> 
</EntityDescriptor> 

답변

0

의 가게를 가져 오는 동안
는 "상점 이름"과 "저장 위치"에 대한 올바른 매개 변수를 언급, 나를 위해 작업 ,

 

     public static X509Certificate2 GetCertificate(string subjectName) 
     { 
      var store = new X509Store(StoreName.My, StoreLocation.LocalMachine); 

+0

향후 독자를 위해 : "blowdart"및 "Nigel Shaw"답변을 확인하십시오. http://stackoverflow.com/questions/1786019/where-did-my-certificate-store-go – granadaCoder