私はSAML認証の調査を始めたばかりで、認証の問題にぶつかったと言わなければなりません。残念ながら、開発マシンでは再現できず、さらに混乱します。
OWINを使用して次の構成があります。
var options = new Saml2AuthenticationOptions(false)
{
Notifications = new Saml2Notifications
{
AuthenticationRequestCreated = (request, provider, dictionary) =>
{
request.Binding = Saml2BindingType.HttpPost;
}
},
AuthenticationType = services.AuthenticationType,
Caption = services.Caption,
SPOptions = new SPOptions
{
EntityId = new EntityId(Path.Combine(services.RelyingPartyUri, "Saml2"))
}
};
options.IdentityProviders.Add(new IdentityProvider(new EntityId(services.IdentityProviderConfiguration.IdentityProviderMetadataUri), options.SPOptions)
{
AllowUnsolicitedAuthnResponse = true,
Binding = Saml2BindingType.HttpPost,
LoadMetadata = true,
SingleSignOnServiceUrl = new Uri(services.IdentityProviderConfiguration.SingleSignOnUri)
});
app.UseSaml2Authentication(options);
services
変数には、メタデータuri、ssouriなどの構成が含まれます。
この構成は私のマシンで完全に機能します。ログインSAMLリクエストを調べましたが、次のようになっています。
<saml2p:AuthnRequest
xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
ID="id10c4b76119b64952857d38c7581ca0b4"
Version="2.0"
IssueInstant="2018-12-04T14:29:00Z"
Destination="https://identity.provider/trust/saml2/http-post/sso/application"
ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
AssertionConsumerServiceURL="https://application/Saml2/Acs">
<saml2:Issuer>https://application/Saml2</saml2:Issuer>
</saml2p:AuthnRequest>
その後、認証は正常に機能します。
テスト目的でこのコードを外部サーバーにデプロイすると、期待どおりに機能する場合がありますが、http-postの代わりに認証メカニズムがhttp-redirectを使用するため、ユーザーを認証できないことがよくあります。
この場合、次のログインSAMLリクエストが表示されます。
<saml2p:AuthnRequest
xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
ID="id10c4b76119b64952857d38c7581ca0b4"
Version="2.0"
IssueInstant="2018-12-04T14:29:00Z"
Destination="https://identity.provider/trust/saml2/http-redirect/sso/application"
ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
AssertionConsumerServiceURL="https://application/Saml2/Acs">
<saml2:Issuer>https://application/Saml2</saml2:Issuer>
</saml2p:AuthnRequest>
認証に使用されるSSOURIの違い。
これまでに行ったことは、構成の問題を排除するために構成ファイルをチェックすることです。すべての構成が有効でありservices.IdentityProviderConfiguration.SingleSignOnUri
、http-postを使用した有効なSSOuriが含まれています。さまざまな設定を試してみましたが、コードスニペットに示されているように、BindingをHttpPostに設定しました。これSingleSignOnServiceUrl
は、IDPメタデータから自動的に取得された場合に問題を解決できるはずです。また、sustainsys.SAML2のソースコードを調べましたが、手がかりとなるものは見つかりませんでした。
どんな助けでも大歓迎です!
あなたが設定されている場合はLoadMetadata=true
、メタデータで見つかった設定は、手動で設定を上書きします。明らかに、Idpのメタデータにはhttps://identity.provider/trust/saml2/http-redirect/sso/application
POSTバインディングを持つエンドポイントが含まれています。
これを修正するには、Idpにメタデータを正しく取得するように依頼します。またはLoadMetadata=false
、コード内構成を設定して依存します。その場合は、コードにIdp署名証明書を追加する必要があります。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加