<?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://static.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>JWT : Un module de validation en Python</title>
		<link>https://static.oa.dnc.global/-OpenID-Connect-6-.html#jwtunmoduledevalidationenpython</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-OpenID-Connect-6-.html#jwtunmoduledevalidationenpython</guid>
		<dc:date>2026-02-14T07:50:26Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Un module utilitaire pour : &lt;br class='autobr' /&gt; d&#233;coder un JWT,
&lt;br class='autobr' /&gt; v&#233;rifier sa signature (HMAC ou RSA),
&lt;br class='autobr' /&gt; prot&#232;ger contre les attaques par timing,
&lt;br class='autobr' /&gt; l&#232;ver des exceptions explicites,
&lt;br class='autobr' /&gt; valider les claims pour garantir que le token est encore valable et destin&#233; au service. &lt;br class='autobr' /&gt;
C'est une impl&#233;mentation qui &#233;vite les bo&#238;tes noires, donc parfaitement ma&#238;tris&#233;e. &lt;br class='autobr' /&gt;
Ce module Python fournit une impl&#233;mentation bas niveau. Il ne d&#233;pend pas de biblioth&#232;ques haut niveau comme PyJWT : on ma&#238;trise enti&#232;rement le processus. &lt;br class='autobr' /&gt;
Comment cela (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-OpenID-Connect-6-.html" rel="directory"&gt;OpenID Connect&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Un module utilitaire pour :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; d&#233;coder un JWT,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; v&#233;rifier sa signature (HMAC ou RSA),
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; prot&#232;ger contre les attaques par timing,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; l&#232;ver des exceptions explicites,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; valider les claims pour garantir que le token est encore valable et destin&#233; au service.&lt;/p&gt;
&lt;p&gt;C'est une impl&#233;mentation qui &#233;vite les bo&#238;tes noires, donc parfaitement ma&#238;tris&#233;e.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Ce module Python fournit une impl&#233;mentation bas niveau. Il ne d&#233;pend pas de biblioth&#232;ques haut niveau comme PyJWT : on ma&#238;trise enti&#232;rement le processus.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Comment cela fonctionne (&#233;tape par &#233;tape)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; 1) D&#233;coupage du JWT&lt;br class='autobr' /&gt;
Le token doit avoir la forme :&lt;/p&gt;
&lt;p&gt;header.payload.signature&lt;/p&gt;
&lt;p&gt;Le code v&#233;rifie :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; qu'il y a bien 3 segments,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; qu'ils sont valides en Base64URL,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; qu'ils contiennent du JSON correct.&lt;/p&gt;
&lt;p&gt;En cas de probl&#232;me &#8594; `JWTFormatError`.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; 2) D&#233;codage Base64URL&lt;br class='autobr' /&gt;
Chaque segment est d&#233;cod&#233; en bytes, avec ajout automatique du padding `=` si n&#233;cessaire.&lt;/p&gt;
&lt;p&gt;En cas d'erreur &#8594; `JWTFormatError`.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; 3) Analyse du header&lt;br class='autobr' /&gt;
Le header doit contenir un champ :&lt;/p&gt;
&lt;p&gt;&#034;alg&#034; : &#034;HS256&#034; | &#034;RS256&#034; | ...&lt;/p&gt;
&lt;p&gt;Si l'algorithme est absent ou non autoris&#233; &#8594; `JWTAlgorithmError`.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; 4) V&#233;rification de la signature&lt;br class='autobr' /&gt;
Selon l'algorithme :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; HMAC (HS256 / HS384 / HS512)&lt;br class='autobr' /&gt;
Recalcul du HMAC avec la cl&#233; secr&#232;te&lt;br class='autobr' /&gt;
Comparaison en temps constant (Time Constant Comparison) : `compare_digest` &lt;br class='autobr' /&gt; &#8594; prot&#232;ge contre les attaques par timing&lt;/p&gt;
&lt;p&gt;Si la signature ne correspond pas &#8594; `JWTSignatureError`.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; RSA (RS256 / RS384 / RS512)&lt;br class='autobr' /&gt;
Chargement de la cl&#233; publique PEM&lt;br class='autobr' /&gt;
V&#233;rification via `cryptography` + PKCS#1 v1.5&lt;/p&gt;
&lt;p&gt;Si la signature est invalide &#8594; `JWTSignatureError`.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; 5) Retour du payload&lt;br class='autobr' /&gt;
Si tout est correct, la fonction renvoie le **payload d&#233;cod&#233;** (dict Python).&lt;/p&gt;
&lt;p&gt;Voici le code :&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#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: #808080; font-style: italic;&#034;&gt;# jwt_validation.py&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: #808080; font-style: italic;&#034;&gt;# coding: utf8&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: #483d8b;&#034;&gt;&#034;&#034;&#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;&lt;span style=&#034;color: #483d8b;&#034;&gt;D&#233;codage et validation d'un Jeton d'Identit&#233; JSON Web Token (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;/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: #483d8b;&#034;&gt;Auteur : &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: #483d8b;&#034;&gt; B.Degoy bertrand@degoy.com &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: #483d8b;&#034;&gt;copyright (c) 2026 B.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: #483d8b;&#034;&gt;licence : MIT&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: #483d8b;&#034;&gt;&#034;&#034;&#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; &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: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; json&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: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;base64&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: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&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: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; hashlib&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: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; typing &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; Any&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; Dict&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: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; JWTDecodeError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;Exception&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #483d8b;&#034;&gt;&#034;&#034;&#034;Base class for all JWT decoding errors.&#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;pass&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: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; JWTFormatError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;JWTDecodeError&lt;span style=&#034;color: black;&#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: #483d8b;&#034;&gt;&#034;&#034;&#034;Raised when the JWT structure is invalid.&#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;pass&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: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; JWTAlgorithmError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;JWTDecodeError&lt;span style=&#034;color: black;&#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: #483d8b;&#034;&gt;&#034;&#034;&#034;Raised when the algorithm is missing or not allowed.&#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;pass&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: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; JWTSignatureError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;JWTDecodeError&lt;span style=&#034;color: black;&#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: #483d8b;&#034;&gt;&#034;&#034;&#034;Raised when the signature is invalid.&#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;pass&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: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; JWTUtils:&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: #483d8b;&#034;&gt;&#034;&#034;&#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;&lt;span style=&#034;color: #483d8b;&#034;&gt; A static utility class providing low-level JWT decoding and signature&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: #483d8b;&#034;&gt; verification, equivalent to the provided PHP implementation but using&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: #483d8b;&#034;&gt; Python exceptions instead of returning 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: #483d8b;&#034;&gt; This class does NOT validate claims (exp, nbf, iss, etc.).&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: #483d8b;&#034;&gt; &#034;&#034;&#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; &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: #808080; 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: #808080; font-style: italic;&#034;&gt;# Base64URL decoding&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: #808080; 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: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; urlsafe_b64decode&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;data: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&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: #483d8b;&#034;&gt;&#034;&#034;&#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;&lt;span style=&#034;color: #483d8b;&#034;&gt; Decode a Base64URL string into raw bytes.&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: #483d8b;&#034;&gt; Adds required padding if missing.&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: #483d8b;&#034;&gt; &#034;&#034;&#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; padding &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;=&#034;&lt;/span&gt; * &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;-&lt;span style=&#034;color: #008000;&#034;&gt;len&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;data&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; % &lt;span style=&#034;color: #ff4500;&#034;&gt;4&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;try&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;base64&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;urlsafe_b64decode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;data + padding&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;except&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;Exception&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;as&lt;/span&gt; e:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTFormatError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Invalid Base64URL segment: {data}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; e&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: #808080; 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: #808080; font-style: italic;&#034;&gt;# HMAC signing&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: #808080; 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: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; sign&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;message: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&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: #483d8b;&#034;&gt;&#034;&#034;&#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;&lt;span style=&#034;color: #483d8b;&#034;&gt; Compute an HMAC signature for the given message using HS256/384/512.&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: #483d8b;&#034;&gt; &#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS256&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&lt;/span&gt;.&lt;span style=&#034;color: #dc143c;&#034;&gt;new&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; hashlib.&lt;span style=&#034;color: black;&#034;&gt;sha256&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;digest&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS384&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&lt;/span&gt;.&lt;span style=&#034;color: #dc143c;&#034;&gt;new&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; hashlib.&lt;span style=&#034;color: black;&#034;&gt;sha384&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;digest&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS512&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&lt;/span&gt;.&lt;span style=&#034;color: #dc143c;&#034;&gt;new&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; hashlib.&lt;span style=&#034;color: black;&#034;&gt;sha512&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;digest&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTAlgorithmError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Unsupported HMAC algorithm: {algo}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; 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: #808080; font-style: italic;&#034;&gt;# Constant-time comparison&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: #808080; 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: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; hash_equals&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;a: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; b: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;bool&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: #483d8b;&#034;&gt;&#034;&#034;&#034;Constant-time comparison to avoid timing attacks.&#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;compare_digest&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;a&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; b&lt;span style=&#034;color: black;&#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;/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: #808080; 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: #808080; font-style: italic;&#034;&gt;# RSA signature verification&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: #808080; 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: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; verify_rsa&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;signature: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key_pem: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;bool&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: #483d8b;&#034;&gt;&#034;&#034;&#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;&lt;span style=&#034;color: #483d8b;&#034;&gt; Verify an RSA signature using a PEM-encoded public key.&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: #483d8b;&#034;&gt; Supported algorithms: RS256, RS384, RS512.&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: #483d8b;&#034;&gt; &#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; cryptography.&lt;span style=&#034;color: black;&#034;&gt;hazmat&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;primitives&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; serialization&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; hashes&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: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; cryptography.&lt;span style=&#034;color: black;&#034;&gt;hazmat&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;primitives&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;asymmetric&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; padding&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; public_key &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; serialization.&lt;span style=&#034;color: black;&#034;&gt;load_pem_public_key&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key_pem.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; hash_algo &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: black;&#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: #483d8b;&#034;&gt;&#034;RS256&#034;&lt;/span&gt;: hashes.&lt;span style=&#034;color: black;&#034;&gt;SHA256&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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: #483d8b;&#034;&gt;&#034;RS384&#034;&lt;/span&gt;: hashes.&lt;span style=&#034;color: black;&#034;&gt;SHA384&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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: #483d8b;&#034;&gt;&#034;RS512&#034;&lt;/span&gt;: hashes.&lt;span style=&#034;color: black;&#034;&gt;SHA512&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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: black;&#034;&gt;&#125;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;get&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;algo&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; hash_algo &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;is&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTAlgorithmError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Unsupported RSA algorithm: {algo}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;try&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; public_key.&lt;span style=&#034;color: black;&#034;&gt;verify&lt;/span&gt;&lt;span style=&#034;color: black;&#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; signature&lt;span style=&#034;color: #66cc66;&#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; message.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; padding.&lt;span style=&#034;color: black;&#034;&gt;PKCS1v15&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; hash_algo&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: black;&#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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;True&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: #ff7700;font-weight:bold;&#034;&gt;except&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;Exception&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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: #808080; 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: #808080; font-style: italic;&#034;&gt;# Signature verification dispatcher&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: #808080; 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: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; verify_signature&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;signature: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; input_data: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key: Any&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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: #483d8b;&#034;&gt;&#034;&#034;&#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;&lt;span style=&#034;color: #483d8b;&#034;&gt; Verify the signature for the given algorithm.&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: #483d8b;&#034;&gt; Raises JWTSignatureError on failure.&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: #483d8b;&#034;&gt; &#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS256&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS384&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS512&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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; key_bytes &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; key &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;isinstance&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;else&lt;/span&gt; key.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#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; expected &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;sign&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;input_data&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key_bytes&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;hash_equals&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;expected&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; signature&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTSignatureError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Invalid HMAC signature&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;return&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;RS256&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;RS384&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;RS512&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;verify_rsa&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;signature&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; input_data&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTSignatureError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Invalid RSA signature&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;return&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTAlgorithmError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Unsupported or invalid signing algorithm: {algo}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; 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: #808080; font-style: italic;&#034;&gt;# Main decode function&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: #808080; 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: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; decode&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;jwt: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key: Any &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; allowed_algorithms: Any &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;True&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; Dict:&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: #483d8b;&#034;&gt;&#034;&#034;&#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;&lt;span style=&#034;color: #483d8b;&#034;&gt; Decode a JWT token, validate its structure, optionally verify its&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: #483d8b;&#034;&gt; signature, and return the payload as a dictionary.&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: #483d8b;&#034;&gt; Raises:&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: #483d8b;&#034;&gt; JWTFormatError: Invalid structure or Base64URL segments.&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: #483d8b;&#034;&gt; JWTAlgorithmError: Missing or disallowed algorithm.&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: #483d8b;&#034;&gt; JWTSignatureError: Signature verification failed.&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: #483d8b;&#034;&gt; &#034;&#034;&#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; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Basic structure check&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;.&#034;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; jwt:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTFormatError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;JWT must contain at least one dot&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; parts &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; jwt.&lt;span style=&#034;color: black;&#034;&gt;split&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;.&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;len&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;parts&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;!=&lt;/span&gt; &lt;span style=&#034;color: #ff4500;&#034;&gt;3&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTFormatError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;JWT must contain exactly 3 segments&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; head_b64&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; payload_b64&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; sig_b64 &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; parts&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: #808080; font-style: italic;&#034;&gt;# Decode JSON header and payload&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: #ff7700;font-weight:bold;&#034;&gt;try&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; header &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; json.&lt;span style=&#034;color: black;&#034;&gt;loads&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;urlsafe_b64decode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;head_b64&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;except&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;Exception&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;as&lt;/span&gt; e:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTFormatError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Invalid JWT header&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; e&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: #ff7700;font-weight:bold;&#034;&gt;try&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; payload &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; json.&lt;span style=&#034;color: black;&#034;&gt;loads&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;urlsafe_b64decode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;payload_b64&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;except&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;Exception&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;as&lt;/span&gt; e:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTFormatError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Invalid JWT payload&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; e&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; signature &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;urlsafe_b64decode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;sig_b64&lt;span style=&#034;color: black;&#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;/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: #808080; font-style: italic;&#034;&gt;# Algorithm checks&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; allowed_algorithms:&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;alg&#034;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; header:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTAlgorithmError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Missing 'alg' in JWT header&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; algo &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; header&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;alg&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;isinstance&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;allowed_algorithms&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;and&lt;/span&gt; algo &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; allowed_algorithms:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTAlgorithmError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Algorithm '{algo}' not allowed&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; signing_input &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;{head_b64}.{payload_b64}&#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; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;verify_signature&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;signature&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; signing_input&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; payload&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://static.oa.dnc.global/local/cache-code/a9d3d6a214dd72fdbcb7dc13d3865678.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Validation des d&#233;clarations (claims)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;L'utilitaire ci-dessus d&#233;code le JWT et v&#233;rifie la signature &#8212; mais **il ne valide pas les claims**, c'est&#8209;&#224;&#8209;dire les champs qui d&#233;finissent *quand* et *dans quelles conditions* le token est valable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Quels claims doivent &#234;tre valid&#233;s ?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Les principaux champs standardis&#233;s dans un JWT sont :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;Claim&lt;/td&gt;
&lt;td&gt;Signification&lt;/td&gt;
&lt;td&gt;Validation&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;`exp`&lt;/td&gt;
&lt;td&gt;Expiration time&lt;/td&gt;
&lt;td&gt;Le token doit &#234;tre encore valide&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;`nbf`&lt;/td&gt;
&lt;td&gt;Not Before&lt;/td&gt;
&lt;td&gt;Le token ne doit pas &#234;tre utilis&#233; trop t&#244;t&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;`iat`&lt;/td&gt;
&lt;td&gt;Issued At&lt;/td&gt;
&lt;td&gt;Optionnel : v&#233;rifier que la date n'est pas aberrante&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;`iss`&lt;/td&gt;
&lt;td&gt;Issuer&lt;/td&gt;
&lt;td&gt;V&#233;rifier que le token vient du bon &#233;metteur&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;`aud`&lt;/td&gt;
&lt;td&gt;Audience&lt;/td&gt;
&lt;td&gt;V&#233;rifier que le token est destin&#233; &#224; ton service&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;`sub`&lt;/td&gt;
&lt;td&gt;Subject&lt;/td&gt;
&lt;td&gt;Optionnel : v&#233;rifier l'identit&#233; attendue&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Fonction validate_claims()&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Voici comment ajouter cette validation :&lt;br class='autobr' /&gt;
On ajoute une fonction **validate_claims(payload, options)** qui :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; lit les champs du payload,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; compare avec l'heure actuelle,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l&#232;ve des exceptions explicites si quelque chose ne va pas.&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#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: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;datetime&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;datetime&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; timezone&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: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; JWTClaimsError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;Exception&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #483d8b;&#034;&gt;&#034;&#034;&#034;Raised when JWT claims validation fails.&#034;&#034;&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;pass&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: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; JWTUtils:&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: #808080; font-style: italic;&#034;&gt;# ... (tout le reste de ta classe ici)&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: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; validate_claims&lt;span style=&#034;color: black;&#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; payload: &lt;span style=&#034;color: #008000;&#034;&gt;dict&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; issuer: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; audience: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; leeway: &lt;span style=&#034;color: #008000;&#034;&gt;int&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #ff4500;&#034;&gt;0&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: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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: #483d8b;&#034;&gt;&#034;&#034;&#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;&lt;span style=&#034;color: #483d8b;&#034;&gt; Validate standard JWT claims (exp, nbf, iss, aud).&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: #483d8b;&#034;&gt; Parameters:&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: #483d8b;&#034;&gt; payload (dict): The decoded JWT payload.&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: #483d8b;&#034;&gt; issuer (str|None): Expected 'iss' value.&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: #483d8b;&#034;&gt; audience (str|None): Expected 'aud' value.&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: #483d8b;&#034;&gt; leeway (int): Allowed clock skew in seconds.&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: #483d8b;&#034;&gt; Raises:&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: #483d8b;&#034;&gt; JWTClaimsError: If any claim is invalid.&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: #483d8b;&#034;&gt; &#034;&#034;&#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; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; now &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;datetime&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;now&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;timezone.&lt;span style=&#034;color: black;&#034;&gt;utc&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;timestamp&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; font-style: italic;&#034;&gt;# --- exp: expiration time ---&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;exp&#034;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; payload:&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; now &lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; payload&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;exp&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; + leeway:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTClaimsError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Token has expired&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; font-style: italic;&#034;&gt;# --- nbf: not before ---&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;nbf&#034;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; payload:&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; now &lt;span style=&#034;color: #66cc66;&#034;&gt;&lt;&lt;/span&gt; payload&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;nbf&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; - leeway:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTClaimsError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Token is not yet valid (nbf)&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; font-style: italic;&#034;&gt;# --- iat: issued at ---&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;iat&#034;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; payload:&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; payload&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;iat&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; now + leeway:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTClaimsError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Token issued in the future (iat)&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; font-style: italic;&#034;&gt;# --- iss: issuer ---&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; issuer &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;is&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; payload.&lt;span style=&#034;color: black;&#034;&gt;get&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;iss&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;!=&lt;/span&gt; issuer:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTClaimsError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Invalid issuer: {payload.get('iss')}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; font-style: italic;&#034;&gt;# --- aud: audience ---&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; audience &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;is&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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; aud &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; payload.&lt;span style=&#034;color: black;&#034;&gt;get&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;aud&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;isinstance&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;aud&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; audience &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; aud:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTClaimsError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Audience '{audience}' not allowed&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; aud &lt;span style=&#034;color: #66cc66;&#034;&gt;!=&lt;/span&gt; audience:&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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; JWTClaimsError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Invalid audience: {aud}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #66cc66;&#034;&gt;&lt;&lt;/span&gt;/python&lt;span style=&#034;color: #66cc66;&#034;&gt;&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: black;&#034;&gt;&#123;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&#123;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;int&lt;/span&gt;&#233;gration dans `decode&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;`&lt;span style=&#034;color: black;&#034;&gt;&#125;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;On ajoute un param&#232;tre optionnel :&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: #66cc66;&#034;&gt;&lt;&lt;/span&gt;&lt;span style=&#034;color: #dc143c;&#034;&gt;code&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;python&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;&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: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; decode&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;jwt&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; allowed_algorithms&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;True&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; validate&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;False&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; issuer&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; audience&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: black;&#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; payload &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; ... &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# comme avant&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; validate:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;validate_claims&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;payload&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; issuer&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;issuer&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; audience&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;audience&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; payload&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: #66cc66;&#034;&gt;&lt;&lt;/span&gt;/python&lt;span style=&#034;color: #66cc66;&#034;&gt;&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;Et on l'appelle comme ceci :&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: #66cc66;&#034;&gt;&lt;&lt;/span&gt;&lt;span style=&#034;color: #dc143c;&#034;&gt;code&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;python&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;&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;payload &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; JWTUtils.&lt;span style=&#034;color: black;&#034;&gt;decode&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #dc143c;&#034;&gt;token&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; key&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;public_key&lt;span style=&#034;color: #66cc66;&#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; allowed_algorithms&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;RS256&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; validate&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;True&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; issuer&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;https://auth.example.com&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; audience&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;my-api&#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;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&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://static.oa.dnc.global/local/cache-code/66a49d5836a68dfc502a9133df866516.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Validation du jeton d'identit&#233; ID Token (JWT sign&#233; ou JWS)</title>
		<link>https://static.oa.dnc.global/-OpenID-Connect-6-.html#validationdujetondidentiteidtokenjwtsigneoujws</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-OpenID-Connect-6-.html#validationdujetondidentiteidtokenjwtsigneoujws</guid>
		<dc:date>2026-02-13T07:23:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Les Jetons d'identit&#233; ne doivent jamais &#234;tre approuv&#233;s tels quels. Les jetons peuvent &#234;tre r&#233;utilis&#233;s par un malware, intercept&#233;s ou falsifi&#233;s par des attaquants. Lorsqu'une application ou une ressource prot&#233;g&#233;e re&#231;oit un jeton d'Identit&#233; JWT, elle doit toujours le valider. Cependant, valider le jeton n'est pas tout : il faut encore v&#233;rifier qu'il est pr&#233;sent&#233; par une application qui le d&#233;tient l&#233;gitimement. &lt;br class='autobr' /&gt;
Probl&#233;matique &lt;br class='autobr' /&gt;
Le jeton d'identit&#233;, de type JWT sign&#233; (JWS), doit &#234;tre valid&#233; dans deux situations : (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-OpenID-Connect-6-.html" rel="directory"&gt;OpenID Connect&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://static.oa.dnc.global/local/cache-vignettes/L93xH94/arton53-c518a.png?1733819613' width='93' height='94' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Les Jetons d'identit&#233; ne doivent jamais &#234;tre approuv&#233;s tels quels. Les jetons peuvent &#234;tre r&#233;utilis&#233;s par un malware, intercept&#233;s ou falsifi&#233;s par des attaquants. Lorsqu'une application ou une ressource prot&#233;g&#233;e re&#231;oit un jeton d'Identit&#233; JWT, elle doit toujours le valider.&lt;br class='autobr' /&gt;
Cependant, valider le jeton n'est pas tout : il faut encore v&#233;rifier qu'il est pr&#233;sent&#233; par une application qui le d&#233;tient l&#233;gitimement.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;Probl&#233;matique&lt;/h3&gt;
&lt;p&gt;Le jeton d'identit&#233;, de type JWT sign&#233; (JWS), doit &#234;tre valid&#233; dans deux situations :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; D&#232;s sa r&#233;ception, conform&#233;ment &#224; ce qui est d&#233;fini dans la sp&#233;cification d'OpenID Connect&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb1' class='spip_note' rel='appendix' title='Voici pourtant ce que dit Google : &#034;Normalement, il est essentiel de (...)' id='nh1'&gt;1&lt;/a&gt;]&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Pour autoriser l'acc&#232;s &#224; une ressource prot&#233;g&#233;e. Voyez comment le probl&#232;me se pose de fa&#231;on g&#233;n&#233;rale : &lt;a href='https://static.oa.dnc.global/-OAuth-2-0-.html#validationdujetonparuneressourceprotegee' class='spip_in'&gt;Validation du jeton par une ressource prot&#233;g&#233;e&lt;/a&gt;. &lt;br class='autobr' /&gt;
Deux cas se pr&#233;sentent :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; soit on passe la cl&#233; publique au serveur de ressource prot&#233;g&#233;e RS qui proc&#232;de localement &#224; sa validation ; si ce RS n'est pas li&#233; &#224; l'organisation qui contr&#244;le le serveur d'authentification, il peut utiliser la fonction &lt;a href='https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectdecouverte' class='spip_in'&gt;API OpenID Connect : D&#233;couverte&lt;/a&gt;,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; soit on utilise une m&#233;thode dite &#034;introspection&#034; consistant &#224; demander l'authentification du jeton JWT au serveur d'authentification qui l'a d&#233;livr&#233; : &lt;a href='https://static.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;Proc&#233;dure pour la Validation et la Consommation du jeton JWT sign&#233; (JWS)&lt;/h3&gt;
&lt;p&gt;La validation d'un jeton d'identit&#233; n&#233;cessite plusieurs &#233;tapes. Que le jeton soit valid&#233; du c&#244;t&#233; du serveur d'authentification ou &#224; distance, la m&#233;thode est la m&#234;me.&lt;/p&gt;
&lt;p&gt;Le d&#233;codage et la validation du jeton suivent la m&#233;thode d&#233;finie ici : &lt;a href=&#034;http://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation&#034; class='spip_out' rel='external'&gt;Sp&#233;cification OpenID Connect : Validation du jeton d'identit&#233;&lt;/a&gt; :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;Les clients DOIVENT valider le jeton ID dans la r&#233;ponse au jeton de la mani&#232;re suivante :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si le jeton d'identification est chiffr&#233;, d&#233;chiffrez-le &#224; l'aide des cl&#233;s et des algorithmes sp&#233;cifi&#233;s lors de l'enregistrement par le client, que l'OP devait utiliser pour chiffrer le jeton d'identification. Si le chiffrement a &#233;t&#233; n&#233;goci&#233; avec l'OP au moment de l'enregistrement et que le jeton d'identification n'est pas chiffr&#233;, le RP&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb2' class='spip_note' rel='appendix' title='Relying Party : l'application cliente ou le serveur de ressource prot&#233;g&#233;e (...)' id='nh2'&gt;2&lt;/a&gt;]&lt;/span&gt; DEVRAIT le rejeter.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; L'identifiant de l'&#233;metteur pour le fournisseur OpenID (qui est g&#233;n&#233;ralement obtenu lors de la d&#233;couverte) DOIT correspondre exactement &#224; la valeur de la d&#233;claration iss (issuer).
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Le client DOIT valider que la d&#233;claration aud (audience) contienne la valeur client_id enregistr&#233;e aupr&#232;s de l'&#233;metteur identifi&#233; par la d&#233;claration iss (&#233;metteur) en tant qu'audience. La d&#233;claration aud (audience) PEUT contenir un tableau avec plus d'un &#233;l&#233;ment. Le jeton ID DOIT &#234;tre rejet&#233; si le jeton ID ne r&#233;pertorie pas le client en tant qu'audience valide, ou s'il contient des audiences suppl&#233;mentaires non approuv&#233;es par le client.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si le jeton d'identification contient plusieurs audiences, le client DEVRAIT v&#233;rifier qu'une d&#233;claration azp est pr&#233;sente.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si une d&#233;claration azp (partie autoris&#233;e) est pr&#233;sente, le client DEVRAIT v&#233;rifier que son client_id est la valeur de la d&#233;claration.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si le jeton ID est re&#231;u via une communication directe entre le client et le point d'extr&#233;mit&#233; du jeton (qui se trouve dans ce flux), la validation TLS du serveur PEUT &#234;tre utilis&#233;e pour valider l'&#233;metteur au lieu de v&#233;rifier la signature du jeton&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb3' class='spip_note' rel='appendix' title='Autrement dit, si la liaison entre le client et le serveur est s&#233;curis&#233;e par (...)' id='nh3'&gt;3&lt;/a&gt;]&lt;/span&gt;. Le client DOIT valider la signature de tous les autres jetons ID conform&#233;ment &#224; JWS [JWS] en utilisant l'algorithme sp&#233;cifi&#233; dans le param&#232;tre d'en-t&#234;te JWT alg. Le client DOIT utiliser les cl&#233;s fournies par l'&#233;metteur.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; La valeur alg DEVRAIT &#234;tre la valeur par d&#233;faut de RS256 ou l'algorithme envoy&#233; par le client dans le param&#232;tre id_token_signed_response_alg lors de l'enregistrement.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si le param&#232;tre d'en-t&#234;te JWT alg utilise un algorithme bas&#233; sur MAC, tel que HS256, HS384 ou HS512, les octets de la repr&#233;sentation UTF-8 du secret client correspondant &#224; l'identifiant client contenu dans la d&#233;claration aud (audience) sont utilis&#233;s comme cl&#233; de validation de la signature. Pour les algorithmes bas&#233;s sur MAC, le comportement n'est pas sp&#233;cifi&#233; si l'aud est multivalu&#233; ou si une valeur azp est diff&#233;rente de la valeur aud.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; L'heure actuelle DOIT &#234;tre ant&#233;rieure &#224; l'heure repr&#233;sent&#233;e par la d&#233;claration exp.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; La d&#233;claration Iat peut &#234;tre utilis&#233; pour rejeter des jetons qui ont &#233;t&#233; &#233;mis trop loin de l'heure actuelle, limitant ainsi la dur&#233;e de stockage des cl&#233;s pour pr&#233;venir les attaques. La plage acceptable est sp&#233;cifique au client.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si une valeur &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#nonce' class='spip_in'&gt;nonce&lt;/a&gt; a &#233;t&#233; envoy&#233;e dans la demande d'authentification, une d&#233;claration de nonce DOIT &#234;tre pr&#233;sente et sa valeur v&#233;rifi&#233;e pour contr&#244;ler qu'il s'agit de la m&#234;me valeur que celle qui a &#233;t&#233; envoy&#233;e dans la demande d'authentification. Le client DEVRAIT v&#233;rifier la valeur de nonce pour les attaques par relecture. La m&#233;thode pr&#233;cise pour d&#233;tecter les attaques par relecture est sp&#233;cifique au client.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si la d&#233;claration acr a &#233;t&#233; mentionn&#233;e, le client DEVRAIT v&#233;rifier que la valeur de r&#233;clamation revendiqu&#233;e est appropri&#233;e. La signification et le traitement des d&#233;clarations acr sont hors du domaine d'application de la pr&#233;sente sp&#233;cification.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si la d&#233;claration auth_time a &#233;t&#233; mentionn&#233;e, par le biais d'une demande sp&#233;cifique pour cette d&#233;claration ou du param&#232;tre max_age, le client DEVRAIT v&#233;rifier la valeur de la d&#233;claration auth_time et demander une nouvelle authentification s'il d&#233;termine qu'il s'est &#233;coul&#233; trop de temps depuis la derni&#232;re authentification de l'utilisateur final.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Exemple de code pour la v&#233;rification locale de la signature du jeton d'identit&#233; JWT sign&#233; (JWS)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;La plupart de ces v&#233;rifications ne n&#233;cessitent qu'une simple comparaison de cha&#238;nes. La validation de la signature est plus complexe. L'impl&#233;mentation qui en est faite par OAuthSD est d&#233;crite maintenant. La fonction suivante, tir&#233;e de &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;, s&#233;pare les composantes du jeton, d&#233;tecte les erreurs de format, v&#233;rifie &#233;ventuellement la signature et retourne la charge utile ou false en cas d'erreur.&lt;/p&gt;
&lt;p&gt;La variable $key passe la cl&#233; publique qui a servi &#224; g&#233;n&#233;rer le jeton JWT.&lt;/p&gt;
&lt;p&gt;Si $key = null, la v&#233;rification de la signature n'est pas effectu&#233;e (on suppose le jeton d&#233;j&#224; valid&#233; par introspection), et le contenu de la charge utile est retourn&#233; sous la forme d'un tableau associatif.&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: #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; * S&#233;pare les composantes du jeton, d&#233;tecte les erreurs de format, v&#233;rifie la signature et retourne la charge utile ou false 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;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 mixed $jwt : le 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; * @param mixed $key : la cl&#233; publique&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 $allowedAlgorithms : un array des codes d'algorithmes autoris&#233;s (sous ensemble de HS256, HS384 ou HS512, RS256, RS384 et RS512). Si ce param&#232;tre est pr&#233;cis&#233;, le jeton doit indiquer l'algorithme et celui-ci doit &#234;tre compris dans l'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: #009933; font-style: italic;&#034;&gt; * @param mixed return : charge utile (tableau associatif) ou 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;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;function&lt;/span&gt; decode&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$jwt&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;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;span style=&#034;color: #000088;&#034;&gt;$allowedAlgorithms&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;/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: #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/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;$jwt&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: #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;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: #000088;&#034;&gt;$tks&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/explode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;explode&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: #000088;&#034;&gt;$jwt&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/count&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;count&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;$tks&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: #cc66cc;&#034;&gt;3&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;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;a href=&#034;http://www.php.net/list&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;list&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;$headb64&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$payloadb64&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$cryptob64&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: #000088;&#034;&gt;$tks&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: #009900; font-weight: bold;&#034;&gt;null&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;===&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$header&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;$this&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;urlSafeB64Decode&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$headb64&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;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: #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: #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: #009900; font-weight: bold;&#034;&gt;null&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;===&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$payload&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;$this&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;urlSafeB64Decode&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$payloadb64&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;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;&#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;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: #000088;&#034;&gt;$sig&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$this&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;urlSafeB64Decode&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$cryptob64&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: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;bool&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$allowedAlgorithms&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;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/isset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;isset&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;$header&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'alg'&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: #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: #666666; font-style: italic;&#034;&gt;// check if bool arg supplied here to maintain BC&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/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;$allowedAlgorithms&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;&amp;&amp;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/in_array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;in_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;$header&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'alg'&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;$allowedAlgorithms&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: #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: #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;span style=&#034;color: #000088;&#034;&gt;$this&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;verifySignature&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$sig&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: #006699; font-weight: bold;&#034;&gt;$headb64&lt;/span&gt;.&lt;span style=&#034;color: #006699; font-weight: bold;&#034;&gt;$payloadb64&lt;/span&gt;&#034;&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;span style=&#034;color: #000088;&#034;&gt;$header&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'alg'&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: #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;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;return&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$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;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;function&lt;/span&gt; verifySignature&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$signature&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$input&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;span style=&#034;color: #000088;&#034;&gt;$algo&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'HS256'&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: #666666; font-style: italic;&#034;&gt;// use constants when possible, for HipHop support&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;switch&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$algo&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;case&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'HS256'&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;case&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'HS384'&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;case&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'HS512'&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;$this&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;hash_equals&lt;/span&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: #000088;&#034;&gt;$this&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;sign&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$input&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;span style=&#034;color: #000088;&#034;&gt;$algo&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;$signature&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;/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;case&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'RS256'&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;a href=&#034;http://www.php.net/openssl_verify&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;openssl_verify&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;$input&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$signature&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;a href=&#034;http://www.php.net/defined&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;defined&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;'OPENSSL_ALGO_SHA256'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; ? OPENSSL_ALGO_SHA256 &lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'sha256'&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: #cc66cc;&#034;&gt;1&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;case&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'RS384'&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: #339933;&#034;&gt;@&lt;/span&gt;&lt;a href=&#034;http://www.php.net/openssl_verify&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;openssl_verify&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;$input&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$signature&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;a href=&#034;http://www.php.net/defined&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;defined&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;'OPENSSL_ALGO_SHA384'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; ? OPENSSL_ALGO_SHA384 &lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'sha384'&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: #cc66cc;&#034;&gt;1&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;case&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'RS512'&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: #339933;&#034;&gt;@&lt;/span&gt;&lt;a href=&#034;http://www.php.net/openssl_verify&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;openssl_verify&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;$input&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$signature&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;a href=&#034;http://www.php.net/defined&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;defined&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;'OPENSSL_ALGO_SHA512'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; ? OPENSSL_ALGO_SHA512 &lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'sha512'&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: #cc66cc;&#034;&gt;1&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;default&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;throw&lt;/span&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;new&lt;/span&gt; \InvalidArgumentException&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;Unsupported or invalid signing algorithm.&#034;&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;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://static.oa.dnc.global/local/cache-code/f60929015b36926971323ab17c8e7fb1.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Voici un autre exemple en Python :&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#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: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; json&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: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;base64&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: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&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: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; hashlib&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: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; typing &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; Any&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; Dict&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; Optional&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: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; JWTDecoder:&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: #808080; 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: #808080; font-style: italic;&#034;&gt;# Base64URL decode&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: #808080; 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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; urlsafe_b64decode&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; data: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&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; padding &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;'='&lt;/span&gt; * &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;-&lt;span style=&#034;color: #008000;&#034;&gt;len&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;data&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; % &lt;span style=&#034;color: #ff4500;&#034;&gt;4&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;base64&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;urlsafe_b64decode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;data + padding&lt;span style=&#034;color: black;&#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;/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: #808080; 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: #808080; font-style: italic;&#034;&gt;# HMAC signature&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: #808080; 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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; sign&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS256&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&lt;/span&gt;.&lt;span style=&#034;color: #dc143c;&#034;&gt;new&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; hashlib.&lt;span style=&#034;color: black;&#034;&gt;sha256&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;digest&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS384&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&lt;/span&gt;.&lt;span style=&#034;color: #dc143c;&#034;&gt;new&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; hashlib.&lt;span style=&#034;color: black;&#034;&gt;sha384&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;digest&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS512&#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; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&lt;/span&gt;.&lt;span style=&#034;color: #dc143c;&#034;&gt;new&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; hashlib.&lt;span style=&#034;color: black;&#034;&gt;sha512&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;digest&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;ValueError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Unsupported HMAC algorithm&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; 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: #808080; font-style: italic;&#034;&gt;# Constant&#8209;time comparison&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: #808080; 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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; hash_equals&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; a: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; b: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;bool&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;hmac&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;compare_digest&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;a&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; b&lt;span style=&#034;color: black;&#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;/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: #808080; 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: #808080; font-style: italic;&#034;&gt;# RSA signature verification&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: #808080; 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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; verify_rsa&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; signature: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; message: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key_pem: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;bool&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: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; cryptography.&lt;span style=&#034;color: black;&#034;&gt;hazmat&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;primitives&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; serialization&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; hashes&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: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; cryptography.&lt;span style=&#034;color: black;&#034;&gt;hazmat&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;primitives&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;asymmetric&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; padding&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; public_key &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; serialization.&lt;span style=&#034;color: black;&#034;&gt;load_pem_public_key&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key_pem.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; hash_algo &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: black;&#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: #483d8b;&#034;&gt;&#034;RS256&#034;&lt;/span&gt;: hashes.&lt;span style=&#034;color: black;&#034;&gt;SHA256&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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: #483d8b;&#034;&gt;&#034;RS384&#034;&lt;/span&gt;: hashes.&lt;span style=&#034;color: black;&#034;&gt;SHA384&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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: #483d8b;&#034;&gt;&#034;RS512&#034;&lt;/span&gt;: hashes.&lt;span style=&#034;color: black;&#034;&gt;SHA512&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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: black;&#034;&gt;&#125;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;get&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;algo&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; hash_algo &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;is&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;ValueError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Unsupported RSA algorithm&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;try&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; public_key.&lt;span style=&#034;color: black;&#034;&gt;verify&lt;/span&gt;&lt;span style=&#034;color: black;&#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; signature&lt;span style=&#034;color: #66cc66;&#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; message.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; padding.&lt;span style=&#034;color: black;&#034;&gt;PKCS1v15&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; hash_algo&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: black;&#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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;True&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: #ff7700;font-weight:bold;&#034;&gt;except&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;Exception&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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: #808080; 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: #808080; font-style: italic;&#034;&gt;# Signature verification&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: #808080; 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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; verify_signature&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; signature: &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; input_data: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key: Any&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;bool&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS256&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS384&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;HS512&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;hash_equals&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;sign&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;input_data&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;isinstance&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;bytes&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;else&lt;/span&gt; key.&lt;span style=&#034;color: black;&#034;&gt;encode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#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; signature&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: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; algo &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;RS256&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;RS384&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;RS512&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;verify_rsa&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;signature&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; input_data&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo&lt;span style=&#034;color: black;&#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;/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: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;ValueError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Unsupported or invalid signing algorithm.&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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;/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: #808080; 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: #808080; font-style: italic;&#034;&gt;# Main decode function&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: #808080; 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: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; decode&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; jwt: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key: Optional&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;Any&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; allowed_algorithms: Any &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;True&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; Optional&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;Dict&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;.&#034;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; jwt:&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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; parts &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; jwt.&lt;span style=&#034;color: black;&#034;&gt;split&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;.&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;len&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;parts&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;!=&lt;/span&gt; &lt;span style=&#034;color: #ff4500;&#034;&gt;3&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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; head_b64&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; payload_b64&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; sig_b64 &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; parts&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: #ff7700;font-weight:bold;&#034;&gt;try&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; header &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; json.&lt;span style=&#034;color: black;&#034;&gt;loads&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;urlsafe_b64decode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;head_b64&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#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; payload &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; json.&lt;span style=&#034;color: black;&#034;&gt;loads&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;urlsafe_b64decode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;payload_b64&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;except&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;Exception&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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; signature &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;urlsafe_b64decode&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;sig_b64&lt;span style=&#034;color: black;&#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;/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: #808080; font-style: italic;&#034;&gt;# Algorithm checks&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; allowed_algorithms:&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;alg&#034;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; header:&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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; algo &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; header&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;alg&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;isinstance&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;allowed_algorithms&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;and&lt;/span&gt; algo &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; allowed_algorithms:&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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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; signing_input &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;{head_b64}.{payload_b64}&#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; &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: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;verify_signature&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;signature&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; signing_input&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; key&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; algo&lt;span style=&#034;color: black;&#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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;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: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; payload&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://static.oa.dnc.global/local/cache-code/70d0a7b3f245dcb3aab2809fbe764de9.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;Avertissement &#224; propos du param&#232;tre 'alg'&lt;/h3&gt;
&lt;p&gt;La sp&#233;cification pr&#233;voit d'appliquer la valeur du param&#232;tre 'alg' pour le choix de l'algorithme de validation de la signature : RFC 7515, section 4.1.1. : &#034;... This Header Parameter MUST be present and MUST be understood and processed by implementations ...&#034;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;C'est une faille de s&#233;curit&#233;&lt;/strong&gt;, et donc une erreur de la sp&#233;cification. OAuthSD applique la m&#233;thode d&#233;finie pour chaque application, quelle que soit la valeur de alg. Il est int&#233;ressant de constater que &lt;a href=&#034;https://oa.dnc.global/-Tests-et-certification-.html&#034; class='spip_out' rel='external'&gt;OAuthSD passe les tests de validation de l'OIDF&lt;/a&gt; comme cela.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;En savoir plus sur la validation du JWT :&lt;/h3&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;a href='https://static.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;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;a href='https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectpointdextremitedinformationssurlesclefskeysendpoint' class='spip_in'&gt;API OpenId Connect : Point d'extr&#233;mit&#233; d'informations sur les clefs (Keys Endpoint)&lt;/a&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-Autorisation-via-un-code-Authorization-Code-Flow-.html#openidconnectexemplescompletsdufluxdautorisationviauncodepuisrequeteuserinfo' class='spip_in'&gt;OpenID Connect : Exemples complets du flux d'Autorisation via un code puis requ&#234;te UserInfo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Voyez &#233;galement :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;a href='https://static.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;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;a href='https://static.oa.dnc.global/-Techniques-et-code-du-serveur-OAuthSD-.html#tableusers' class='spip_in'&gt;Table Users&lt;/a&gt;&lt;/p&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;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;a href='https://static.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;Voici pourtant ce que dit Google : &#034;Normalement, il est essentiel de valider un jeton d'identification avant de l'utiliser, mais puisque vous communiquez directement avec Google via un canal HTTPS sans interm&#233;diaire et que vous utilisez le secret de votre client pour vous authentifier aupr&#232;s de Google, vous pouvez &#234;tre s&#251;r que le jeton que vous recevez vient vraiment de Google et est valide.&#034; C'est &#224; dire que le jeton peut &#234;tre n'importe quoi, une tartine, un cafard ou un cheval, du moment que l'on a une r&#233;ponse c'est bon !!! Autant dire que le jeton ne sert &#224; rien. Tiens, on reconnait l&#224; l'erreur qui avait pr&#233;valu avec le jeton d'acc&#232;s d'OAuth 2.0. Heureusement il y a la suite : &#034;Si votre serveur transmet le jeton d'identification &#224; d'autres composants de votre application, il est extr&#234;mement important que les autres composants le valident avant de l'utiliser. &#034; (&lt;a href=&#034;https://developers.google.com/identity/protocols/OpenIDConnect#validatingtoken&#034; class='spip_url spip_out' rel='external'&gt;https://developers.google.com/ident...&lt;/a&gt;).&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;Relying Party : l'application cliente ou le serveur de ressource prot&#233;g&#233;e etc..&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;Autrement dit, si la liaison entre le client et le serveur est s&#233;curis&#233;e par TLS, on pourrait se passer de valider la signature. C'est ce que dit Google ici : &lt;a href=&#034;https://developers.google.com/identity/protocols/OpenIDConnect#validatingtoken&#034; class='spip_url spip_out' rel='external'&gt;https://developers.google.com/ident...&lt;/a&gt; . Cependant, nous consid&#233;rons qu'il faut toujours valider la signature du jeton quel que soit l'utilisation, et pas seulement dans le cas o&#249; le jeton est retransmis &#224; une application ou ressource tierce.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		&lt;div class='rss_ps'&gt;&lt;p&gt;Voir aussi :
&lt;br /&gt;&lt;img src='https://static.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://www.pingidentity.com/fr/company/blog/posts/2019/the-hard-parts-of-jwt-security-nobody-talks-about.html&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://www.pingidentity.com/fr/company/blog/posts/2019/the-hard-parts-of-jwt-security-nobody-talks-about.html&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Gestion de la session OIDC : Fonctionnalit&#233;s</title>
		<link>https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#gestiondelasessionoidcfonctionnalites</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#gestiondelasessionoidcfonctionnalites</guid>
		<dc:date>2024-04-28T10:33:30Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;SSO, SLI, SLO, SRA : ces fonctionnalit&#233;s offertes par OAuthSD simplifient la gestion des sessions et des connexions pour les utilisateurs, en garantissant une exp&#233;rience fluide et s&#233;curis&#233;e lors de l'utilisation d'applications multiples compatibles avec OpenID Connect. &lt;br class='autobr' /&gt;
Avant de d&#233;tailler comment OAuthSD met en &#339;uvre ces fonctionnalit&#233;s, assurons-nous de bien les distinguer : &lt;br class='autobr' /&gt; SSO (Single Sign-On) : Il s'agit d'un m&#233;canisme qui permet &#224; un utilisateur de se connecter une seule fois pour acc&#233;der &#224; (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html" rel="directory"&gt;OpenID Connect : SSO, management de session etc.&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;SSO, SLI, SLO, SRA : ces fonctionnalit&#233;s offertes par OAuthSD simplifient la gestion des sessions et des connexions pour les utilisateurs, en garantissant une exp&#233;rience fluide et s&#233;curis&#233;e lors de l'utilisation d'applications multiples compatibles avec OpenID Connect.&lt;/p&gt;
&lt;p&gt;Avant de d&#233;tailler comment OAuthSD met en &#339;uvre ces fonctionnalit&#233;s, assurons-nous de bien les distinguer :&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;&lt;strong&gt;SSO (Single Sign-On)&lt;/strong&gt; : Il s'agit d'un m&#233;canisme qui permet &#224; un utilisateur de se connecter une seule fois pour acc&#233;der &#224; plusieurs applications, sans avoir &#224; se reconnecter &#224; chaque fois. Avec OAuthSD, le SSO est mis en place pour offrir une authentification unique pour un groupe d'applications, &#233;vitant ainsi &#224; un m&#234;me internaute de devoir s'authentifier plusieurs fois pour acc&#233;der &#224; des applications diff&#233;rentes.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;SLI (Single Login In) &lt;/strong&gt; : Le SLI est un concept similaire au SSO, mais il se concentre sur le fait qu'une fois connect&#233;, un utilisateur peut acc&#233;der &#224; plusieurs applications sans avoir &#224; se reconnecter. OAuthSD utilise le SLI pour faciliter la navigation et l'&#233;change de donn&#233;es au sein d'une application multiple.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;SLO (Single Log-Out) &lt;/strong&gt; : Le SLO est le pendant du SSO, mais pour la d&#233;connexion. Il permet &#224; un utilisateur de se d&#233;connecter une seule fois pour se d&#233;connecter de toutes les applications auxquelles il est connect&#233;. Cela garantit une d&#233;connexion globale et renforce la s&#233;curit&#233; en cas de d&#233;part de l'utilisateur de son poste de travail.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;SRA (Single Re-Authentication) &lt;/strong&gt; : Le SRA est un m&#233;canisme qui permet &#224; un utilisateur de se r&#233;-authentifier de mani&#232;re transparente lorsqu'un cookie d'authentification n'est plus valide. Cela garantit une s&#233;curit&#233; renforc&#233;e en cas de besoin de r&#233;-authentification.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Cet article a &#233;t&#233; &#233;crit &#224; l'aide de &lt;a href=&#034;https://chat.i-tego.com&#034; class='spip_out' rel='external'&gt;i-Tego ChatBot&lt;/a&gt;, en r&#233;ponse &#224; la question : &#034;Dans le contexte d'OAuthSD, expliquer SSO, SLI, SLO, SRA.&#034;&lt;/i&gt;&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>OAuthSD vers la Certification OpenID (r)</title>
		<link>https://static.oa.dnc.global/-Tests-et-certification-.html#oauthsdverslacertificationopenidr</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-Tests-et-certification-.html#oauthsdverslacertificationopenidr</guid>
		<dc:date>2021-04-28T18:10:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;OAuthSD a satisfait aux tests en vue de la certification OpenID. &lt;br class='autobr' /&gt;
L'auteur (B.D.) est membre de l'OpenID Foundation, ce qui lui permet d'introduire OAuthSD dans le processus de certification en vue d'obtenir le label &#034;OpenID Certified&#034;. &lt;br class='autobr' /&gt;
Avril 2021 - Nouvelle s&#233;rie de tests &lt;br class='autobr' /&gt;
Les tests OIDF Conformance ont &#233;volu&#233;, OAuthSD aussi, de nouveaux tests ont &#233;t&#233; effectu&#233;s pour les flux OpenID Authorization Code et Implicit. &lt;br class='autobr' /&gt;
Tests de certification du flux Authorization Code (response_type 'code') Le r&#233;sultat (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-Tests-et-certification-.html" rel="directory"&gt;Tests et certification&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://static.oa.dnc.global/local/cache-vignettes/L150xH109/arton118-f07d9.png?1733820003' width='150' height='109' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;OAuthSD a satisfait aux tests en vue de la &lt;a href=&#034;https://openid.net/certification/&#034; class='spip_out' rel='external'&gt;certification OpenID&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;L'auteur (B.D.) est membre de l'OpenID Foundation, ce qui lui permet d'introduire OAuthSD dans le processus de certification en vue d'obtenir le label &#034;OpenID Certified&#034;.&lt;/p&gt;
&lt;p&gt;&lt;a id=&#034;testsavril2021&#034;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Avril 2021 - Nouvelle s&#233;rie de tests&lt;/h3&gt;
&lt;p&gt;Les tests OIDF Conformance ont &#233;volu&#233;, &lt;a href=&#034;https://oa.dnc.global/web/-Decouvrir-.html#oauthsdv2&#034; class='spip_out' rel='external'&gt;OAuthSD aussi&lt;/a&gt;, de nouveaux tests ont &#233;t&#233; effectu&#233;s pour les flux OpenID Authorization Code et Implicit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Tests de certification du flux Authorization Code (response_type 'code') &lt;/strong&gt;&lt;br class='autobr' /&gt;
Le r&#233;sultat est visible &#224; l'URL :&lt;br class='autobr' /&gt;
&lt;a href=&#034;https://www.certification.openid.net/plan-detail.html?plan=5pu5MgJdbusGd&amp;public=true&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://www.certification.openid.net/plan-detail.html?plan=5pu5MgJdbusGd&amp;public=true&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class='spip_document_106 spip_documents spip_documents_center'&gt;
&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L500xH643/oidcc-basic-certification-test-plan_20210428-e07df.png?1733820004' width='500' height='643' alt=&#034;OAuthSD oidcc-basic certification test&#034; title=&#034;OAuthSD oidcc-basic certification test&#034; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Commentaires :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; test &#034;oidcc-unsigned-request-object-supported-correctly-or-rejected-as-unsupported&#034; : EXPERIMENTAL : OAuthSD impl&#233;mente le param&#232;tre 'request' sous sa forme JWT non sign&#233; et pass&#233; par valeur (comme l'attend ce test). &lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; test 'oidcc-claims-essential' : Notre avis et qu'il s'agit l&#224; d'un &#233;cart inutile par rapport &#224; la rigueur de la sp&#233;cification g&#233;n&#233;rale, pr&#233;judiciable &#224; la s&#233;curit&#233; des donn&#233;es personnelles. OAuthSD n'impl&#233;mente pas le param&#232;tre 'claims' ainsi que l'indique son document de d&#233;couverte, le test devrait donc &#234;tre saut&#233;. Cependant, le test se traduit par un avertissement, ce qui n'est pas un obstacle &#224; la certification.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; test &#034;oidcc-refresh-token&#034; : ce test est saut&#233; car le client de test a &#233;t&#233; configur&#233; sans le flux &#034;refresh_token&#034;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test de certification du flux Implicit (response_type 'token' et 'id_token token')&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Le r&#233;sultat est visible &#224; l'URL :&lt;br class='autobr' /&gt;
&lt;a href=&#034;https://www.certification.openid.net/plan-detail.html?plan=7Z0tOWnMttGlm&amp;public=true&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://www.certification.openid.net/plan-detail.html?plan=7Z0tOWnMttGlm&amp;public=true&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class='spip_document_107 spip_documents spip_documents_center'&gt;
&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L500xH574/oidcc-implicit-certification-test-plan_20210501-70a23.png?1733820004' width='500' height='574' alt=&#034;OAuthSD oidc implicit certification test&#034; title=&#034;OAuthSD oidc implicit certification test&#034; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Cette s&#233;rie appelle les m&#234;mes commentaires que la pr&#233;c&#233;dente.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Mai 2019 - Configuration Basic OP : succ&#232;s &#224; 100% !&lt;/h3&gt;
&lt;p&gt;Cette configuration teste OAuthSD en tant que OP (OpenID Connect Provider) avec le flux Authorization Code.&lt;br class='autobr' /&gt;
Le r&#233;sultat des tests peut &#234;tre vu ci-dessous. On voit que OAuthSD remplit 100% des exigences (Il est normal que le test OP-redirect_uri-NotReg reste &#224; l'&#233;tat non compl&#233;t&#233;)&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb1' class='spip_note' rel='appendix' title='Il est normal que le test OP-redirect_uri-NotReg reste &#224; l'&#233;tat non compl&#233;t&#233; (...)' id='nh1'&gt;1&lt;/a&gt;]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class='spip_document_74 spip_documents spip_documents_center'&gt;
&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L500xH1272/tests_basic_op-c343a.png?1733820004' width='500' height='1272' alt=&#034;&#034; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;La certification OpenID peut &#234;tre obtenue avec quelques tests &#224; l'&#233;tat &#034;Warning&#034;. Notre engagement de qualit&#233; nous commande de satisfaire &#224; 100% des tests.&lt;/i&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;Il est normal que le test OP-redirect_uri-NotReg reste &#224; l'&#233;tat non compl&#233;t&#233; car &#034;Ce test devrait avoir pour r&#233;sultat que le fournisseur OpenID affiche un message d'erreur dans votre agent d'utilisateur. Vous devez ignorer le statut de ce test dans l'outil de test, car il sera incomplet.&#034;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>API Open ID Connect : Introspection (Introspection Endpoint)</title>
		<link>https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectintrospectionintrospectionendpoint</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectintrospectionintrospectionendpoint</guid>
		<dc:date>2021-04-15T08:15:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;L'introspection permet &#224; une application cliente ou &#224; un serveur de ressource (RS) de valider un jeton aupr&#232;s du serveur d'authentification (AS) . &lt;br class='autobr' /&gt;
