下面是统一认证系统SOAP接口,根据应用系统请求生成的SAML响应的实例:
<Response xmlns="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:samlp=
"urn:oasis:names:tc:SAML:1.0:protocol"
InResponseTo="560c2de3-5dea-48c1-9004-6bfaa1daafae"
IssueInstant="2003-10-28T09:21:08Z" MajorVersion="1" MinorVersion="0" Recipient="90" ResponseID="32600595-16fc-49d6-96b8-86e11311cd59">
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">
</ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
<ds:Reference URI="">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
<ds:DigestValue>wd8Ga3PRKTfjP95iQyT4yW0RR1s=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>EHcl01Z19jMy5ltn5R90ulFXC9qQK658apnP00xl7n5vkRY+9mV3rRSYM1cIY3S06LFIQImY8lGGK/Q6fjl/8w==
</ds:SignatureValue></ds:Signature>
<Status><StatusCode Value="samlp:Success"></StatusCode></Status>
<Assertion xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
AssertionID="e08f2775-ec45-4de5-ac3b-5a6048a7f8fe"
IssueInstant="2003-10-28T09:21:29Z" Issuer="CSDL" MajorVersion="1" MinorVersion="0">
<Conditions NotBefore="2003-10-28T09:21:08Z" NotOnOrAfter="2003-10-28T09:26:08Z"></Conditions>
<AuthenticationStatement AuthenticationInstant="2003-10-28T09:20:25Z" AuthenticationMethod="FORM">
<Subject>
<NameIdentifier>test</NameIdentifier>
</Subject>
<SubjectLocality IPAddress="192.168.0.42"></SubjectLocality>
</AuthenticationStatement>
<AttributeStatement>
<Subject><NameIdentifier>test</NameIdentifier></Subject>
<Attribute AttributeName="roles" AttributeNamespace="roles">
<AttributeValue>role1</AttributeValue>
</Attribute>
</AttributeStatement>
</Assertion>
</Response>
下面分析SAML响应的格式。可以将上述的例子简化为:
< Response>
<ds:Signature> </ds:Signature>
<Status> </Status>
<Assertion>
<Conditions> </Conditions>
<AuthenticationStatement> </AuthenticationStatement>
<AttributeStatement> </AttributeStatement>
</Assertion>
</ Response >
下面对其结构进行解释:
< Response>节点中的Recipient属性指明了接收响应的资源方的标识,InResponseTo属性指明了是对那一条SAML请求的响应。
<ds:Signature>节点是对整个SAML响应文档进行数字签名的。
<Status>用来表示响应的状态,其子节点<StatusCode Value="samlp:Success">表示请求被成功的处理。
随后的<Assertion>节点返回了对该请求处理产生的断言。断言的<Conditions>表明了断言有效的条件。系统要依据它和断言的ID进行重放缓冲,防止重放攻击。
可以看出该断言一共包括两个声明:
1,认证声明<AuthenticationStatement>包含了用户认证的信息, 罗列了用户登录的基本信息,包括认证时间、认证方式、用户标识、认证IP等。
2,属性声明<AttributeStatement>包含了用户在此资源上的角色属性。以返回一个属性的值,它可以是一个集合。





