<?xml 
version="1.0" encoding="utf-8"?>
<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
>

<channel xml:lang="fr">
	<title>OpenID Connect OAuth Server d&#233;di&#233; </title>
	<link>https://oa.dnc.global/</link>
	<description>OAuth Server by DnC (OAuthSD) est un serveur d'authentification qui impl&#233;mente OAuth 2.0 et OpenID Connect.
Avec la connexion unique, une entit&#233; permet aux utilisateurs de ses applications de naviguer de l'une &#224; l'autre de fa&#231;on trans-parente. En centralisant l'authentification des applications et des utilisateurs, un serveur OpenID Connect permet de contr&#244;ler parfaitement l'acc&#232;s des applications et des utilisateurs aux informations sensibles.</description>
	<language>fr</language>
	<generator>SPIP - www.spip.net</generator>

	<image>
		<title>&lt;small&gt;OpenID Connect&lt;/small&gt; OAuth Server &lt;small&gt; d&#233;di&#233; &lt;/small&gt;</title>
		<url>https://oa.dnc.global/local/cache-vignettes/L144xH126/siteon0-a21bf.png?1733820003</url>
		<link>https://oa.dnc.global/</link>
		<height>126</height>
		<width>144</width>
	</image>



<item xml:lang="fr">
		<title>JSON Web Token (JWT)</title>
		<link>https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt</link>
		<guid isPermaLink="true">https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt</guid>
		<dc:date>2020-08-08T08:50:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;JWT est un standard ouvert (RFC 7519) qui d&#233;finit une mani&#232;re compacte et autonome de transmission s&#233;curis&#233;e d'informations entre les parties sous la forme d'un objet JSON. &lt;br class='autobr' /&gt;
