C# 本地WebApi未重定向到身份验证
由于某些原因,OWIN没有重定向到ADFS中指定的登录页面, 我对ADF(Windows Server 2012)没有任何控制权,我遵循了Microsoft文档(),但我现在被卡住了。 我认为,通过引用元数据,一切都可以开箱即用地配置 我的控制器(从WebApi生成的模板) 我的Startup.csC# 本地WebApi未重定向到身份验证,c#,asp.net,asp.net-web-api,adfs,C#,Asp.net,Asp.net Web Api,Adfs,由于某些原因,OWIN没有重定向到ADFS中指定的登录页面, 我对ADF(Windows Server 2012)没有任何控制权,我遵循了Microsoft文档(),但我现在被卡住了。 我认为,通过引用元数据,一切都可以开箱即用地配置 我的控制器(从WebApi生成的模板) 我的Startup.cs public partial class Startup { // For more information on configuring authentication, please vi
public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(WsFederationAuthenticationDefaults.AuthenticationType);
app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
{
MetadataAddress = ConfigurationManager.AppSettings["ida:AdfsMetadataEndpoint"],
Wtrealm = ConfigurationManager.AppSettings["ida:Audience"],
});
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType
});
}
}
如何告诉ADFS重定向到领域?我发现ADFS需要一个具有唯一id的依赖方来验证用户并正确重定向到领域
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Message>Authorization has been denied for this request.</Message>
</Error>
/adfs/ls/?wtrealm=http%3a%2f%2flocalhost%3a554&wctx=WsFedOwinState%3d9C7kwsHRjBM86yrii5niUWF1gW9VFvCKBTj_D3z4-QQ5P25opteVK0mWf0fudEQdsgIexkHxTxhKDqBmfSWNAuJ3togHTBE40CEKYa8JLKJOxsgxNGIreYBOzNYzK8NNvR26PCMCowCFoM9NGJOC8w&wa=wsignin1.0
public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(WsFederationAuthenticationDefaults.AuthenticationType);
app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
{
MetadataAddress = ConfigurationManager.AppSettings["ida:AdfsMetadataEndpoint"],
Wtrealm = ConfigurationManager.AppSettings["ida:Audience"],
});
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType
});
}
}