Les jetons soumis peuvent &#234;tre du type Access Token, Identity Token (JWT) ou Json Web Encryption (JWE). Impl&#233;mentation de l'Introspection &lt;br class='autobr' /&gt;
Il n'y a pas (&#224; ce jour) de &#034;norme&#034; d&#233;finissant l'Introspection pour OpenID Connect. Cependant, OAuthSD, ainsi que les impl&#233;mentations courantes, se fonde sur la proposition de standard RFC 7662 : OAuth 2.0 Token (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html" rel="directory"&gt;API OpenID Connect : Points d'extr&#233;mit&#233;&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://static.oa.dnc.global/local/cache-vignettes/L128xH128/arton54-a2dc1.png?1733821221' width='128' height='128' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;L'introspection permet &#224; une application cliente ou &#224; un serveur de ressource (RS) de valider un jeton aupr&#232;s du serveur d'authentification (AS) .&lt;/p&gt;
&lt;p&gt;Les jetons soumis peuvent &#234;tre du type &lt;a href='https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html' class='spip_in'&gt;Access Token&lt;/a&gt;, &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt' class='spip_in'&gt;Identity Token (JWT)&lt;/a&gt; ou &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jwejsonwebencryption' class='spip_in'&gt;Json Web Encryption (JWE)&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;Impl&#233;mentation de l'Introspection&lt;/h3&gt;
&lt;p&gt;Il n'y a pas (&#224; ce jour) de &#034;norme&#034; d&#233;finissant l'Introspection pour OpenID Connect. Cependant, OAuthSD, ainsi que les impl&#233;mentations courantes, se fonde sur la proposition de standard &lt;a href=&#034;https://tools.ietf.org/html/rfc7662&#034; class='spip_out' rel='external'&gt;RFC 7662 : OAuth 2.0 Token Introspection&lt;/a&gt;. DnC a propos&#233; une fonction d'&lt;a href=&#034;https://github.com/bshaffer/oauth2-server-php/pull/964&#034; class='spip_out' rel='external'&gt;introspection pour la biblioth&#232;que OAuth 2.0 PHP&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Proposition de standard RFC 7662&lt;/h3&gt;
&lt;p&gt;&lt;i&gt;Traduction d'un extrait du document &lt;a href=&#034;https://tools.ietf.org/html/rfc7662&#034; class='spip_out' rel='external'&gt;RFC 7662 : OAuth 2.0 Token Introspection&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;
2.2. R&#233;ponse d'introspection&lt;/p&gt;
&lt;p&gt; Le serveur r&#233;pond avec un objet JSON [RFC7159] dans le format &#034;application/json &#034;avec les membres de niveau sup&#233;rieur suivants.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;active&lt;/strong&gt;&lt;br class='autobr' /&gt;
CHAMPS OBLIGATOIRE. bool&#233;en indiquant si le jeton pr&#233;sent&#233; est actuellement actif ou non. Les sp&#233;cificit&#233;s de l'&#233;tat &#034;actif&#034; d'un jeton variera en fonction de la mise en &#339;uvre du serveur d'autorisation et les informations qu'il conserve sur ses jetons, mais une &#034;vraie&#034;&lt;br class='autobr' /&gt;
valeur retourn&#233;e pour la propri&#233;t&#233; &#034;active&#034; indiquera g&#233;n&#233;ralement 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 et rel&#232;ve de sa fen&#234;tre de validit&#233; donn&#233;e (par exemple, apr&#232;s son heure d'&#233;mission et avant son heure d'expiration). Voir la section 4 pour des informations sur la mise en &#339;uvre de ces contr&#244;les.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;scope&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Une cha&#238;ne JSON contenant une liste de port&#233;es associ&#233;es &#224; ce jeton, dans le format d&#233;crit dans la Section 3.3 de OAuth 2.0 [RFC6749].&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;client_id&lt;/strong&gt;&lt;br class='autobr' /&gt; OPTIONNEL. Identifiant de client pour le client OAuth 2.0 qui a demand&#233; ce jeton.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;username&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Identifiant lisible par l'homme pour le propri&#233;taire de la ressource qui a autoris&#233; ce jeton.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;token_type&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Type de jeton tel que d&#233;fini dans la section 5.1 de OAuth 2.0 [RFC6749].&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;exp&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Horodatage entier, mesur&#233; en nombre de secondes depuis le 1er janvier 1970 UTC, en indiquant la date d'expiration de ce jeton, comme d&#233;fini dans JWT [RFC7519].&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iat&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Horodatage entier, mesur&#233; en nombre de secondes depuis le 1er janvier 1970 UTC, en indiquant quand ce jeton a &#233;t&#233; publi&#233; &#224; l'origine, tel que d&#233;fini dans JWT [RFC7519].&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;nbf&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Horodatage entier, mesur&#233; en nombre de secondes depuis le 1er janvier 1970 UTC, en indiquant quand ce jeton ne doit pas &#234;tre utilis&#233; auparavant, comme d&#233;fini dans JWT [RFC7519].&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;sub&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Sujet du jeton, tel que d&#233;fini dans JWT [RFC7519].&lt;br class='autobr' /&gt;
G&#233;n&#233;ralement, un identifiant lisible par machine du propri&#233;taire de la ressource qui a autoris&#233; ce jeton.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;aud&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. cha&#238;ne Identifiant sp&#233;cifique au service ou liste de cha&#238;nes identifiants repr&#233;sentant le public vis&#233; pour ce jeton, comme d&#233;fini dans JWT [RFC7519].&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iss&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Cha&#238;ne repr&#233;sentant l'&#233;metteur de ce jeton, sous la forme d&#233;finie dans JWT [RFC7519].&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;jti&lt;/strong&gt;&lt;br class='autobr' /&gt;
OPTIONNEL. Identificateur de cha&#238;ne pour le jeton, tel que d&#233;fini dans JWT [RFC7519].&lt;/p&gt;
&lt;p&gt;Des impl&#233;mentations sp&#233;cifiques PEUVENT &#233;tendre cette structure avec leurs propres noms de r&#233;ponse sp&#233;cifiques aux services en tant que membres de niveau sup&#233;rieur de cet objet JSON. Les noms de r&#233;ponse destin&#233;s &#224; &#234;tre utilis&#233;s sur plusieurs domaines DOIVENT &#234;tre inscrit dans le registre &#034;OAuth Token Introspection Response&#034; d&#233;fini &#224; la section 3.1.&lt;/p&gt;
&lt;p&gt;Le serveur d'autorisation PEUT r&#233;pondre diff&#233;remment &#224; diff&#233;rentes ressources prot&#233;g&#233;es faisant la m&#234;me demande. Par exemple, un serveur d'autorisation PEUT limiter les port&#233;es d'un jeton donn&#233; retourn&#233; pour chaque ressource prot&#233;g&#233;e pour emp&#234;cher une ressource prot&#233;g&#233;e d'en apprendre davantage sur le r&#233;seau que n&#233;cessaire pour son fonctionnement.&lt;/p&gt;
&lt;p&gt;La r&#233;ponse PEUT &#234;tre mise en cache par la ressource prot&#233;g&#233;e pour am&#233;liorer les performances et r&#233;duire la charge sur le point final d'introspection, mais au prix de la qualit&#233; de la validit&#233; des informations utilis&#233;es par la ressource prot&#233;g&#233;e pour prendre des d&#233;cisions d'autorisation. Voir la section 4 pour plus d'informations en ce qui concerne le compromis lorsque la r&#233;ponse est mise en cache.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;DnC s'est inspir&#233; de cette proposition de standard pour &#233;tendre les jetons accept&#233;s aux trois types &lt;a href='https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html' class='spip_in'&gt;Access Token&lt;/a&gt;, &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt' class='spip_in'&gt;Identity Token (JWT)&lt;/a&gt; ou &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jwejsonwebencryption' class='spip_in'&gt;Json Web Encryption (JWE)&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Point d'extr&#233;mit&#233; d'introspection&lt;/h3&gt;
&lt;p&gt;Point d'extr&#233;mit&#233; d'introspection (Introspection Endpoint)&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;https://oa.dnc.global/introspect&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;&lt;a id=&#034;oidcformedemandeintrospection&#034;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Forme de la demande d'Introspection&lt;/h3&gt;
&lt;p&gt;La demande ne doit &#234;tre effectu&#233;e que par la m&#233;thode POST.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OAuthSD ne n&#233;cessite pas l'enregistrement d'un scope r&#233;serv&#233; pour autoriser le client &#224; utiliser l'introspection, contrairement &#224; d'autres impl&#233;mentations. Le scope 'openid' est &#233;galement inutile, le controleur fonctionnant aussi bien dans le cadre de OAuth 2.0 que celui d'OpenID Connect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Contr&#244;le de l'acc&#232;s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Les demandes adress&#233;es au point de terminaison d'introspection doivent &#234;tre authentifi&#233;es avec les informations d'identification du client (Client Credentials Grant) ou autoris&#233;es avec un jeton d'acc&#232;s au porteur (Bearer Token).&lt;br class='autobr' /&gt;
En cons&#233;quence, l'application appelante (ou le serveur de ressource) doit &#234;tre enregistr&#233;e comme cliente sur le serveur d'authentification&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Client Credentials Grant&lt;/strong&gt;&lt;br class='autobr' /&gt;
C'est l'approche la plus simple et celle qui est recommand&#233;e. &lt;br class='autobr' /&gt;
L'application appelante (ou le serveur de ressource) doit &#234;tre enregistr&#233;e comme cliente sur le serveur d'authentification&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb3-1' class='spip_note' rel='appendix' title='OAuthSD autorise tous les clients enregistr&#233;s &#224; acc&#233;der au point de (...)' id='nh3-1'&gt;1&lt;/a&gt;]&lt;/span&gt;.&lt;br class='autobr' /&gt;
L'authentification est effectu&#233;e en utilisant l'authentification HTTP Basic (cf. section 2.3.1 de OAuth 2.0 [RFC6749]). Les identifiants client_id et client_secret sont ceux qui ont &#233;t&#233; d&#233;finis lors de l'inscription de l'application cliente sur le serveur.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bearer Token&lt;/strong&gt;&lt;br class='autobr' /&gt;
Cette approche n&#233;cessite un jeton d'acc&#232;s pour autoriser la demande d'introspection. &lt;br class='autobr' /&gt;
Pour un serveur de ressource, cela est plus compliqu&#233; du fait de la dur&#233;e limit&#233;e de validit&#233; du jeton d'acc&#232;s, contraignant &#224; une nouvelle demande de jeton. Une fa&#231;on d'obtenir un tel jeton consiste &#224; inscrire l'application pour le flux &lt;a href='https://static.oa.dnc.global/-Autorisation-de-serveur-a-serveur-Client-Credentials-Grant-.html#oauth20autorisationdeserveuraserveurexemplecomplet' class='spip_in'&gt;Client Credential Grant&lt;/a&gt;. &lt;br class='autobr' /&gt;
L'authentification est effectu&#233;e en passant le jeton dans l'en-t&#234;te Authorization de la demande d'introspection.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OAuthSD permet de sauter cette &#233;tape en r&#233;glant la constante de configuration AUTHENTICATE_INTROSPECT_REQUEST &#224; false.&lt;br class='autobr' /&gt;
De fait, la rfc indique que l'objectif de cette authentification client est &#034;Pour emp&#234;cher les attaques par balayage de jetons ...&#034;&lt;br class='autobr' /&gt;
Les attaques par balayage (scanning) pourraient &#234;tre mieux att&#233;nu&#233;es de certaines autres mani&#232;res, en particulier au niveau du r&#233;seau.&lt;br class='autobr' /&gt;
De plus, donner &#224; un client inconnu des informations sur la validit&#233; du jeton n'est pas un probl&#232;me de s&#233;curit&#233; &#233;lev&#233;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Requ&#234;te&lt;/h3&gt;
&lt;p&gt;Les param&#232;tre suivants doivent &#234;tre post&#233;s :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;strong&gt;token&lt;/strong&gt; (OBLIGATOIRE) : le jeton &#224; valider. Les jetons soumis peuvent &#234;tre du type &lt;a href='https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html' class='spip_in'&gt;Access Token&lt;/a&gt;, &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt' class='spip_in'&gt;Identity Token (JWT)&lt;/a&gt; ou &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jwejsonwebencryption' class='spip_in'&gt;Json Web Encryption (JWE)&lt;/a&gt;. &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;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;strong&gt;requester_ip&lt;/strong&gt; (OPTIONNEL) : Lorsque l'Introspection est demand&#233;e par une ressource prot&#233;g&#233;e (distincte de l'application cliente &#224; l'origine de l'authentification), il importe de ne pas r&#233;pondre &#224; un malware ayant intercept&#233; le jeton et tentant de le r&#233;-utiliser. &lt;br class='autobr' /&gt;
Pour cela, la ressource prot&#233;g&#233;e doit &lt;a href='https://static.oa.dnc.global/-Authentifier-l-application-.html#verificationdeloriginedelarequeterecueparunserveurderessource' class='spip_in'&gt;transmettre l'IP du demandeur au moyen du param&#232;tre 'requester_ip'&lt;/a&gt;.&lt;br class='autobr' /&gt;
La fonction d'introspection d'OAuthSD v&#233;rifie que l'IP indiqu&#233;e est celle qui a &#233;t&#233; enregistr&#233; avec l'application cliente ou, &#224; d&#233;faut, se trouve dans le sous r&#233;seau de l'application cliente tel qu'il peut &#234;tre d&#233;termin&#233; &#224; partir de l'URL de retour.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OAuthSD ne n&#233;cessite pas le param&#232;tre token_type.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Avertissement &#224; propos du &lt;strong&gt;param&#232;tre 'alg'&lt;/strong&gt; : la RFC 7515, section 4.1.1 pr&#233;voit d'appliquer la valeur du param&#232;tre 'alg' pour le choix de l'algorithme de validation de la signature.&lt;br class='autobr' /&gt;
C'est une faille de s&#233;curit&#233; s&#233;v&#232;re, et donc une erreur de la sp&#233;cification. L'introspection d'OAuthSD applique la m&#233;thode d&#233;finie pour chaque application, avec laquelle les jetons sont sign&#233;s, quelle que soit la valeur de 'alg' et g&#233;n&#232;re une erreur si la valeur est diff&#233;rente.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;R&#233;ponse du serveur&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;En cas de succ&#232;s&lt;/strong&gt;, le serveur retourne une r&#233;ponse HTTP 200.&lt;/p&gt;
&lt;p&gt;Le corps de la r&#233;ponse contient un tableau portant les informations suivantes :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='ida5b2_c0'&gt; index &lt;/th&gt;&lt;th id='ida5b2_c1'&gt; type &lt;/th&gt;&lt;th id='ida5b2_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='ida5b2_c0'&gt;status&lt;/td&gt;
&lt;td headers='ida5b2_c1'&gt;entier&lt;/td&gt;
&lt;td headers='ida5b2_c2'&gt;code HTTP&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td headers='ida5b2_c0'&gt;headers&lt;/td&gt;
&lt;td headers='ida5b2_c1'&gt;string&lt;/td&gt;
&lt;td headers='ida5b2_c2'&gt;Headers de la r&#233;ponse&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='ida5b2_c0'&gt;page&lt;/td&gt;
&lt;td headers='ida5b2_c1'&gt;string&lt;/td&gt;
&lt;td headers='ida5b2_c2'&gt;JSON Array :&lt;br class='autobr' /&gt;
active : true,&lt;br class='autobr' /&gt;
scope : (JSON string Array) scopes associ&#233;s au jeton.&lt;br class='autobr' /&gt;
client_id : ID de l'application cliente qui a demand&#233; ce jeton.&lt;br class='autobr' /&gt;
username : ID OAuth de l'utilisateur final (human-readable).&lt;br class='autobr' /&gt;
exp : (long) (secondes depuis le 1&#176; janvier 1970). Unix Time de la fin de validit&#233; du jeton.&lt;br class='autobr' /&gt;
iat : (long) (secondes depuis le 1&#176; janvier 1970). Unix Time de cr&#233;ation du jeton&lt;br class='autobr' /&gt;
iss : (string) issuer : serveur d'authentification qui a diffus&#233; ce jeton.&lt;br class='autobr' /&gt;
sub : identifiant interne de l'utilisateur qui a autoris&#233; ce jeton.&lt;br class='autobr' /&gt;
aud : audience d&#233;finie pour ce jeton.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Si le jeton n'est pas valide&lt;/strong&gt;, alors que la requ&#234;te n'a pas &#233;chou&#233;, l'introspection ne retourne un code HTTP 200 et une r&#233;ponse active : false.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Le traitement des erreurs d'introspection d&#233;crit dans ce qui suit est propre &#224; cette version de OAuthSD, destin&#233;e au d&#233;veloppement et &#224; la mise au point d'une application mettant en oeuvre la d&#233;l&#233;gation d'authentification. Conform&#233;ment &#224; la sp&#233;cification, les serveurs OAuthSD de production ne donnent pas de d&#233;tail sur l'erreur, mais retournent simplement un code HTTP 401 et une r&#233;ponse active : false.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;En cas d'&#233;chec de la requ&#234;te&lt;/strong&gt;, le corps de la r&#233;ponse contient :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='id6d2b_c0'&gt; index &lt;/th&gt;&lt;th id='id6d2b_c1'&gt; type &lt;/th&gt;&lt;th id='id6d2b_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id6d2b_c0'&gt;page&lt;/td&gt;
&lt;td headers='id6d2b_c1'&gt;string&lt;/td&gt;
&lt;td headers='id6d2b_c2'&gt;JSON Array :&lt;br class='autobr' /&gt;
error : titre de l'erreur,&lt;br class='autobr' /&gt;
error_description : description de l'erreur&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;La r&#233;ponse HTTP ainsi que les valeurs de error et error_description sont donn&#233;es par le tableau suivant :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;strong&gt;R&#233;ponse&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error&lt;br class='autobr' /&gt;
titre de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error_description&lt;br class='autobr' /&gt;
description de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Explication&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;Only one method may be used to authenticate at a time (Auth header, GET or POST)&lt;/td&gt;
&lt;td&gt;La requ&#234;te est mal form&#233;e&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;Missing parameters : &#034;token&#034; is required&lt;/td&gt;
&lt;td&gt;La requ&#234;te Introspection requiert le param&#232;tre 'token'.&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;When putting the token in the body, the method must be POST or PUT&lt;/td&gt;
&lt;td&gt;Si on place le token dans le corps de la requ&#234;te, la m&#233;thode ne peut &#234;tre que POST ou PUT&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;The content type for POST requests must be &#034;application/x-www-form-urlencoded&lt;/td&gt;
&lt;td&gt;l'IETF sp&#233;cifie ce type de contenu. NB : tous les serveurs Web ne remplissent pas cette variable _SERVER voir &lt;a href=&#034;http://tools.ietf.org/html/rfc6750#section-2.2&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;http://tools.ietf.org/html/rfc6750#section-2.2&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;401&lt;/td&gt;
&lt;td&gt;invalid_token&lt;/td&gt;
&lt;td&gt;JWT is malformed&lt;/td&gt;
&lt;td&gt;le jeton JWT ne peut &#234;tre d&#233;cod&#233;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;h3 class=&#034;spip&#034;&gt;Exemples&lt;/h3&gt;
&lt;p&gt;Demande de validation d'un jeton d'identit&#233;, m&#233;thode Auth Header (ou &#034;JWT Bearer&#034; ) :&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: #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;span style=&#034;color: #666666; font-style: italic;&#034;&gt;Autorisation avec OAuth Server by 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;OpenID Connect : Introspection, m&#233;thode Auth Header &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;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;function&lt;/span&gt; oauth_authorize&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$idtoken&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: #000088;&#034;&gt;$Ok&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: #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;$idtoken&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: #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;AUTHENTICATION_SERVER_URL &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'introspect'&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_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;/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;'Authorization: Bearer '&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$idtoken&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;/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;$response&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: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;int&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;a href=&#034;http://www.php.net/curl_getinfo&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_getinfo&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: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'http_code'&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: #cc66cc;&#034;&gt;200&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;$jwt&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;$response&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: #000088;&#034;&gt;$Ok&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$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;'active'&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;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: #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;span style=&#034;color: #000088;&#034;&gt;$Ok&lt;/span&gt; AND &lt;a href=&#034;http://www.php.net/isset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;isset&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;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;HTTP_REFERER&#034;&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: #000088;&#034;&gt;$urlParts&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/parse_url&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;parse_url&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;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;HTTP_REFERER&#034;&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: #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;$urlParts&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'host'&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;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;HTTP_HOST&#034;&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;&#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;// CORS : autoriser l'origine&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;$issuer&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$urlParts&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'scheme'&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;&#034;://&#034;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$urlParts&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'host'&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; include_spip&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'inc/headers'&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/header&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;header&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;'Access-Control-Allow-Origin'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$issuer&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;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;return&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$Ok&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://static.oa.dnc.global/local/cache-code/f546d8239657ccedea95364e8ab2cb92.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;Variante avec m&#233;thode GET pour SPIP :&lt;br class='autobr' /&gt;
&lt;strong&gt;SPIP&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: #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;span style=&#034;color: #666666; font-style: italic;&#034;&gt;Autorisation avec OAuth Server by 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;OpenID Connect : Introspection, m&#233;thode GET &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;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;function&lt;/span&gt; oauth_authorize&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$idtoken&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: #000088;&#034;&gt;$Ok&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: #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;$idtoken&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;// Interroger l'introspection de OAuth Server by 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; include_spip&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'inc/distant'&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;$url&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;http://oa.dnc.global/introspect?token=&#034;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$idtoken&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;$response&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; recuperer_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$url&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: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;int&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$response&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'status'&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: #cc66cc;&#034;&gt;200&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;$jwt&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;$response&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'page'&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;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: #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;$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;'active'&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;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;&#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/isset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;isset&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;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;HTTP_ORIGIN&#034;&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;// Acc&#232;s HTTP (CORS) : autoriser l'origine&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; include_spip&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'inc/headers'&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;$issuer&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;a href=&#034;http://www.php.net/strtr&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;strtr&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;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;HTTP_ORIGIN&#034;&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;'&lt;&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: #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/header&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;header&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;'Access-Control-Allow-Origin'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$issuer&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;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;$Ok&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: #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: #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;return&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$Ok&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://static.oa.dnc.global/local/cache-code/f9ed3e05ef32d40e5354ea7f9e794a98.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Un exemple plus complet, faisant appara&#238;tre la totalit&#233; des erreurs possibles, figure ici : &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-Autorisation-via-un-code-Authorization-Code-Flow-.html#openidconnectexemplescompletsdufluxdautorisationviauncodepuisrequeteuserinfo' class='spip_in'&gt;OpenID Connect : Exemples complets du flux d'Autorisation via un code puis requ&#234;te UserInfo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Dans le cas o&#249; l'application cliente et le serveur de donn&#233;es prot&#233;g&#233;es se trouvent dans des domaines diff&#233;rents, il faut g&#233;rer l'autorisation HTTP, comme cela est fait dans l'exemple ci-dessus. Voyez &lt;a href='https://static.oa.dnc.global/-Sujets-communs-a-Oauth-2-et-OpenID-Connect-.html#controledacceshttpcors' class='spip_in'&gt;Contr&#244;le d'acc&#232;s HTTP (CORS)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; L'interrogation du serveur d'autorisation &#224; chaque acc&#232;s d'une ressource prot&#233;g&#233;e peut le surcharger. Pour &#233;viter cela, on peut mettre en cache la r&#233;ponse du serveur du c&#244;t&#233; du serveur de ressource. Avec SPIP, c'est le r&#244;le de la fonction &lt;a href=&#034;http://code.spip.net/autodoc/tree/ecrire/inc/distant.php.html#function_recuperer_url_cache&#034; class='spip_out' rel='external'&gt;recuperer_url_cache()&lt;/a&gt; qui pourra remplacer &lt;a href=&#034;http://code.spip.net/autodoc/tree/ecrire/inc/distant.php.html#function_recuperer_url&#034; class='spip_out' rel='external'&gt;recuperer_url()&lt;/a&gt; dans l'exemple pr&#233;c&#233;dent. La fonction permet de r&#233;gler le d&#233;lai de garde en cache, qu'il convient de fixer &#224; une dur&#233;e assez courte (10 secondes par exemple), l'essentiel &#233;tant de ne pas bombarder le serveur. Voici un exemple :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SPIP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034; data-clipboard-text=&#034;$res = recuperer_url_cache( $url, array('delai_cache' =&gt; 10) ); // D&#233;lai de 10s&#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;$res&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; recuperer_url_cache&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&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: #0000ff;&#034;&gt;'delai_cache'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&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: #009900;&#034;&gt;&amp;#41;&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;// D&#233;lai de 10s&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;La fonction d&#233;crite pr&#233;c&#233;demment peut &#234;tre utilis&#233;e dans une fonction d'autorisation d'acc&#232;s &#224; un objet SPIP ( ici l'objet gis de radar ) :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SPIP&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;function&lt;/span&gt; _autoriser_gis&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$faire&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$quoi&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$qui&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$options&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;span style=&#034;color: #000088;&#034;&gt;$qui&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'statut'&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;'0minirezo'&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;// Toujours autoriser un administrateur&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;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: #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: #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;$idtoken&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'token'&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;&#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;// V&#233;rifier le jeton d'acc&#232;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: #b1b100;&#034;&gt;return&lt;/span&gt; oauth_authorize&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$idtoken&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;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&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;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://static.oa.dnc.global/local/cache-code/537cdc13218065f5ea90df5df93ef8ca.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Il faut cependant noter que la mise en cache expose &#224; la r&#233;utilisation du jeton par un malware.&lt;/p&gt;
&lt;p&gt;Exemple d'appel, avec le jeton pass&#233; par la m&#233;thode Auth Header et le param&#232;tre '&lt;a href='https://static.oa.dnc.global/-Authentifier-l-application-.html#verificationdeloriginedelarequeterecueparunserveurderessource' class='spip_in'&gt;requester_ip&lt;/a&gt;' par Post :&lt;br class='autobr' /&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: #666666; font-style: italic;&#034;&gt;// Method Bearer + parameters by Post&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;/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;'requester_ip'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'SERVER_ADDR'&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;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;$authorization&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;Authorization: Bearer &#034;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$res1&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'id_token'&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;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;&lt;span style=&#034;color: #000088;&#034;&gt;$introspection_endpoint&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;/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;'Content-Type: application/x-www-form-urlencoded'&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;'Authorization: Bearer '&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$id_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: #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_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_POST&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;1&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: #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://static.oa.dnc.global/local/cache-code/e13c64904e5aa04d40a6454be3c83ff8.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;a id=&#034;avantages&#034;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Avantages et inconv&#233;nients de l'Introspection&lt;/h3&gt;
&lt;p&gt;La validation du jeton d'identit&#233; (ID Token) aupr&#232;s du serveur d'authentification (introspection) pr&#233;sente quatre avantages importants : &lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; elle permet de &lt;strong&gt;savoir si le jeton a &#233;t&#233; r&#233;voqu&#233;&lt;/strong&gt;, contrairement &#224; la validation locale ; c'est l&#224; un avantage fondamental pour la s&#233;curit&#233; : si vous d&#233;cidez de r&#233;voquer un jeton d'acc&#232;s, alors il faut bien que les applications r&#233;agissent, le seul moyen est l'introspection.
&lt;br /&gt;&lt;img src='https://static.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 ne n&#233;cessite pas de conna&#238;tre la cl&#233; publique de l'application cliente pour valider la signature du jeton, ce qui permet &#224; des serveurs de ressource &#233;trangers &#224; l'organisation de valider les jetons re&#231;us ;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; on peut obtenir des informations sur l'utilisateur final (qui est &#224; l'origine de l'autorisation) qui permettent d'identifier cet utilisateur et, donc, d'agir en fonction de la confiance &#224; accorder d'apr&#232;s son profil ;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; il est possible de mettre en &#339;uvre la d&#233;claration &#034;jti&#034; (JWT ID) qui permet au serveur d'autorisation de v&#233;rifier que le jeton n'a pas d&#233;j&#224; &#233;t&#233; utilis&#233; ;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OAuthSD propose &#233;galement la v&#233;rification de l'IP du demandeur : si une ressource prot&#233;g&#233;e a transmis l'adresse IP de son propre demandeur avec le param&#232;tre 'requester_ip', on v&#233;rifie que cette adresse IP se trouve dans le sous-r&#233;seau de l'application cliente identifi&#233;e par la d&#233;claration 'aud'. Cela est essentiel pour ne pas r&#233;pondre &#224; un malware ayant intercept&#233; le jeton.&lt;/p&gt;
&lt;p&gt;Elle a pour seul inconv&#233;nient d'augmenter le trafic avec le serveur d'autorisation.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Remarque quant au lien entre jeton d'identit&#233; et jeton d'acc&#232;s et l'int&#233;r&#234;t r&#233;el de ce dernier&lt;/h3&gt;
&lt;p&gt;Justin Richer : (&lt;a href=&#034;http://lists.openid.net/pipermail/openid-specs-ab/Week-of-Mon-20130909/003951.html&#034; class='spip_out' rel='external'&gt;openid-specs-ab&lt;/a&gt;)&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;&lt;i&gt;&#034;Il n'y a pas de relation 1:1 entre le jeton d'acc&#232;s et jeton d'identit&#233; (ID Token), surtout si vous consid&#233;rez que le jeton d'acc&#232;s peut &#234;tre actualis&#233; ou ne pas expirer, alors que le jeton d'identit&#233; doit expirer. Le ID Token repr&#233;sente l'&#233;v&#233;nement authn (et la session, dans une certaine mesure), alors que le jeton d'acc&#232;s repr&#233;sente une autorisation d&#233;l&#233;gu&#233;e d'acc&#232;s aux informations de profil de l'utilisateur. Vous pouvez obtenir des informations sur l'&#233;v&#233;nement d'authentification qui a g&#233;n&#233;r&#233; le jeton d'acc&#232;s &#224; partir de l'introspection, mais il est important de se rappeler que le jeton d'acc&#232;s n'est pas destin&#233; &#224; &#234;tre &#233;troitement li&#233; &#224; cet &#233;v&#233;nement d'authentification. En fait, c'est toute la question d'OAuth qui lie de fa&#231;on l&#226;che l'authentification au jeton d'acc&#232;s et maintient le jeton d'acc&#232;s valide alors que l'utilisateur n'est plus l&#224;.&lt;/i&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Cette remarque &#224; propos de la faiblesse du lien entre jeton d'acc&#232;s et jeton d'identit&#233; rejoint la conclusion &#233;mise &#224; propos de la &lt;a href='https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#demandedinformationssurlutilisateuruserinfoendpoint' class='spip_in'&gt;requ&#234;te Userinfo&lt;/a&gt; : toute requ&#234;te Userinfo devrait suivre le cycle : demande d'autorisation, validation du ID Token, demande Userinfo, v&#233;rification de la concordance des user_id. C'est ce qui est d&#233;crit dans les &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-Autorisation-via-un-code-Authorization-Code-Flow-.html#openidconnectexemplescompletsdufluxdautorisationviauncodepuisrequeteuserinfo' class='spip_in'&gt;exemples&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Que vaut r&#233;ellement un jeton d'acc&#232;s si :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; on ne peut v&#233;rifier sa validit&#233; sans introspection&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb3-2' class='spip_note' rel='appendix' title='Une piste consiste &#224; Emettre un jeton d'acc&#232;s en tant que JWT.' id='nh3-2'&gt;2&lt;/a&gt;]&lt;/span&gt; (autant alors faire l'introspection pour le jeton d'identit&#233;),
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; on n'est pas certain du lien avec le jeton d'identit&#233; ?&lt;/p&gt;
&lt;p&gt;Plus g&#233;n&#233;ralement, ne devrait-on pas conclure ainsi : &lt;strong&gt;plut&#244;t que d'utiliser le jeton d'acc&#232;s ne vaudrait-il pas mieux utiliser exclusivement le jeton d'identit&#233; ?&lt;/strong&gt; C'est pour cela qu'il existe un flux OpenID Connect ne retournant que l'ID Token.&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;OAuthSD autorise tous les clients enregistr&#233;s &#224; acc&#233;der au point de terminaison d'introspection. Il est donc inutile de sp&#233;cifier un scope ou une m&#233;tadonn&#233;e particuliers.&lt;/p&gt;
&lt;/div&gt;&lt;div id='nb3-2'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh3-2' class='spip_note' title='Notes 3-2' rev='appendix'&gt;2&lt;/a&gt;] &lt;/span&gt;Une piste consiste &#224; &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#emettreunjetondaccesentantquejwt' class='spip_in'&gt;Emettre un jeton d'acc&#232;s en tant que JWT&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>API OpenId Connect : Point d'extr&#233;mit&#233; d'informations sur les clefs (Keys Endpoint)</title>
		<link>https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectpointdextremitedinformationssurlesclefskeysendpoint</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectpointdextremitedinformationssurlesclefskeysendpoint</guid>
		<dc:date>2021-04-14T10:15:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Le protocole OpenID Connect utilise un jeton d'identit&#233; (ID Token) fond&#233; sur JWT. La norme d&#233;crit comment une application cliente doit valider un ID Token re&#231;u en r&#233;ponse &#224; une demande d'authentification. Cette v&#233;rification peut se faire localement (ou sinon par introspection), ce qui n&#233;cessite d'acc&#233;der aux informations sur les cl&#233;s publiques. &lt;br class='autobr' /&gt;
C'est ce que permet le &lt;br class='autobr' /&gt;
Point d'extr&#233;mit&#233; d'informations sur les clefs (Keys Endpoint) &lt;br class='autobr' /&gt;
https://oa.dnc.global/keys &lt;br class='autobr' /&gt;
Forme de la demande d'informations sur les cl&#233;s (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html" rel="directory"&gt;API OpenID Connect : Points d'extr&#233;mit&#233;&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://static.oa.dnc.global/local/cache-vignettes/L128xH128/arton57-692a7.png?1733821221' width='128' height='128' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Le protocole OpenID Connect utilise un &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt' class='spip_in'&gt;jeton d'identit&#233; (ID Token) fond&#233; sur JWT&lt;/a&gt;. La norme d&#233;crit comment une application cliente doit &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-6-.html#validationdujetondidentiteidtokenjwtsigneoujws' class='spip_in'&gt;valider un ID Token&lt;/a&gt; re&#231;u en r&#233;ponse &#224; une demande d'authentification. Cette v&#233;rification peut se faire localement (ou sinon par introspection), ce qui n&#233;cessite d'acc&#233;der aux informations sur les cl&#233;s publiques.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;C'est ce que permet le&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Point d'extr&#233;mit&#233; d'informations sur les clefs (Keys Endpoint)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code class='spip_code' dir='ltr'&gt;https://oa.dnc.global/keys&lt;/code&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Forme de la demande d'informations sur les cl&#233;s&lt;/h3&gt;
&lt;p&gt;La demande ne doit &#234;tre effectu&#233;e que par la m&#233;thode POST.&lt;/p&gt;
&lt;p&gt;Le client doit inclure ses informations d'authentification telles que d&#233;crites &#224; la section 2.3. du document [RFC6749].&lt;/p&gt;
&lt;p&gt;Exemple de requ&#234;te :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;POST /keys HTTP/1.1&lt;br /&gt; Host: oa.dnc.global&lt;br /&gt; Content-Type: application/x-www-form-urlencoded&lt;br /&gt; Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW&lt;/code&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;R&#233;ponse&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;En cas de succ&#232;s&lt;/strong&gt; le serveur retourne une r&#233;ponse HTTP 200.&lt;br class='autobr' /&gt;
Le corps de la r&#233;ponse contient une liste de d&#233;finitions des cl&#233;s publiques.&lt;/p&gt;
&lt;p&gt;Chaque d&#233;finition de cl&#233; est repr&#233;sent&#233;e sous un format JSON telle que d&#233;fini dans le document &lt;a href=&#034;https://tools.ietf.org/html/rfc7517&#034; class='spip_out' rel='external'&gt;JSON Web Key (JWK)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Exemple&lt;/strong&gt;&lt;br class='autobr' /&gt;
Voici un exemple de r&#233;ponse au format JSON :&lt;br class='autobr' /&gt;
&lt;strong&gt;[JSON]&lt;/strong&gt;&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;{&#034;keys&#034;:[{&lt;br /&gt; &#034;kid&#034;:&#034;618584200ef916a154008d898a1e7edc&#034;,&lt;br /&gt; &#034;kty&#034;:&#034;RSA&#034;,&lt;br /&gt; &#034;alg&#034;:&#034;RS256&#034;,&lt;br /&gt; &#034;use&#034;:&#034;sig&#034;,&lt;br /&gt; &#034;e&#034;:&#034;AQAB&#034;,&lt;br /&gt; &#034;n&#034;:&#034;ykcWIXjQ-f61XCJutT4JcgpmmobtB0U7ZcejT8tBD8rOZPkQDYf0Q3pMjCkNT8RRKzMYtkelY2CNn3U7kVJMgbJAtvZsCdlChVHAKvRnjwh1GR_6Zpmajm5cuz4bjQWWUIPIoXe_4JbC8nCrHdaagzB_6PrV_NILyn5unG1RLOrWx7_yzLaterDKxHTCBeOlqv_5VGFey0Ecf-X7Bj8YRx6fpamK4BcEAZSAbZMtAnTckp3hOYJgZo3MOXDxSQw1YR83i5Udcoaf7sxfhEA_b7r9CeNfgj76MKM7sdCfBMI7_JSz-YU_pJKCuT9Ny3IJQ0fQHpDzSq2oD_3cDcLjfXTGM67rXElwr9l8yrSNa29UGK4q2u9cFCQmJGlxVhZU6bzs7l4202LTJdPlzm_29jwLVvtqnVJSovMLHx84ReFtus1RdKRGB2plDQccvBNvp92D9lOnM3bAu1fKRAJwNh3hg1d6k7MVCHxoo9HVnkxzW48rAAJE2nk44a2Y0cclufBhvKRdNavldS1XOyZ_qf3qCAzsuYF1VAga8I-QOb6OyXp0KGLptbyYD-ZXISGPw3pDD3aAof_PMfFhSB96GHDnm-UCRpFHndQ_fZgtZhWugU8z22rV-irYCySqVkpE0ToWbNXNFZ9Jo1GXdwkpi1WjB7S-ipjzRFOlxhwbvZ0&#034;},&lt;br /&gt; ...&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;kid&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Comme diff&#233;rentes applications clientes peuvent utiliser la m&#234;me paire de cl&#233; publique/priv&#233;e, les cl&#233;s sont index&#233;es par un identifiant &#034;kid&#034; plut&#244;t que par un client_id.&lt;/p&gt;
&lt;p&gt;Cet identifiant est notamment pr&#233;sent dans la charge utile du &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt' class='spip_in'&gt;jeton JWT&lt;/a&gt;, ce qui permettra de s&#233;lectionner la cl&#233; publique n&#233;cessaire pour &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-6-.html#validationdujetondidentiteidtokenjwtsigneoujws' class='spip_in'&gt;valider la signature du jeton JWT&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt; jwks_uri, fichier jwks.json&lt;/h3&gt;
&lt;p&gt;La norme pr&#233;voit que le document de d&#233;couverte .well-known/openid_configuration d&#233;finisse une constante jwks_uri donnant l'URL du fichier jwks.json, sous la forme :&lt;br class='autobr' /&gt;
&lt;code class='spip_code' dir='ltr'&gt;&#034;jwks_uri&#034; : &#034;https://oa.dnc.global/jwks/jwks.json&#034;,&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Cette URL permet d'obtenir la m&#234;me information que par le Point d'extr&#233;mit&#233; d'informations sur les clefs. Cependant, ces donn&#233;es sont statiques, alors que l'appel au contr&#244;leur Keys recalcule le fichier jwks.json &#224; chaque fois afin de prendre en compte un &#233;ventuel changement.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;UpdatekeysController&lt;/h3&gt;
&lt;p&gt;OAuthSD propose un point d'entr&#233;e &#034;updatekeys&#034; qui provoque le re-calcul des paires de cl&#233;s publiques-priv&#233;es de tous les clients ainsi que la mise &#224; jour des informations sur les cl&#233;s.&lt;br class='autobr' /&gt;
Ce contr&#244;leur n'est accessible qu'&#224; partir de la m&#234;me adresse que le serveur et sera donc soit lanc&#233; localement par le Superviseur soit par une t&#226;che CRON &#224; l'aide de wget.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Outre le fichier jwks.json, le dossier /jwks contient un fichier au format JSON pour chaque cl&#233; publique, sous le nom &lt;code class='spip_code' dir='ltr'&gt;&lt;kid&gt;.json&lt;/code&gt;.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Compte-tenu de la charge de calcul n&#233;cessaire &#224; l'&#233;tablissement du fichier, l'appel au point d'extr&#233;mit&#233; Keys doit &#234;tre r&#233;serv&#233; &#224; des applications de confiance ou &#234;tre prot&#233;g&#233; contre les attaques de type d&#233;ni de service.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Pour &#233;viter le recalcul du fichier jwks.json &#224; chaque appel de Keys, il est possible de modifier la r&#232;gle de r&#233;&#233;criture dans le fichier .htaccess pour :&lt;br class='autobr' /&gt;
&lt;code class='spip_code' dir='ltr'&gt;RewriteRule ^keys /jwks/jwks.json [QSA,L]&lt;/code&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Une cl&#233; publique peut &#233;galement &#234;tre lue au moyen de l'&lt;a href='https://static.oa.dnc.global/-Techniques-et-code-du-serveur-OAuthSD-.html#apihttpresttreeql' class='spip_in'&gt;API HTTP REST + TreeQL&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Lien de (re)connexion</title>
		<link>https://static.oa.dnc.global/-OpenID-Connect-Autorisation-via-un-code-Authorization-Code-Flow-.html#liendereconnexion</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-OpenID-Connect-Autorisation-via-un-code-Authorization-Code-Flow-.html#liendereconnexion</guid>
		<dc:date>2021-04-02T15:30:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Il peut &#234;tre utile de permettre &#224; un utilisateur de se connecter sans passer par une proc&#233;dure d'identification. Par exemple lorsque le login ou le mot de passe a &#233;t&#233; perdu et pour &#233;viter la fastidieuse proc&#233;dure de r&#233;cup&#233;ration du &#034;mot de passe oubli&#233;&#034;. &lt;br class='autobr' /&gt;
Nous d&#233;crivons ici comment cr&#233;er un lien de reconnexion qui pourra, par exemple, &#234;tre adress&#233; &#224; l'utilisateur dans un e-mail. &lt;br class='autobr' /&gt;
Plut&#244;t que faire figurer le jeton d'identit&#233; dans le lien, qui peut &#234;tre trop grand pour &#234;tre pass&#233; en URL, on prendra l'ID Token (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-OpenID-Connect-Autorisation-via-un-code-Authorization-Code-Flow-.html" rel="directory"&gt;OpenID Connect : Autorisation via un code (Authorization Code Flow)&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://static.oa.dnc.global/local/cache-vignettes/L128xH128/arton216-26f9e.png?1733819294' width='128' height='128' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Il peut &#234;tre utile de permettre &#224; un utilisateur de se connecter sans passer par une proc&#233;dure d'identification. Par exemple lorsque le login ou le mot de passe a &#233;t&#233; perdu et pour &#233;viter la fastidieuse proc&#233;dure de r&#233;cup&#233;ration du &#034;mot de passe oubli&#233;&#034;.&lt;/p&gt;
&lt;p&gt;Nous d&#233;crivons ici comment cr&#233;er un lien de reconnexion qui pourra, par exemple, &#234;tre adress&#233; &#224; l'utilisateur dans un e-mail.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Plut&#244;t que faire figurer le jeton d'identit&#233; dans le lien, qui peut &#234;tre trop grand pour &#234;tre pass&#233; en URL, on prendra l'ID Token dans une table o&#249; il se trouve index&#233; par son hash, et ce sera cette valeur qui sera pass&#233;e dans le lien de reconnexion.&lt;/p&gt;
&lt;p&gt;En t&#234;te de chaque page pouvant &#234;tre appel&#233;e avec reconnexion, on appellera avec :&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_spip code&#034; data-clipboard-text=&#034;&#034;&gt;&lt;div class=&#034;spip&#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: #222&#034;&gt;&lt;INCLURE&lt;span style=&#034;color: #74B900;&#034;&gt;{fond=inclure/autoconnect}&lt;/span&gt;&lt;span style=&#034;color: #74B900;&#034;&gt;{env}&lt;/span&gt;&lt;/span&gt;&lt;span style=&#034;color: #222;&#034;&gt;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;la noisette suivante :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SPIP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_spip code&#034;&gt;&lt;div class=&#034;spip&#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: #D05000;&#034;&gt;[&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#034;&gt;(&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#034;&gt;#REM&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#034;&gt;)&lt;/span&gt; 150b Autoconnect : connexion OIDC avec la m&#233;thode id_token_hint &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;Remplace la noisette identification pour assurer l'authentification avec l'ID Token pass&#233; par le param&#232;tre d'URL token&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;auteur : B.Degoy i-Tego&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;licence : GNU/GPL&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: #D05000;&#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: #D05000;&#034;&gt;[&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#034;&gt;(&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#034;&gt;#ENV&lt;/span&gt;&lt;span style=&#034;color: #74B900;&#034;&gt;{token}&lt;/span&gt;&lt;span style=&#034;color: #FF851D;&#034;&gt;|autoconnect&lt;/span&gt;&lt;span style=&#034;color: #74B900;&#034;&gt;{&lt;span style=&#034;color: #D05000;&#034;&gt;#SELF&lt;/span&gt;}&lt;/span&gt;&lt;span style=&#034;color: #FF851D;&#034;&gt;|non&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#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: #D05000;&#034;&gt;[&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#034;&gt;(&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#034;&gt;#SESSION&lt;/span&gt;&lt;span style=&#034;color: #74B900;&#034;&gt;{id_auteur}&lt;/span&gt;&lt;span style=&#034;color: #FF851D;&#034;&gt;|non&lt;/span&gt;&lt;span style=&#034;color: #D05000;&#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: #C90&#034;&gt;&lt;:oauth:vous_devez_vous_identifier:&gt;&lt;/span&gt;.&lt;br /&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: #C90&#034;&gt;&lt;:oauth:vous_pas_compte:&gt; &lt;a href=&#034;./spip.php?page=inscription&amp;lang=&lt;span style=&#034;color: #D05000;&#034;&gt;#ENV&lt;/span&gt;&lt;span style=&#034;color: #74B900;&#034;&gt;{lang}&lt;/span&gt;&#034;&gt;&lt;:oauth:creer_compte_auteur:&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&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;br /&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: #D05000;&#034;&gt;#LOGIN_PUBLIC&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: #D05000;&#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: #D05000;&#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://static.oa.dnc.global/local/cache-code/2ef80c2ab7d129ec43abc6df97ece4ed.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Voici le code du filtre autoconnect :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PHP SPIP&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: #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; * Autoconnect pour DnC SaaS (base SPIP)&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; * @auteur : B.Degoy i-Tego&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; * SPIP, Systeme de publication pour l'internet &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; * Copyright (c) 2001-2020&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; * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James &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; * Ce programme est un logiciel libre distribue sous licence GNU/GPL. &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; * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. &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: #666666; font-style: italic;&#034;&gt;//[dnc150b]&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: #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;* Lancer une (re)connexion par la m&#233;thode OIDC id_token_hint avec le token fourni.&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;* Ceci suppose que la derni&#232;re connexion de l'utilisateur ait &#233;t&#233; enregistr&#233;e dans la table 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;* La table jwt est index&#233;e par le hash de l'ID 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;* C'est cette valeur, plus courte que l'ID token lui-m&#234;me, qui est pass&#233;e dans l'URL d'autoconnexion.&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 mixed $idt_hash : le hash de l'ID 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;*/&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; filtre_autoconnect_dist&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$idt_hash&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&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: #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;//DebugBreak(&#034;435347910947900005@127.0.0.1;d=1&#034;); //DEBUG&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;// R&#233;cup&#233;rer l'ID Token et le client avec idt_hash&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; include_spip&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'base/abstract_sql'&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;$res&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; sql_fetsel&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'client_id, id_token'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'spip_jwt'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'idt_hash='&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; sql_quote&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$idt_hash&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;/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;&lt;span style=&#034;color: #000088;&#034;&gt;$res&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;// G&#233;n&#233;rer un state &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; include_spip&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'inc/session'&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;$state&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/md5&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;md5&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;$idt_hash&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;$state&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/substr&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;substr&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;$state&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: #cc66cc;&#034;&gt;16&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; session_set&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'state'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$state&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;// Page &#224; laquelle rediriger apr&#232;s l'authentification.&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/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;$url&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: #000088;&#034;&gt;$url&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;/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;$url&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; parametre_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'token'&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;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// sans le token &#233;videmment (car il ne sera plus valide apr&#232;s la (re)connexion.&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; session_set&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'caller'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&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: #666666; font-style: italic;&#034;&gt;// voir plugin oidcclient : oidc_setps.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;/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;// lancer une (re)connexion par la m&#233;thode OIDC id_token_hint&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;$redirect&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'/authorize'&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;$redirect&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; parametre_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$redirect&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'response_type'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'code'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'&amp;'&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;$redirect&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; parametre_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$redirect&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'scope'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'openid sli'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'&amp;'&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;$redirect&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; parametre_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$redirect&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#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;span style=&#034;color: #0000ff;&#034;&gt;'&amp;'&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;$redirect&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; parametre_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$redirect&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#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;$res&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_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: #0000ff;&#034;&gt;'&amp;'&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;$redirect&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; parametre_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$redirect&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'state'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$state&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'&amp;'&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;$redirect&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; parametre_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$redirect&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'url'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'&amp;'&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;$redirect&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; parametre_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$redirect&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'id_token_hint'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$res&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'id_token'&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;'&amp;'&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; include_spip&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'inc/headers'&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; redirige_par_entete&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$redirect&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;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;// idt_hash non valide ou erreur plus g&#233;n&#233;rale.&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: #0000ff;&#034;&gt;&#034;&#034;&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;// pour faire &#233;chouer le test&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;/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://static.oa.dnc.global/local/cache-code/7f5f4195b8cc3621de588507f2dad2a0.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Cette proc&#233;dure de reconnexion revient exactement &#224; une nouvelle connexion de l'utilisateur. Cela veut dire en particulier que le cookie SLI et les jetons seront r&#233;g&#233;n&#233;r&#233;s.&lt;/p&gt;
&lt;p&gt;Comme le jeton d'identit&#233; change, son hash change et il en r&#233;sulte que le jeton pass&#233; dans le lien de reconnexion est &#224; usage unique.&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>M&#233;thodes alternatives pour le monitoring de la session OpenID Conect et le SLO</title>
		<link>https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#methodesalternativespourlemonitoringdelasessionopenidconectetleslo</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#methodesalternativespourlemonitoringdelasessionopenidconectetleslo</guid>
		<dc:date>2021-01-29T10:30:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Pour synchroniser l'&#233;tat de connexion de chaque application utilis&#233;e par un m&#234;me utilisateur, nous avons utilis&#233; un code javascript pour interroger r&#233;guli&#232;rement le serveur d'authentification. &lt;br class='autobr' /&gt;
S'agissant de d&#233;connecter les sessions de toutes les applications de l'utilisateur final (SLO), il existe des alternatives. &lt;br class='autobr' /&gt;
Les trois premi&#232;res alternatives font l'objet de propositions de sp&#233;cification &#233;mises en 2020. OAuthSD ne met en &#339;uvre que OpenID Connect Session Management. La troisi&#232;me solution est plus (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html" rel="directory"&gt;OpenID Connect : SSO, management de session etc.&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Pour synchroniser l'&#233;tat de connexion de chaque application utilis&#233;e par un m&#234;me utilisateur, nous avons utilis&#233; un code javascript pour interroger r&#233;guli&#232;rement le serveur d'authentification.&lt;/p&gt;
&lt;p&gt;S'agissant de d&#233;connecter les sessions de toutes les applications de l'utilisateur final (SLO), il existe des alternatives.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Les trois premi&#232;res alternatives font l'objet de propositions de sp&#233;cification &#233;mises en 2020. OAuthSD ne met en &#339;uvre que OpenID Connect Session Management.&lt;br class='autobr' /&gt;
La troisi&#232;me solution est plus ancienne et ne devrait pas l'emporter sur ces d&#233;finitions plus r&#233;centes.&lt;/p&gt;
&lt;p&gt;Quoiqu'il en soit, la &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#monitoringdeletatdelauthentificationetslo' class='spip_in'&gt;solution de monitoring impl&#233;ment&#233;e par OAuthSD&lt;/a&gt; fonctionne parfaitement et est extr&#234;mement simple, ne n&#233;cessitant pas de modification du serveur. Elle a l'avantage de permettre &#233;galement de signaler &#224; l'utilisateur l'approche de la fin de la session OIDC et de lui offrir de la prolonger.&lt;/p&gt;
&lt;p&gt;Nous ne sommes donc pas tr&#232;s motiv&#233;s pour appliquer l'une ou l'autre de ces m&#233;thodes.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;OpenID Connect Front-Channel Logout&lt;/h3&gt;
&lt;p&gt;Voir : &lt;a href=&#034;https://openid.net/specs/openid-connect-frontchannel-1_0.html&#034; class='spip_out' rel='external'&gt;OpenID Connect Front-Channel Logout 1.0 - draft 04&lt;/a&gt; (ao&#251;t 2020).&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;OpenID Connect Back-Channel Logout&lt;/h3&gt;
&lt;p&gt;Voir : &lt;a href=&#034;https://openid.net/specs/openid-connect-backchannel-1_0.html&#034; class='spip_out' rel='external'&gt;OpenID Connect Back-Channel Logout 1.0 - draft 06&lt;/a&gt; (ao&#251;t 2020).&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;OpenID Connect Session Management&lt;/h3&gt;
&lt;p&gt;Nous avons d&#233;crit cette m&#233;thode ici : &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#openidconnectsessionmanagement' class='spip_in'&gt;OpenID Connect Session Management&lt;/a&gt;. Son principe et sa complexit&#233; sont assez semblables aux deux pr&#233;c&#233;dentes. &lt;br class='autobr' /&gt;
&lt;a href='https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#openidconnectsessionmanagement' class='spip_in'&gt;OAuthSD met en &#339;uvre cette m&#233;thode&lt;/a&gt; &#224; des fins d'exp&#233;rimentation et de suivi de la norme OpenID Connect.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Solution utilis&#233;e par Drupal et Google Accounts&lt;/h3&gt;
&lt;p&gt;Voir : &lt;a href=&#034;https://www.drupal.org/project/openid_connect_sso&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://www.drupal.org/project/openid_connect_sso&lt;/a&gt;&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;Apr&#232;s la connexion de l'utilisateur sur le serveur ou la d&#233;connexion de l'un des sites du r&#233;seau, le module d&#233;marre une cha&#238;ne de redirection qui visite le script SSO de chaque site du r&#233;seau.&lt;br class='autobr' /&gt;
Le script SSO d&#233;finit ensuite un cookie informant le site parent de la connexion/d&#233;connexion en attente.&lt;br class='autobr' /&gt;
Lorsque l'utilisateur visite le site r&#233;el, le cookie est lu et l'utilisateur se connecte/d&#233;connecte automatiquement.&lt;/p&gt;
&lt;p&gt;Cette approche est identique &#224; celle utilis&#233;e par les comptes Google.&lt;/p&gt;
&lt;p&gt;Le but des redirections est de donner &#224; chaque site la possibilit&#233; de d&#233;finir un cookie valide pour son domaine contournant ainsi la politique de m&#234;me origine qui interdit &#224; un site de d&#233;finir un cookie pour un autre domaine.&lt;/p&gt;
&lt;p&gt;Les redirections sont rapides et imperceptibles, car le script SSO est autonome ... et ne d&#233;finit que le cookie.&lt;/p&gt;
&lt;/blockquote&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;/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; * @file&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; * Creates cookies for each of the network sites to signal a login/logout.&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: #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/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;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'HTTP_HOST'&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;// Some pre-HTTP/1.1 clients will not send a Host header.&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;// We can't work around this.&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/exit&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;exit&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;&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;// The collection of SSO script addresses which form the redirection network.&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;// Don't include the protocol (http://, https://).&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;// Example url (SSO script on subdomain): &#034;a.firstsite.com&#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;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Example url (SSO script in the Drupal directory): &#034;firstsite.com/sso.php&#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;&lt;span style=&#034;color: #000088;&#034;&gt;$network&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: #0000ff;&#034;&gt;'a.firstsite.com'&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;'a.shop.secondsite.com'&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;&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;// An array of network domain names. The keys are potential origin host names&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;// which do not appear in the list above, and each value is the cookie domain&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;// name for that host.&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;// $domains = 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;/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;// Enable HTTPS for all redirect URLs.&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;// $https = true;&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;// Enable adding the domain name to the cookie name.&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;// $cookie_name_strict = true;&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;// Validate the query parameters and network size.&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;sso_validate_query_params&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;a href=&#034;http://www.php.net/count&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;count&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;$network&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;&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;2&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/exit&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;exit&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;&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;// $_SERVER['HTTP_HOST'] is lowercased here per specifications.&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;$host&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/strtolower&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;strtolower&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;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'HTTP_HOST'&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: #000088;&#034;&gt;$origin_host&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'origin_host'&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;span style=&#034;color: #000088;&#034;&gt;$origin_domain&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/isset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;isset&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;$domains&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$origin_host&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: #000088;&#034;&gt;$domains&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$origin_host&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;$origin_host&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;// Find the next site that needs to be visited in the $network, by removing&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;// the origin site re-keying the 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: #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;$network&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;as&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$delta&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$site&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;$site&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$origin_domain&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: #cc66cc;&#034;&gt;0&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;||&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;$site&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'a.'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$origin_domain&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: #cc66cc;&#034;&gt;0&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/unset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;unset&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;$network&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$delta&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: #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;span style=&#034;color: #000088;&#034;&gt;$network&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array_values&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array_values&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;$network&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/ltrim&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;ltrim&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;$host&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'a.'&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: #000088;&#034;&gt;$origin_domain&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;// We are on the site which has started the process.&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 need to create the cookie, the site already handled its login / logout.&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;// Start from the beginning of the redirect list.&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;$redirect_destination&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; sso_redirect_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$network&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #cc66cc;&#034;&gt;0&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: #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;$https&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: #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: #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; sso_create_cookie&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'op'&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;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;$network&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;as&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$delta&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$site&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;$site&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$host&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: #cc66cc;&#034;&gt;0&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;||&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;$site&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'a.'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$host&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: #cc66cc;&#034;&gt;0&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;$current_site_delta&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$delta&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;break&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;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/isset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;isset&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;$current_site_delta&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/trigger_error&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;trigger_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: #0000ff;&#034;&gt;'Current site not found in network'&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;E_USER_ERROR&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/exit&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;exit&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; &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: #000088;&#034;&gt;$next_site_delta&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$current_site_delta&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;1&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;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/isset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;isset&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;$network&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$next_site_delta&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;// Redirect to the next network site.&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;$redirect_destination&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; sso_redirect_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$network&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$next_site_delta&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: #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;$https&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: #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: #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;// We are at the last network site. In these scenarios, we need to&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;// redirect to the destination, or to the original host in case of a logout.&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: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'op'&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;'login'&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;$redirect_destination&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'destination'&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;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: #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: #000088;&#034;&gt;$redirect_destination&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$https&lt;/span&gt; ? &lt;span style=&#034;color: #0000ff;&#034;&gt;'https://'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'http://'&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: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'origin_host'&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;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;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;// Redirect the user. We need to prevent the redirect from being cached.&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/header&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;header&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;'Cache-Control: max-age=0'&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;a href=&#034;http://www.php.net/header&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;header&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;'Expires: Sun, 09 Aug 1987 22:00:00 +0100'&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;a href=&#034;http://www.php.net/header&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;header&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;'Pragma: no-cache'&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;a href=&#034;http://www.php.net/header&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;header&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;'Location: '&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$redirect_destination&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: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;302&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/exit&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;exit&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; &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; * Validates the query parameters.&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; * Required parameters:&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; * - op: Tells us what the current operation is: login or logout.&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; * - origin_host: Indicates which site initiated the login/logout.&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; * Additional required parameter when the operation is &#034;login&#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;&lt;span style=&#034;color: #009933; font-style: italic;&#034;&gt; * - destination: The url to redirect the user to after all redirects are done.&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; sso_validate_query_params&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;&#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/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;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'op'&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;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;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'origin_host'&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: #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;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/in_array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;in_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;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'op'&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;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;'login'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'logout'&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: #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;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;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'op'&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;'login'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;&amp;&amp;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/isset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;isset&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;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'destination'&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: #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: #b1b100;&#034;&gt;return&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: #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: #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; * Creates a cookie signaling the required operation.&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; * Removes any conflicting cookies.&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 $operation&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; * The operation to signal, login or logout.&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; sso_create_cookie&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$operation&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;span style=&#034;color: #000088;&#034;&gt;$operation&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: #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;$remove&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'Drupal.visitor.SSOLogout'&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;$create&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'Drupal.visitor.SSOLogin'&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: #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: #000088;&#034;&gt;$remove&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'Drupal.visitor.SSOLogin'&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;$create&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'Drupal.visitor.SSOLogout'&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: #000088;&#034;&gt;$secure&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&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;$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;'https'&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: #000088;&#034;&gt;$domain&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/ltrim&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;ltrim&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/strtolower&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;strtolower&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;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'HTTP_HOST'&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;span style=&#034;color: #0000ff;&#034;&gt;'a.'&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;$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;'cookie_name_strict'&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: #000088;&#034;&gt;$remove&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: #000088;&#034;&gt;$domain&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;$create&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: #000088;&#034;&gt;$domain&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;a href=&#034;http://www.php.net/setcookie&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;setcookie&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;$remove&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;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: #339933;&#034;&gt;-&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;3600&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: #000088;&#034;&gt;$domain&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$secure&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;// The expiration should be less than the Drupal session duration.&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;// The most common Drupal `session.gc_maxlifetime` value is 200000 seconds,&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;// so we define the expiration to half a minute before that, accordingly.&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/setcookie&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;setcookie&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;$create&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;1&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&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: #339933;&#034;&gt;+&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;200000&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;-&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;30&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: #000088;&#034;&gt;$domain&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$secure&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;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;/**&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; * Returns an URL to which redirection can be issued.&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 $host&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 bool $https&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 string&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; sso_redirect_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$host&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$https&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;span style=&#034;color: #339933;&#034;&gt;!&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;$host&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: #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;$host&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$https&lt;/span&gt; ? &lt;span style=&#034;color: #0000ff;&#034;&gt;'https://'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;:&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'http://'&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: #000088;&#034;&gt;$host&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;$args&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: #0000ff;&#034;&gt;'op'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'op'&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;span style=&#034;color: #0000ff;&#034;&gt;'origin_host'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'origin_host'&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;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;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;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'op'&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;'login'&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;$args&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'destination'&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;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'destination'&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;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: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$host&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;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;$args&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://static.oa.dnc.global/local/cache-code/e614aa788811f423599889cf93631d2b.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Monitoring de l'&#233;tat de l'authentification et SLO</title>
		<link>https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#monitoringdeletatdelauthentificationetslo</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#monitoringdeletatdelauthentificationetslo</guid>
		<dc:date>2020-09-07T11:00:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Le monitoring de l'&#233;tat de l'authentification a pour but de synchroniser la connexion locale d'une application avec le jeton d'acc&#232;s correspondant. &lt;br class='autobr' /&gt;
OAuthSD, suivant en cela OAuth 2.0, consid&#232;re que l'utilisateur final est connect&#233; &#224; une application tant que le jeton d'acc&#232;s associ&#233; est valide. &lt;br class='autobr' /&gt;
Il n'y a pas &#034;naturellement&#034; de relation directe entre ce jeton et l'&#233;tat de connexion local d'une application. Chaque application devra donc mettre en place un monitoring, c&#244;t&#233; client, dans le but de : surveiller (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html" rel="directory"&gt;OpenID Connect : SSO, management de session etc.&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Le monitoring de l'&#233;tat de l'authentification a pour but de synchroniser la connexion locale d'une application avec le jeton d'acc&#232;s correspondant.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;OAuthSD, suivant en cela OAuth 2.0, consid&#232;re que l'utilisateur final est connect&#233; &#224; une application tant que le jeton d'acc&#232;s associ&#233; est valide.&lt;/p&gt;
&lt;p&gt;Il n'y a pas &#034;naturellement&#034; de relation directe entre ce jeton et l'&#233;tat de connexion local d'une application. Chaque application devra donc mettre en place un monitoring, c&#244;t&#233; client, dans le but de :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; surveiller la validit&#233; du jeton d'acc&#232;s,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; r&#233;aliser la r&#233;-authentification silencieuse et la connexion automatique,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; compl&#233;ter le m&#233;canisme de d&#233;connexion unique (Single Logout, SLO) en provoquant la d&#233;connexion locale de l'application lorsque le jeton d'acc&#232;s a expir&#233;.&lt;/p&gt;
&lt;p&gt;Plusieurs solutions se pr&#233;sentent pour assurer le suivi de la session OIDC :&lt;/p&gt;
&lt;p&gt;1. La communaut&#233; se voit proposer une &#034;norme&#034; de gestion de la session OpenID Connect (voir : &lt;a href=&#034;https://openid.net/specs/openid-connect-session-1_0.html&#034; class='spip_out' rel='external'&gt;OpenID Connect Session Management&lt;/a&gt; ) qui s'appuie sur des iframes du c&#244;t&#233; du serveur et du c&#244;t&#233; de l'application.&lt;/p&gt;
&lt;p&gt;Dans sa version 30 publi&#233;e en ao&#251;t 2020, le paragraphe 5, encore pr&#233;sent dans la version 28, intitul&#233; &#034;Back-Channel Logout&#034;, disparait. &lt;br class='autobr' /&gt;
En effet, une nouvelle proposition &#034;&lt;a href=&#034;https://openid.net/specs/openid-connect-backchannel-1_0.html&#034; class='spip_out' rel='external'&gt;OpenID Connect Back-Channel Logout&lt;/a&gt;&#034; &#233;vite les dysfonctionnements pr&#233;vus au paragraphe &#034;User Agents Blocking Access to Third-Party Content&#034; :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;Notez qu'au moment de la r&#233;daction de cet article, certains agents utilisateurs (navigateurs) commencent &#224; bloquer l'acc&#232;s au contenu tiers par d&#233;faut pour bloquer certains m&#233;canismes utilis&#233;s pour suivre l'activit&#233; de l'utilisateur final sur les sites. Plus pr&#233;cis&#233;ment, le contenu tiers bloqu&#233; est un contenu de site Web avec une origine diff&#233;rente de l'origine de la fen&#234;tre de l'agent utilisateur cibl&#233;e. Les donn&#233;es du site incluent les cookies et toutes les API de stockage Web (sessionStorage, localStorage, etc.).&lt;/p&gt;
&lt;p&gt;Cela peut emp&#234;cher la capacit&#233; des notifications de l'OP au niveau du RP d'acc&#233;der &#224; l'&#233;tat de l'agent utilisateur du RP pour mettre en &#339;uvre des actions de d&#233;connexion locale. En particulier, les cookies et les API de stockage Web peuvent ne pas &#234;tre disponibles dans le cadre OP charg&#233; dans le contexte RP. L'effet secondaire ici est que, selon le m&#233;canisme utilis&#233; (cookies ou stockage Web), les donn&#233;es n&#233;cessaires pour recalculer session_state peuvent ne pas &#234;tre disponibles. Les impl&#233;mentations bas&#233;es sur les cookies peuvent alors renvoyer des modifications pour chaque appel, ce qui entra&#238;ne des boucles infinies de r&#233;-authentifications. Par cons&#233;quent, les d&#233;ploiements de cette sp&#233;cification sont recommand&#233;s pour inclure un code d&#233;fensif pour d&#233;tecter cette situation et, si possible, informer l'utilisateur final que les d&#233;connexions RP demand&#233;es n'ont pas pu &#234;tre effectu&#233;es. Les d&#233;tails du code d&#233;fensif n&#233;cessaire d&#233;passent le cadre de cette sp&#233;cification ; il peut varier selon l'agent utilisateur et peut varier dans le temps, car la situation de pr&#233;vention du suivi de l'agent utilisateur est fluide et continue d'&#233;voluer. &#034;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;i&gt;Une proposition de sp&#233;cification qui a connu 30 modifications mais qui n'&#233;volue plus depuis ao&#251;t 2020, et qui de plus se termine sur un constat de dysfonctionnement, est morte !&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;De plus, il ne s'agit l&#224; que d'un proc&#233;d&#233; de communication entre une application et le serveur OIDC, communication qui peut &#234;tre r&#233;alis&#233;e par d'autres moyens, et notamment par interrogation r&#233;guli&#232;re du contr&#244;leur Authorize avec prompt = 'none'. Nous pensons (peut-&#234;tre &#224; tort ?) qu'une &#034;norme&#034; concernant une couche ISO de niveau protocole ne doit pas introduire &#224; ce niveau un proc&#233;d&#233; de communication particulier.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;2. Notre solution est pr&#233;sent&#233;e ici : &lt;a href='https://static.oa.dnc.global/-Ressources-pour-les-developpeurs-.html#implementationdumonitoringavecjavascriptexemplespourspipetwordpress' class='spip_in'&gt;Impl&#233;mentation du monitoring avec Javascript : exemples pour SPIP et WordPress&lt;/a&gt; interroge donc le contr&#244;leur Authorise avec le param&#232;tre display='none'.&lt;br class='autobr' /&gt; &lt;i&gt;Une impl&#233;mentation c&#244;t&#233; client s'appuyant sur la norme OpenID Connect telle qu'elle existe actuellement est bien pr&#233;f&#233;rable &#224; une nouvelle complication des applications clientes et permet d'&#233;viter la violation du principe d'ind&#233;pendance des couches ISO&lt;/i&gt;.&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>OpenID Connect Session Management</title>
		<link>https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#openidconnectsessionmanagement</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#openidconnectsessionmanagement</guid>
		<dc:date>2020-08-12T15:49:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Nota : il s'agit d'une version p&#233;rim&#233;e mais des serveurs sont fond&#233;s dessus (Publik par exemple). Cette proposition de sp&#233;cification r&#233;pond au besoin de conna&#238;tre l'&#233;tat r&#233;el de connexion de l'utilisateur et de g&#233;rer la d&#233;connexion unique. Dans l'&#233;tat actuel, ce document pr&#233;sente de multiples d&#233;fauts. DnC suit l'&#233;volution de cette sp&#233;cification et OAuthSD devra int&#233;grer les sp&#233;cifications qui seront finalement approuv&#233;es. &lt;br class='autobr' /&gt;
Sans attendre, le serveur OAuthSD r&#233;pond aux fonctionnalit&#233;s &#233;voqu&#233;es avec la technique (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html" rel="directory"&gt;OpenID Connect : SSO, management de session etc.&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://static.oa.dnc.global/local/cache-vignettes/L128xH128/arton71-cf6b7.png?1733821225' width='128' height='128' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Nota : il s'agit d'une version p&#233;rim&#233;e mais des serveurs sont fond&#233;s dessus (Publik par exemple).&lt;br class='autobr' /&gt;
Cette proposition de sp&#233;cification r&#233;pond au besoin de conna&#238;tre l'&#233;tat r&#233;el de connexion de l'utilisateur et de g&#233;rer la d&#233;connexion unique. &lt;br class='autobr' /&gt;
Dans l'&#233;tat actuel, ce document pr&#233;sente de multiples d&#233;fauts. DnC suit l'&#233;volution de cette sp&#233;cification et OAuthSD devra int&#233;grer les sp&#233;cifications qui seront finalement approuv&#233;es.&lt;/p&gt;
&lt;p&gt;Sans attendre, le serveur OAuthSD r&#233;pond aux fonctionnalit&#233;s &#233;voqu&#233;es avec la technique de la &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#slissosloetsrasontdansunbateauoauthsd' class='spip_in'&gt;connexion unique&lt;/a&gt; et de la &lt;a href='https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectlogoutlogoutendpoint' class='spip_in'&gt;d&#233;connexion unique&lt;/a&gt; qui en d&#233;coule ainsi que le &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#monitoringdeletatdelauthentificationetslo' class='spip_in'&gt;monitoring&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Traduction du document &lt;a href=&#034;https://openid.net/specs/openid-connect-session-1_0.html&#034; class='spip_out' rel='external'&gt;OpenID Connect Session Management 1.0 - draft 28&lt;/a&gt;&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;
...&lt;/p&gt;
&lt;p&gt;Cette sp&#233;cification d&#233;finit le terme suivant :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; Session&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; P&#233;riode continue pendant laquelle un utilisateur final acc&#232;de &#224; un RP (Relying Party) en s'appuyant sur l'authentification de l'utilisateur final effectu&#233;e par le fournisseur OpenID.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;2. D&#233;couverte du point de terminaison&lt;/h3&gt;
&lt;p&gt;Pour prendre en charge la gestion de session OpenID Connect, le RP doit obtenir les URL de point de terminaison associ&#233;es &#224; la gestion de session. Ces URL sont normalement obtenues via la r&#233;ponse &#224; la d&#233;couverte de l'OP, comme d&#233;crit dans OpenID Connect Discovery 1.0 [OpenID.Discovery], ou PEUVENT &#234;tre apprises via d'autres m&#233;canismes.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;2.1. M&#233;tadonn&#233;es de d&#233;couverte du fournisseur OpenID&lt;/h3&gt;
&lt;p&gt;Ces param&#232;tres de m&#233;tadonn&#233;es de fournisseur OpenID DOIVENT &#234;tre inclus dans les r&#233;ponses de d&#233;couverte du serveur lorsque la gestion de session et la d&#233;couverte sont prises en charge :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; check_session_iframe&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; CHAMPS OBLIGATOIRES. URL d'un iframe de l'OP qui prend en charge les communications entre origines crois&#233;es pour les informations d'&#233;tat de session avec le client RP, &#224; l'aide de l'API postMessage de HTML5. La page est charg&#233;e &#224; partir d'un iframe invisible incorpor&#233; dans une page du RP afin de pouvoir s'ex&#233;cuter dans le contexte de s&#233;curit&#233; de l'OP. Il accepte les requ&#234;tes postMessage en provenance de l'iframe du RP concern&#233; et utilise postMessage pour renvoyer le statut de connexion de l'utilisateur final vers l'OP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; end_session_endpoint&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; CHAMPS OBLIGATOIRES. URL de l'OP sur laquelle un RP peut effectuer une redirection pour demander &#224; l'utilisateur final d'&#234;tre d&#233;connect&#233; de l'OP.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;3. Cr&#233;ation et mise &#224; jour de sessions&lt;/h3&gt;
&lt;p&gt;Dans OpenID Connect, la session du RP commence g&#233;n&#233;ralement lorsque le RP valide le jeton d'identification de l'utilisateur final. Reportez-vous &#224; la sp&#233;cification OpenID Connect Core 1.0 [OpenID.Core] pour savoir comment obtenir un jeton ID et le valider. Lorsque l'OP prend en charge la gestion de session, il DOIT &#233;galement renvoyer l'&#233;tat de session en tant que &lt;strong&gt;param&#232;tre suppl&#233;mentaire session_state&lt;/strong&gt; dans la r&#233;ponse d'authentification. La r&#233;ponse d'authentification OpenID Connect est sp&#233;cifi&#233;e dans la Section 3.1.2.5 d'OpenID Connect Core 1.0.&lt;/p&gt;
&lt;p&gt;Ce param&#232;tre est :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;session_state&lt;/strong&gt; &lt;br class='autobr' /&gt; Etat de session. Cha&#238;ne JSON [RFC7159] repr&#233;sentant l'&#233;tat de connexion de l'utilisateur final sur l'OP. Il NE DOIT PAS contenir le caract&#232;re espace (&#034;&#034;). Cette valeur est opaque pour le RP. Ceci est OBLIGATOIRE si la gestion de session est prise en charge.&lt;/p&gt;
&lt;p&gt;La valeur de l'&#233;tat de session est initialement calcul&#233;e sur le serveur. La m&#234;me valeur d'&#233;tat de session est &#233;galement recalcul&#233;e par l'iframe dans le navigateur du client. La g&#233;n&#233;ration de valeurs appropri&#233;es pour l'&#233;tat de session est sp&#233;cifi&#233;e dans la section 4.2 et est bas&#233;e sur un hachage cryptographique sal&#233; de l'ID client, de l'URL d'origine et de l'&#233;tat du navigateur OP. Pour l'URL d'origine, le serveur peut utiliser l'URL d'origine de la r&#233;ponse d'authentification, conform&#233;ment &#224; l'algorithme sp&#233;cifi&#233; &#224; la section 4 de la RFC 6454 [RFC6454].&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;4. Notification de changement d'&#233;tat de session&lt;/h3&gt;
&lt;p&gt;Un jeton d'identit&#233; vient g&#233;n&#233;ralement avec une date d'expiration. Le RP PEUT s'y fier pour expirer la session du RP. Cependant, il est tout &#224; fait possible que l'utilisateur final se soit d&#233;connect&#233; de l'OP avant la date d'expiration. Par cons&#233;quent, il est hautement souhaitable de pouvoir conna&#238;tre le statut de connexion de l'utilisateur final &#224; l'OP.&lt;/p&gt;
&lt;p&gt;Pour ce faire, il est possible de r&#233;p&#233;ter la demande d'authentification avec prompt = none&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb4-1' class='spip_note' rel='appendix' title='Cette solution a notre pr&#233;f&#233;rence, voir la note suivante.' id='nh4-1'&gt;1&lt;/a&gt;]&lt;/span&gt;. Cependant, cela entra&#238;ne un trafic r&#233;seau, ce qui est probl&#233;matique sur les appareils mobiles qui deviennent de plus en plus populaires. Par cons&#233;quent, une fois que la session est &#233;tablie avec la demande d'authentification et la r&#233;ponse, il est souhaitable de pouvoir v&#233;rifier l'&#233;tat de la connexion sur l'op&#233;rateur sans g&#233;n&#233;rer de trafic sur le r&#233;seau en interrogeant un OP iframe cach&#233; &#224; partir d'un RP iframe avec un postMessage &#224; origine restreinte, comme suit.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;4.1. RP iframe&lt;/h3&gt;
&lt;p&gt;Le RP charge un iframe invisible &#224; partir de lui-m&#234;me. Cette iframe DOIT conna&#238;tre l'ID de l'OP iframe, comme d&#233;crit &#224; la section 4.2, afin de pouvoir envoyer un message &#224; l'OP iframe. L'iframe RP interroge l'OP iframe avec postMessage &#224; un intervalle appropri&#233;&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb4-2' class='spip_note' rel='appendix' title='Il est donc inexact d'affirmer, comme indiqu&#233; au paragraphe pr&#233;c&#233;dent, que la (...)' id='nh4-2'&gt;2&lt;/a&gt;]&lt;/span&gt; pour l'application RP. Avec chaque postMessage, il envoie l'&#233;tat de session d&#233;fini dans la section 4.2.&lt;/p&gt;
&lt;p&gt;Le postMessage de l'iframe RP fournit la concat&#233;nation suivante en tant que donn&#233;es :&lt;/p&gt;
&lt;p&gt; ID client + &#034; &#034; + &#233;tat de session&lt;/p&gt;
&lt;p&gt;Il doit &#233;galement pouvoir recevoir le postMessage de l'OP iframe. Les donn&#233;es re&#231;ues seront soit 'changed', soit 'unchanged', sauf si la syntaxe du message envoy&#233; est d&#233;termin&#233;e par le terminal op&#233;rateur comme &#233;tant malform&#233;e, auquel cas les donn&#233;es re&#231;ues seront erron&#233;es. D&#232;s r&#233;ception de la modification, le RP DOIT effectuer une nouvelle authentification avec prompt = none pour obtenir l'&#233;tat de la session en cours sur le terminal op&#233;rateur. &#192; la r&#233;ception d'une erreur, le RP NE DOIT PAS effectuer de nouvelle authentification avec prompt = none, afin de ne pas causer de boucles infinies potentielles g&#233;n&#233;rant un trafic r&#233;seau vers le terminal op&#233;rateur.&lt;/p&gt;
&lt;p&gt;Voici un exemple de pseudo-code non normatif pour l'iframe RP :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Javascript&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_javascript code&#034;&gt;&lt;div class=&#034;javascript&#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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; stat &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;&#034;unchanged&#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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; mes &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; client_id &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;&#034; &#034;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; session_state&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: #000066; font-weight: bold;&#034;&gt;function&lt;/span&gt; check_session&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;/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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; targetOrigin &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;&#034;https://server.example.com&#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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; win &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; window.&lt;span style=&#034;color: #660066;&#034;&gt;parent&lt;/span&gt;.&lt;span style=&#034;color: #660066;&#034;&gt;document&lt;/span&gt;.&lt;span style=&#034;color: #660066;&#034;&gt;getElementById&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #3366CC;&#034;&gt;&#034;op&#034;&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: #660066;&#034;&gt;contentWindow&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; win.&lt;span style=&#034;color: #660066;&#034;&gt;postMessage&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; mes&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; targetOrigin&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;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: #000066; font-weight: bold;&#034;&gt;function&lt;/span&gt; setTimer&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;/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; check_session&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; timerID &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; setInterval&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #3366CC;&#034;&gt;&#034;check_session()&#034;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;span style=&#034;color: #CC0000;&#034;&gt;3&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;*&lt;/span&gt;&lt;span style=&#034;color: #CC0000;&#034;&gt;1000&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;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; window.&lt;span style=&#034;color: #660066;&#034;&gt;addEventListener&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #3366CC;&#034;&gt;&#034;message&#034;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; receiveMessage&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #003366; 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: #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: #000066; font-weight: bold;&#034;&gt;function&lt;/span&gt; receiveMessage&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;e&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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; targetOrigin &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;&#034;https://server.example.com&#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: #000066; font-weight: bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;e.&lt;span style=&#034;color: #660066;&#034;&gt;origin&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!==&lt;/span&gt; targetOrigin &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;span style=&#034;color: #000066; font-weight: bold;&#034;&gt;return&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&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; stat &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; e.&lt;span style=&#034;color: #660066;&#034;&gt;data&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: #000066; font-weight: bold;&#034;&gt;if&lt;/span&gt; stat &lt;span style=&#034;color: #339933;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;&#034;changed&#034;&lt;/span&gt; then take the actions below...&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://static.oa.dnc.global/local/cache-code/e9b36928434a4a846dd2595c5677dbcd.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;4.2. OP iframe&lt;/h3&gt;
&lt;p&gt;Le RP charge &#233;galement un OP iframe invisible &#224; partir de check_session_iframe de l'OP. Le RP DOIT assigner un attribut id &#224; l'iframe afin qu'il puisse l'adresser, comme d&#233;crit ci-dessus. L'OP iframe DOIT imposer que l'appelant ait la m&#234;me origine que son cadre parent. Il DOIT rejeter les demandes postMessage de toute autre source.&lt;/p&gt;
&lt;p&gt;Comme sp&#233;cifi&#233; dans la section 4.1, le postMessage de l'iframe RP fournit la concat&#233;nation suivante en tant que donn&#233;es :&lt;/p&gt;
&lt;p&gt; &lt;code class='spip_code' dir='ltr'&gt;ID client + &#034; &#034; + session_state&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;L'op iframe a acc&#232;s &#224; l'&#233;tat du navigateur dans l'OP (dans un cookie ou dans un stockage HTML5) qu'il utilise pour calculer et comparer l'&#233;tat de session OP pass&#233; par le RP. L'OP iframe DOIT le recalculer &#224; partir de l'ID client pr&#233;c&#233;demment obtenu, de l'URL d'origine de la source (&#224; partir de postMessage) et de l'&#233;tat actuel du navigateur OP. L'&#233;tat de session inclut toutes ces informations pour des raisons de confidentialit&#233;, de sorte que diff&#233;rents clients actifs dans le m&#234;me navigateur ont des valeurs d'&#233;tat de session distinctes.&lt;/p&gt;
&lt;p&gt;Si le postMessage re&#231;u est syntaxiquement incorrect, de sorte que l'ID client publi&#233; et l'URL d'origine ne peuvent pas &#234;tre d&#233;termin&#233;s ou sont incorrects sur le plan syntaxique, l'OP iframe DOIT poster (postMessage) &#224; la source la cha&#238;ne d'erreur. Si la valeur re&#231;ue et la valeur calcul&#233;e ne correspondent pas, l'OP iframe DOIT poster &#224; la source la cha&#238;ne modifi&#233;e. S'il y a correspondance, alors il DOIT poster la cha&#238;ne inchang&#233;e.&lt;/p&gt;
&lt;p&gt;Voici un exemple non normatif de pseudo-code pour l'OP iframe :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Javascript&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_javascript code&#034;&gt;&lt;div class=&#034;javascript&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;window.&lt;span style=&#034;color: #660066;&#034;&gt;addEventListener&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #3366CC;&#034;&gt;&#034;message&#034;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; receiveMessage&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #003366; 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: #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: #000066; font-weight: bold;&#034;&gt;function&lt;/span&gt; receiveMessage&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;e&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;span style=&#034;color: #006600; font-style: italic;&#034;&gt;// e.data has client_id and session_state&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: #006600; font-style: italic;&#034;&gt;// Validate message origin&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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; client_id &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; e.&lt;span style=&#034;color: #660066;&#034;&gt;data&lt;/span&gt;.&lt;span style=&#034;color: #660066;&#034;&gt;split&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #3366CC;&#034;&gt;' '&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;#91;&lt;/span&gt;&lt;span style=&#034;color: #CC0000;&#034;&gt;0&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;span style=&#034;color: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; session_state &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; e.&lt;span style=&#034;color: #660066;&#034;&gt;data&lt;/span&gt;.&lt;span style=&#034;color: #660066;&#034;&gt;split&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #3366CC;&#034;&gt;' '&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;#91;&lt;/span&gt;&lt;span style=&#034;color: #CC0000;&#034;&gt;1&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;span style=&#034;color: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; salt &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; session_state.&lt;span style=&#034;color: #660066;&#034;&gt;split&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #3366CC;&#034;&gt;'.'&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;#91;&lt;/span&gt;&lt;span style=&#034;color: #CC0000;&#034;&gt;1&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: #006600; font-style: italic;&#034;&gt;// if message syntactically invalid&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: #006600; font-style: italic;&#034;&gt;// postMessage('error', e.origin) and return&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: #006600; font-style: italic;&#034;&gt;// get_op_browser_state() is an OP defined function&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: #006600; font-style: italic;&#034;&gt;// that returns the browser's login status at the OP.&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: #006600; font-style: italic;&#034;&gt;// How it is done is entirely up to the OP.&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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; opbs &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; get_op_browser_state&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: #006600; font-style: italic;&#034;&gt;// Here, the session_state is calculated in this particular way,&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: #006600; font-style: italic;&#034;&gt;// but it is entirely up to the OP how to do it under the&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: #006600; font-style: italic;&#034;&gt;// requirements defined in this specification.&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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; ss &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; CryptoJS.&lt;span style=&#034;color: #660066;&#034;&gt;SHA256&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;client_id &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;' '&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; e.&lt;span style=&#034;color: #660066;&#034;&gt;origin&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;' '&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; opbs &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;' '&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; salt&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: #3366CC;&#034;&gt;&#034;.&#034;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;+&lt;/span&gt; salt&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: #000066; font-weight: bold;&#034;&gt;var&lt;/span&gt; stat &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;''&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: #000066; font-weight: bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;session_state &lt;span style=&#034;color: #339933;&#034;&gt;==&lt;/span&gt; ss&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; stat &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;'unchanged'&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;span style=&#034;color: #000066; font-weight: bold;&#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; stat &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #3366CC;&#034;&gt;'changed'&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; e.&lt;span style=&#034;color: #660066;&#034;&gt;source&lt;/span&gt;.&lt;span style=&#034;color: #660066;&#034;&gt;postMessage&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;stat&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; e.&lt;span style=&#034;color: #660066;&#034;&gt;origin&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;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://static.oa.dnc.global/local/cache-code/2b3cdcf7363ee7ecd93a0ccb30c9f38e.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;L'&#233;tat du navigateur OP sera g&#233;n&#233;ralement stock&#233; dans un cookie ou dans un stockage local HTML5. Il a pour origine le serveur d'autorisations. Il capture des &#233;v&#233;nements significatifs tels que les connexions, les d&#233;connexions, le changement d'utilisateur, le changement de statut d'authentification pour les clients utilis&#233;s par l'utilisateur final, etc. Ainsi, l'OP DEVRAIT mettre &#224; jour la valeur de l'&#233;tat du navigateur en r&#233;ponse &#224; de tels &#233;v&#233;nements significatifs. En cons&#233;quence, le prochain appel &#224; check_session () apr&#232;s un tel &#233;v&#233;nement renverra la valeur modifi&#233;e. Il est RECOMMAND&#201; que le terminal op&#233;rateur ne mette pas &#224; jour l'&#233;tat du navigateur trop fr&#233;quemment en l'absence d'&#233;v&#233;nements significatifs, afin d'&#233;viter un trafic r&#233;seau excessif sur le client en r&#233;ponse &#224; des &#233;v&#233;nements erron&#233;s.&lt;/p&gt;
&lt;p&gt;Le calcul de l'&#233;tat de session renvoy&#233; en r&#233;ponse &#224; des demandes d'authentification infructueuses DEVRAIT, en plus de l'&#233;tat du navigateur, incorporer suffisamment d'al&#233;a sous la forme d'un sel afin d'emp&#234;cher l'identification d'un utilisateur final lors d'appels successifs au point de terminaison d'autorisation de l'OP.&lt;/p&gt;
&lt;p&gt;Dans le cas d'un client autoris&#233; (r&#233;ponse d'authentification r&#233;ussie), l'OP DEVRAIT changer la valeur de l'&#233;tat de session renvoy&#233; au client &#224; l'occurrence de l'un des &#233;v&#233;nements suivants :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; L'ensemble des utilisateurs authentifi&#233;s aupr&#232;s du navigateur change (connexion, d&#233;connexion, ajout de session).&lt;/p&gt;
&lt;p&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Le statut d'authentification des clients utilis&#233;s par l'utilisateur final change.&lt;/p&gt;
&lt;p&gt;De plus, l'&#233;tat du navigateur utilis&#233; pour v&#233;rifier l'&#233;tat de la session DEVRAIT changer avec de tels &#233;v&#233;nements. Les appels &#224; check_session() renverront les modifications apport&#233;es par rapport aux versions ant&#233;rieures de l'&#233;tat de session apr&#232;s de tels &#233;v&#233;nements. Il est RECOMMAND&#201; que l'&#233;tat du navigateur NE DEVRAIT PAS varier trop souvent en l'absence de tels &#233;v&#233;nements afin de minimiser le trafic sur le r&#233;seau caus&#233; par la r&#233;ponse du client aux notifications modifi&#233;es.&lt;/p&gt;
&lt;p&gt;Dans le cas d'une demande d'authentification infructueuse, la valeur de l'&#233;tat de session renvoy&#233;e DEVRAIT varier avec chaque demande. Cependant, l'&#233;tat de la session du navigateur n'a pas besoin de changer sauf si un &#233;v&#233;nement significatif se produit. En particulier, de nombreuses valeurs d'&#233;tat de session peuvent &#234;tre simultan&#233;ment valides, par exemple en introduisant un sel al&#233;atoire dans les &#233;tats de session &#233;mis en r&#233;ponse &#224; des demandes d'authentification infructueuses.&lt;/p&gt;
&lt;p&gt;Si un cookie est utilis&#233; pour conserver l'&#233;tat du navigateur OP, l'indicateur HttpOnly ne peut probablement pas &#234;tre d&#233;fini pour ce cookie car il doit &#234;tre accessible &#224; partir de JavaScript. Par cons&#233;quent, les informations pouvant &#234;tre utilis&#233;es pour identifier l'utilisateur ne doivent pas &#234;tre plac&#233;es dans le cookie, car elles pourraient &#234;tre lues par du JavaScript non associ&#233;.&lt;/p&gt;
&lt;p&gt;Dans certaines impl&#233;mentations, les notifications modifi&#233;es ne se produiront que lorsque la session de l'utilisateur final sera modifi&#233;e, alors que dans d'autres impl&#233;mentations, elles pourront &#233;galement survenir &#224; la suite de modifications apport&#233;es &#224; d'autres sessions entre l'agent d'utilisateur et le terminal op&#233;rateur. Les PR doivent &#234;tre pr&#233;par&#233;s &#224; toute &#233;ventualit&#233;, en g&#233;rant en silence tous les faux positifs susceptibles de se produire.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;5. D&#233;connexion initi&#233;e par le RP&lt;/h3&gt;
&lt;p&gt;Un RP peut notifier &#224; l'OP que l'utilisateur final s'est d&#233;connect&#233; du site et peut &#233;galement vouloir se d&#233;connecter de l'OP. Dans ce cas, le RP, apr&#232;s avoir d&#233;connect&#233; l'utilisateur final du RP, redirige l'agent utilisateur de l'utilisateur final vers l'URL du point de terminaison de d&#233;connexion de l'OP. Cette URL est normalement obtenue via l'&#233;l&#233;ment end_session_endpoint de la r&#233;ponse &#224; la d&#233;couverte de l'OP ou peut &#234;tre apprise via d'autres m&#233;canismes.&lt;/p&gt;
&lt;p&gt;Cette sp&#233;cification d&#233;finit &#233;galement les param&#232;tres suivants qui sont transmis en tant que param&#232;tres de requ&#234;te dans la demande de d&#233;connexion :&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;id_token_hint&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; CONSEILL&#201;&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb4-3' class='spip_note' rel='appendix' title='Obligatoire pour OAuthSD' id='nh4-3'&gt;3&lt;/a&gt;]&lt;/span&gt;. Le jeton d'ID pr&#233;c&#233;demment &#233;mis a &#233;t&#233; transmis au point de terminaison de la d&#233;connexion en tant qu'indication de la session authentifi&#233;e actuelle de l'utilisateur final avec le client. Ceci est utilis&#233; comme indication de l'identit&#233; de l'utilisateur final que le RP demande &#224; &#234;tre d&#233;connect&#233; par l'OP. L'OP n'a pas besoin d'&#234;tre r&#233;pertori&#233; en tant que public du jeton ID lorsqu'il est utilis&#233; en tant que valeur id_token_hint.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;post_logout_redirect_uri&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; OPTIONNEL. URL &#224; laquelle le RP demande que l'agent utilisateur de l'utilisateur final soit redirig&#233; apr&#232;s la d&#233;connexion. La valeur DOIT avoir d&#233;j&#224; &#233;t&#233; enregistr&#233;e aupr&#232;s de l'OP, soit &#224; l'aide du param&#232;tre d'enregistrement post_logout_redirect_uris, soit via un autre m&#233;canisme. S'il est fourni, l'OP DEVRAIT honorer cette demande apr&#232;s la d&#233;connexion.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;state&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; OPTIONNEL. Valeur opaque utilis&#233;e par le RP pour maintenir l'&#233;tat entre la demande de d&#233;connexion et le rappel au noeud final sp&#233;cifi&#233; par le param&#232;tre de requ&#234;te post_logout_redirect_uri. S'il est inclus dans la demande de d&#233;connexion, l'OP retransmet cette valeur au RP en utilisant le param&#232;tre de requ&#234;te d'&#233;tat lors de la redirection de l'agent d'utilisateur vers le RP.&lt;/p&gt;
&lt;p&gt;Au point de terminaison de la d&#233;connexion, l'OP DEVRAIT demander &#224; l'utilisateur final s'il souhaite &#233;galement se d&#233;connecter de l'OP. Si l'utilisateur final dit &#034;oui&#034;, alors l'OP DOIT d&#233;connecter l'utilisateur final.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;5.1. Redirection vers RP apr&#232;s la d&#233;connexion&lt;/h3&gt;
&lt;p&gt;Dans certains cas, le RP demande &#224; ce que l'agent d'utilisateur de l'utilisateur final soit redirig&#233; vers le RP apr&#232;s la d&#233;connexion. La redirection post-d&#233;connexion n'est effectu&#233;e que lorsque la d&#233;connexion est lanc&#233;e par le RP, auquel cas la cible de la redirection est la valeur du param&#232;tre de requ&#234;te post_logout_redirect_uri utilis&#233;e par le RP initiateur ; sinon ce n'est pas fait. Cette sp&#233;cification d&#233;finit ce param&#232;tre d'enregistrement dynamique &#224; cette fin, conform&#233;ment &#224; la section 2.1 d'OpenID Connect Dynamic Client Registration 1.0 [OpenID.Registration].&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;5.1.1. M&#233;tadonn&#233;es d'inscription du client&lt;/h3&gt;
&lt;p&gt;Ce param&#232;tre de m&#233;tadonn&#233;es client PEUT &#234;tre inclus dans les informations d'enregistrement du client lorsque la gestion de session et l'enregistrement dynamique sont pris en charge :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;post_logout_redirect_uris&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; OPTIONNEL. Tableau d'URL fournies par le RP auquel il PEUT demander que l'agent d'utilisateur de l'utilisateur final soit redirig&#233; &#224; l'aide du param&#232;tre post_logout_redirect_uri apr&#232;s la d&#233;connexion&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb4-4' class='spip_note' rel='appendix' title='Nous consid&#233;rons cette fonctionnalit&#233; comme tr&#232;s dangereuse, car elle permet &#224; (...)' id='nh4-4'&gt;4&lt;/a&gt;]&lt;/span&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;6. Validation&lt;/h3&gt;
&lt;p&gt;Si l'une des proc&#233;dures de validation d&#233;finies dans la pr&#233;sente sp&#233;cification &#233;choue, les op&#233;rations n&#233;cessitant des informations qui n'ont pas &#233;t&#233; correctement valid&#233;es DOIVENT &#234;tre annul&#233;es et les informations qui n'ont pas &#233;t&#233; valid&#233;es NE DOIVENT PAS &#234;tre utilis&#233;es.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;7. Consid&#233;rations de mise en &#339;uvre&lt;/h3&gt;
&lt;p&gt;Cette sp&#233;cification d&#233;finit les fonctionnalit&#233;s utilis&#233;es par les parties utilisatrices et les fournisseurs OpenID ayant choisi d'impl&#233;menter la gestion de session. Toutes ces parties utilisatrices et fournisseurs OpenID DOIVENT impl&#233;menter les fonctions list&#233;es dans cette sp&#233;cification comme &#233;tant &#034;REQUIRED&#034; ou d&#233;crites avec un &#034;MUST&#034;. Aucune autre consid&#233;ration d'impl&#233;mentation pour les impl&#233;mentations de Session Management n'est d&#233;finie par cette sp&#233;cification.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;8. Consid&#233;rations de s&#233;curit&#233;&lt;/h3&gt;
&lt;p&gt;L'OP iframe DOIT imposer que l'appelant ait la m&#234;me origine que son cadre parent. Il DOIT rejeter les demandes postMessage provenant de toute autre source, afin d'emp&#234;cher les attaques de script entre sites.&lt;/p&gt;
&lt;p&gt;Le param&#232;tre id_token_hint associ&#233; &#224; une demande de d&#233;connexion peut &#234;tre utilis&#233; pour d&#233;terminer quel RP a lanc&#233; la demande de d&#233;connexion. Les demandes de d&#233;connexion sans valeur id_token_hint valide constituent un moyen de d&#233;ni de service potentiel ; par cons&#233;quent, les op&#233;rateurs peuvent vouloir demander une confirmation explicite de l'utilisateur avant d'agir.&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;/blockquote&gt;&lt;h3 class=&#034;spip&#034;&gt;Critique raisonn&#233;e de la m&#233;thode et solution pour OAuthSD&lt;/h3&gt;
&lt;p&gt;Rappelons tout d'abord que la m&#233;thode des iframes n'est pas celle que pr&#233;conise OAuthSD, voyez : &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#monitoringdeletatdelauthentificationetslo' class='spip_in'&gt;Monitoring de l'&#233;tat de l'authentification et SLO&lt;/a&gt; et &lt;a href='https://static.oa.dnc.global/-Ressources-pour-les-developpeurs-.html#implementationdumonitoringavecjavascriptexemplespourspipetwordpress' class='spip_in'&gt;Impl&#233;mentation du monitoring avec Javascript : exemples pour SPIP et WordPress&lt;/a&gt;. OAuthSD met en &#339;uvre la m&#233;thode pr&#233;sent&#233;e pr&#233;c&#233;demment &#224; des fins d'exp&#233;rimentation et de suivi de la norme OpenID Connect.&lt;/p&gt;
&lt;p&gt;Cependant, ce document pr&#233;sente des erreurs de principe conduisant &#224; des complications inutiles, r&#233;sultant en une m&#233;thode de monitoring inefficace. En particulier, de tr&#232;s nombreux &#233;v&#233;nements hors sujet n&#233;cessitent d'interroger l'OP sur la r&#233;alit&#233; de la connexion, ce qui entra&#238;ne un trafic important.&lt;/p&gt;
&lt;p&gt;De toutes fa&#231;ons, les erreurs, omissions et impr&#233;cisions de ce document conduisent &#224; un non fonctionnement du syst&#232;me tel que d&#233;crit.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;1. Se concentrer sur notre sujet : un utilisateur et une application donn&#233;e&lt;/h3&gt;
&lt;p&gt;&lt;i&gt;&#034;L'&#233;tat du navigateur ... capture des &#233;v&#233;nements significatifs tels que les connexions, les d&#233;connexions, le changement d'utilisateur, le changement de statut d'authentification pour les clients utilis&#233;s par l'utilisateur final, etc. Ainsi, l'OP DEVRAIT mettre &#224; jour la valeur de l'&#233;tat du navigateur en r&#233;ponse &#224; de tels &#233;v&#233;nements significatifs.&#034;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Dans cette phrase, l'expression &lt;i&gt;&#034;les connexions, les d&#233;connexions, le changement d'utilisateur, le changement de statut d'authentification pour les clients utilis&#233;s par l'utilisateur final, etc.&#034;&lt;/i&gt; est un galimatias redondant, encore embrouill&#233; par &lt;i&gt;&#034;des &#233;v&#233;nements tels que&#034;&lt;/i&gt; (il y aurait encore d'autres &#233;v&#233;nements &#224; prendre en compte ?) et par le &lt;i&gt;&#034;etc.&#034;&lt;/i&gt; final. Le texte qui suit &lt;i&gt;&#034;Dans le cas d'un client autoris&#233; (r&#233;ponse d'authentification r&#233;ussie), l'OP DEVRAIT changer la valeur de l'&#233;tat de session renvoy&#233; au client &#224; l'occurrence de l'un des &#233;v&#233;nements suivants : - L'ensemble des utilisateurs authentifi&#233;s aupr&#232;s du navigateur change (connexion, d&#233;connexion, ajout de session). - Le statut d'authentification des clients utilis&#233;s par l'utilisateur final change.&#034;&lt;/i&gt; n'est qu'une redite du pr&#233;c&#233;dent. Passons sur le fait que l'authentification n'est pas relative au client mais &#224; l'utilisateur final : on n'est pas &#224; une approximation pr&#232;s.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&#034;De plus, l'&#233;tat du navigateur utilis&#233; pour v&#233;rifier l'&#233;tat de la session DEVRAIT changer avec de tels &#233;v&#233;nements.&#034;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&#034;Il est RECOMMAND&#201; que l'&#233;tat du navigateur NE DEVRAIT PAS varier trop souvent en l'absence de tels &#233;v&#233;nements afin de minimiser le trafic sur le r&#233;seau caus&#233; par la r&#233;ponse du client aux modifications notifi&#233;es&#034;&lt;/i&gt;. C'est une absurdit&#233; : s'il n'y a pas d'&#233;v&#233;nement, il n'y a pas de notification de changement.&lt;/p&gt;
&lt;p&gt;Il appara&#238;t que les changements d'&#233;tats relatifs &#224; toutes les applications et tous les utilisateurs donnent lieu &#224; notification d'un changement d'&#233;tat.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;La seule chose qui nous int&#233;resse est de savoir si l'utilisateur de l'application ouverte sur le navigateur consid&#233;r&#233; est connect&#233; ou non.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;2. Obtenir directement l'&#233;tat de connexion, et non l'indication d'un changement&lt;/h3&gt;
&lt;p&gt;&lt;i&gt;&#034;Les appels &#224; check_session() renverront les modifications apport&#233;es par rapport aux versions ant&#233;rieures de l'&#233;tat de session apr&#232;s de tels &#233;v&#233;nements.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;D&#232;s r&#233;ception de la modification, le RP DOIT effectuer une nouvelle authentification avec prompt = none pour obtenir l'&#233;tat de la session en cours sur le terminal op&#233;rateur.&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;L'id&#233;e est de notifier un changement d'&#233;tat, et de r&#233;interroger le serveur pour savoir si l'utilisateur est toujours vu connect&#233;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution OAuthSD :&lt;/strong&gt; L'&#233;tat de connexion est relatif &#224; une application et &#224; un utilisateur. Il est traduit par la validit&#233; du jeton d'acc&#232;s.&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;Cette solution a notre pr&#233;f&#233;rence, voir la note suivante.&lt;/p&gt;
&lt;/div&gt;&lt;div id='nb4-2'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh4-2' class='spip_note' title='Notes 4-2' rev='appendix'&gt;2&lt;/a&gt;] &lt;/span&gt;Il est donc inexact d'affirmer, comme indiqu&#233; au paragraphe pr&#233;c&#233;dent, que la connaissance de l'&#233;tat de session peut &#234;tre effectu&#233; &#034;sans g&#233;n&#233;rer de trafic sur le r&#233;seau&#034;. Pour r&#233;duire le trafic, il conviendra d'augmenter l'intervalle d'interrogation de l'OP. Chez DnC, nous pr&#233;f&#233;rons tester la connexion avec prompt = none, le serveur OAuthSD &#233;tant optimis&#233; pour r&#233;pondre tr&#232;s rapidement &#224; une requ&#234;te de type XMLHttpRequest.&lt;/p&gt;
&lt;/div&gt;&lt;div id='nb4-3'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh4-3' class='spip_note' title='Notes 4-3' rev='appendix'&gt;3&lt;/a&gt;] &lt;/span&gt;Obligatoire pour OAuthSD&lt;/p&gt;
&lt;/div&gt;&lt;div id='nb4-4'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh4-4' class='spip_note' title='Notes 4-4' rev='appendix'&gt;4&lt;/a&gt;] &lt;/span&gt;Nous consid&#233;rons cette fonctionnalit&#233; comme tr&#232;s dangereuse, car elle permet &#224; un malware de rediriger l'utilisateur final sur une page &#233;trang&#232;re &#224; l'application initiale, favorisant ainsi le physing.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>



</channel>

</rss>
