将 Kentor.AuthServices 升级到 Sustainsys.Saml2 后 /saml2/idp/ 出现 404 错误
404 error for /saml2/idp/ after upgrading Kentor.AuthServices to Sustainsys.Saml2
可以使用 Kentor.AuthServices.Owin 0.18.0 并且通常是此流量日志。
200 GET https://some-saml2-idp.com/saml2/idp/SSO_1..39%3D&RelayState=Os..j
302 POST https://demo.local/AuthServices/Acs
200 GET for the set RedirectUri
升级到 Sustainsys 后。Saml2.Owin 2.2.0 我得到了这个流量日志...
200 GET https://some-saml2-idp.com/saml2/idp/SSO_1a7f5..sy%2Fh9rebTw%3D%3D&RelayState=1M..3c
302 POST https://demo.local/AuthServices/Acs
303 GET https://demo.local/login?error=access_denied
200 GET https://some-saml2-idp.com/saml2/idp/SSO_1a7f..NfLr6E299uPwE%3D&RelayState=cS..L
302 POST https://demo.local/AuthServices/Acs
404 GET https://demo.local/saml2/idp/SSO_1..39?SAMLRequest=hZ..bTw==&RelayState=1M..c&error=access_denied
我试过清除所有地方的 cookie,并试图找到任何 "own" 导致错误或错误参数的代码。
如果我可以在不更改 IDP 端的任何内容的情况下让我的两个分支都正常工作,我会更愿意。
我的 Web.config 具有以下结构...
<sustainsys.saml2 entityId="https://demo.local/AuthServices"
returnUrl="https://demo.local"
publicOrigin="https://demo.local"
modulePath="/AuthServices">
<serviceCertificates>
<add fileName="~/somename.pfx"
use="Signing" />
</serviceCertificates>
<identityProviders>
<add entityId="My-IDP"
allowUnsolicitedAuthnResponse="true"
loadMetadata="true"
metadataLocation="https://some-saml2-idp.com/metadata" />
</identityProviders>
</sustainsys.saml2>
还有我的 Owin 初创公司...
var defaultSignInAsAuthType = "Cookies";
app.SetDefaultSignInAsAuthenticationType(defaultSignInAsAuthType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = defaultSignInAsAuthType,
ReturnUrlParameter = "returnUrl",
LoginPath = new PathString("/login"),
LogoutPath = new PathString("/logout")
});
var saml2Options = new Saml2AuthenticationOptions(true);
app.UseSaml2Authentication(saml2Options);
app.UseStageMarker(PipelineStage.Authenticate);
AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.Name;
我缺少什么来模仿旧包设置的行为?
这些版本之间存在许多可能引发问题的重大更改。
Katana 日志记录将包含错误消息。一些相关的事情是:
- 最小可接受的传入签名算法现在默认为 SHA-256。可以通过
minIncomingSigninAlgorithm
配置进行设置。
- 模块路径(所有端点的基本路径)现在默认为
/Saml2
而不是 /AuthServices
。在问题中,它已经正确配置为 /AuthServices
以向后兼容。
- 2.X 不再支持 ClaimsAuthenticationManager,因为它不再使用 System.IdentityModel 令牌处理程序。使用
AcsCommandResultCreated
通知来修改创建的身份。
可以使用 Kentor.AuthServices.Owin 0.18.0 并且通常是此流量日志。
200 GET https://some-saml2-idp.com/saml2/idp/SSO_1..39%3D&RelayState=Os..j
302 POST https://demo.local/AuthServices/Acs
200 GET for the set RedirectUri
升级到 Sustainsys 后。Saml2.Owin 2.2.0 我得到了这个流量日志...
200 GET https://some-saml2-idp.com/saml2/idp/SSO_1a7f5..sy%2Fh9rebTw%3D%3D&RelayState=1M..3c
302 POST https://demo.local/AuthServices/Acs
303 GET https://demo.local/login?error=access_denied
200 GET https://some-saml2-idp.com/saml2/idp/SSO_1a7f..NfLr6E299uPwE%3D&RelayState=cS..L
302 POST https://demo.local/AuthServices/Acs
404 GET https://demo.local/saml2/idp/SSO_1..39?SAMLRequest=hZ..bTw==&RelayState=1M..c&error=access_denied
我试过清除所有地方的 cookie,并试图找到任何 "own" 导致错误或错误参数的代码。
如果我可以在不更改 IDP 端的任何内容的情况下让我的两个分支都正常工作,我会更愿意。
我的 Web.config 具有以下结构...
<sustainsys.saml2 entityId="https://demo.local/AuthServices"
returnUrl="https://demo.local"
publicOrigin="https://demo.local"
modulePath="/AuthServices">
<serviceCertificates>
<add fileName="~/somename.pfx"
use="Signing" />
</serviceCertificates>
<identityProviders>
<add entityId="My-IDP"
allowUnsolicitedAuthnResponse="true"
loadMetadata="true"
metadataLocation="https://some-saml2-idp.com/metadata" />
</identityProviders>
</sustainsys.saml2>
还有我的 Owin 初创公司...
var defaultSignInAsAuthType = "Cookies";
app.SetDefaultSignInAsAuthenticationType(defaultSignInAsAuthType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = defaultSignInAsAuthType,
ReturnUrlParameter = "returnUrl",
LoginPath = new PathString("/login"),
LogoutPath = new PathString("/logout")
});
var saml2Options = new Saml2AuthenticationOptions(true);
app.UseSaml2Authentication(saml2Options);
app.UseStageMarker(PipelineStage.Authenticate);
AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.Name;
我缺少什么来模仿旧包设置的行为?
这些版本之间存在许多可能引发问题的重大更改。
Katana 日志记录将包含错误消息。一些相关的事情是:
- 最小可接受的传入签名算法现在默认为 SHA-256。可以通过
minIncomingSigninAlgorithm
配置进行设置。 - 模块路径(所有端点的基本路径)现在默认为
/Saml2
而不是/AuthServices
。在问题中,它已经正确配置为/AuthServices
以向后兼容。 - 2.X 不再支持 ClaimsAuthenticationManager,因为它不再使用 System.IdentityModel 令牌处理程序。使用
AcsCommandResultCreated
通知来修改创建的身份。