[opw-web] Support http://openid.net/signon/1.0 in Yadis discovery



commit 5ffa7cac897db24fd97ffbea819e1182446d8360
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Tue Oct 3 20:41:55 2017 -0400

    Support http://openid.net/signon/1.0 in Yadis discovery
    
    dreamwidth.org advertises a <Type/> of http://openid.net/signon/1.0,
    but what it implements is more like OpenID 1.1 - it, for example,
    includes an is_valid element in the mode.check_authentication response.
    Just proceed trying to use OpenID 1.1 with anything reporting
    http://openid.net/signon/1.0, it might even be a mistake based on
    the text of the Yadis specification, which shows examples of that
    type.

 auth/Hybrid/thirdparty/OpenID/LightOpenID.php |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/auth/Hybrid/thirdparty/OpenID/LightOpenID.php b/auth/Hybrid/thirdparty/OpenID/LightOpenID.php
index 2da4b30..addbb29 100644
--- a/auth/Hybrid/thirdparty/OpenID/LightOpenID.php
+++ b/auth/Hybrid/thirdparty/OpenID/LightOpenID.php
@@ -547,9 +547,14 @@ class LightOpenID
                             return $server;
                         }
 
-                        # OpenID 1.1
-                        $ns = preg_quote('http://openid.net/signon/1.1', '#');
-                        if (preg_match('#<Type>\s*'.$ns.'\s*</Type>#s', $content)) {
+                        # OpenID 1.1; the difference between OpenID 1.0 and 1.1 is very
+                        # small, and some providers (in particular dreamwith.org) apparently
+                        # advertise OpenID 1.0 with Yadis discovery, but provide something
+                        # more like OpenID 1.1.
+                        $ns1 = preg_quote('http://openid.net/signon/1.0', '#');
+                        $ns2 = preg_quote('http://openid.net/signon/1.1', '#');
+                        if (preg_match('#<Type>\s*'.$ns1.'\s*</Type>#s', $content) ||
+                            preg_match('#<Type>\s*'.$ns2.'\s*</Type>#s', $content)) {
 
                             preg_match('#<URI.*?>(.*)</URI>#', $content, $server);
                             preg_match('#<.*?Delegate>(.*)</.*?Delegate>#', $content, $delegate);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]