【发布时间】:2015-01-28 19:46:01
【问题描述】:
我的 Global.asax.cs 文件中有 2 个事件
WSFederationAuthenticationModule_SecurityTokenValidated 和 WSFederationAuthenticationModule_RedirectingToIdentityProvider
wif 引擎不调用 WSFederationAuthenticationModule_RedirectingToIdentityProvider。为什么?
public class MvcApplication : System.Web.HttpApplication
{
void WSFederationAuthenticationModule_SecurityTokenValidated(object sender, SecurityTokenValidatedEventArgs e)
{
FederatedAuthentication.SessionAuthenticationModule.IsSessionMode = true;
}
void WSFederationAuthenticationModule_RedirectingToIdentityProvider(object sender, RedirectingToIdentityProviderEventArgs e)
{
//some code
}
}
这是 web.config 中的 microsoft.identityModel 部分
<microsoft.identityModel>
<service saveBootstrapTokens="true">
<audienceUris mode="Never">
</audienceUris>
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true" issuer="http://localhost/dss.web.sts.tokenbaker/" realm="http://localhost/dss.web.frontend" requireHttps="false" />
<cookieHandler requireSsl="false" />
</federatedAuthentication>
<issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<trustedIssuers>
<add thumbprint="308efdee6453fff68c402e5eceee5b8bb9eaa619" name="servcert" />
</trustedIssuers>
</issuerNameRegistry>
</service>
</microsoft.identityModel>
【问题讨论】:
-
您是否检查过 web.config 中
元素上的passiveRedirectEnabled 属性是否设置为true? -
您可以发布您的 web.config 的 microsoft.identityModel 部分吗?这应该有助于诊断情况。
-
我添加了 microsoft.identityModel 部分的内容
-
你有没有想过这个问题?
-
今天我很惊讶地发现这些方法在我的应用程序中被自动调用。我总是在活动中注册他们。您还可以找到它们的事件:FederatedAuthentication.FederationConfigurationCreated +=FederatedAuthentication_FederationConfigurationCreated;