0
我正在創建一個新的MVC5 - ASP.NET Identity項目,並且我想支持兩種登錄方法:窗體和eID(數字護照)。配置OWIN使用Forms登錄和聯合登錄
我想使用OWIN輕鬆地實現這些功能:
- 形式登錄:用戶驗證基於用戶名和密碼,
- 美聯儲驗證:讀取所述eID數據,接收請求和找到耦合到該eID的用戶(https://www.e-contract.be/eid-idp/authentication)。現在我已經能夠通過WIF添加FedAuth STS,但每當我打開我的申請,我得到自動重定向到開齋節網站(如果我禁用passiveredirect我得到一個重定向循環)
我知道這將是一個廣泛的主題,我知道這是一個非常普遍的問題。我嘗試了一些教程的搜索,但我找不到任何資源來了解更多關於OWIN或實現(我認爲這是通過oAuth)fedauth。
我應該如何去實施?謝謝!
** **解決方案
這是我使用的web.config:
<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="ida:FederationMetadataLocation" value="https://www.e-contract.be/eid-idp/endpoints/ws-federation/metadata/auth-ident-metadata.xml" />
<add key="ida:Issuer" value="https://www.e-contract.be/eid-idp/protocol/ws-federation/auth-ident" />
<add key="ida:ProviderSelection" value="productionSTS" />
..
</appSettings>
<location path="FederationMetadata">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<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>
</system.webServer>
<system.identityModel>
<identityConfiguration>
<audienceUris>
<add value="https://localhost:44301/" />
</audienceUris>
<issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">
<trustedIssuers>
<add thumbprint="5981a2be47ca66203c9165edeb697d833df1b77d" name="www.e-contract.be" /><!-- Change this thumbprint if eID stops working https://www.e-contract.be/eid-idp/main.seam -->
</trustedIssuers>
</issuerNameRegistry>
<claimsAuthenticationManager type="ePortaal.Federation.FederationUserAuthenticationManager, ePortaal" />
<certificateValidation certificateValidationMode="None" />
<securityTokenHandlers>
<remove type="System.IdentityModel.Tokens.SessionSecurityTokenHandler, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add type="System.IdentityModel.Services.Tokens.MachineKeySessionSecurityTokenHandler, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</securityTokenHandlers>
</identityConfiguration>
</system.identityModel>
<system.identityModel.services>
<federationConfiguration>
<cookieHandler requireSsl="true" />
<wsFederation requireHttps="true" passiveRedirectEnabled="false" realm="https://localhost:44301/" issuer="https://www.e-contract.be/eid-idp/protocol/ws-federation/auth-ident" />
</federationConfiguration>
</system.identityModel.services>
電子合同改變了他們的指紋每隔幾個月,你可以找到它下「網站上Identiteit指紋:5981a2be47ca66203c9165edeb697d833df1b77d(把這個鍵在你的web.config)」