有人可以请我指出创建SamlAssertion的示例的方向,该示例在Conditions节点中包含AudienceRestriction?SAML Assertion中的AudienceRestriction
下面就是我希望把它放在我的代码示例:
//Create the SAML Assertion
SamlAssertion samlAssert = new SamlAssertion();
samlAssert.AssertionId = Convert.ToBase64String(encoding.GetBytes(System.Guid.NewGuid().ToString()));
samlAssert.Issuer = "http://www.example.com/";
// Set up the conditions of the assertion - Not Before and Not After
samlAssert.Conditions = new SamlConditions(DateTime.Now, DateTime.Now.AddMinutes(5));
所需的XML看起来是这样的:
<Assertion xmlns="urn:oasis:names:tc:SAML:1.0:assertion" AssertionID="_e835eca079133299b2f8a2a63ad72fe8" IssueInstant="2007-02-07T20:22:58.165Z" Issuer="http://www.example.com/" MajorVersion="1" MinorVersion="1">
<Conditions NotBefore="2007-02-07T20:22:58.162Z" NotOnOrAfter="2007-02-07T20:24:58.162Z">
<AudienceRestrictionCondition>
<Audience>http://www.example2.com</Audience>
</AudienceRestrictionCondition>
</Conditions>
我看到有一个构造SamlConditions类它允许第三个参数,条件,还有一个SamlAudienceRestriction类,但我似乎无法弄清楚如何连接这两个。我想如果我看到一些代码,这对我来说会变得很痛苦,但不幸的是,我的google-foo今天让我失望。
你用什么库来生成这个库? ComponentSpace?谢谢。 – dana 2012-03-02 18:08:46