Les documents suivants sp&#233;cifient comment le jeton JWT est mis en oeuvre : pour OAuth 2.0 : RFC 7523 : JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants pour OpenID Connect : OpenID Connect Core 1.0 incorporating errata set 1. &lt;br class='autobr' /&gt;
Avertissement : OpenID Connect fait un usage particulier de (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html" rel="directory"&gt;JSON Web Token (JWT, JWS)&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L93xH94/arton35-0a04f.png?1733818769' width='93' height='94' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;JWT est un standard ouvert (&lt;a href=&#034;https://datatracker.ietf.org/doc/rfc7519/&#034; class='spip_out' rel='external'&gt;RFC 7519&lt;/a&gt;) qui d&#233;finit une mani&#232;re compacte et autonome de transmission s&#233;curis&#233;e d'informations entre les parties sous la forme d'un objet JSON.&lt;/p&gt;
&lt;p&gt;Les documents suivants sp&#233;cifient comment le jeton JWT est mis en oeuvre :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; pour OAuth 2.0 : &lt;a href=&#034;https://datatracker.ietf.org/doc/rfc7523/&#034; class='spip_out' rel='external'&gt;RFC 7523 : JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants&lt;/a&gt; &lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; pour OpenID Connect : &lt;a href=&#034;http://openid.net/specs/openid-connect-core-1_0.html&#034; class='spip_out' rel='external'&gt;OpenID Connect Core 1.0 incorporating errata set 1&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Avertissement : OpenID Connect fait un usage particulier de JWT pour &#233;laborer le jeton d'identit&#233;. Voyez : &lt;a href='https://oa.dnc.global/-OpenID-Connect-6-.html#openidconnectlejetondidentiteidtokenjwtsigneoujws' class='spip_in'&gt;OpenID Connect : Le jeton d'identit&#233; ID Token (JWT sign&#233; ou JWS)&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Structure du Jeton JWS (JWT sign&#233;)&lt;/h3&gt;
&lt;p&gt;Un jeton JWT (prononc&#233; &#171; jot &#187;) sign&#233; se compose de trois parties s&#233;par&#233;es par des points (.) :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;&lt;header&gt;.&lt;payload&gt;.&lt;signature&gt;&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;Chacune de ces trois composantes est cod&#233; Base64Url. &lt;a href=&#034;https://bshaffer.github.io/oauth2-server-php-docs/&#034; class='spip_out' rel='external'&gt;OAuth 2.0 Server PHP&lt;/a&gt; utilise les fonctions suivantes :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PHP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @author Brent Shaffer &lt;bshafs at gmail dot com&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt; * @license MIT License&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;public&lt;/span&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;function&lt;/span&gt; urlSafeB64Encode&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$data&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$b64&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/base64_encode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;base64_encode&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$data&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$b64&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/str_replace&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;str_replace&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'+'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'/'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;&lt;span style=&#034;color: #000099; font-weight: bold;&#034;&gt;\r&lt;/span&gt;&#034;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;&lt;span style=&#034;color: #000099; font-weight: bold;&#034;&gt;\n&lt;/span&gt;&#034;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'='&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'-'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'_'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$b64&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$b64&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;public&lt;/span&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;function&lt;/span&gt; urlSafeB64Decode&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$b64&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$b64&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/str_replace&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;str_replace&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'-'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'_'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'+'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'/'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$b64&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;a href=&#034;http://www.php.net/base64_decode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;base64_decode&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$b64&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://oa.dnc.global/local/cache-code/6e61d2a1a9c1df8f76986a1a99729669.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Bien que son format compact incite &#224; le transmettre par URL, il est recommand&#233; de le transmettre par Header dans l'en-t&#234;te Authorization avec le m&#233;canisme d'authentification Bearer :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImRlbW8iLCJmdWxsTmFtZSI6&lt;/code&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;Header : Ent&#234;te&lt;/h3&gt;
&lt;p&gt;L'en-t&#234;te se compose g&#233;n&#233;ralement d'un array JSON de deux membres :&lt;/p&gt;
&lt;p&gt;Alg : le type du jeton, qui est donc JWT&lt;br class='autobr' /&gt;
Typ : l'algorithme de hachage utilis&#233;, comme HMAC SHA256 ou RSA.&lt;/p&gt;
&lt;p&gt;Pour coder/d&#233;coder la signature, OAuth Server by DnC utilise par d&#233;faut l'algorithme RS256 et peut utiliser HS256, HS384 ou HS512 ainsi que RS384 et RS512.&lt;/p&gt;
&lt;p&gt;Par exemple :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;{&lt;br /&gt; &#034;typ&#034;: &#034;JWT&#034;,&lt;br /&gt; &#034;alg&#034;: &#034;RS256&#034;&lt;br /&gt; }&lt;/code&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;Paylod : Charge utile&lt;/h3&gt;
&lt;p&gt;La charge utile contient les d&#233;clarations sous le format JSON.&lt;/p&gt;
&lt;p&gt;Les d&#233;clarations (claims) sont des informations sur une entit&#233; (g&#233;n&#233;ralement, l'utilisateur) et des m&#233;tadonn&#233;es suppl&#233;mentaires.&lt;/p&gt;
&lt;p&gt;Il existe trois types de d&#233;clarations : reserved, public et private.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;D&#233;clarations r&#233;serv&#233;es&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ces d&#233;clarations sont r&#233;serv&#233;es, en ce sens que leur nom ne doit pas &#234;tre utilis&#233; par d'autres d&#233;clarations qui pourraient &#234;tre d&#233;finies dans le cadre d'un protocole ou d'une application particuliers.&lt;/p&gt;
&lt;p&gt;Elles sont pr&#233;d&#233;finies par le standard JWT (voir &lt;a href=&#034;https://tools.ietf.org/html/rfc7519#section-4.1.7&#034; class='spip_out' rel='external'&gt;Registered Claim Names&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Format des d&#233;clarations r&#233;serv&#233;es&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Avertissement : les d&#233;finitions donn&#233;es ici sont celles de l'IETF (RFC 7523), diff&#233;rente de la d&#233;finition g&#233;n&#233;rale donn&#233;e par la RFC 7519. La fondation OpenID (openid.net) donne une d&#233;finition plus compl&#232;te et diff&#233;rente sur certains points.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Les d&#233;clarations r&#233;serv&#233;es propres &#224; JWT sont les suivantes (voir &lt;a href=&#034;https://tools.ietf.org/html/rfc7523#section-3&#034; class='spip_out' rel='external'&gt;JWT Format and Processing Requirements&lt;/a&gt;) :&lt;/p&gt;
&lt;p&gt;1. Le jeton JWT DOIT contenir une d&#233;claration &#034;&lt;strong&gt;iss&lt;/strong&gt;&#034; (&lt;strong&gt;&#233;metteur&lt;/strong&gt;) contenant l'identifiant unique de l'entit&#233; qui a &#233;mis le jeton.&lt;/p&gt;
&lt;p&gt;2. Le jeton JWT DOIT contenir une d&#233;claration &#034;&lt;strong&gt;sub&lt;/strong&gt;&#034; (&lt;strong&gt;subject&lt;/strong&gt;) identifiant le Principal qui est le sujet de la JWT. Deux cas doivent &#234;tre diff&#233;renci&#233;s :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;A. Pour Authorization Grant, le sujet identifie g&#233;n&#233;ralement un accesseur autoris&#233; pour lequel le jeton d'acc&#232;s est demand&#233; (c'est-&#224;-dire le propri&#233;taire de la ressource ou un d&#233;l&#233;gu&#233; autoris&#233;), mais dans certains cas, ce peut &#234;tre un identifiant pseudonyme ou une autre valeur indiquant un utilisateur anonyme.&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb1' class='spip_note' rel='appendix' title='Cette d&#233;finition approximative implique que la valeur de &#034;sub&#034; et son (...)' id='nh1'&gt;1&lt;/a&gt;]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;B. Pour Client Authentication&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb2' class='spip_note' rel='appendix' title='Il s'agit du flux JWT Bearer Authorization Grant.' id='nh2'&gt;2&lt;/a&gt;]&lt;/span&gt;, le sujet DOIT &#234;tre le &#034;client_id&#034; du client OAuth.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;3. Le jeton JWT DOIT contenir une d&#233;finition &#034;&lt;strong&gt;aud&lt;/strong&gt;&#034; (&lt;strong&gt;audience&lt;/strong&gt;), audience(s) pour laquelle (ou lesquelles) ce jeton d'identit&#233; est destin&#233;. Il DOIT contenir le client_id OAuth 2.0 de la partie de confiance en tant que valeur d'audience.&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb3' class='spip_note' rel='appendix' title='La sp&#233;cification pr&#233;voit : &#034;Il PEUT aussi contenir des identifiants pour (...)' id='nh3'&gt;3&lt;/a&gt;]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;4. Le jeton JWT DOIT contenir une d&#233;finition &#034;&lt;strong&gt;exp&lt;/strong&gt;&#034; (&lt;strong&gt;expiration time&lt;/strong&gt;) qui limite la fen&#234;tre de temps pendant laquelle le JWT peut &#234;tre utilis&#233;.&lt;/p&gt;
&lt;p&gt;5. Le JWT PEUT contenir une d&#233;finition &#171; &lt;strong&gt;nbf&lt;/strong&gt; &#187; (&lt;strong&gt;not before&lt;/strong&gt;) qui identifie l'instant avant lequel le jeton NE DOIT PAS &#234;tre accept&#233;.&lt;/p&gt;
&lt;p&gt;6. Le JWT PEUT contenir une d&#233;finition &#034;&lt;strong&gt;iat&lt;/strong&gt;&#034; &lt;strong&gt;(issued at&lt;/strong&gt;) qui identifie l'instant auquel le jeton a &#233;t&#233; d&#233;livr&#233;.&lt;/p&gt;
&lt;p&gt;7. Le jeton JWT PEUT contenir une d&#233;finition &#034;&lt;strong&gt;jti&lt;/strong&gt;&#034; (&lt;strong&gt;JWT ID&lt;/strong&gt;) qui fournit un identifiant unique pour le jeton. Si c'est le cas, le serveur OAuthSD s'assure qu'un jeton JWT n'est pas r&#233;utilis&#233; pendant sa dur&#233;e de validit&#233;.&lt;/p&gt;
&lt;p&gt;Le jeton JWT peut &#233;galement pr&#233;senter une d&#233;claration &lt;strong&gt;at_hash&lt;/strong&gt;, voir : &lt;a href='https://oa.dnc.global/-Gestion-du-jeton-d-acces-.html#validationdujetondaccesavecladeclarationat_hashdujetondidentite' class='spip_in'&gt;Validation du jeton d'acc&#232;s avec la d&#233;claration at_hash du jeton d'identit&#233;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;D&#233;clarations publiques&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Elles peuvent &#234;tre d&#233;finies &#224; volont&#233;. Mais pour &#233;viter les collisions, leurs noms devraient &#234;tre choisis dans le IANA JSON Web Token Registry mentionn&#233; pr&#233;c&#233;demment ou &#234;tre d&#233;finis avec la d&#233;claration d'un espace de noms.&lt;/p&gt;
&lt;p&gt;Exemple de d&#233;clarations :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;{ &lt;br /&gt; &#034;iss&#034;: &#034;https:\/\/oa.dnc.global&#034;,&lt;br /&gt; &#034;iat&#034;:1410255630,&lt;br /&gt; &#034;exp&#034;:1410259230,&lt;br /&gt; &#034;sub&#034;: &#034;a394190a00f2d36b21309036b0b&#034;,&lt;br /&gt; &#034;aud&#034;:&#034;_c036b0b6f97a394190a00f2d36b213091938d225&#034;&lt;br /&gt; }&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;D&#233;clarations priv&#233;es&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ce sont des d&#233;clarations personnalis&#233;es cr&#233;&#233;es pour partager des informations entre les parties qui ont pr&#233;vu de les utiliser.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Il doit &#234;tre bien compris que l'en-t&#234;te et la charge utile sont de simples cha&#238;nes cod&#233;es en base64, qui peuvent facilement &#234;tre d&#233;chiffr&#233;es et lues. Il ne doit donc pas y figurer de donn&#233;e sensible.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Signature&lt;/h3&gt;
&lt;p&gt;La signature est utilis&#233;e pour v&#233;rifier que l'exp&#233;diteur du jeton JWT est bien celui qu'il pr&#233;tend &#234;tre et de veiller &#224; ce que le message n'a pas &#233;t&#233; modifi&#233; en cours de route. Un JWT sign&#233; est conforme au standard JWS (JSON Web Signature, RFC 7515).&lt;/p&gt;
&lt;p&gt;Le JWT est sign&#233; en utilisant un secret (avec l'algorithme HMAC) ou une paire de cl&#233;s publique/priv&#233;e en utilisant RSA. C'est cette deuxi&#232;me solution qui est pr&#233;f&#233;r&#233;e par OAuthSD (la signature par HMAC est jug&#233;e insuffisamment s&#233;curis&#233;e).&lt;/p&gt;
&lt;p&gt;Lorsque l'application passe le jeton &#224; un serveur de ressource prot&#233;g&#233;e (RS), &lt;strong&gt;il est imp&#233;ratif que le serveur de ressource valide le jeton&lt;/strong&gt;. Le serveur de ressource (RS) qui valide la signature doit &#234;tre en possession de la cl&#233; publique correspondant &#224; la cl&#233; priv&#233;e avec laquelle la signature a &#233;t&#233; &#233;labor&#233;e. Il est &#233;galement possible, voire avantageux, de faire valider le jeton par le serveur d'authentification (voir : &lt;a href='https://oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectintrospectionintrospectionendpoint' class='spip_in'&gt;API Open ID Connect : Introspection (Introspection Endpoint)&lt;/a&gt;).&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;OAuthSD : gestion de la paire de cl&#233;s publique/priv&#233;e&lt;/h3&gt;
&lt;p&gt;A chaque application cliente enregistr&#233;e sur le serveur correspond une paire de cl&#233;s publique/priv&#233;e.&lt;/p&gt;
&lt;p&gt;OAuthSD facilite la cr&#233;ation et la gestion des cl&#233;s de la fa&#231;on suivante :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; La paire de cl&#233;s publique/priv&#233;e est cr&#233;&#233;e automatiquement au moment de l'inscription de l'application cliente sur le serveur OAuthSD.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; L'interface de gestion d'OAuthSD permet &#224; l'auteur-propri&#233;taire de l'application d'&#233;diter ces cl&#233;s.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; De plus, un &lt;strong&gt;script updatekeys.php&lt;/strong&gt; du core permet de re-g&#233;n&#233;rer les cl&#233;s. Il est recommand&#233; d'appeler ce script par une t&#226;che CRON locale r&#233;guli&#232;rement, par exemple tous les deux mois. &lt;br class='autobr' /&gt;
Ce processus est totalement transparent pour les applications clientes validant la signature du JWT par introspection ou qui interogent le point d'acc&#232;s Keys pour r&#233;cup&#233;rer la cl&#233; publique.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Remarque de s&#233;curit&#233;&lt;/h3&gt;
&lt;p&gt;Notons que la validation du jeton ne suffit pas au serveur de ressource pour &lt;strong&gt;s'assurer que l'application qui pr&#233;sente le jeton le d&#233;tient l&#233;gitimement&lt;/strong&gt; et &#233;viter de r&#233;pondre &#224; une application &#233;trang&#232;re. Voir &#224; ce sujet : &lt;a href='https://oa.dnc.global/-Authentifier-l-application-.html#verificationdeloriginedelarequeterecueparunserveurderessource' class='spip_in'&gt;V&#233;rification de l'origine de la requ&#234;te re&#231;ue par un serveur de ressource&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div class='rss_notes'&gt;&lt;div id='nb1'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh1' class='spip_note' title='Notes 1' rev='appendix'&gt;1&lt;/a&gt;] &lt;/span&gt;Cette d&#233;finition approximative implique que la valeur de &#034;sub&#034; et son interpr&#233;tation d&#233;pendent de l'application.&lt;/p&gt;
&lt;/div&gt;&lt;div id='nb2'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh2' class='spip_note' title='Notes 2' rev='appendix'&gt;2&lt;/a&gt;] &lt;/span&gt;Il s'agit du flux &lt;a href='https://oa.dnc.global/-Autorisation-porteuse-de-JWT-JWT-Bearer-Authorization-Grant-.html#demandedautorisationavecjwtjwtbearerauthorizationgrant' class='spip_in'&gt;JWT Bearer Authorization Grant&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;div id='nb3'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh3' class='spip_note' title='Notes 3' rev='appendix'&gt;3&lt;/a&gt;] &lt;/span&gt;La sp&#233;cification pr&#233;voit : &#034;Il PEUT aussi contenir des identifiants pour d'autres audiences. Dans le cas g&#233;n&#233;ral, la valeur aud est un tableau de cha&#238;nes sensibles &#224; la casse. Dans le cas particulier o&#249; il n'y a qu'une audience, la valeur aud PEUT &#234;tre une cha&#238;ne sensible &#224; la casse&#034;. &lt;i&gt;La biblioth&#232;que oauth2-server-php r&#233;duit &#034;aud&#034; &#224; l'id du client client_id&lt;/i&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>JWE (JSON Web Encryption)</title>
		<link>https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jwejsonwebencryption</link>
		<guid isPermaLink="true">https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jwejsonwebencryption</guid>
		<dc:date>2020-01-23T12:10:59Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;La sp&#233;cification JWE (JSON Web Encryption) standardise la fa&#231;on de repr&#233;senter un contenu chiffr&#233; dans une structure de donn&#233;es bas&#233;e sur JSON. C'est une sp&#233;cification g&#233;n&#233;rale, qui s'applique au cryptage de la charge utile du JWT. &lt;br class='autobr' /&gt;
OAuthSD permet aux applications clientes d'&#233;changer des donn&#233;es prot&#233;g&#233;es avec des jetons JWE authentifi&#233;s. &lt;br class='autobr' /&gt;
Comme avec JWS, il n'est pas question d'appliquer dans sa totalit&#233; le &#034;standard&#034; JOSE dont les multiples options et la complexit&#233; ouvrent de grandes failles de s&#233;curit&#233;. (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html" rel="directory"&gt;JSON Web Token (JWT, JWS)&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;La sp&#233;cification JWE (JSON Web Encryption) standardise la fa&#231;on de repr&#233;senter un contenu chiffr&#233; dans une structure de donn&#233;es bas&#233;e sur JSON. C'est une sp&#233;cification g&#233;n&#233;rale, qui s'applique au cryptage de la charge utile du JWT.&lt;/p&gt;
&lt;p&gt;OAuthSD permet aux applications clientes d'&#233;changer des donn&#233;es prot&#233;g&#233;es avec des jetons JWE authentifi&#233;s.&lt;/p&gt;
&lt;p&gt;Comme avec JWS, il n'est pas question d'appliquer dans sa totalit&#233; le &#034;standard&#034; JOSE dont les multiples options et la complexit&#233; ouvrent de grandes failles de s&#233;curit&#233;.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;R&#233;f&#233;rence : &lt;a href=&#034;https://tools.ietf.org/html/rfc7516&#034; class='spip_out' rel='external'&gt;RFC 7516&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Ce document d&#233;finit deux formes de s&#233;rialisation pour repr&#233;senter la charge utile chiffr&#233;e : la s&#233;rialisation compacte JWE et la s&#233;rialisation JWE JSON.&lt;br class='autobr' /&gt;
Nous traiterons la s&#233;rialisation compacte, qui est la seule &#224; produire un JWT s&#233;curis&#233; pour l'URL (Url safe).&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;S&#233;rialisation compacte JWE&lt;/h3&gt;
&lt;p&gt;Avec la s&#233;rialisation compacte JWE, un jeton JWT est construit avec cinq composants cl&#233;s, chacun s&#233;par&#233; par un point (.) : En-t&#234;te JOSE, cl&#233; crypt&#233;e JWE, vecteur d'initialisation JWE, donn&#233;es d'authentification suppl&#233;mentaires (AAD) JWE, charge utile chiffr&#233;e JWE et balise d'authentification JWE :&lt;/p&gt;
&lt;p&gt;&lt;code class='spip_code' dir='ltr'&gt;JOSE header . JWE Encrypted Key . JWE initialization vector . JWE Ciphertext . JWE Authentication Tag&lt;/code&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Cryptage sym&#233;trique, Mode de gestion de cl&#233;&lt;/h3&gt;
&lt;p&gt;Le principe g&#233;n&#233;ral du JWE consiste &#224; crypter un contenu avec un algorithme de cryptage sym&#233;trique. Il est donc n&#233;cessaire que les deux parties, &#233;metteur et destinataire, utilisent une m&#234;me &lt;strong&gt;cl&#233; de chiffrement du contenu (CEK)&lt;/strong&gt; .&lt;/p&gt;
&lt;p&gt;Le Mode de gestion de cl&#233; est la fa&#231;on d'indiquer au destinataire comment il doit d&#233;terminer la valeur de la cl&#233; CEK.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Traduction d'un extrait de la RFC 7516 :&lt;/i&gt;&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;
&lt;strong&gt;Mode de gestion de cl&#233;&lt;/strong&gt;&lt;br class='autobr' /&gt; M&#233;thode de d&#233;termination du chiffrement de la valeur de cl&#233; de chiffrement du contenu (CEK) &#224; utiliser.&lt;br class='autobr' /&gt;
Chaque algorithme utilis&#233; pour d&#233;terminer la valeur CEK utilise un Mode de gestion de cl&#233;. Les Modes de gestion de cl&#233; utilis&#233;s par cette sp&#233;cification sont : (...)&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Chiffrement de cl&#233; (Key Encryption)&lt;/strong&gt;&lt;br class='autobr' /&gt; Un mode de gestion des cl&#233;s dans lequel la valeur CEK est chiffr&#233;e pour le&lt;br class='autobr' /&gt; destinataire pr&#233;vu en utilisant un algorithme de chiffrement asym&#233;trique.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Encapsulation de cl&#233; (Key Wrapping)&lt;/strong&gt;&lt;br class='autobr' /&gt; Un mode de gestion des cl&#233;s dans lequel la valeur CEK est chiffr&#233;e pour le&lt;br class='autobr' /&gt; destinataire pr&#233;vu &#224; l'aide d'un algorithme d'encapsulation de cl&#233; sym&#233;trique.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Accord de cl&#233; directe (Direct Key Agreement)&lt;/strong&gt;&lt;br class='autobr' /&gt; Un mode de gestion des cl&#233;s dans lequel un algorithme d'accord de cl&#233; est utilis&#233;&lt;br class='autobr' /&gt; pour convenir de la valeur CEK.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Accord de cl&#233; avec encapsulation de cl&#233; (Key agreement with Key Wrapping)&lt;/strong&gt;&lt;br class='autobr' /&gt; Un mode de gestion des cl&#233;s dans lequel un algorithme d'accord de cl&#233; est utilis&#233;&lt;br class='autobr' /&gt; pour convenir d'une cl&#233; sym&#233;trique utilis&#233;e pour chiffrer la valeur CEK pour le &lt;br class='autobr' /&gt; destinataire pr&#233;vu &#224; l'aide d'un algorithme d'encapsulation de cl&#233; sym&#233;trique.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Cryptage direct (Direct Encryption)&lt;/strong&gt;&lt;br class='autobr' /&gt;
Un mode de gestion de cl&#233; dans lequel la valeur CEK utilis&#233;e est la valeur du secret de cl&#233; sym&#233;trique partag&#233; entre les parties.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Deux modes sont particuli&#232;rement utilis&#233;s : le cryptage direct ( sym&#233;trique ) pour sa simplicit&#233; et le chiffrement de cl&#233; ( asym&#233;trique ) qui est parfaitement adapt&#233; &#224; des applications inscrites sur un serveur OIDC.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Mode de gestion &#034;Cryptage direct&#034; : Choix de la cl&#233; de chiffrement&lt;/h3&gt;
&lt;p&gt;Dans ce mode, le contenu du JWE est crypt&#233; avec un algorithme sym&#233;trique. Pour le d&#233;crypter, nous avons besoin d'une cl&#233; CEK connue &#224; la fois par l'application &#233;mettant le JWE et le serveur OAuthSD. Le mode de gestion de cl&#233; &#034;Cryptage direct&#034; est le mode de partage le plus simple : la cl&#233; est un secret partag&#233; &#034;hors ligne&#034; entre les deux parties.&lt;/p&gt;
&lt;p&gt;La cl&#233; CEK ne doit pas &#234;tre la cl&#233; publique d'un client, ni aucune autre donn&#233;e publique !&lt;br class='autobr' /&gt;
Il ne peut pas non plus s'agir de la cl&#233; priv&#233;e d'un client, car elle doit rester secr&#232;te &#224; l'int&#233;rieur de l'OP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cas d'un &#034;jeton au porteur&#034; (Bearer Token)&lt;/strong&gt;&lt;br class='autobr' /&gt;
Lorsqu'une ressource prot&#233;g&#233;e pr&#233;sente &#224; l'Introspection un jeton en provenance d'une application, il s'agit d'un &#034;jeton au porteur&#034; (Bearer Token).&lt;/p&gt;
&lt;p&gt;Lorsque le contr&#244;leur d'Introspection re&#231;oit le JWE, il ne peut pas d&#233;terminer l'application avant le d&#233;cryptage (contrairement au cas d'un JWT). Ainsi, le secret CEK ne peut &#234;tre qu'une valeur pr&#233;d&#233;termin&#233;e &#224; l'int&#233;rieur d'un groupe priv&#233; d'applications et de ressources prot&#233;g&#233;es, contr&#244;l&#233;es par un m&#234;me serveur OAuthSD.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cas d'un jeton JWE utilis&#233; dans un protocole PoP&lt;/strong&gt;&lt;br class='autobr' /&gt;
Dans le cas de la preuve de possession apport&#233;e par une application (PoP), ou d'autres protocoles d'identification d'application mis en &#339;uvre par OAuthSD, l'application qui pr&#233;sente le jeton JWE communique son identifiant client_id en m&#234;me temps que le jeton avec le param&#232;tre suppl&#233;mentaire 'aud' (audience).&lt;/p&gt;
&lt;p&gt;Il est alors possible d'utiliser le secret de l'application cliente comme cl&#233; de chiffrement de contenu (CEK).&lt;/p&gt;
&lt;p&gt;Il faudra veiller &#224; ce que le secret ne soit pas r&#233;v&#233;l&#233; par une mauvaise utilisation dans le cadre d'une application sans backend.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Avantages et inconv&#233;nients du cryptage direct&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Le cryptage direct est le plus simple &#224; programmer, et donc le plus souvent utilis&#233;. Mais il est compliqu&#233; &#224; exploiter, car le partage &#034;hors ligne&#034; de la cl&#233; avec de nombreux clients est fastidieux, et la mise &#224; jour plus encore. A cela s'ajoute le risque de compromission inh&#233;rent &#224; une transmission &#034;hors ligne&#034;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Mode de gestion &#034;Chiffrement de cl&#233;&#034;&lt;/h3&gt;
&lt;p&gt;Dans le cas de jetons JWE &#233;mis par des applications clientes enregistr&#233;es sur le serveur OAuthSD, nous avons tout ce qu'il faut pour g&#233;rer un chiffrement asym&#233;trique de la cl&#233; CEK, une paire de cl&#233;s publique/priv&#233;e &#233;tant attach&#233;e &#224; chaque application.&lt;/p&gt;
&lt;p&gt;La cl&#233; publique sera utilis&#233;e pour le chiffrement.&lt;/p&gt;
&lt;p&gt;Pour le d&#233;chiffrement, il n'est pas question de passer la cl&#233; priv&#233;e &#224; une application publique. Il ne serait pas non plus de bonne pratique de la passer &#224; une application de confiance, sauf peut-&#234;tre sur le m&#234;me serveur ou groupe de serveurs co-localis&#233;s. Le d&#233;chiffrement et la validation du jeton sera donc effectu&#233; sur le serveur, avec un contr&#244;leur Introspect adapt&#233; &#224; JWE.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Introspection d'un jeton JWE&lt;/h3&gt;
&lt;p&gt;Dans le serveur OAuthSD , &lt;a href='https://oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectintrospectionintrospectionendpoint' class='spip_in'&gt;le contr&#244;leur Introspection&lt;/a&gt; peut recevoir un jeton d'identit&#233; ID chiffr&#233; avec JWE aussi bien qu'un jeton ID JWT standard.&lt;br class='autobr' /&gt;
Si un jeton JWE est reconnu, il est d&#233;chiffr&#233; et le processus se poursuit avec la charge utile du JWE, qui n'est autre que le JWT.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Cas d'usage de JWE&lt;/h3&gt;
&lt;p&gt;Dans l'utilisation courante du jeton d'identit&#233; (ID Token), la charge utile ne comporte pas de donn&#233;es sensibles. &lt;br class='autobr' /&gt;
Cependant, dans le cas o&#249; des &lt;a href='https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#incorporeraujetonjwtdesdeclarationssupplementaires' class='spip_in'&gt;donn&#233;es suppl&#233;mentaires sont incorpor&#233;es dans le jeton&lt;/a&gt;, comme par exemple :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; des droits particuliers accord&#233;s &#224; un utilisateur, &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; des &#233;l&#233;ments de configuration de l'application cible en fonction d'un utilisateur, etc.&lt;br class='autobr' /&gt;
Il devient utile de masquer ces donn&#233;es.&lt;/p&gt;
&lt;p&gt;Rien n'emp&#234;che &#233;galement de se servir du JWE de fa&#231;on extensive pour &lt;strong&gt;transporter des informations de fa&#231;on prot&#233;g&#233;e&lt;/strong&gt;, ce qui, dans certaines applications, permettrait d'&#233;viter d'exposer des donn&#233;es sensibles &#224; l'aide de web services (ou ressources prot&#233;g&#233;es).&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Attention ! JOSE n'est pas s&#251;r !&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#034;https://paragonie.com/blog/2017/03/jwt-json-web-tokens-is-bad-standard-that-everyone-should-avoid&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://paragonie.com/blog/2017/03/jwt-json-web-tokens-is-bad-standard-that-everyone-should-avoid&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_ps'&gt;&lt;p&gt;R&#233;f&#233;rences :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; &lt;a href=&#034;https://medium.facilelogin.com/jwt-jws-and-jwe-for-not-so-dummies-b63310d201a3&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://medium.facilelogin.com/jwt-jws-and-jwe-for-not-so-dummies-b63310d201a3&lt;/a&gt;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; &lt;a href=&#034;https://github.com/web-token/jwt-framework&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://github.com/web-token/jwt-framework&lt;/a&gt;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; &lt;a href=&#034;https://web-token.spomky-labs.com/&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://web-token.spomky-labs.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; &lt;a href=&#034;https://crypto.stackexchange.com/questions/54330/proper-implementation-of-aes-256-gcm-with-php-openssl&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://crypto.stackexchange.com/questions/54330/proper-implementation-of-aes-256-gcm-with-php-openssl&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Incorporer au jeton JWT des d&#233;clarations suppl&#233;mentaires</title>
		<link>https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#incorporeraujetonjwtdesdeclarationssupplementaires</link>
		<guid isPermaLink="true">https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#incorporeraujetonjwtdesdeclarationssupplementaires</guid>
		<dc:date>2019-06-28T11:04:56Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Les sp&#233;cifications d'OAuth 2.0 autorisent l'ajout de nouvelles d&#233;clarations (claims) &#224; la charge utile du jeton JWT. Cet article montre comment cela est r&#233;alis&#233; dans le cadre d'OAuthSD. &lt;br class='autobr' /&gt;
Cas d'usage &lt;br class='autobr' /&gt;
Il convient de s'assurer que l'utilisateur final est bien habilit&#233; &#224; acc&#233;der &#224; des ressources prot&#233;g&#233;es, qu'il s'agisse de donn&#233;es personnelles ou que l'application soit propri&#233;taire des donn&#233;es. On voudrait &#233;galement pouvoir contr&#244;ler les donn&#233;es transmises par une ressource prot&#233;g&#233;e &#224; une application en fonction (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html" rel="directory"&gt;JSON Web Token (JWT, JWS)&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L93xH94/arton133-f9c9b.png?1733818769' width='93' height='94' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Les sp&#233;cifications d'OAuth 2.0 autorisent l'ajout de nouvelles d&#233;clarations (claims) &#224; la charge utile du jeton JWT.&lt;br class='autobr' /&gt;
Cet article montre comment cela est r&#233;alis&#233; dans le cadre d'OAuthSD.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;Cas d'usage&lt;/h3&gt;
&lt;p&gt;Il convient de s'assurer que l'utilisateur final est bien habilit&#233; &#224; acc&#233;der &#224; des ressources prot&#233;g&#233;es, qu'il s'agisse de donn&#233;es personnelles ou que l'application soit propri&#233;taire des donn&#233;es. On voudrait &#233;galement pouvoir contr&#244;ler les donn&#233;es transmises par une ressource prot&#233;g&#233;e &#224; une application en fonction des droits de l'utilisateur final dans cette application.&lt;/p&gt;
&lt;p&gt;Les administrateurs aussi bien que les utilisateurs finaux utiliseront OpenID Connect pour s'authentifier sur une application. On voudra donc &lt;strong&gt;moduler les droits et privil&#232;ges de l'utilisateur final en fonction de son identit&#233;, de son appartenance ou de son profil&lt;/strong&gt;. L'exemple le plus simple est la distinction entre des droits de lecture des donn&#233;es et des droits de modification. On peut &#233;galement envisager d'attribuer &#224; l'utilisateur des droits d'administration de tout ou partie d'une application.&lt;/p&gt;
&lt;p&gt;Ce n'est pas le r&#244;le du serveur d'authentification, qui se doit d'&#234;tre transparent par rapport aux port&#233;es d'autorisation (scopes) mis en oeuvre par une application. Pour cela, OAuthSD permet &#224; une application externe d'incorporer des d&#233;clarations suppl&#233;mentaires aux jetons JWT, qu'il s'agisse d'un &lt;a href='https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#emettreunjetondaccesentantquejwt' class='spip_in'&gt;jeton d'acc&#232;s au format JWT&lt;/a&gt; ou d'un &lt;a href='https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt' class='spip_in'&gt;jeton d'identit&#233;&lt;/a&gt;. Les ressources prot&#233;g&#233;es &#034;sauront&#034; interpr&#233;ter les donn&#233;es du JWT pour contr&#244;ler leur r&#233;ponse.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Remarque quant &#224; la s&#233;curit&#233; des donn&#233;es&lt;/h3&gt;
&lt;p&gt;Rappelons que la charge utile du jeton JWT n'est pas crypt&#233;e, mais seulement &#034;URL64-encoded&#034;. Il convient donc de ne pas transmettre de cette fa&#231;on des donn&#233;es sensibles.&lt;/p&gt;
&lt;p&gt;L'int&#233;r&#234;t de passer des donn&#233;es suppl&#233;mentaires dans la charge utile du jeton JWT est de les lier de fa&#231;on infalsifiable &#224; l'identit&#233; du client et &#224; celle de l'utilisateur &#224; l'aide de la signature. Cela est particuli&#232;rement pertinent pour transmettre les privil&#232;ges d'un utilisateur ou d'une application &#224; une ressource prot&#233;g&#233;e. Dans cette optique, on peut :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; soit transmettre directement les privil&#232;ges ; par exemple un r&#244;le qui prendrait des valeurs telles que 'administrateur', 'redacteur', 'propri&#233;taire', 'utilisateur', etc., ou tout autre code compris par la ressource, &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; soit transmettre les informations sur l'utilisateur qui permettront &#224; la ressource prot&#233;g&#233;e d'&#233;tablir ses privil&#232;ges.&lt;/p&gt;
&lt;p&gt;Mais attention dans ce deuxi&#232;me cas : il ne faudra pas d&#233;voiler de donn&#233;es sensibles sur l'utilisateur. Si la transmission de telles donn&#233;es &#224; la ressource prot&#233;g&#233;e s'av&#233;rait indispensable, la ressource prot&#233;g&#233;e pourra interroger le &lt;a href='https://oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#demandedinformationssurlutilisateuruserinfoendpoint' class='spip_in'&gt;service Userinfo&lt;/a&gt;. &lt;br class='autobr' /&gt;
On pourrait penser &#224; un jeton crypt&#233; (&lt;a href='https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jwejsonwebencryption' class='spip_in'&gt;JWE&lt;/a&gt;), mais cela n&#233;cessiterait, outre un d&#233;veloppement sp&#233;cifique, de s'&#233;carter du standard OpenID Connect. Il serait beaucoup plus simple de crypter les informations suppl&#233;mentaires en un seul bloc et de les passer dans une d&#233;claration unique.&lt;/p&gt;
&lt;p&gt;Il faut &#233;galement faire attention &#224; ne pas d&#233;passer la longueur admise pour un JWT (&lt;i&gt;&#224; pr&#233;ciser&lt;/i&gt;).&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Transmission de privil&#232;ges de l'utilisateur final avec l'authentification&lt;/h3&gt;
&lt;p&gt;OAuthSD offre deux m&#233;thodes compl&#233;mentaires pour incorporer dans le JWT des informations relatives &#224; un utilisateur final :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'&#233;criture de donn&#233;es suppl&#233;mentaires dans les champs 'profile' et 'scope' de la table users &#224; l'aide du &lt;a href='https://oa.dnc.global/-Techniques-et-code-du-serveur-OAuthSD-.html#apihttprest' class='spip_in'&gt;service HTTP Rest&lt;/a&gt;. Il s'agit d'un processus asynchrone dans la mesure o&#249; les donn&#233;es sont inscrites &#224; un moment choisi par une application ext&#233;rieure, ind&#233;pendamment de l'interrogation du serveur d'autorisation.&lt;/p&gt;
&lt;p&gt;OAuthSD utilise l'&#233;tendue d'autorisation (scope) &#034;privileges&#034; pour contr&#244;ler l'acc&#232;s &#224; ces informations. Quand une application pr&#233;sente le scope 'privileges' dans la demande d'autorisation, les d&#233;clarations 'profil' et 'scope' sont inscrites dans la r&#233;ponse Userinfo ainsi que dans la charge utile du jeton JWT. L'acc&#232;s &#224; l'&lt;a href='https://oa.dnc.global/-Techniques-et-code-du-serveur-OAuthSD-.html#apihttpresttreeql' class='spip_in'&gt;API HTTP REST + TreeQL&lt;/a&gt; donne un bon exemple de transmission de privil&#232;ges.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'incorporation de donn&#233;es suppl&#233;mentaires rafra&#238;chies au moment de la fabrication du jeton JWT, par exemple en interrogeant un service externe. Il s'agit d'un processus synchrone ou de &#034;scope dynamique&#034;, permettant d'obtenir des informations en phase avec celles d&#233;tenues par les applications de gestion des utilisateurs dans le cas o&#249; cette gestion est ext&#233;rieure au serveur.&lt;/p&gt;
&lt;p&gt;Cette deuxi&#232;me m&#233;thode est d&#233;velopp&#233;e maintenant.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Incorporer des donn&#233;es suppl&#233;mentaires &#224; la charge utile du jeton JWT&lt;/h3&gt;
&lt;p&gt;Cette fonctionnalit&#233; est propre &#224; une utilisation d'OAuthSD dans un groupe d'applications ma&#238;tris&#233;es par une m&#234;me organisation (Corporate Realm).&lt;/p&gt;
&lt;p&gt;La biblioth&#232;que oauth2-server-php offre une fonction reconfigurable pour ins&#233;rer des d&#233;clarations suppl&#233;mentaires dans un JWT au moment de sa cr&#233;ation (depuis la version 1.10.0).&lt;/p&gt;
&lt;p&gt;Pour incorporer des donn&#233;es suppl&#233;mentaires, il faut :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; fixer la constante de configuration EXTRA_PAYLOAD &#224; 'true'. &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; d&#233;finir le contenu de la &lt;strong&gt;fonction extra_payload()&lt;/strong&gt; du fichier /oidc/interface/extrapayload.php. &lt;br class='autobr' /&gt;
La fonction extra_payload() doit &#234;tre &#233;crite par le concepteur des applications. Ce peut &#234;tre un appel &#224; un webservice tiers. La fonction re&#231;oit les param&#232;tres client_id, user_id et scope et doit retourner un array de 'claim' =&gt; 'valeur' qui sera combin&#233; avec les d&#233;clarations de la charge utile sans pouvoir remplacer les d&#233;clarations standard.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Cette m&#233;thode permet de cr&#233;er des d&#233;clarations ayant un nom quelconque. Cependant, les d&#233;clarations standard d'OIDC ('id', 'jti', 'iss', 'aud', 'sub', 'exp', 'iat', 'token_type' et 'scope') ne pourront &#234;tre surcharg&#233;es : elles garderont leur nom et leur valeur. Si une d&#233;claration 'scope' est retourn&#233;e, elle sera incorpor&#233;e &#224; la charge utile du JWT sous le nom &#034;extra_scope&#034;.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Les informations sont rafra&#238;chies au moment de la cr&#233;ation du jeton JWT ou de son rafra&#238;chissement. Cela implique que ces informations ne sont pas strictement synchrones de leur correspondantes dans le syst&#232;me ext&#233;rieur. Si les droits d'un utilisateur changent dans le syst&#232;me ext&#233;rieur, il conviendra de r&#233;voquer la session de l'utilisateur afin de provoquer une nouvelle demande d'authentification ce qui entra&#238;nera la cr&#233;ation d'un nouveau jeton JWT. Mais dans le cas o&#249; il serait n&#233;cessaire de modifier un grand nombre d'utilisateurs, une autre fa&#231;on d'assurer le synchronisme sera de fermer le service le temps de la dur&#233;e de vie d'un JWT.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Cette m&#233;thode n'&#233;crit pas dans la table users et, en particulier, dans le champ &#034;scope&#034;. Si les d&#233;clarations suppl&#233;mentaires comprennent une d&#233;claration &#034;scope&#034; (ce qui sera g&#233;n&#233;ralement le cas), la valeur du champ &#034;scope&#034; de la table users sera incorpor&#233;e &#224; la charge utile du JWT sous le nom &#034;user_scope&#034;.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Dans tous les cas, la valeur du param&#232;tre 'scope' pass&#233; &#224; l'appel d'authorize par l'application sera incorpor&#233; sous le nom 'requested_scope'&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb2-1' class='spip_note' rel='appendix' title='Le nom &#034;scope&#034; est malheureusement utilis&#233; par Oauth 2.0 pour des concepts (...)' id='nh2-1'&gt;1&lt;/a&gt;]&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Voyez ci-dessous le code d'un exemple extrayant d'un web-service des donn&#233;es suppl&#233;mentaires.&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div class='rss_notes'&gt;&lt;div id='nb2-1'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh2-1' class='spip_note' title='Notes 2-1' rev='appendix'&gt;1&lt;/a&gt;] &lt;/span&gt;Le nom &#034;scope&#034; est malheureusement utilis&#233; par Oauth 2.0 pour des concepts diff&#233;rents. Il est donc naturel d'utiliser des noms diff&#233;rents pour &#233;viter de m&#233;langer ou d'&#233;craser des donn&#233;es.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		&lt;div class='rss_ps'&gt;&lt;h3 class=&#034;spip&#034;&gt;Exemple : Donn&#233;es suppl&#233;mentaires issues d'un Web Service&lt;/h3&gt;
&lt;p&gt;Dans OAuthSD, cette fonctionnalit&#233; est impl&#233;ment&#233;e de la fa&#231;on suivante :&lt;/p&gt;
&lt;p&gt;Il faut tout d'abord d&#233;finir les constantes n&#233;cessaires dans la configuration :&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;/** [dnc13']&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* If true, Authorize will call the function obtain_extra_payload() of &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* /oidc/interface/extrapayload.php to obtain extra data for claims. &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/define&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;define&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'EXTRA_PAYLOAD'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;/* If not null, the function obtain_extra_payload() will check this WS to obtain extra data. &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/define&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;define&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'WS_EXTRA_PAYLOAD_URL'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'https://xxxx.xxx'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://oa.dnc.global/local/cache-code/973d7a7dfbabb11a125456b6ae03048f.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;La fonction extra_payload est d&#233;finie comme &#233;tant la fonction reconfigurable appel&#233;e au moment de la construction de la charge utile du JWT :&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;//[dnc13'] Enable getting extra payload for JWT&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; EXTRA_PAYLOAD &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$server_config&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'jwt_extra_payload_callable'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'extra_payload'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://oa.dnc.global/local/cache-code/9ee8f5834892be622dd665e49bd0eaca.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;La fonction est d&#233;finie dans le dossier /oidc/interface/extrapayload.php. Voici un exemple obtenant les donn&#233;es par appel &#224; un web service :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PHP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;&lt;?php&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;/* extrapayload.php&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;OauthSD project&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;Auteur : Bertrand Degoy &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;Copyright (c) 2019 DnC &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;Licence GPLv3&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;/** [dnc13'] Projet I&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* Fonction de callback appell&#233;e par JwtAccessToken::createPayload()&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* Retourne des d&#233;clarations (claims) &#224; introduire dans le jeton d'identit&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* Les donn&#233;es sont extraites d'un webservice.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* Deux retours du webservice sont accept&#233;s :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* - une valeur scalaire : elle sera affect&#233;e &#224; la d&#233;claration extra_scope dans la charge utile du jeton d'identit&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* - un array associatif au format JSON : apr&#232;s d&#233;codage en array, chaque composante &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* de premier niveau sera pr&#233;par&#233;e en vue d'&#234;tre incorpor&#233;e &#224; la charge utile du jeton JWT.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* Voir : &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* https://oa.dnc.global/web/133&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* https://github.com/bshaffer/oauth2-server-php/pull/804&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @param string $user_id : utilisateur final identifi&#233; par le contr&#244;leur Authorize,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @param string $client_id : application cliente pass&#233;e aux contr&#244;leurs Authorize et Token,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @param string $requested_scopes : les scopes pass&#233;s au contr&#244;leur Authorize, &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @param mixed $cnx : objet PDO connecteur &#224; la base de donn&#233;es.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @return array (empty on error).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;function&lt;/span&gt; extra_payload&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$client_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$user_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$requested_scope&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; EXTRA_PAYLOAD &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$extra&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; obtain_extra_payload&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$client_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$user_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$requested_scope&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$extra&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!==&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/is_array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;is_array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$a_extra&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/json_decode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;json_decode&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$extra&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// array &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$standards&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;id jti iss aud sub exp iat token_type scope&#034;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;foreach&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$a_extra&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;as&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$key&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$value&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/strpos&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;strpos&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$standards&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$key&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!==&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$key&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'extra_'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$key&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$key&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$value&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/empty&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;empty&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$extra&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// valeur scalaire : d&#233;claration extra_scope&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'extra_scope'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$extra&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// vide&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Connect to database&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;global&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$connection&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$cnx&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;new&lt;/span&gt; \PDO&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$connection&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'dsn'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$connection&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'username'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$connection&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'password'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Log error&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; log_error&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'ExtraPayloadWS'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'Empty data'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$client_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$user_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;901&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;0&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$cnx&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Erreur de communication ou erreur du WS. D&#233;j&#224; dans le log.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// int&#233;grer requested_scope si $result n'est pas vide&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/empty&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;empty&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'requested_scope'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$requested_scope&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// vide en cas d'erreur&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;/** [dnc13'] Projet I&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* Obtenir d'un webservice des donn&#233;es suppl&#233;mentaires.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* L'autorisation d'acc&#232;s au WS est obtenue en passant le secret de l'application par la m&#233;thode Authorization Bearer.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @param string $user_id : utilisateur final identifi&#233; par le contr&#244;leur Authorize,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @param string $client_id : application cliente pass&#233;e aux contr&#244;leurs Authorize et Token,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @param string $requested_scopes : les scopes pass&#233;s au contr&#244;leur Authorize,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;* @return mixed false, string or array() les donn&#233;es re&#231;ues du WS sont retourn&#233;es sans modification. &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;function&lt;/span&gt; obtain_extra_payload&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$client_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$user_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$requested_scope&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt; &lt;a href=&#034;http://www.php.net/is_null&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;is_null&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;WS_EXTRA_PAYLOAD_URL&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;include_once&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;__DIR__ &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'../../commons/configure_oidc.php'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Connect to database&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;global&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$connection&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$storage_config&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$cnx&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;new&lt;/span&gt; \PDO&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$connection&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'dsn'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$connection&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'username'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$connection&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'password'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Get the client secret&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$stmt&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$cnx&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;prepare&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&#034;http://www.php.net/sprintf&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;sprintf&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'SELECT client_secret FROM %s WHERE client_id=:client_id'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$storage_config&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'client_table'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$stmt&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;execute&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&#034;http://www.php.net/compact&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;compact&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'client_id'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$data&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$stmt&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;fetch&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;\PDO&lt;span style=&#034;color: #339933;&#034;&gt;::&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;FETCH_ASSOC&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/empty&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;empty&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$client_secret&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/trim&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;trim&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$data&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'client_secret'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Obtain data from WS at WS_EXTRA_PAYLOAD_URL&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$data&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Parameters are POSTed to the WS.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'user_id'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$user_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'client_id'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$client_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'passed_scope'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$requested_scope&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// value passed to Authorize in the request &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/curl_init&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_init&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;WS_EXTRA_PAYLOAD_URL&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_RETURNTRANSFER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_TIMEOUT&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;10&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_HTTPHEADER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'Authorization: Bearer '&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$client_secret&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_POST&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_HTTPHEADER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'Content-Type: application/x-www-form-urlencoded'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_POSTFIELDS&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;a href=&#034;http://www.php.net/http_build_query&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;http_build_query&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$data&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;//curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false);&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/curl_exec&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_exec&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/empty&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;empty&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_close&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_close&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Curl error during WS request.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$error&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/curl_error&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_error&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_close&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_close&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Log error&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; log_error&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'ExtraPayload'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'Comm or WS error: '&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$error&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$client_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$user_id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;900&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;0&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$cnx&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// No client secret, public application?&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// No WS URL &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://oa.dnc.global/local/cache-code/0e9045d62aff21e35c67f23308f4a9f2.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; L'authentification de l'appel au web service est faite en passant le secret de l'application par la m&#233;thode Authorization : Bearer. Ceci suppose que le WS est int&#233;gr&#233; &#224; l'application de supervision du serveur, celle-ci acc&#233;dant aux donn&#233;es des applications clientes. Si ce n'&#233;tait pas le cas, il faudrait modifier le code pour passer une cha&#238;ne secr&#232;te connue des deux parties.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; Le web service re&#231;oit les identifiants de l'application cliente et de l'utilisateur final, ainsi que les port&#233;es demand&#233;es par l'application. Il pourra s'en servir pour appliquer les r&#232;gles m&#233;tier qui conduiront &#224; d&#233;finir la r&#233;ponse, ou &#224; ne pas r&#233;pondre.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; Impl&#233;mentation de la fonction extra_payload() dans oauth2-server-php :&lt;br class='autobr' /&gt;
voir &lt;a href=&#034;https://github.com/bshaffer/oauth2-server-php/pull/804&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://github.com/bshaffer/oauth2-server-php/pull/804&lt;/a&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Exemples&lt;/h3&gt;&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;Cha&#238;ne transmise&lt;/td&gt;
&lt;td&gt;Retour extra_payload&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;&lt;code class='spip_code' dir='ltr'&gt;&#034;1,2&#034;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;array = extra_scope : string = &#034;1,2&#034;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;code class='spip_code' dir='ltr'&gt;&#034;{&#034;\&#034;scope\&#034;:\&#034;1,2\&#034;}&#034;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;array = extra_scope : string = &#034;1,2&#034;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;&lt;code class='spip_code' dir='ltr'&gt;&#034;{\&#034;admin\&#034;:\&#034;1\&#034;}&#034;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;array = admin : string = &#034;1&#034;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;code class='spip_code' dir='ltr'&gt;&#034;admin=1&#034;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;array = extra_scope : string = &#034;admin=1&#034;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;&lt;code class='spip_code' dir='ltr'&gt;&#034;admin=\&#034;1\&#034;&#034;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;array = extra_scope : string = &#034;admin=\&#034;1\&#034;&#034;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;code class='spip_code' dir='ltr'&gt;&#034;{\&#034;key1\&#034;:\&#034;value1\&#034;,\&#034;key2\&#034;:\&#034;value2\&#034;,\&#034;key3\&#034;:\&#034;value3\&#034;}&#034;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;array = &lt;br/&gt;key1 : string = &#034;value1&#034; &lt;br/&gt;key2 : string = &#034;value2&#034; &lt;br/&gt;key3 : string = &#034;value3&#034;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Plus loin avec l'Introspection</title>
		<link>https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#plusloinaveclintrospection</link>
		<guid isPermaLink="true">https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#plusloinaveclintrospection</guid>
		<dc:date>2019-06-24T15:30:48Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;En l'absence d'une norme stable, la biblioth&#232;que oauth2-server-php de Brent Shaffer n'a pas de point d'extr&#233;mit&#233; Introspection. &lt;br class='autobr' /&gt;
OAuthSD, comme de nombreux serveurs d'autorisation, impl&#233;mente son propre contr&#244;leur pour l'Introspection. Il a &#233;t&#233; d&#233;velopp&#233; &#034;au-dessus&#034; de la biblioth&#232;que. &lt;br class='autobr' /&gt;
Que pourrait &#234;tre une &#034;impl&#233;mentation minimale et compatible&#034; du contr&#244;leur Introspection pour la biblioth&#232;que ? Avant de commencer &#224; coder, examinons le projet de RFC 7662 OAuth 2.0 Token Introspection. &lt;br class='autobr' /&gt;
&#192; propos de la (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html" rel="directory"&gt;JSON Web Token (JWT, JWS)&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L150xH150/arton130-630ee.png?1734010453' width='150' height='150' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;En l'absence d'une norme stable, la biblioth&#232;que oauth2-server-php de Brent Shaffer n'a pas de point d'extr&#233;mit&#233; Introspection.&lt;/p&gt;
&lt;p&gt;OAuthSD, comme de nombreux serveurs d'autorisation, impl&#233;mente son propre contr&#244;leur pour l'Introspection. Il a &#233;t&#233; d&#233;velopp&#233; &#034;au-dessus&#034; de la biblioth&#232;que.&lt;/p&gt;
&lt;p&gt;Que pourrait &#234;tre une &#034;impl&#233;mentation minimale et compatible&#034; du contr&#244;leur Introspection pour la biblioth&#232;que ? Avant de commencer &#224; coder, examinons le projet de &lt;a href=&#034;https://datatracker.ietf.org/doc/rfc7662/&#034; class='spip_out' rel='external'&gt;RFC 7662&lt;/a&gt; OAuth 2.0 Token Introspection.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;&#192; propos de la n&#233;cessit&#233; pour le Serveur de Ressource de s'authentifier&lt;/h3&gt;
&lt;p&gt;Selon rfc7662 Section 2.1. :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt; &#034;L'appelant DOIT avoir une autorisation pour acc&#233;der &#224; ce point de terminaison&#034;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;i&gt;(Ce que nous aurions pu faire pour se conformer &#224; cette sp&#233;cification :&lt;br class='autobr' /&gt;
Cette impl&#233;mentation attend un jeton d'acc&#232;s &#233;mis pour un client enregistr&#233; (non public).&lt;br class='autobr' /&gt;
La provenance de ce jeton d'acc&#232;s d&#233;pend du service.&lt;br class='autobr' /&gt;
Il a peut-&#234;tre &#233;t&#233; obtenu du serveur d'autorisation par l'appelant en tant qu'application cliente.&lt;br class='autobr' /&gt;
Ou bien, si l'appelant est un serveur de ressources interrog&#233; par une application cliente, le jeton lui a peut-&#234;tre &#233;t&#233; transmise par l'appelant.)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Nous soumettons &#224; la sagacit&#233; du lecteur les observations suivantes :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Le but de cette autorisation est &#034;Pour emp&#234;cher les attaques par balayage de jetons&#034;.&lt;br class='autobr' /&gt;
Ce type d'attaques est g&#233;n&#233;ralement g&#233;r&#233; au niveau du pare-feu en relation avec le service.&lt;br class='autobr' /&gt;
Par exemple, avec Apache, nous pourrions d&#233;finir une authentification HTTP Basic au niveau du r&#233;pertoire.&lt;br class='autobr' /&gt;
Ensuite, sur un serveur g&#233;r&#233; WHM / cPanel, nous pourrions utiliser CSF / LFD pour bloquer les &#233;checs de connexion r&#233;p&#233;titifs.&lt;br class='autobr' /&gt;
Nous pourrions &#233;galement configurer &#224; cette fin une r&#232;gle Apache Modsec particuli&#232;re.&lt;br class='autobr' /&gt;
Plus g&#233;n&#233;ralement, l'attenuation des attaques est mieux effectu&#233;e en amont plut&#244;t qu'au niveau de l'application. Cela induit une charge de calcul moindre, voire nulle, sur le serveur d'autorisations.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Pour que le serveur de ressources s'authentifie, il doit &#234;tre enregistr&#233; en tant qu'application cliente&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb3-1' class='spip_note' rel='appendix' title='Ceci est l'option prise par IBM' id='nh3-1'&gt;1&lt;/a&gt;]&lt;/span&gt;, ce qui suppose qu'il appartient au domaine de l'entreprise.&lt;br class='autobr' /&gt;
Ceci est vrai dans la plupart des cas, mais nous pouvons d&#233;sirer que tout serveur de ressources &#233;tranger puisse v&#233;rifier un JWT.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;&#192; propos du but de l'Introspection&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Valider la signature&lt;/strong&gt;&lt;br class='autobr' /&gt;
La charge utile du jeton JWT n'est pas crypt&#233;e, seulement encod&#233;e. Son contenu est imm&#233;diatement lisible par le RS avant la validation de la signature.&lt;br class='autobr' /&gt;
Donc, le RS a besoin d'une introspection pour v&#233;rifier que la signature est valide (si elle ne la valide pas localement en utilisant la cl&#233; publique).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Authentifier l'application qui appelle le serveur de ressource (RS)&lt;/strong&gt;&lt;br class='autobr' /&gt;
De plus, le but de transmettre un jeton &#224; un RS est de lui indiquer s'il peut r&#233;pondre &#224; l'application requ&#233;rante et quelles donn&#233;es il peut lui transmettre dans sa r&#233;ponse.&lt;br class='autobr' /&gt;
Un attaquant pourrait avoir vol&#233; un JWT et l'utiliser avec sa propre application. Le risque est que le RS r&#233;ponde &#224; une application et / ou &#224; un utilisateur non autoris&#233;. Il est donc essentiel d'authentifier l'application qui interroge le RS pour l'emp&#234;cher de r&#233;pondre &#224; un malware (voir plus loin).&lt;/p&gt;
&lt;p&gt;Cela dit, quelle t&#226;che sp&#233;cifique doit &#234;tre accomplie par l'Introspection et quelle doit &#234;tre la r&#233;ponse ?&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;&#192; propos de la r&#233;ponse de l'Introspection&lt;/h3&gt;
&lt;p&gt;Selon la section 2.2. de rfc7662, le seul membre requis est &#034;actif&#034;, un indicateur bool&#233;en indiquant la validit&#233; du jeton vu depuis le serveur qui l'a &#233;mis.&lt;br class='autobr' /&gt;
Cela va au-del&#224; de la validation de la signature car cela &#034;indique qu'un jeton donn&#233; a &#233;t&#233; &#233;mis par ce serveur d'autorisation, n'a pas &#233;t&#233; r&#233;voqu&#233; par le propri&#233;taire de la ressource, ...&#034;.&lt;/p&gt;
&lt;p&gt;Mais inclure dans cette valeur la condition &#034;et se trouve dans sa fen&#234;tre temporelle de validit&#233; donn&#233;e&#034; ne parait pas pertinent : le RS poss&#232;de d&#233;j&#224; les informations de la charge utile. En revanche, le jeton pourrait avoir &#233;t&#233; invalid&#233; au niveau du serveur, et c'est cette information que l'introspection apportera. Au passage, notons qu'il n'y a pas de lien entre la dur&#233;e de vie du jeton d'acc&#232;s et celle du jeton d'identit&#233;. Il y a une possibilit&#233; de r&#233;voquer le jeton d'acc&#232;s, mais qu'en est-il du jeton d'identit&#233; ?&lt;/p&gt;
&lt;p&gt;Notez que l'Introspection devrait &#233;galement &#234;tre utilisable pour valider un jeton d'acc&#232;s JWT, avec des membres moins nombreux et diff&#233;rents. C'est une autre raison pour ne pas sp&#233;cifier les membres de fa&#231;on autoritaire.&lt;br class='autobr' /&gt;
&lt;a id=&#034;PasMalware&#034;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Emp&#234;cher le Serveur de Ressource de r&#233;pondre &#224; un malware&lt;/h3&gt;
&lt;p&gt;C'est une question centrale !&lt;/p&gt;
&lt;p&gt;La sp&#233;cification reconna&#238;t la question, mais ne donne pas une r&#233;ponse normalis&#233;e. Il est indiqu&#233; dans la section 2.1 :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;&#034;Le point de terminaison d'introspection PEUT accepter d'autres param&#232;tres OPTIONNELS pour fournir un contexte suppl&#233;mentaire &#224; la requ&#234;te. Par exemple, un serveur d'autorisation peut souhaiter conna&#238;tre l'adresse IP du client acc&#233;dant &#224; la ressource prot&#233;g&#233;e pour d&#233;terminer si le client pr&#233;sentant le jeton est le bon. La d&#233;finition de ce param&#232;tre ou de tout autre param&#232;tre sort du cadre de la pr&#233;sente sp&#233;cification, ... &#034;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Nous proposons mettre ceci en &#339;uvre de la mani&#232;re suivante :&lt;br class='autobr' /&gt;
Si le RS appelant le point de terminaison Introspection transmet l'adresse IP de son propre demandeur dans le &lt;strong&gt;'requester_ip'&lt;/strong&gt;, nous devons v&#233;rifier que cette adresse IP se trouve dans le m&#234;me sous-r&#233;seau que l'application cliente identifi&#233;e par la d&#233;claration 'aud'. Voyez : &lt;a href='https://oa.dnc.global/-Authentifier-l-application-.html#verificationdeloriginedelarequeterecueparunserveurderessource' class='spip_in'&gt;V&#233;rification de l'origine de la requ&#234;te re&#231;ue par un serveur de ressource&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;&#192; propos de l'adaptation de la r&#233;ponse au Serveur de Ressource&lt;/h3&gt;
&lt;p&gt;Il est indiqu&#233; &#224; la section 2.2 :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;&#034;Le serveur d'autorisation PEUT r&#233;pondre diff&#233;remment &#224; diff&#233;rentes ressources prot&#233;g&#233;es qui font la m&#234;me demande. Par exemple, un serveur d'autorisation PEUT limiter les &#233;tendues d'un jeton donn&#233; qui sont renvoy&#233;es &#224; chaque ressource prot&#233;g&#233;e afin d'emp&#234;cher une ressource prot&#233;g&#233;e d'en apprendre davantage sur l'ensemble plus vaste d'applications du r&#233;seau que n&#233;cessaire pour son fonctionnement. &#034;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Cela semble tr&#232;s difficile &#224; mettre en &#339;uvre. Dans l'exemple donn&#233;, qui traite des port&#233;es, le RS doit faire appel &#224; l'introspection avec plus de param&#232;tres ou le AS doit avoir des informations sur le RS. En somme, il s'agit de prendre en compte les scopes au niveau de l'introspection pour d&#233;finir les autorisations.&lt;/p&gt;
&lt;p&gt;Cette prescription peut &#234;tre appliqu&#233;e dans un domaine d'entreprise pour des applications particuli&#232;res, elle ne sera donc pas prise en compte dans notre &#034;impl&#233;mentation minimale et compatible&#034;.&lt;/p&gt;
&lt;p&gt;Nous pensons que &lt;strong&gt;les port&#233;es d&#233;finissant les droits ont une signification qui devrait &#234;tre interpr&#233;t&#233;e par la ressource prot&#233;g&#233;e elle-m&#234;me&lt;/strong&gt;, le serveur d'authentification devant les transmettre de mani&#232;re transparente. Voyez : &lt;a href='https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#incorporeraujetonjwtdesdeclarationssupplementaires' class='spip_in'&gt;Incorporer au jeton JWT des d&#233;clarations suppl&#233;mentaires&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;... ou ne r&#233;pond pas du tout&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Il est indiqu&#233; dans la section 4 :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;&#034;Si le jeton ne peut &#234;tre utilis&#233; que sur certains serveurs de ressources, le serveur d'autorisation DOIT d&#233;terminer s'il peut ou non &#234;tre utilis&#233; sur le serveur de ressources effectuant l'appel d'introspection&#034;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Cette prescription n'est rien de plus qu'une d&#233;clinaison radicale de la pr&#233;c&#233;dente. Nous allons la traiter de la m&#234;me mani&#232;re.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Proposition d'un contr&#244;leur d'introspection pour la biblioth&#232;que&lt;/h3&gt;
&lt;p&gt;Une &#034;impl&#233;mentation minimale et compatible&#034; du contr&#244;leur Introspection aurait les caract&#233;ristiques suivantes :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; se limitera &#224; la validation de la signature JWT avec l'option de v&#233;rification de l'adresse IP du client (param&#232;tre 'requester_ip'), sans aucune hypoth&#232;se quant &#224; l'utilisation du jeton,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; ne n&#233;cessitera pas l'authentification de l'appelant,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; acceptera le jeton porteur de pr&#233;f&#233;rence pour poster un jeton,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; peut r&#233;pondre comme indiqu&#233; dans le RFC.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&#034;https://github.com/bdegoy?utf8=%E2%9C%93&amp;tab=repositories&amp;q=OAuthSD&#034;&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L24xH24/github_24-28c1d.png?1733817782' width='24' height='24' /&gt;&lt;/a&gt; Suivez ce d&#233;veloppement sur GitHub&lt;/strong&gt;&lt;br class='autobr' /&gt;
Voyez le fork :&lt;br class='autobr' /&gt; &lt;a href=&#034;https://github.com/bdegoy/oauth2-server-php-a1&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://github.com/bdegoy/oauth2-server-php-a1&lt;/a&gt;&lt;br class='autobr' /&gt;
Testez avec :&lt;br class='autobr' /&gt; &lt;a href=&#034;https://github.com/bdegoy/oauth2-server-php-introspection-test&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://github.com/bdegoy/oauth2-server-php-introspection-test&lt;/a&gt;&lt;br class='autobr' /&gt;
Discutez-en :&lt;br class='autobr' /&gt; &lt;a href=&#034;https://github.com/bshaffer/oauth2-server-php/pull/964&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://github.com/bshaffer/oauth2-server-php/pull/964&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div class='rss_notes'&gt;&lt;div id='nb3-1'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh3-1' class='spip_note' title='Notes 3-1' rev='appendix'&gt;1&lt;/a&gt;] &lt;/span&gt;Ceci est l'option prise par IBM&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Emettre un jeton d'acc&#232;s en tant que JWT</title>
		<link>https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#emettreunjetondaccesentantquejwt</link>
		<guid isPermaLink="true">https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#emettreunjetondaccesentantquejwt</guid>
		<dc:date>2019-05-24T14:23:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;La biblioth&#232;que oauth2-server-php de Brent Shaffer permet d'&#233;mettre un jeton d'acc&#232;s en tant que JWT. Avec cette fonctionnalit&#233;, les flux de codes d'autorisation OAuth 2.0 et OpenID Connect semblent tr&#232;s similaires, cependant ... &lt;br class='autobr' /&gt;
Voyez : https://bshaffer.github.io/oauth2-server-php-docs/overview/jwt-access-tokens/ &lt;br class='autobr' /&gt;
Configuration du serveur d'autorisations pour le jeton d'acc&#232;s JWT &lt;br class='autobr' /&gt;
Dans la biblioth&#232;que, cela se fait en d&#233;finissant le param&#232;tre de configuration &#034;use_jwt_access_tokens&#034; &#224; 'true' : (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html" rel="directory"&gt;JSON Web Token (JWT, JWS)&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L93xH94/arton129-da361.png?1733818769' width='93' height='94' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;La biblioth&#232;que oauth2-server-php de Brent Shaffer permet d'&#233;mettre un jeton d'acc&#232;s en tant que JWT.&lt;br class='autobr' /&gt;
Avec cette fonctionnalit&#233;, les flux de codes d'autorisation OAuth 2.0 et OpenID Connect semblent tr&#232;s similaires, cependant ...&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Voyez : &lt;a href=&#034;https://bshaffer.github.io/oauth2-server-php-docs/overview/jwt-access-tokens/&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://bshaffer.github.io/oauth2-server-php-docs/overview/jwt-access-tokens/&lt;/a&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Configuration du serveur d'autorisations pour le jeton d'acc&#232;s JWT&lt;/h3&gt;
&lt;p&gt;Dans la biblioth&#232;que, cela se fait en d&#233;finissant le param&#232;tre de configuration &#034;use_jwt_access_tokens&#034; &#224; 'true' :&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$config&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #339933;&#034;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'use_jwt_access_tokens'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #339933;&#034;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://oa.dnc.global/local/cache-code/6b596a368837e4eb2b1886b45efe505a.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Pour la configuration de OAuthSD, le fichier /commons/configure_oauth.php et le fichier configure_oidc.php d&#233;finissent tous deux la constante USE_JWT_ACCESS_TOKENS, fix&#233;e &#224; 'false' par d&#233;faut.&lt;/p&gt;
&lt;p&gt;Avec les flux OpenID Connect, lorsqu'il est configur&#233; sur 'true', le contr&#244;leur Token &#233;met &#224; la fois le jeton d'acc&#232;s et le jeton d'identification en tant que JWT.&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; access_token&lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; string &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYzNDExNjM3Mjc2ZjJjMzUxZjczYz&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;VFx1Rk972S4ON1Dn6FwadTDS2U_A&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; expires_in&lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; long &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;3600&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; token_type&lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; string &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;bearer&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; scope&lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; string &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;openid profile&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; id_token&lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; string &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJvMnNwLmRuYy5nbG9iYWwiLCJzdW...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;m6TFdfGhgjPyIA0w&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://oa.dnc.global/local/cache-code/90b747655193c458131358eca261d8f1.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;Use Case&lt;/h3&gt;
&lt;p&gt;Ecoutons Brent Shaffer&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb4-1' class='spip_note' rel='appendix' id='nh4-1'&gt;1&lt;/a&gt;]&lt;/span&gt; :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;&#034;vous pouvez utiliser les jetons d'acc&#232;s JWT si vous avez des syst&#232;mes distribu&#233;s et que vous devez valider l'authenticit&#233; d'un jeton aupr&#232;s de plusieurs parties sans avoir &#224; passer un appel r&#233;seau.&lt;/p&gt;
&lt;p&gt;Par exemple, un jeton est attribu&#233; par le serveur d'autorisations. Ce jeton est un jeton Web JSON sign&#233; par la cl&#233; priv&#233;e du serveur d'autorisations. Les serveurs de ressources (o&#249; les appels d'API sont effectu&#233;s) sont r&#233;partis dans le monde entier et ex&#233;cutent plusieurs applications. Tant que les serveurs de ressources disposent de la cl&#233; publique du serveur d'autorisations, qui n'a pas besoin d'&#234;tre s&#233;curis&#233;e, ils peuvent valider les jetons rapidement sans aucun appel r&#233;seau. Les jetons n'ont m&#234;me pas besoin d'&#234;tre persist&#233;s.&lt;/p&gt;
&lt;p&gt;C'est un cas d'utilisation d'entreprise, mais il est tr&#232;s utile pour les syst&#232;mes distribu&#233;s..&#034;&lt;/p&gt;
&lt;/blockquote&gt;&lt;h3 class=&#034;spip&#034;&gt;Discussion&lt;/h3&gt;
&lt;p&gt;Cette fonctionnalit&#233; a &#233;t&#233; d&#233;crite en 2014, alors qu'OpenID Connect &#233;tait en construction. Il visait probablement &#224; donner aux utilisateurs d'OAuth2 la capacit&#233; de valider les jetons d'acc&#232;s dans les serveurs de ressources.&lt;/p&gt;
&lt;p&gt;Il faut &#233;galement consid&#233;rer le probl&#232;me pos&#233; par OAuth : ce n'est pas un syst&#232;me d'authentification (mais d'autorisation) parce que le jeton d'acc&#232;s est opaque et ne donne pas d'information sur l'utilisateur final. En incorporant l'ID de l'utilisateur dans le jeton JWT, on fait d'OAuth un syst&#232;me d'authentification ce qui permet de passer l'information sur l'utilisateur &#224; des ressources prot&#233;g&#233;es. C'est ce que Facebook fait avec ce qu'ils appellent le &#034;&lt;a href=&#034;https://developers.facebook.com/docs/reference/login/signed-request/&#034; class='spip_out' rel='external'&gt;signed request&lt;/a&gt;&#034;.&lt;/p&gt;
&lt;p&gt;Avec cette fonctionnalit&#233;, les flux de codes d'autorisation OAuth 2.0 et OpenID Connect semblent tr&#232;s similaires. &lt;br class='autobr' /&gt;
Il faut cependant noter la diff&#233;rence entre jeton d'acc&#232;s et jeton d'identit&#233; : ils ne sont notamment pas li&#233;s dans le temps. La notion de &#034;&lt;strong&gt;session OIDC&lt;/strong&gt;&#034; repose sur la validit&#233; du jeton d'identit&#233; qui expire, alors que le jeton d'acc&#232;s expire ind&#233;pendamment, peut &#234;tre rafra&#238;chi ou peut ne pas expirer. Cette utilisation du jeton d'acc&#232;s en tant que JWT ne peut donc remplacer le jeton d'identit&#233; d'OpenID Connect.&lt;/p&gt;
&lt;p&gt;Les jetons JWT peuvent &#234;tre utilis&#233;s en tant qu'OAuth 2.0 Bearer Tokens pour coder toutes les parties pertinentes d'un jeton d'acc&#232;s dans le jeton d'acc&#232;s lui-m&#234;me au lieu d'avoir &#224; les stocker dans une base de donn&#233;es. Cela pourrait s'av&#233;rer tr&#232;s utile avec les applications sans session (comme les applications &#224; page unique), avec une latence r&#233;duite pour la validation de jeton.&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div class='rss_notes'&gt;&lt;div id='nb4-1'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh4-1' class='spip_note' title='Notes 4-1' rev='appendix'&gt;1&lt;/a&gt;] &lt;/span&gt;&lt;a href=&#034;https://github.com/bshaffer/oauth2-server-php/issues/478#issuecomment-59982374&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://github.com/bshaffer/oauth2-server-php/issues/478#issuecomment-59982374&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Un jeton d'identit&#233; peut &#234;tre utilis&#233; pour ...</title>
		<link>https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#unjetondidentitepeutetreutilisepour</link>
		<guid isPermaLink="true">https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#unjetondidentitepeutetreutilisepour</guid>
		<dc:date>2018-11-13T16:02:53Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Dans la lit&#233;rature sur OpenID Connect, le point de vue est souvent limit&#233; &#224; l'identification centralis&#233;e (SSO ou single sign-on). Un jeton d'identit&#233; est la carte d'identit&#233; de l'utilisateur final et le passeport pour l'application cliente : il peut &#234;tre utilis&#233; &#224; d'autres fins que la connexion de base. &lt;br class='autobr' /&gt;
Le jeton au format JWT pr&#233;sente les avantages suivants : C'est une sp&#233;cification connue, largement adopt&#233;, et des biblioth&#232;ques client disponibles dans de nombreux langages (voyez Adaptation des (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html" rel="directory"&gt;JSON Web Token (JWT, JWS)&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L93xH94/arton64-d1e62.png?1733818770' width='93' height='94' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Dans la lit&#233;rature sur OpenID Connect, le point de vue est souvent limit&#233; &#224; l'identification centralis&#233;e (SSO ou single sign-on).&lt;br class='autobr' /&gt;
Un jeton d'identit&#233; est la carte d'identit&#233; de l'utilisateur final et le passeport pour l'application cliente : il peut &#234;tre utilis&#233; &#224; d'autres fins que la connexion de base.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Le &lt;a href='https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt' class='spip_in'&gt;jeton au format JWT&lt;/a&gt; pr&#233;sente les avantages suivants :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; C'est une sp&#233;cification connue, largement adopt&#233;, et des biblioth&#232;ques client disponibles dans de nombreux langages (voyez &lt;a href='https://oa.dnc.global/-Ressources-pour-les-developpeurs-.html' class='spip_in'&gt;Adaptation des applications&lt;/a&gt;).
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Il facilite la signature et la &lt;a href='https://oa.dnc.global/-OpenID-Connect-6-.html#validationdujetondidentiteidtokenjwtsigneoujws' class='spip_in'&gt;v&#233;rification&lt;/a&gt; &#224; l'aide de biblioth&#232;ques cryptographiques valid&#233;es.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Puisqu'il peut &#234;tre d&#233;cod&#233; au format JSON, cela permet d'inclure des m&#233;tadonn&#233;es et des informations sur le jeton, ainsi que des donn&#233;es compl&#233;mentaires pour l'application &#224; laquelle il est adress&#233;.&lt;/p&gt;
&lt;p&gt;Tant que le serveur d'autorisations et le serveur de ressources s'accordent sur la signification du jeton, le contenu n'a aucune importance. Ce qui signifie que soit on colle au standard OpenID Connect, et alors le serveur de ressource est limit&#233; &#224; UserInfo, soit on est dans un espace propri&#233;taire (corporate realm) o&#249; l'on fait ce que l'on veut.&lt;/p&gt;
&lt;p&gt;Avant d'aborder les utilisations possibles, il faut bien consid&#233;rer que :&lt;br class='autobr' /&gt;
&lt;strong&gt;Le jeton d'identit&#233; doit &#234;tre v&#233;rifi&#233; d&#232;s r&#233;ception par l'application cliente ou la ressource prot&#233;g&#233;e, avant toute utilisation.&lt;/strong&gt; &lt;br class='autobr' /&gt;
Il existe deux m&#233;thodes : la &lt;a href='https://oa.dnc.global/-OpenID-Connect-6-.html#validationdujetondidentiteidtokenjwtsigneoujws' class='spip_in'&gt;validation locale du JWS&lt;/a&gt; ou l'&lt;a href='https://oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectintrospectionintrospectionendpoint' class='spip_in'&gt;introspection&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Ceci &#233;tant acquis, on peut citer les applications suivantes :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Passage d'identit&#233; &#224; des tiers&lt;/strong&gt; - Le jeton ID peut &#234;tre transmis &#224; d'autres composants d'application ou &#224; des services d'arri&#232;re-plan lorsque la connaissance de l'identit&#233; de l'utilisateur (end-user) est requise, par exemple pour identifier les enregistrements d'un historique. &lt;br class='autobr' /&gt;
Il est &#233;galement possible &#224; une application de &lt;strong&gt;passer le jeton pour obtenir l'acc&#232;s &#224; une ressource prot&#233;g&#233;e&lt;/strong&gt;, &#224; charge pour celle-ci de &lt;a href='https://oa.dnc.global/-Authentifier-l-application-.html#verificationdeloriginedelarequeterecueparunserveurderessource' class='spip_in'&gt;le valider en mentionnant l'IP de l'appelant&lt;/a&gt;. &lt;br class='autobr' /&gt;
Il est possible de moduler la r&#233;ponse de la ressource en fonction des privil&#232;ges de l'utilisateur en adaptant les scopes transmis &#224; cet usage. Ceci est largement d&#233;velopp&#233; dans cet article : &lt;a href='https://oa.dnc.global/-Sujets-communs-a-Oauth-2-et-OpenID-Connect-.html#definitiondesscopesoidcetgeneralitessurleurutilisationparlesapplications' class='spip_in'&gt;D&#233;finition des scopes OIDC et g&#233;n&#233;ralit&#233;s sur leur utilisation par les applications&lt;/a&gt; et dans les articles connexes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SaaS - Software as Service&lt;/strong&gt; - Une des possibilit&#233;s les plus int&#233;ressantes offertes par OAuthSD consiste &#224; &lt;a href='https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#incorporeraujetonjwtdesdeclarationssupplementaires' class='spip_in'&gt;ajouter des d&#233;clarations dans le jeton d'identit&#233;&lt;/a&gt;. On peut ainsi coupler un syst&#232;me de vente en ligne &#224; un serveur OIDC afin de louer des services en ligne. Le logiciel mis en location est configur&#233; comme application cliente du serveur OIDC. &lt;br class='autobr' /&gt;
Au moment de l'authentification de l'utilisateur final, le module d'identification du contr&#244;leur Authorize fait appel au syst&#232;me de vente en ligne pour v&#233;rifier que l'utilisateur est &#224; jour de ses paiements.&lt;br class='autobr' /&gt;
Cette &#233;tape permet &#233;galement de d&#233;finir les privil&#232;ges de l'utilisateur final sur l'application, par exemple :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; la validation d'&#233;ventuelles options de l'application prises avec l'abonnement,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; des droits limit&#233;s (consultation seule ...) au cours d'un d&#233;lai de gr&#226;ce apr&#232;s &#233;ch&#233;ance,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; etc. &lt;br class='autobr' /&gt;
Les privil&#232;ges sont incorpor&#233;s dans la charge utile du jeton d'identit&#233; (ID Token) sous la forme de d&#233;clarations suppl&#233;mentaires. Les noms des d&#233;clarations et les valeurs transmises sont propres &#224; l'application consid&#233;r&#233;e.&lt;/p&gt;
&lt;p&gt;DnC a d&#233;velopp&#233; le &lt;a href=&#034;https://buy.dnc.global/-fr-.html&#034; class='spip_out' rel='external'&gt;syst&#232;me DnC SaaS&lt;/a&gt; qui a tr&#232;s largement contribu&#233; &#224; la mise au point du serveur OAuthSD.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sessions sans &#233;tat&lt;/strong&gt; - Le jeton d'identification peut &#234;tre impl&#233;ment&#233; dans un cookie de navigateur. Cela supprime la n&#233;cessit&#233; de stocker des sessions c&#244;t&#233; serveur (en m&#233;moire ou sur disque), ce qui peut &#234;tre un fardeau pour la gestion et la mont&#233;e en &#233;chelle. La session est v&#233;rifi&#233;e en validant localement le jeton d'identification. Lorsque le jeton atteint sa limite de validit&#233; (exp), l'application peut simplement en demander un nouveau &#224; l'OP via une r&#233;-authentification silencieuse &lt;i&gt;prompt = none&lt;/i&gt;.&lt;br class='autobr' /&gt;
Cette utilisation du jeton est souvent associ&#233;e &#224; la gestion de session des applications &#224; page unique (Single Page Application, SPA)&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb5-1' class='spip_note' rel='appendix' title='Pourquoi se limiter &#224; la page unique ? Remarquons que cette technique est (...)' id='nh5-1'&gt;1&lt;/a&gt;]&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Notes :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; ll s'agit bien de JWT stock&#233;s en cookie. Pas d'utiliser le JWT comme moyen d'assurer la r&#233;tention de session en passant le JWT dans l'URL, ce qui serait une aberration de s&#233;curit&#233;. &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Le stockage des JWT par HTML5 Storage, ou toute autre m&#233;thode n&#233;cessitant JavaScript pour relire le jeton ouvre la porte &#224; des attaques de type CSRF.&lt;/p&gt;
&lt;p&gt;Voici un exemple qui montre comment utiliser le jeton pour simuler une session en cha&#238;nant les pages avec l'id de l'utilisateur final (user_id) :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PHP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #339933;&#034;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Tenter de r&#233;cup&#233;rer l'user_id depuis le JWT du cookie&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$GLOBALS&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'user_id'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;null&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$prompt&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'login'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$decoded_jwt&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/unserialize&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;unserialize&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$_COOKIE&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'decoded_jwt'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/is_array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;is_array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$decoded_jwt&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$decoded_jwt&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'exp'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;&gt;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/time&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;time&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Le JWT du cookie est valide et nous donne l'user_id&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$GLOBALS&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'user_id'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$decoded_jwt&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'sub'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Demander un nouveau jeton sans r&#233;authentification (prompt=none)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$prompt&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'none'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/is_null&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;is_null&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$GLOBALS&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'user_id'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// sinon, il faut demander un jeton avec authentification de l'utilisateur&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #339933;&#034;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://oa.dnc.global/local/cache-code/7be96da86edf591e2652fdecd1588dc7.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;&lt;i&gt;DnC a d&#233;velopp&#233; des applications de ce type. Par exemple, &lt;a href=&#034;https://photos.dnc.global/?les_jardins_de_mon_moulin&#034; class='spip_out' rel='external'&gt;photos.dnc.global&lt;/a&gt; est &lt;strong&gt;une application sans base de donn&#233;es&lt;/strong&gt;, dont les sessions sont fond&#233;es sur le JWT en cookie. On comprend l'int&#233;r&#234;t pour la mont&#233;e en &#233;chelle : une telle application peut &#234;tre r&#233;partie sur de nombreux serveurs sans que le d&#233;veloppeur ait &#224; se soucier de r&#233;plication des donn&#233;es&lt;/i&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;strong&gt;Echange de jetons&lt;/strong&gt; - Le jeton ID peut &#234;tre &#233;chang&#233; contre un jeton d'acc&#232;s au point de terminaison Token d'un serveur d'autorisations OAuth 2.0 ( cf. &lt;a href=&#034;https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-12&#034; class='spip_out' rel='external'&gt;Draft IETF : Token Exchange&lt;/a&gt; ). Il existe des sc&#233;narios r&#233;els o&#249; un document d'identit&#233; est requis pour obtenir l'acc&#232;s, par exemple lorsque vous vous enregistrez dans un h&#244;tel pour obtenir la cl&#233; de votre chambre. L'&#233;change de jetons a des utilisations dans les applications distribu&#233;es et d'entreprise.&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div class='rss_notes'&gt;&lt;div id='nb5-1'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh5-1' class='spip_note' title='Notes 5-1' rev='appendix'&gt;1&lt;/a&gt;] &lt;/span&gt;Pourquoi se limiter &#224; la page unique ? Remarquons que cette technique est particuli&#232;rement avantageuse pour g&#233;rer des applications multi-pages et/ou un ensemble d'applications &#224; page unique.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		&lt;div class='rss_ps'&gt;&lt;p&gt;Voir :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; &lt;a href=&#034;http://cryto.net/~joepie91/blog/2016/06/13/stop-using-jwt-for-sessions/&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;http://cryto.net/~joepie91/blog/2016/06/13/stop-using-jwt-for-sessions/&lt;/a&gt;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; &lt;a href=&#034;https://curity.io/resources/learn/jwt-best-practices/&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://curity.io/resources/learn/jwt-best-practices/&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
		</content:encoded>


		

	</item>



</channel>

</rss>
