- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试将 Web SSO 与 WS-Federation 结合使用,以从 ASP.NET MVC 5 应用程序获取外部 IDP。
在此场景中,ASP.NET 应用程序是服务提供者。
对于登录,我想使用 SAML HTTP 重定向绑定(bind)。
外部 IDP WS-FED 元数据:
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" ID="id-58j8Ew5J8B7hOu51hu5qYyIGsXc-"
cacheDuration="P0Y0M30DT0H0M0.0S" entityID="idp:domain.com"
validUntil="2016-07-24T18:51:12Z">
<md:IDPSSODescriptor WantAuthnRequestsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:KeyDescriptor use="signing">
<dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
<dsig:X509Data>
<dsig:X509Certificate>
<!-- CERT -->
</dsig:X509Certificate>
<dsig:X509IssuerSerial>
<dsig:X509IssuerName><!--ISSUER--></dsig:X509IssuerName>
<dsig:X509SerialNumber><!--SN--></dsig:X509SerialNumber>
</dsig:X509IssuerSerial>
<dsig:X509SubjectName><!--CN--></dsig:X509SubjectName>
</dsig:X509Data>
</dsig:KeyInfo>
</md:KeyDescriptor>
<md:KeyDescriptor use="encryption">
<dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
<dsig:X509Data>
<dsig:X509Certificate>
<!-- CERT -->
</dsig:X509Certificate>
<dsig:X509IssuerSerial>
<dsig:X509IssuerName>
<!--ISSUER-->
</dsig:X509IssuerName>
<dsig:X509SerialNumber>
<!--SN-->
</dsig:X509SerialNumber>
</dsig:X509IssuerSerial>
<dsig:X509SubjectName>
<!--CN-->
</dsig:X509SubjectName>
</dsig:X509Data>
</dsig:KeyInfo>
<md:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
<md:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc" />
<md:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes192-cbc" />
<md:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" />
<md:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
</md:KeyDescriptor>
<md:ArtifactResolutionService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
Location="https://domain.com/fed/idp/soap" index="1"
isDefault="true" />
<md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://domain.com/fed/idp/samlv20"
ResponseLocation="https://domain.com/fed/idp/samlv20" />
<md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://domain.com/fed/idp/samlv20"
ResponseLocation="https://domain.com/fed/idp/samlv20" />
<md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat>
<md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</md:NameIDFormat>
<md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName</md:NameIDFormat>
<md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat>
<md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://domain.com/fed/idp/samlv20" />
<md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://domain.com/fed/idp/samlv20" />
</md:IDPSSODescriptor>
</md:EntityDescriptor>
Start.up.cs 中的身份验证设置:
public partial class Startup
{
private static readonly string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
private static readonly string adfsMetadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];
public static bool ValidateServerCertificate(object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
}
public void ConfigureAuth(IAppBuilder app)
{
//only for dev purpose
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
var wsFedOpt = new WsFederationAuthenticationOptions
{
Wtrealm = realm,
MetadataAddress = adfsMetadata,
AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType,
TokenValidationParameters = new TokenValidationParameters
{
SaveSigninToken = true,
},
};
app.UseWsFederationAuthentication(wsFedOpt);
}
}
当我运行应用程序时,出现错误:
序列不包含元素
描述:
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.InvalidOperationException: Sequence contains no elements
来源错误:
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.
堆栈跟踪:
[InvalidOperationException: Sequence contains no elements] System.Linq.Enumerable.First(IEnumerable`1 source) +264 Microsoft.IdentityModel.Protocols.d__1.MoveNext() +576 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +11532712 Microsoft.IdentityModel.Protocols.d__3.MoveNext() +1236
现在我不知道什么是不好的?外部 IDP 联合元数据、ASP.NET MVC 配置或其他内容。
当我在登录期间尝试使用外部 IDP 的外部 SP 时,它调用 HTTP GET,URI 格式为:
https://domain.com/fed/idp/samlv20?SAMLRequest=
然后我将重定向到外部 IDP 登录页面。
我尝试了与本地 IDP ( Identity Server v3 ) 相同的配置过程,它有效。
当我使用本地 SP 时,还会在登录期间根据本地 IDP(Identity Server v3)元数据配置身份验证,它调用 HTTP GET:
https://localhost:44333/core/wsfed?wtrealm=urn%3amvc5&wctx=WsFedOwinState%3dqNRmL2H9VZcEDKooeSF5nywV2vAHUDLXRSA77oe8jyVwZtGjpgRquhqYNUPbH28vrhm55zuEBYZnRw_k2nK-a97HHv9tiYLnwt4G19i1-q0&wa=wsignin1.0&wreply=https%3a%2f%2flocalhost%3a44392%2f
然后我会重定向到 IDP 登录页面。
也许我需要实现 ASP.NET 使用 URI 格式 https://domain.com/fed/idp/samlv20?SAMLRequest= 用于 SAML HTTP 重定向绑定(bind)。
感谢您提供任何有用的反馈。
最佳答案
看起来您混淆了协议(protocol)。元数据适用于 SAML2 协议(protocol)(简称 SAML2P),而不适用于 WS-Federation 协议(protocol)。
您需要 SAML2P owin 中间件而不是 WS-Fed 中间件。除非您可以让 Idp 使用 WS-Federation。
关于asp.net-mvc-5 - ASP.NET MVC 5 将 Web SSO 与外部 IDP 结合使用 - WS Fed 元数据未解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38021181/
我有一张 Excel 表格,用于更新玩家评分。 播放器 配售 初始化 1 2 3 4 金融评级 一个 1 2.0 1.000 0.018 0.016 0.014 2.007 D 2 -2.0 54.5
我有一个 map = std::map ,其中 myItemModel继承QAbstractItemModel . 我现在要合并所有 myItemModel合一myItemModel (其他所有元素模
我大量使用“do.call”来生成函数调用。例如: myfun <- "rnorm"; myargs <- list(n=10, mean=5); do.call(myfun, myargs); 但是
想象一下 InputStream 的以下变体: trait FutureInputStream { //read bytes asynchronously. Empty array means E
这是我的 C 代码: #include void sum(); int newAlphabet; int main(void) { sum();
我只是想选择类“.last”之后的每个元素。 HTML: 1 2 Jquery
我正在为一个项目构建一个 XML 反序列化器,我经常遇到这种类型的代码情况: var myVariable = ParseNDecimal(xml.Element("myElement")) == n
这是来自 Selecting the highest salary 的继续问题 假设有一个表 'wagetable' name lowhours highhours wage pri
我正在为我的程序创建一个战舰程序;该程序运行良好,但我试图确保当用户将坐标超出范围时,程序会说他们输入的坐标不正确。这是代码: #include #include void
我有一个函数,它为每种情况返回不同的 DWORD 值,如果出现错误。所以我有以下定义: #define ERR_NO_DB_CONNECTION 0x90000 #define ERR_DB_N
在派生类中引发基类事件以下简单示例演示了在基类中声明可从派生类引发的事件的标准方法。此模式广泛应用于 .NET Framework 类库中的 Windows 窗体类。在创建可用作其他类的基类的类时,应
我只是想知道这是否可能: use Modern::Perl; my @list = ('a' .. 'j'); map { func($_) } each(@list); sub func { m
我一直在使用 =IF(L2="","Active",IF(K2I2,"Late"))) 有效,但现在我需要检查 F 上的多个条件 专栏 我试过了 OR 函数 =IF(OR(F2="Scheduled"
我有 2 个命令,如下所示。 在视频中添加介绍图片 ffmpeg -y -loop 1 -framerate 10 -t 3 -i intro.png -i video.mp4 -filter_com
好的,我有这个公式可以根据名字和姓氏列表生成用户名。现在,虽然这可行,但我希望单元格改为引用我自己的 VBA 函数。但是,由于代码少得多,我仍然想使用原始公式。 我有这个公式: =SUBSTITUTE
我有两个 HAProxy 实例。两个实例都启用了统计信息并且工作正常。 我正在尝试将两个实例的统计信息合并为一个,以便我可以使用单个 HAProxy 来查看前端/后端统计信息。我试图让两个 hapro
我有一个 Observable,其中每个新值都应该引起一个 HTTP 请求。在客户端,我只关心最新的响应值;但是,我希望每个请求都能完成以进行监控/等。目的。 我目前拥有的是这样的: function
我的网站上有 TinyMCE 插件。在 TinyMCE 插件的 textarea 中添加图像时,我希望这些图像包含延迟加载。我网站的缩略图具有特定类型的延迟加载,其中 src 图像是灰色背景。根据用户
我希望合并润滑间隔,以便如果它们重叠,则从内部第一个时间获取最小值和从内部最后一个时间获取最大值并总结以创建一个跨越整个时间段的新间隔。这是一个reprex: library(lubridate, w
我有一个应用程序,它本质上是一个页眉、主要内容和一个始终可见的页脚。页脚可以改变大小,我想在页脚上方的主内容面板上放置一些工具。主要布局是用 flex 完成的,我阅读文档的理解是绝对定位通过相对于最近
我是一名优秀的程序员,十分优秀!