IdP Initiated SSOのASP.NetでPOCを実行しています。 ADFSログインページに自分のAD資格情報で正常にログインしています。 しかし、アサーションのページで、SAMLの応答を取得してユーザーを検証するにはどうすればよいですか? 私は開発者ツールを使用して応答を見ることができますが、どうすればC#で取得できますか?SAMLの返信を読むにはどうすればよいですか?
を私は(私はそれが実際にどのように動作するかについてとてもわからないグーグルの後、このどこかを見つけました。)SAML応答クエリ文字列パラメータの値を印刷してみました:私は試してみました何
。
ClaimsPrincipal claimsPrincipal = System.Threading.Thread.CurrentPrincipal as ClaimsPrincipal;
Response.Write("Is user Authenticated = " + claimsPrincipal.Identity.IsAuthenticated.ToString());
私はこれを取得する:私が得るすべては、いくつかの暗号化された文字列であるSystem.Security.Principal.GenericPrincipal
string rawSamlData = Request["SAMLResponse"];
Response.Write("Raw data \n");
Response.Write(rawSamlData);
rawSamlData = HttpUtility.UrlDecode(rawSamlData);
Response.Write("after url decode \n");
Response.Write(rawSamlData);
// read the base64 encoded bytes
byte[] samlData = Convert.FromBase64String(rawSamlData);
Response.Write("after base 64 \n");
Response.Write(samlData);
// read back into a UTF string
string samlAssertion = Encoding.UTF8.GetString(samlData);
Response.Write("saml assertion \n");
Response.Write(samlAssertion);
:私はこれを取得する偽
Response.Write(" Current Principal = " + System.Threading.Thread.CurrentPrincipal.ToString());
。 SAMLレスポンスをデコードしてユーザーを認証するにはどうすればよいですか?