Subversion Repositories eFlore/Applications.del

Rev

Rev 2144 | Rev 2156 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2144 Rev 2154
Line 141... Line 141...
141
	 * @param String $jeton un jeton JWT précédemment validé
141
	 * @param String $jeton un jeton JWT précédemment validé
142
	 */
142
	 */
143
	protected function decoderJeton($jeton) {
143
	protected function decoderJeton($jeton) {
144
		$parts = explode('.', $jeton);
144
		$parts = explode('.', $jeton);
145
		$payload = $parts[1];
145
		$payload = $parts[1];
146
		$payload = base64_decode($payload);
146
		$payload = $this->urlsafeB64Decode($payload);
147
		$payload = json_decode($payload, true);
147
		$payload = json_decode($payload, true);
Line 148... Line 148...
148
 
148
 
149
		return $payload;
149
		return $payload;
Line 150... Line 150...
150
	}
150
	}
-
 
151
 
-
 
152
	/**
-
 
153
	 * Decode a string with URL-safe Base64.
-
 
154
	 * copié depuis firebase/jwt
-
 
155
	 *
-
 
156
	 * @param string $input A Base64 encoded string
-
 
157
	 * @return string A decoded string
-
 
158
	 */
-
 
159
	protected function urlsafeB64Decode($input)	{
-
 
160
		$remainder = strlen($input) % 4;
-
 
161
		if ($remainder) {
-
 
162
			$padlen = 4 - $remainder;
-
 
163
			$input .= str_repeat('=', $padlen);
-
 
164
		}
-
 
165
		return base64_decode(strtr($input, '-_', '+/'));
-
 
166
	}
151
 
167
 
152
	/**
168
	/**
153
	 * Retourne un profil d'utilisateur non connecté (anonyme), avec un identifiant de session
169
	 * Retourne un profil d'utilisateur non connecté (anonyme), avec un identifiant de session
154
	 * PHP qui permet de suivre son activité
170
	 * PHP qui permet de suivre son activité
155
	 */
171
	 */
Line 334... Line 350...
334
				$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
350
				$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
335
			}
351
			}
336
		}
352
		}
337
		return $headers;
353
		return $headers;
338
	}
354
	}
339
}
-
 
340
355
}
-
 
356