summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId/Yadis/XrdElement.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-12-15 22:17:20 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-12-15 22:17:20 -0800
commite12782c1a6727390b2107ff2e39d4ac6173d86fc (patch)
tree3be0ccda0a9425927263f5b6b9616ef8ba11ac08 /src/DotNetOpenId/Yadis/XrdElement.cs
parent078b1f350eb40ceee7423c25b1d833dd1f242da4 (diff)
parenta545f7be2693596fa14540c359e43150a6a7cf88 (diff)
downloadDotNetOpenAuth-origin/mono.zip
DotNetOpenAuth-origin/mono.tar.gz
DotNetOpenAuth-origin/mono.tar.bz2
Merge branch 'v2.5' into monoorigin/mono
Conflicts: src/DotNetOpenId/Properties/AssemblyInfo.cs src/DotNetOpenId/RelyingParty/AuthenticationResponse.cs
Diffstat (limited to 'src/DotNetOpenId/Yadis/XrdElement.cs')
-rw-r--r--src/DotNetOpenId/Yadis/XrdElement.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/DotNetOpenId/Yadis/XrdElement.cs b/src/DotNetOpenId/Yadis/XrdElement.cs
index 285677b..5c0ba44 100644
--- a/src/DotNetOpenId/Yadis/XrdElement.cs
+++ b/src/DotNetOpenId/Yadis/XrdElement.cs
@@ -22,6 +22,28 @@ namespace DotNetOpenId.Yadis {
}
}
+
+ int XriResolutionStatusCode {
+ get {
+ var n = Node.SelectSingleNode("xrd:Status", XmlNamespaceResolver);
+ string codeString;
+ if (n == null || string.IsNullOrEmpty(codeString = n.GetAttribute("code", ""))) {
+ throw new OpenIdException(Strings.XriResolutionStatusMissing);
+ }
+ int code;
+ if (!int.TryParse(codeString, out code) || code < 100 || code > 399) {
+ throw new OpenIdException(Strings.XriResolutionStatusMissing);
+ }
+ return code;
+ }
+ }
+
+ public bool IsXriResolutionSuccessful {
+ get {
+ return XriResolutionStatusCode == 100;
+ }
+ }
+
public string CanonicalID {
get {
var n = Node.SelectSingleNode("xrd:CanonicalID", XmlNamespaceResolver);
@@ -29,6 +51,13 @@ namespace DotNetOpenId.Yadis {
}
}
+ public bool IsCanonicalIdVerified {
+ get {
+ var n = Node.SelectSingleNode("xrd:Status", XmlNamespaceResolver);
+ return n != null && string.Equals(n.GetAttribute("cid", ""), "verified", StringComparison.Ordinal);
+ }
+ }
+
IEnumerable<ServiceElement> searchForServiceTypeUris(Util.Func<Protocol, string> p) {
var xpath = new StringBuilder();
xpath.Append("xrd:Service[");