|
@@ -26,6 +26,8 @@
|
26
|
26
|
|
27
|
27
|
class URLBuilder {
|
28
|
28
|
|
|
29
|
+ const MIN_VERSION_FOR_NS = 2;
|
|
30
|
+
|
29
|
31
|
private static $namespace = array(
|
30
|
32
|
1 => 'http://openid.net/signon/1.1',
|
31
|
33
|
2 => 'http://specs.openid.net/auth/2.0'
|
|
@@ -58,7 +60,6 @@
|
58
|
60
|
|
59
|
61
|
public static function buildRequest($type, $base, $delegate, $identity, $returnURL, $handle, $version = 1) {
|
60
|
62
|
$args = array(
|
61
|
|
- 'openid.ns' => self::$namespace[$version],
|
62
|
63
|
'openid.mode' => 'checkid_' . $type,
|
63
|
64
|
'openid.identity' => $delegate,
|
64
|
65
|
'openid.claimed_id' => $identity,
|
|
@@ -67,6 +68,10 @@
|
67
|
68
|
array('openid.nonce' => $_SESSION['openid']['nonce']))
|
68
|
69
|
);
|
69
|
70
|
|
|
71
|
+ if ($version >= self::MIN_VERSION_FOR_NS) {
|
|
72
|
+ $args['openid.ns'] = self::$namespace[$version];
|
|
73
|
+ }
|
|
74
|
+
|
70
|
75
|
if ($handle !== null) {
|
71
|
76
|
$args['openid.assoc_handle'] = $handle;
|
72
|
77
|
}
|
|
@@ -110,11 +115,14 @@
|
110
|
115
|
|
111
|
116
|
public static function buildAssociate($server, $version = 1) {
|
112
|
117
|
$args = array(
|
113
|
|
- 'openid.ns' => self::$namespace[$version],
|
114
|
118
|
'openid.mode' => 'associate',
|
115
|
119
|
'openid.assoc_type' => 'HMAC-SHA1',
|
116
|
120
|
);
|
117
|
121
|
|
|
122
|
+ if ($version >= self::MIN_VERSION_FOR_NS) {
|
|
123
|
+ $args['openid.ns'] = self::$namespace[$version];
|
|
124
|
+ }
|
|
125
|
+
|
118
|
126
|
if (KeyManager::supportsDH()) {
|
119
|
127
|
$args['openid.session_type'] = 'DH-SHA1';
|
120
|
128
|
$args['openid.dh_modulus'] = KeyManager::getDhModulus();
|
|
@@ -129,10 +137,13 @@
|
129
|
137
|
|
130
|
138
|
public static function buildAuth($params, $version = 1) {
|
131
|
139
|
$args = array(
|
132
|
|
- 'openid.ns' => self::$namespace[$version],
|
133
|
140
|
'openid.mode' => 'check_authentication'
|
134
|
141
|
);
|
135
|
142
|
|
|
143
|
+ if ($version >= self::MIN_VERSION_FOR_NS) {
|
|
144
|
+ $args['openid.ns'] = self::$namespace[$version];
|
|
145
|
+ }
|
|
146
|
+
|
136
|
147
|
$toadd = array('assoc_handle', 'sig', 'signed');
|
137
|
148
|
$toadd = array_merge($toadd, explode(',', $params['openid_signed']));
|
138
|
149
|
|