My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 41 attachment: loid.patch (1.2 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/lightopenid/openid.php b/lightopenid/openid.php
index 767a274..2ebb62d 100644
--- a/lightopenid/openid.php
+++ b/lightopenid/openid.php
@@ -335,6 +335,29 @@ class LightOpenID
}

/**
+ * Performs Google Apps specific openid endpoint discovery.
+ * This uses data from host-meta file provided by Google.
+ *
+ * Falls back to {@link discover()}.
+ *
+ * @throws ErrorException
+ * @param string $url
+ * @return string OP Endpoint (i.e. OpenID provider address).
+ */
+ function discover_google_apps($url)
+ {
+ $domain_name = $url;
+ if (preg_match('#^https?://([^/]+)#', $url, $matches)) {
+ $domain_name = $matches[1];
+ }
+ $response = $this->request_curl('https://www.google.com/accounts/o8/.well-known/host-meta?hd=' . $domain_name);
+ if (!preg_match('#Link: <(.*)>;#', $response, $matches)) {
+ throw new ErrorException('Link for "' . $domain_name . '" is not found in Google host-meta file.');
+ }
+ return $this->discover($matches[1]);
+ }
+
+ /**
* Performs Yadis and HTML discovery. Normally not used.
* @param $url Identity URL.
* @return String OP Endpoint (i.e. OpenID provider address).
Powered by Google Project Hosting