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

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

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



<item xml:lang="fr">
		<title>JWT : Un module de validation en Python</title>
		<link>https://oa.dnc.global/-OpenID-Connect-6-.html#jwtunmoduledevalidationenpython</link>
		<guid isPermaLink="true">https://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://oa.dnc.global/-OpenID-Connect-6-.html#validationdujetondidentiteidtokenjwtsigneoujws</link>
		<guid isPermaLink="true">https://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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;&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://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://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://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://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://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://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://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://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://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://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://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://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://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>APACHE mod_auth_openidc</title>
		<link>https://oa.dnc.global/-Ressources-pour-les-developpeurs-.html#apachemod_auth_openidc</link>
		<guid isPermaLink="true">https://oa.dnc.global/-Ressources-pour-les-developpeurs-.html#apachemod_auth_openidc</guid>
		<dc:date>2024-11-07T13:55:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;APACHE mod_auth_openidc est un module d'authentification pour le serveur HTTP Apache 2.x qui d&#233;l&#232;gue l'authentification des utilisateurs &#224; un fournisseur OpenID Connect. Cela permet de contr&#244;ler l'acc&#232;s &#224; tout ou partie d'un domaine Web. &lt;br class='autobr' /&gt;
Il est ainsi possible d'acc&#233;der &#224; des applications sans avoir &#224; les modifier pour OIDC. &lt;br class='autobr' /&gt;
Ce module permet &#224; un serveur Web Apache 2.x de fonctionner en tant que partie de confiance OpenID Connect (RP) ou 'client' d'un fournisseur OpenID Connect (OP). &lt;br class='autobr' /&gt;
Il d&#233;l&#232;gue (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-Ressources-pour-les-developpeurs-.html" rel="directory"&gt;Adaptation des applications&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L150xH134/arton220-59307.png?1733820003' width='150' height='134' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;APACHE mod_auth_openidc est un module d'authentification pour le serveur HTTP Apache 2.x qui d&#233;l&#232;gue l'authentification des utilisateurs &#224; un fournisseur OpenID Connect. Cela permet de contr&#244;ler l'acc&#232;s &#224; tout ou partie d'un domaine Web.&lt;/p&gt;
&lt;p&gt;Il est ainsi possible d'acc&#233;der &#224; des applications sans avoir &#224; les modifier pour OIDC.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Ce module permet &#224; un serveur Web Apache 2.x de fonctionner en tant que partie de confiance OpenID Connect (RP) ou 'client' d'un fournisseur OpenID Connect (OP).&lt;/p&gt;
&lt;p&gt;Il d&#233;l&#232;gue l'authentification des utilisateurs &#224; l'OP, dont il re&#231;oit en retour un jeton d'identit&#233; (ID Token) contenant les informations d'identit&#233; de l'utilisateur. &lt;br class='autobr' /&gt;
Il transmet ces informations aux applications h&#233;berg&#233;es et prot&#233;g&#233;es par le serveur Web Apache.&lt;/p&gt;
&lt;p&gt;Le contenu et/ou les applications prot&#233;g&#233;s peuvent &#234;tre servis par le serveur Apache lui-m&#234;me ou peuvent &#234;tre servis depuis un autre endroit lorsqu'Apache est configur&#233; en tant que proxy inverse devant le(s) serveur(s) d'origine.&lt;/p&gt;
&lt;p&gt;See : &lt;a href=&#034;https://github.com/zmartzone/mod_auth_openidc&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://github.com/zmartzone/mod_auth_openidc&lt;/a&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Pr&#233;paration&lt;/h3&gt;
&lt;p&gt;Tout d'abord il faut v&#233;rifier la pr&#233;sence du module mod_auth_openidc :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;# apachectl -M&lt;br /&gt; ...&lt;br /&gt; auth_openidc_module (shared)&lt;br /&gt; ...&lt;/code&gt;&lt;/div&gt; &lt;p&gt;Si absent, il faut installer le module mod_auth_openidc.so :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;# yum install mod_auth_openidc&lt;br /&gt; ...&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;et relancer Apache.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Configurer un VirtualHost&lt;/h3&gt;
&lt;p&gt;Dans l'exemple qui suit, un serveur &#224; l'URL example.com comporte un r&#233;pertoire '/protected' prot&#233;g&#233; par OIDC.&lt;/p&gt;
&lt;p&gt;Il y a trois sections dans cet exemple : d'abord la d&#233;finition du serveur, puis la configuration OIDC et enfin la d&#233;finition d'un emplacement prot&#233;g&#233; par OIDC.&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;NameVirtualHost *:80&lt;br /&gt; &lt;br /&gt; &lt;VirtualHost *:80&gt;&lt;br /&gt; ServerAdmin webmaster@example.com&lt;br /&gt; ServerName example.com&lt;br /&gt; ServerAlias www.example.com&lt;br /&gt; DocumentRoot /home/example/public_html/&lt;br /&gt; DirectoryIndex index.html&lt;br /&gt; ErrorLog /var/log/oidc/error.log&lt;br /&gt; CustomLog /var/log/oidc/access.log&lt;br /&gt; &lt;br /&gt; OIDCProviderMetadataURL https://oa.dnc.global/.well-known/openid-configuration&lt;br /&gt; OIDCClientID openidc_example&lt;br /&gt; OIDCClientSecret ...&lt;br /&gt; OIDCRedirectURI http://example.com/protected/redirect_uri&lt;br /&gt; OIDCCryptoPassphrase &lt;password&gt;&lt;br /&gt; OIDCJWKSRefreshInterval 3600&lt;br /&gt; &lt;br /&gt; &lt;Location /protected/&gt;&lt;br /&gt; AuthType openid-connect&lt;br /&gt; Require valid-user&lt;br /&gt; &lt;/Location&gt;&lt;br /&gt; &lt;br /&gt; &lt;/VirtualHost&gt;&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OIDCProviderMetadataURL : URL du document de d&#233;couverte (Discovery metadata). Par convention il s'agit du fichier openid-configuration se trouvant &#224; la racine des documents de l'OP dans le r&#233;pertoire /.well-known/. &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OIDCClientID, OIDCClientSecret : les identifiants du module en tant que client de l'OP (ou relying party, RP).
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OIDCRedirectURI : une URI factice qui doit pointer dans un r&#233;pertoire prot&#233;g&#233; par ce module (dans notre exemple &#224; l'int&#233;rieur du r&#233;pertoire 'protected') mais ne doit PAS pointer vers un contenu. Il faut l'enregistrer en tant qu'URI de redirection dans la configuration du client sur l'OP.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OIDCCryptoPassphrase : un mot de passe al&#233;atoire &#224; des fins de cryptage de la session.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; OIDCJWKSRefreshInterval : Dur&#233;e de vie de l'authentification.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;D&#233;clarations renvoy&#233;es depuis OpenID Connect via le module Apache&lt;/h3&gt;
&lt;p&gt;Le module passe les d&#233;clarations du jeton d'identit&#233; ID_TOKEN aux applications h&#233;berg&#233;es et prot&#233;g&#233;es par le serveur web Apache.&lt;/p&gt;
&lt;p&gt;Par d&#233;faut, le module d&#233;finit la variable REMOTE_USER sur la revendication id_token [sub], concat&#233;n&#233;e avec l'identifiant de l'&#233;metteur de l'OP ([sub]@[iss]).&lt;/p&gt;
&lt;p&gt;Les autres d&#233;clarations du jeton d'identit&#233; ID_TOKEN sont transmises dans les en-t&#234;tes HTTP et/ou les variables d'environnement avec celles (&#233;ventuellement) obtenues &#224; partir du point de terminaison UserInfo.&lt;/p&gt;
&lt;p&gt;La super globale $_SERVER contient ces d&#233;clarations sous la forme :&lt;br class='autobr' /&gt;
&lt;code class='spip_code' dir='ltr'&gt;OIDC_XXX&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;On peut par exemple les lister comme suit :&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: #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;$_SERVER&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;as&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$key&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$value&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/preg_match&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;preg_match&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;&#034;/OIDC_/i&#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: #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;echo&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;&lt;span style=&#034;color: #006699; font-weight: bold;&#034;&gt;$key&lt;/span&gt; : &lt;span style=&#034;color: #006699; font-weight: bold;&#034;&gt;$value&lt;/span&gt;&#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: #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://oa.dnc.global/local/cache-code/c14292a2e185e5861872a1de693eda24.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;Autorisation Apache Require&lt;/h3&gt;
&lt;p&gt;Les r&#232;gles d'autorisation Apache Require standard peuvent &#234;tre appliqu&#233;es avec l'ensemble des d&#233;clarations fournies par le jeton d'identit&#233;.&lt;/p&gt;
&lt;p&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://oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#gestiondelasessionoidcfonctionnalites</link>
		<guid isPermaLink="true">https://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://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>Q : le flux d'autorisation est-il aussi bon pour le natif/mobile ?</title>
		<link>https://oa.dnc.global/-Decouvrir-.html#qlefluxdautorisationestilaussibonpourlenatifmobile</link>
		<guid isPermaLink="true">https://oa.dnc.global/-Decouvrir-.html#qlefluxdautorisationestilaussibonpourlenatifmobile</guid>
		<dc:date>2024-03-14T09:55:29Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;B&#233;n&#233;ficiant des travaux de Bertrand Degoy, i-Tego ma&#238;trise l'IA g&#233;n&#233;rative &#224; partir des donn&#233;es de votre entreprise. Nous pouvons ainsi vous fournir des outils de recherche avanc&#233;s sur un tr&#232;s grand nombre de documents de tout type, explorer vos bases de donn&#233;es, vos e-mails etc. Le tout avec une traduction automatique ! &lt;br class='autobr' /&gt;
Voici l'exemple d'un chat exploitant la documentation d'i-Tego : &lt;br class='autobr' /&gt;
Q:le flux d'autorisation est-il aussi bon pour les applications natives/mobiles que pour les applications Web ? &lt;br class='autobr' /&gt;
R : Le (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-Decouvrir-.html" rel="directory"&gt;D&#233;couvrir&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L76xH150/arton804-7b172.png?1733820003' width='76' height='150' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;B&#233;n&#233;ficiant des travaux de &lt;a href=&#034;https://ia.dnc.global/&#034; class='spip_out' rel='external'&gt;Bertrand Degoy&lt;/a&gt;, i-Tego ma&#238;trise l'IA g&#233;n&#233;rative &#224; partir des donn&#233;es de votre entreprise. Nous pouvons ainsi vous fournir des outils de recherche avanc&#233;s sur un tr&#232;s grand nombre de documents de tout type, explorer vos bases de donn&#233;es, vos e-mails etc. Le tout avec une traduction automatique !&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;dl class='spip_document_111 spip_documents spip_documents_left' style='float:left;'&gt;
&lt;dt&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L309xH612/itego_chat_smartphone-717a0.png?1733817730' width='309' height='612' alt='' /&gt;&lt;/dt&gt;
&lt;dt class='crayon document-titre-111 spip_doc_titre' style='width:309px;'&gt;&lt;strong&gt;i-Tego chat bot&lt;/strong&gt;&lt;/dt&gt;
&lt;dd class='crayon document-descriptif-111 spip_doc_descriptif' style='width:309px;'&gt;i-Tego offers businesses a chatbot whose document database includes their own data : &lt;a href=&#034;https://chat.i-tego.com/&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://chat.i-tego.com/&lt;/a&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;Voici l'exemple d'un chat exploitant la documentation d'i-Tego :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:le flux d'autorisation est-il aussi bon pour les applications natives/mobiles que pour les applications Web ?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;R : Le flux d'autorisation est g&#233;n&#233;ralement consid&#233;r&#233; comme plus adapt&#233; pour les applications Web que pour les applications natives ou mobiles. En effet, les applications Web sont plus faciles &#224; s&#233;curiser car elles fonctionnent dans un environnement contr&#244;l&#233; et d&#233;pendent d'une connexion permanente au serveur, ce qui facilite l'utilisation du flux &#034;Authorization Code&#034; pour prot&#233;ger les donn&#233;es.&lt;/p&gt;
&lt;p&gt;En revanche, les applications natives ou mobiles peuvent rencontrer des difficult&#233;s avec le flux d'autorisation, notamment en ce qui concerne l'authentification de l'application elle-m&#234;me. Les m&#233;thodes de s&#233;curit&#233; telles que le &#034;Proof Key for Code Exchange&#034; ou le &#034;Proof of Possession&#034; peuvent renforcer la s&#233;curit&#233; des jetons &#233;mis, mais ne permettent pas toujours d'authentifier pleinement une application sans back-end.&lt;/p&gt;
&lt;p&gt;Il est donc recommand&#233; d'utiliser le flux de code d'autorisation pour les applications natives ou mobiles, mais il est important de prendre en compte les sp&#233;cificit&#233;s de ces types d'applications en mati&#232;re de s&#233;curit&#233;.&lt;/p&gt;
&lt;p&gt;Sources :&lt;/p&gt;
&lt;p&gt; Document &#034;Authentifier l'application - OpenID Connect OAuth Server d&#233;di&#233;&#034; (pages 8, 9, 14, 15)&#034;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Il est important de noter que la question &#224; une r&#233;ponse libell&#233;e en fran&#231;ais est fond&#233;e sur des documents diff&#233;rents que celle r&#233;pondant &#224; une &lt;a href='https://oa.dnc.global/-Discover-.html#qisauthorizationflowasgoodfornativemobile' class='spip_in' hreflang='en'&gt;question libell&#233;e en anglais&lt;/a&gt;. En effet, la base documentaire fournie par i-Tego au chatbot est principalement en langue fran&#231;aise. Dans le choix des sources, la priorit&#233; est donn&#233;e &#224; la langue de la question.&lt;/i&gt;&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>L'authentification dans le cadre de l'IIoT</title>
		<link>https://oa.dnc.global/-Decouvrir-.html#lauthentificationdanslecadredeliiot</link>
		<guid isPermaLink="true">https://oa.dnc.global/-Decouvrir-.html#lauthentificationdanslecadredeliiot</guid>
		<dc:date>2022-10-23T10:00:38Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Assurer la s&#233;curit&#233; de la transmission des donn&#233;es entre les applications et les objets connect&#233;s de l'Industrie du Futur : Outre la s&#233;curisation des donn&#233;es en provenance des capteurs, l'&#233;tude et le d&#233;monstrateur du projet &#034;AuthSec&#034; seront particuli&#232;rement orient&#233;s vers la s&#233;curit&#233; des ordres pass&#233;s aux actionneurs en vue d'&#233;viter les dysfonctionnements et les accidents. Deux techniques seront combin&#233;es : l'authentification de bout en bout, au niveau applicatif, pour compl&#233;ter la s&#233;curit&#233; du niveau (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-Decouvrir-.html" rel="directory"&gt;D&#233;couvrir&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L150xH98/arton234-93bb9.png?1733820003' width='150' height='98' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Assurer la s&#233;curit&#233; de la transmission des donn&#233;es entre les applications et les objets connect&#233;s de l'Industrie du Futur : &lt;br class='autobr' /&gt;
Outre la s&#233;curisation des donn&#233;es en provenance des capteurs, l'&#233;tude et le d&#233;monstrateur du projet &#034;AuthSec&#034; seront particuli&#232;rement orient&#233;s vers la s&#233;curit&#233; des ordres pass&#233;s aux actionneurs en vue d'&#233;viter les dysfonctionnements et les accidents. &lt;br class='autobr' /&gt;
Deux techniques seront combin&#233;es : l'authentification de bout en bout, au niveau applicatif, pour compl&#233;ter la s&#233;curit&#233; du niveau r&#233;seau ; des algorithmes bas&#233;s sur l'apprentissage profond pour d&#233;tecter et bloquer les commandes &#224; risque.&lt;br class='autobr' /&gt;
Cette d&#233;marche s'inscrit dans une r&#233;flexion sur les conditions de la Cyber-r&#233;silience de l'Usine du Futur.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;Le contexte dans lequel se con&#231;oit la s&#233;curit&#233; de l'Usine du Futur&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Une ouverture encore mal ma&#238;tris&#233;e&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;S'agissant de la s&#233;curit&#233; des applications informatiques des entreprises le mod&#232;le initial consistait (et consiste toujours pour beaucoup) &#224; sanctuariser les donn&#233;es et les traitements dans &lt;strong&gt;un r&#233;seau local isol&#233;&lt;/strong&gt; des services ext&#233;rieurs et auquel seuls les utilisateurs du site pouvaient acc&#233;der. Ce mod&#232;le radicalement efficace est devenu inapplicable compte tenu de l'int&#233;r&#234;t que pourraient pr&#233;senter certains services externes pour une application particuli&#232;re et de la n&#233;cessit&#233; d'ouvrir l'acc&#232;s au r&#233;seau &#224; des utilisateurs ext&#233;rieurs : collaborateurs, clients, usagers. Il para&#238;t inutile de justifier plus avant ce qui est maintenant une &#233;vidence.&lt;br class='autobr' /&gt;
S'agissant des collaborateurs hors site, une premi&#232;re ouverture a consist&#233; &#224; permettre l'acc&#232;s &#224; des utilisateurs ou des applications depuis le r&#233;seau Internet &#224; l'aide de pare-feu, de tunnels ou d'une console distante, l'acc&#232;s &#233;tant contr&#244;l&#233; en une seule fois &#224; l'entr&#233;e. Le collaborateur distant se trouve alors dans la m&#234;me situation que s'il se trouvait sur le site de l'entreprise. Bien que ce &lt;strong&gt;mod&#232;le p&#233;rim&#233;trique&lt;/strong&gt; soit &#224; l'origine de nombreux et graves probl&#232;mes de s&#233;curit&#233;, sa simplicit&#233; conceptuelle, son application d&#232;s les d&#233;buts de l'informatique et sa facilit&#233; de mise en &#339;uvre en font une solution trop largement adopt&#233;e.&lt;br class='autobr' /&gt;
Parall&#232;lement, le besoin s'est fait sentir de mettre &#224; la disposition du public des applications leur permettant d'interagir avec les donn&#233;es de l'entreprise ou de l'administration. C'est tout naturellement que les &lt;strong&gt;applications Web&lt;/strong&gt; sont n&#233;es. L'utilisateur distant n'acc&#232;de plus au r&#233;seau avec des outils omnipotents, mais au niveau applicatif, de son navigateur au &#171; site web &#187;, c'est &#224; dire &#224; une application r&#233;sidant sur un serveur. Une &lt;strong&gt;authentification de niveau applicatif&lt;/strong&gt;, g&#233;r&#233;e par l'application elle m&#234;me, permet de limiter son acc&#232;s aux seuls traitement et donn&#233;es qui sont autoris&#233;s &#224; l'utilisateur qui s'y connecte. &lt;br class='autobr' /&gt;
On aurait pens&#233; que les applications Web auraient &#233;t&#233; d&#233;velopp&#233;es dans le m&#234;me temps pour permettre le &lt;strong&gt;t&#233;l&#233;travail&lt;/strong&gt;, mais cela n'a pas &#233;t&#233; anticip&#233; par les grandes entreprises rest&#233;es positionn&#233;es sur le travail sur site, ou accoutum&#233;es aux tunnels ( &#233;tablissant des r&#233;seaux virtuels priv&#233;s ou virtual private network, ou &lt;strong&gt;tunnel VPN&lt;/strong&gt; ) pour le travail de site &#224; site, et qui ont naturellement adopt&#233; le mod&#232;le p&#233;rim&#233;trique pour le t&#233;l&#233;travail.&lt;br class='autobr' /&gt;
Outre les facteurs historiques et culturels, il faut reconna&#238;tre le frein que repr&#233;sente la n&#233;cessit&#233; de &lt;strong&gt;modifier les applications &#171; natives &#187; pour en faire des applications web capables d'authentification&lt;/strong&gt;, avec des d&#233;lais et des co&#251;ts consid&#233;r&#233;s comme improductifs. Face &#224; l'urgence d'organiser le t&#233;l&#233;travail, un marketing opportuniste a fait admettre le tunnel VPN comme la panac&#233;e, alors que cela consiste &#224; &#233;tendre le r&#233;seau de l'entreprise aux r&#233;seau locaux des box familiales au domicile des employ&#233;s, avec les risques que l'on imagine - eh bien non, justement, on ne l'imagine pas. Alors que la s&#233;curit&#233; des tunnels de site &#224; site avait soigneusement &#233;t&#233; &#233;tablie, la pr&#233;cipitation et les mauvaises pratiques pr&#233;valent dans le cadre du t&#233;l&#233;travail.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;La tentation du Cloud&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Une certaine image de l'Usine du Futur est aujourd'hui d&#233;termin&#233;e par des facteurs qui lui sont largement &#233;trangers :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; la domination du march&#233; grand public sur le march&#233; professionnel, imposant ses produits et ses sch&#233;mas mentaux ainsi que ses m&#233;thodes de marketing,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le besoin de connexion &#224; distance pour le t&#233;l&#233;travail, malheureusement fond&#233; sur des r&#233;seaux con&#231;us pour le grand public et des &#233;quipements domestiques,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le d&#233;sir de mobilit&#233;, recherche quasi ludique d'une facilit&#233; de connexion permanente, sans distinction de moyens, de techniques ou de comportement entre l'espace professionnel et la vie ext&#233;rieure,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'approche commerciale des entreprise de services du num&#233;rique qui, &#224; la suite des GAFAMs ayant largement promu la technique d'externalisation des services dans le Cloud, proposent de plus en plus des plateformes en tant que service (PaaS) qui leur sont particuli&#232;rement avantageuses, en &#233;vitant de trop mentionner ni traiter les probl&#232;mes de s&#233;curit&#233; que cela implique.&lt;/p&gt;
&lt;p&gt;A ces facteurs ext&#233;rieurs, on pourrait ajouter deux tendances bien ancr&#233;es dans l'esprit de certains dirigeants et qui devraient pourtant appartenir au pass&#233; :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'externalisation de fonctions relevant de comp&#233;tences consid&#233;r&#233;es comme inaccessibles ou rang&#233;es par principe hors du &#171; c&#339;ur de m&#233;tier &#187;,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'incompr&#233;hension des techniques de s&#233;curit&#233;, la confiance excessive, la n&#233;gligence au nom de la rapidit&#233; de d&#233;veloppement et de la productivit&#233;, ou encore le classement des investissements de s&#233;curit&#233; dans les charges improductives,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; la crainte de se voir reprocher des choix technologiques hasardeux plut&#244;t que le maintien de techniques dont la fiabilit&#233; serait justifi&#233;e par leur anciennet&#233; et leur large adoption,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le sentiment de propri&#233;t&#233; des ITs sur la s&#233;curit&#233;, qui - de leur point de vue - devrait &#234;tre de leur seule comp&#233;tence et donc appliqu&#233;e exclusivement au niveau r&#233;seau, faussement en concurrence avec une s&#233;curit&#233; au niveau applicatif pr&#233;sent&#233;e comme alternative et non comme compl&#233;mentaire.&lt;/p&gt;
&lt;p&gt;Ainsi, il est donn&#233; aux public et aux chefs d'entreprise &lt;strong&gt;une vision de l'Usine du Futur dans laquelle tout est connect&#233; &#224; tout&lt;/strong&gt;, sur le mod&#232;le applicable au grand public. &lt;br class='autobr' /&gt;
L'une des implications les plus lourdes pour la s&#233;curit&#233; des r&#233;seaux est la multiplication des connexions ext&#233;rieures non seulement &#224; la p&#233;riph&#233;rie des r&#233;seaux, mais encore dans leur profondeur. &lt;br class='autobr' /&gt;
Or, un grand d&#233;sordre existe dans la s&#233;curit&#233; des r&#233;seaux, &#224; l'origine de nombreux accidents de s&#233;curit&#233; ou de s&#251;ret&#233; de fonctionnement. Pour l'Usine du Futur, de tels accidents sont inacceptables car ils pourront se traduire en perte de propri&#233;t&#233; industrielle et en arr&#234;t de production.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Le mod&#232;le &#171; J&#233;richo &#187; &lt;/h3&gt;
&lt;p&gt;Depuis longtemps d&#233;j&#224; les entreprises ont ouvert l'acc&#232;s &#224; leur r&#233;seau en contr&#244;lant l'acc&#232;s &#224; leur p&#233;rim&#233;trie. Cependant, de multiples attaques aux cons&#233;quences graves ont d&#233;montr&#233; la &lt;strong&gt;faillite du mod&#232;le p&#233;rim&#233;trique&lt;/strong&gt;. &lt;br class='autobr' /&gt;
Ce constat a &#233;t&#233; fait il y a de nombreuses ann&#233;es d&#233;j&#224;. En 2004, le Jericho Forum introduisait le concept de d&#233;p&#233;rim&#233;trisation, une strat&#233;gie de d&#233;fense qui consiste en un syst&#232;me de s&#233;curit&#233; segment&#233; et multicouche bas&#233; sur le chiffrement et l'authentification, incluant les ressources hors site. Plus proche de nous, le concept de &#171; z&#233;ro confiance &#224; l'acc&#232;s r&#233;seau &#187; ( Zero Trust Network Access, ZTNA ) en reprend quelques principes, sous une forme plus m&#233;diatique, mettant l'accent sur l'authentification. &lt;br class='autobr' /&gt;
Selon le mod&#232;le &#171; J&#233;richo &#187;, &lt;strong&gt;la s&#233;curit&#233; est appliqu&#233;e l&#224; o&#249; se trouvent les donn&#233;es et les traitements &#224; prot&#233;ger, c'est &#224; dire au niveau applicatif de chaque service &lt;/strong&gt; ( applications, services Web, machines, objets connect&#233;s etc. ). C'est bien ce qu'applique l'OTAN avec le principe de protection &#034;Data-centric Security (DCS) :&#034; rather than focusing on network perimeter defence focuses on securing access to the data itself.&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb1' class='spip_note' rel='appendix' title='Konrad Wrona &#034;Towards Data-centric Security for NATO Operations&#034; DIGILIENCE (...)' id='nh1'&gt;1&lt;/a&gt;]&lt;/span&gt;&#034;.&lt;/p&gt;
&lt;p&gt;Il ne faut pas concevoir l'authentification au niveau applicatif comme un moyen de suppl&#233;er &#224; une mauvaise s&#233;curit&#233; du r&#233;seau. Assurer la s&#233;curit&#233; &#224; travers les applications web exige que l'on ne puisse pas acc&#233;der directement aux donn&#233;es au niveau r&#233;seau. &lt;strong&gt;Le principe sera d'isoler les services dans un p&#233;rim&#232;tre r&#233;duit ( r&#233;sultant de la segmentation multicouche ), bien s&#233;curis&#233; au niveau r&#233;seau et accessibles seulement au niveau applicatif avec authentification. &lt;/strong&gt; En particulier, cela exige de ne pas permettre l'acc&#232;s direct au gestionnaire de donn&#233;es, ce qui implique que toute op&#233;ration administrative devrait &#234;tre effectu&#233;e &#224; partir d'une connexion locale. L'id&#233;al serait de n'ouvrir au niveau r&#233;seau que les ports strictement n&#233;cessaires aux protocoles de la couche ISO n&#176; 5, &#224; la limite seulement 443 pour HTTP et MQTT s&#233;curis&#233;s par TLS.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;L'Usine du Futur sera s&#233;curis&#233;e ou ne sera pas&lt;/h3&gt;
&lt;p&gt;Mais de quoi parle-t-on ? L'usine du Futur n'existe-t-elle pas d&#233;j&#224; ? Les cha&#238;nes de construction automobile ne sont-elles pas d&#233;j&#224; totalement informatis&#233;es et robotis&#233;es ? Le syst&#232;me CATIA ne permet-il pas de concevoir, d&#233;velopper et r&#233;aliser de nouveaux produits, son succ&#232;s mondial t&#233;moignant de sa s&#233;curit&#233; ? A l'&#233;vidence les grandes entreprises ont ma&#238;tris&#233; le sujet. Il est certain qu'elles ne sont pas sensibles &#224; l'image m&#233;diatique, ayant les moyens d'&#233;tude n&#233;cessaires &#224; la conduite de leur &#233;volution. &lt;br class='autobr' /&gt;
&lt;strong&gt;Ce sont les TPE/PME qui se trouvent &#224; la merci du tapage m&#233;diatique &#8211; y compris sur les revues &#171; professionnelles &#187; - et la cible de d&#233;marches commerciales mal adapt&#233;es. Ce sont elles qui doivent &#234;tre accompagn&#233;es au cours de leur cr&#233;ation ou de leur transformation.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;S&#251;ret&#233; de fonctionnement, Contr&#244;le des acc&#232;s et S&#233;curit&#233; des donn&#233;es&lt;/h3&gt;
&lt;p&gt;Si on se r&#233;f&#232;re aux offres d'un marketing dominant, il faut s'en remettre &#224; l'Internet pour d&#233;localiser les donn&#233;es et les traitements dans le Cloud. Les donn&#233;es font alors le tour du monde : o&#249; et par qui sont-elles trait&#233;es, et par quelles applications ? O&#249; sont-elles sauvegard&#233;es ? Comment sont-elles prot&#233;g&#233;es ?&lt;br class='autobr' /&gt;
Avant de r&#233;pondre &#224; ces questions, il faut d&#233;finir la notion de Cloud .&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Cloud ou Cloud priv&#233; ?&lt;/h3&gt;
&lt;p&gt;Il convient tout d'abord de distinguer :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; La d&#233;finition initiale du Cloud qui est n&#233;e de la virtualisation des traitements et du stockage des donn&#233;es chez les grands h&#233;bergeurs, permettant de mettre &#224; disposition des abonn&#233;s des ressources virtuelles. Dans cette configuration, il s'agit de &#034;&lt;strong&gt;Cloud priv&#233;&lt;/strong&gt;&#034; dont l'acc&#232;s et la configuration sont sous le contr&#244;le de l'entreprise ( ou a minima d'un sous-traitant de confiance ). Des offres telles que IBM Cloud, Amazone AWS ou OVH Private Cloud offrent les garanties de propri&#233;t&#233; attendues par les entreprises.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Une &lt;strong&gt;externalisation g&#233;n&#233;rale des traitements et des donn&#233;es&lt;/strong&gt; confi&#233;s &#224; des sous-traitants ext&#233;rieurs &#224; l'entreprise, qui eux-m&#234;mes peuvent faire appel &#224; d'autres intervenants sans que ce soit identifiable et contr&#244;lable par l'entreprise, ni m&#234;me stable dans le temps. Parmi ces offres, il existe des services de donn&#233;es ou de traitement sans doute tr&#232;s commodes, mais dont la qualit&#233; et la p&#233;rennit&#233; est incontr&#244;lable. L'opacit&#233; de cette configuration a conduit au terme de nuage, qui par un effet de sablier a &#233;t&#233; &#233;rig&#233; au niveau d'un principe largement v&#233;hicul&#233; par les m&#233;dias.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Un enjeu de s&#233;curit&#233;&lt;/h3&gt;
&lt;p&gt;Avec des donn&#233;es et des traitements distribu&#233;s dans un tel Cloud, tous les enjeux de s&#233;curit&#233; se situent hors de la port&#233;e de l'entreprise :&lt;br class='autobr' /&gt;
&#8226;	S&#233;curit&#233; des acc&#232;s : l'authentification des utilisateurs et des applications est d&#233;l&#233;gu&#233;e hors du contr&#244;le de l'entreprise. &lt;br class='autobr' /&gt;
&#8226;	S&#233;curit&#233; des donn&#233;es des utilisateurs du public : peut-on r&#233;ellement appliquer le RGPD ? &lt;br class='autobr' /&gt;
&#8226;	S&#233;curit&#233; des donn&#233;es de l'entreprise non garantie, exposant &#224; l'espionnage industriel et &#224; la contrefa&#231;on. &lt;br class='autobr' /&gt;
&#8226;	Sauvegarde des donn&#233;es de l'entreprise : il lui est impossible de s'en assurer, au risque d'une perte totale.&lt;br class='autobr' /&gt;
De plus dans une telle configuration, la surface d'attaque est ind&#233;finie et probablement immense.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Un enjeu de s&#251;ret&#233;, de rapidit&#233; et de continuit&#233; de fonctionnement&lt;/h3&gt;
&lt;p&gt;&#8226;	S&#251;ret&#233; de fonctionnement : trop de composants hors du champ d'action de l'entreprise, totalement contraire &#224; toute d&#233;marche de qualit&#233;.&lt;br class='autobr' /&gt;
&#8226;	Rapidit&#233; : les processus industriels sont quasi temps r&#233;el. Des interruptions de service de quelques secondes, ou des temps de r&#233;ponse pr&#233;sentant de temps en temps des valeurs inacceptables, peuvent d&#233;stabiliser une cha&#238;ne de production, voire provoquer son arr&#234;t.&lt;br class='autobr' /&gt;
&#8226;	Continuit&#233; : la disponibilit&#233; des r&#233;seaux est &#233;galement en question, en commen&#231;ant par le raccordement de l'entreprise au r&#233;seau. Certes, le maillage de l'Internet assure la s&#251;ret&#233; du transport &#224; longue distance, mais le m&#234;me probl&#232;me de disponibilit&#233; se retrouve du c&#244;t&#233; des fournisseurs, &#224; moins qu'il s'agisse de grands h&#233;bergeurs.&lt;/p&gt;
&lt;p&gt;Pas totalement convaincu ? Voyez : David Heinemmeier Hansson : &#171; &lt;a href=&#034;https://world.hey.com/dhh/why-we-re-leaving-the-cloud-654b47e0&#034; class='spip_out' rel='external'&gt;Why we are leaving the cloud&lt;/a&gt; &#187;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;&#034;On premise&#034; ou cloud priv&#233; ?&lt;/h3&gt;
&lt;p&gt;L'analyse ci-dessus conduit &#224; :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; ne pas tout mettre dans un Cloud mal d&#233;fini et hors contr&#244;le, mais s'en tenir aux &lt;strong&gt;Cloud priv&#233;s&lt;/strong&gt; des grands h&#233;bergeurs, voire &#224; un datacenter de proximit&#233; ( ou &lt;strong&gt;Cloud de proximit&#233;&lt;/strong&gt; ). &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; envisager la technique du &#034;serveur edge&#034; pour r&#233;duire la surface d'attaque, r&#233;duire le temps de r&#233;ponse, contribuer &#224; la r&#233;silience et conforter la souverainet&#233;.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; identifier les t&#226;ches sensibles aux d&#233;lais de transmission ou d'interruption de service (voire aux attaques de d&#233;ni de service) et les assurer localement (r&#233;silience),
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; veiller &#224; confier les t&#226;ches sensibles &#224; des sous-traitants proches.&lt;/p&gt;
&lt;p&gt;Une approche radicale de la r&#233;silience conduirait &#224; distinguer un ensemble ind&#233;pendant de machines, d'applications de contr&#244;le et de gestion quotidienne de la production capable d'assurer la production sans connexion ext&#233;rieure.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Quel choix pour un serveur d'authentification ?&lt;/h3&gt;
&lt;p&gt;Le principe de l'authentification avec OpenID Connect est que les applications d&#233;l&#232;guent le processus au serveur, le dialogue d'identification &#233;tant effectu&#233; directement entre l'utilisateur et le serveur, sans intervention de l'application. Il en r&#233;sulte que toutes les donn&#233;es relatives &#224; l'authentification des applications et des utilisateurs, leurs donn&#233;es personnelles et les donn&#233;es cryptographiques sont situ&#233;es sur le serveur.&lt;/p&gt;
&lt;p&gt;De plus, les &#233;changes entre les diff&#233;rents p&#244;les pour l'authentification se produisent tr&#232;s fr&#233;quemment au rythme des &#233;changes de donn&#233;es et doivent &#234;tre extr&#234;mement rapides. Quelques dizaines de millisecondes est l'ordre de grandeur vis&#233;. Le serveur est le coop&#233;rant oblig&#233; de toute transaction s&#233;curis&#233;e. Il doit donc &#234;tre parfaitement disponible.&lt;/p&gt;
&lt;p&gt;Enfin, la plus dangereuse des attaques serait le d&#233;tournement du trafic vers un serveur pirate. Pour se pr&#233;munir contre tout d&#233;tournement d'adresse Internet (IP) il convient de situer le serveur d'authentification dans un &#034;syst&#232;me autonome&#034; coh&#233;rent avec le r&#233;seau de l'entreprise. Une solution radicale serait de placer le serveur dans le r&#233;seau de l'entreprise. Sinon, il convient de choisir un ensemble de r&#233;seaux g&#233;r&#233;s par une m&#234;me entit&#233; (fournisseur de service, h&#233;bergeurs, interm&#233;diaires techniques, etc.).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;La s&#233;curit&#233; et la s&#251;ret&#233; imposent donc de situer le serveur d'authentification &#034;&#224; proximit&#233;&#034; du r&#233;seau de l'entreprise.&lt;/strong&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;Konrad Wrona &#034;Towards Data-centric Security for NATO Operations&#034; DIGILIENCE 2020&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>OIDC et les Application &#224; page unique : exemple d'une belle mascarade !</title>
		<link>https://oa.dnc.global/-Authentifier-l-application-.html#oidcetlesapplicationapageuniqueexempledunebellemascarade</link>
		<guid isPermaLink="true">https://oa.dnc.global/-Authentifier-l-application-.html#oidcetlesapplicationapageuniqueexempledunebellemascarade</guid>
		<dc:date>2022-09-16T16:37:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Une application &#224; page unique (SPA) est une application Web qui charge une seule page HTML &#224; partir du serveur Web, puis la met &#224; jour de mani&#232;re dynamique en r&#233;ponse &#224; l'interaction de l'utilisateur et &#224; d'autres &#233;v&#233;nements. &lt;br class='autobr' /&gt;
Tirant argument des progr&#232;s des navigateurs, permettant &#224; Javascript de mettre en &#339;uvre les r&#232;gles CORS et d'acc&#233;der au cryptage, certains pr&#233;conisent de mettre en &#339;uvre le flux de code avec autorisation plut&#244;t que le flux implicite. &lt;br class='autobr' /&gt;
La magie du flux &#034;Authorization Code&#034; est alors (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-Authentifier-l-application-.html" rel="directory"&gt;Authentifier l'application&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L150xH150/arton177-aabd3.png?1733820003' width='150' height='150' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Une application &#224; page unique (SPA) est une application Web qui charge une seule page HTML &#224; partir du serveur Web, puis la met &#224; jour de mani&#232;re dynamique en r&#233;ponse &#224; l'interaction de l'utilisateur et &#224; d'autres &#233;v&#233;nements.&lt;/p&gt;
&lt;p&gt;Tirant argument des progr&#232;s des navigateurs, permettant &#224; Javascript de mettre en &#339;uvre les r&#232;gles CORS et d'acc&#233;der au cryptage, certains pr&#233;conisent de mettre en &#339;uvre le flux de code avec autorisation plut&#244;t que le flux implicite.&lt;/p&gt;
&lt;p&gt;La magie du flux &#034;Authorization Code&#034; est alors &#233;voqu&#233;e pour pr&#233;tendre que l'acc&#232;s aux donn&#233;es est s&#233;curis&#233;. Ce n'est que pure mascarade ! Bling bling bling ...&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;Une application &#224; page unique est une application &#034;sans back-end&#034;&lt;/h3&gt;
&lt;p&gt;Plusieurs architectures permettent de cr&#233;er des applications &#224; page unique. La tendance est l'architecture &#034;serveur l&#233;ger&#034;, qui installe sur l'agent utilisateur ( en g&#233;n&#233;ral le navigateur de l'utilisateur ) la page initiale contenant du code Javascript. Ce code assurera la logique et les transitions d'&#233;tat de l'application, celle-ci obtenant ses donn&#233;es d'API RESTful prot&#233;g&#233;es par OAuth 2.0. Dans cette configuration, l'application r&#233;side sur l'agent utilisateur et non sur le serveur : une application &#224; page unique est donc une application &#034;sans back-end&#034;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Les SPA pourraient (maintenant ?) mettre en &#339;uvre le flux de code avec autorisation (Authorization Code Grant)&lt;/h3&gt;
&lt;p&gt;Il est de nombreuses configurations dans lesquelles les h&#244;tes de l'application et les points de terminaison des services se situent sur des serveurs diff&#233;rents : serveur d'authentification, ressources prot&#233;g&#233;es (RS) ou API.&lt;/p&gt;
&lt;p&gt;Les applications &#224; page unique en sont un bon exemple.&lt;/p&gt;
&lt;p&gt;En utilisation Web normale, cette approche multi-h&#244;te ou, plus pr&#233;cis&#233;ment, &#034;multi-origines&#034; est restreinte pour de bonnes raisons de s&#233;curit&#233;. Les d&#233;clarations de partage de ressources multi-origines ( Cross-Origin Resource Sharing, CORS ) permettent de contourner la contrainte.&lt;/p&gt;
&lt;p&gt;Les navigateurs se sont am&#233;lior&#233;s depuis la conception du flux implicite. La mise en &#339;uvre de CORS pour autoriser la demande de jeton &#224; partir de JavaScript est maintenant disponible, ainsi que les API de cryptographie n&#233;cessaires pour valider la signature du jeton JWT. &lt;br class='autobr' /&gt;
Il est donc techniquement possible d'utiliser le flux de code d'autorisation pour l'authentification et l'autorisation des applications sans back-end, y compris pour les applications &#224; page unique.&lt;/p&gt;
&lt;p&gt;Faut-il en d&#233;duire pour autant que l'utilisation de ce flux, dans cette configuration, garantit la s&#233;curit&#233; des donn&#233;es ?&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Avec les SPA, les probl&#232;mes de la s&#233;curit&#233; de l'authentification restent pos&#233;s&lt;/h3&gt;
&lt;p&gt;Les SPA sont des applications &#034;sans-back-end&#034;. Leur code se trouve sur l'agent utilisateur, donc n'importe o&#249;, contrairement aux applications &#034;avec back-end&#034; dont le code, unique, est prot&#233;g&#233; au sein d'un serveur. A ce titre :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Sont expos&#233;s dans le code, de fa&#231;on plus ou moins accessible au public :&lt;br class='autobr' /&gt; - l'identifiant et le secret de l'application, &lt;br class='autobr' /&gt; - les jetons d'acc&#232;s ou d'identit&#233;.&lt;/p&gt;
&lt;p&gt;Avec l'identifiant et le secret, une application malicieuse peut se procurer des jetons. Avec les jetons, elle pourrait demander des donn&#233;es au nom de la v&#233;ritable application.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; L'URL de redirection est celle de l'application, donc celle de son h&#244;te, c'est &#224; dire l'user-agent. Elle ne peut &#234;tre inscrite sur le serveur et doit &#234;tre fournie par l'application. &lt;br class='autobr' /&gt;
Si on est dans le cas d'user-agent de station de travail ( desktops ) situ&#233;s dans un espace de confiance ( un ou plusieurs domaines connus ), il reste encore possible de comparer cette URL &#224; un mod&#232;le enregistr&#233; sur le serveur d'autorisation. Mais m&#234;me dans ce cas, si l'application malveillante se trouve sur le m&#234;me h&#244;te&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb1' class='spip_note' rel='appendix' title='ce qui est non seulement le cas courant mais aussi le cas ( worst case ) (...)' id='nh1'&gt;1&lt;/a&gt;]&lt;/span&gt;, la distinction est impossible. Si on a affaire &#224; une application de mobile, cela devient vraiment risqu&#233;.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Dans le cas d'une application de mobile, la demande de jeton au point d'entr&#233;e Token et la r&#233;ponse ne circulent pas dans une liaison de serveur ( celui de l'application ) &#224; serveur ( le serveur d'authentification ) dans laquelle les deux extr&#233;mit&#233;s sont identifi&#233;es, mais entre diff&#233;rents mobiles non identifi&#233;s et le serveur d'authentification. &lt;strong&gt;Ainsi dispara&#238;t une des qualit&#233;s reconnues du flux de code d'autorisation appliqu&#233; aux clients avec back-end&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Il existe bien des &lt;a href='https://oa.dnc.global/-Authentifier-l-application-.html#typologiedesapplicationsauregarddelasecuritedesdonnees' class='spip_in'&gt;m&#233;thodes compl&#233;mentaires&lt;/a&gt; permettant de lier les jetons &#224; l'user-agent ou bien &#224; l'identifiant de connexion TLS (TLS Token Binding). Cela permet de prouver que l'user-agent ( ex. le navigateur de l'utilisateur final ) est bien celui avec lequel l'authentification a &#233;t&#233; effectu&#233;e et le jeton cr&#233;&#233;. Mais cela ne permet pas de discriminer la bonne application d'un malware ex&#233;cut&#233; sur la m&#234;me liaison TLS. Dans le m&#234;me ordre d'id&#233;es, la technique de preuve de possession &lt;a href='https://oa.dnc.global/-Authentifier-l-application-.html#proofofpossessionpop' class='spip_in'&gt;Proof of Possession (PoP)&lt;/a&gt; semble conduire &#224; la m&#234;me conclusion.&lt;/p&gt;
&lt;p&gt;En particulier, la m&#233;thode &#034;&lt;a href='https://oa.dnc.global/-Authentifier-l-application-.html#cledeverificationpourlechangedecodepkce' class='spip_in'&gt;Proof Key for Code Exchange, PKCE&lt;/a&gt;&#034; , appliqu&#233;e aux applications sans back-end dans le cadre du flux Authorization Code, renforce la s&#233;curit&#233; en &#233;vitant le d&#233;tournement du code d'autorisation. Avec cette technique, le secret de l'application n'est pas utilis&#233;, ce qui permet de ne pas le divulguer. Cependant, cela interdit d'identifier l'application. PKCE permet de s'assurer que l'application qui pr&#233;sente le code d'autorisation est bien celle dans laquelle a &#233;t&#233; effectu&#233;e la proc&#233;dure d'identification de l'utilisateur final, quelle que soit cette application.&lt;/p&gt;
&lt;p class=&#034;important&#034;&gt;Dans le cas d'une SPA comme dans celui de toute application sans back-end&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb2' class='spip_note' rel='appendix' title='Tout comme dans le cas d'une application native de mobile et de toute (...)' id='nh2'&gt;2&lt;/a&gt;]&lt;/span&gt;, il n'est pas possible de s'assurer que l'application qui pr&#233;sente le jeton est bien l'application attendue, et pas un malware. &lt;br class='autobr' /&gt;
De fait, il revient &#224; l'utilisateur d'identifier l'application ! Cela va bien dans le premier paradigme (prot&#233;ger les donn&#233;es de l'utilisateur), mais pas dans le deuxi&#232;me (prot&#233;ger les donn&#233;es de l'entit&#233;).&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Encapsuler les donn&#233;es crypt&#233;es dans une classe Javascript ???&lt;/h3&gt;
&lt;p&gt;Avec les SPA, il n'est pas possible de stocker des informations d'identification selon les m&#233;thodes classiques, telles que les jetons d'acc&#232;s dans les cookies et le stockage de session. Au lieu de cela, on imagine de conserver les donn&#233;es sensibles dans des variables JavaScript.&lt;/p&gt;
&lt;p&gt;Certains recommandent alors d'utiliser une classe Javascript pour stocker et fournir ces variables. Cette m&#233;thode re&#231;oit le joli nom d'&#034;encapsulation&#034; qui donne un aspect s&#233;rieux et innovant &#224; une m&#233;thode pourtant bien banale.&lt;/p&gt;
&lt;p&gt;Cependant, il ne s'agit l&#224; que d'une m&#233;thode d'obfuscation dont l'efficacit&#233; est insuffisante face &#224; un attaquant d&#233;termin&#233;. Un simple debugger web (tous les navigateurs modernes en int&#232;grent un) permet d'ex&#233;cuter pas &#224; pas le code et de voir passer les variables.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Pourquoi les sp&#233;cifications confirment-elles une pratique douteuse ?&lt;/h3&gt;
&lt;p&gt;On peut lire dans le document &lt;a href=&#034;https://openid.net/specs/openid-heart-oauth2-1_0.html#rfc.section.2.1.3&#034; class='spip_out' rel='external'&gt;Health Relationship Trust Profile for OAuth 2.0&lt;/a&gt;&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb3' class='spip_note' rel='appendix' title='Qui peut traduire &#034;Health Relationship Trust Profile&#034; ? Google Translator (...)' id='nh3'&gt;3&lt;/a&gt;]&lt;/span&gt;&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;
2.1.3. Client int&#233;gr&#233; au navigateur avec d&#233;l&#233;gation d'utilisateur&lt;/p&gt;
&lt;p&gt;Ce type de client s'applique aux clients qui agissent pour le compte d'un propri&#233;taire de ressource particulier et n&#233;cessitent la d&#233;l&#233;gation des droits de cet utilisateur pour acc&#233;der &#224; la ressource prot&#233;g&#233;e. De plus, ces clients sont int&#233;gr&#233;s &#224; un navigateur Web et partagent efficacement une session active entre les syst&#232;mes.&lt;/p&gt;
&lt;p&gt;Ces clients utilisent le flux implicite de OAuth 2 en envoyant un propri&#233;taire de ressource au point terminal Authorize pour obtenir une autorisation. L'utilisateur DOIT s'authentifier aupr&#232;s du point terminal Authorize. Le navigateur Web de l'utilisateur est ensuite redirig&#233; vers un URI h&#233;berg&#233; par le client, &#224; partir duquel le client peut directement obtenir un jeton d'acc&#232;s. &#201;tant donn&#233; que &lt;strong&gt;le client lui-m&#234;me ne s'authentifie jamais aupr&#232;s du serveur et que le jeton est mis directement &#224; la disposition du navigateur&lt;/strong&gt;, ce flux ne convient que pour les clients incorpor&#233;s dans un navigateur Web, tel qu'un client JavaScript sans composant de serveur principal. Dans la mesure du possible, &lt;strong&gt;il est pr&#233;f&#233;rable d'utiliser le flux de code d'autorisation en raison de ses propri&#233;t&#233;s de s&#233;curit&#233; sup&#233;rieures&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Ce type de client NE DOIT PAS demander ou recevoir un jeton d'actualisation. Les jetons d'acc&#232;s &#233;mis &#224; ce type de client DOIVENT &#234;tre de courte dur&#233;e et DEVRAIENT &#234;tre rejet&#233;s &#224; l'expiration de la session authentifi&#233;e de l'utilisateur avec le client.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Il est donc bien reconnu qu'il y a un probl&#232;me que le flux de code d'autorisation ne r&#233;soudra pas. Ce flux est sans doute &#034;de s&#233;curit&#233; sup&#233;rieure&#034;, mais dans le cas des applications sans back-end il &#233;choue &#224; authentifier l'application, &#224; laquelle peut se substituer un malware situ&#233; sur l'agent utilisateur.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pourtant, la r&#233;daction du paragraphe donne &#224; penser que le flux de code d'autorisation fera mieux que le flux implicite. Et on &#233;vite de fa&#231;on simple l'exposition du secret de l'application, et pour cause : &#034;le client lui-m&#234;me ne s'authentifie jamais aupr&#232;s du serveur&#034;.&lt;/p&gt;
&lt;p&gt;Dans ce contexte, &#233;voquer la s&#233;curit&#233; offerte par le flux &#034;Authorization Code&#034; est une &lt;i&gt;mascarade : n.f. com&#233;die hypocrite, mise en sc&#232;ne trompeuse&lt;/i&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Un article pr&#233;sentant le contre et concluant sur le pour&lt;/h3&gt;
&lt;p&gt;Voici un article int&#233;ressant pour l'analyse qui est faite : &lt;a href=&#034;https://medium.com/@robert.broeckelmann/securely-using-the-oidc-authorization-code-flow-and-a-public-client-with-single-page-applications-55e0a648ab3a&#034; class='spip_out' rel='external'&gt;SECURELY USING THE OIDC AUTHORIZATION CODE FLOW AND A PUBLIC CLIENT WITH SINGLE PAGE APPLICATIONS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;L'auteur pr&#233;conise l'utilisation du flux d'autorisation avec code pour les SPA publiques, mais en fait une analyse d&#233;taill&#233;e qui met bien en &#233;vidence les multiples insuffisances de la configuration. Contrairement au titre &#034;Securely ...&#034; et &#224; la conclusion de l'article, voil&#224; encore une ambig&#252;it&#233;.&lt;/p&gt;
&lt;p&gt;En titrant sur les applications publiques, l'auteur &#233;vite au moins la divulgation du secret de l'application, puisqu'il n'y en a pas. Cela va faciliter le travail des applications malicieuses ! n'allons pas demander des donn&#233;es prot&#233;g&#233;es comme cela.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Incomp&#233;tence ou mensonge de marketing ?&lt;/h3&gt;
&lt;p&gt;Notre article a &#233;t&#233; motiv&#233; par la lecture de celui-ci : &lt;a href=&#034;https://www.ubisecure.com/single-sign-on/single-page-application-and-openid-connect/&#034; class='spip_url spip_out' rel='external'&gt;https://www.ubisecure.com/single-si...&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Le fil rouge de cet article est simple :&lt;/p&gt;
&lt;p&gt;1. Les progr&#232;s des navigateurs (CORS et cryptographie) permettent &#224; Javascript de mettre en &#339;uvre le flux authorization code.&lt;/p&gt;
&lt;p&gt;2. Donc, il ne faut plus mettre en &#339;uvre le flux implicite avec les SPA, mais le flux Authorization Code.&lt;br class='autobr' /&gt;
Sous entendu : puisque vous savez bien que le flux Authorization Code est celui qu'il faut employer avec OIDC, et qu'on vous avait bien dit que le flux implicite &#233;tait de s&#233;curit&#233; douteuse, vous comprenez que tout va bien maintenant.&lt;/p&gt;
&lt;p&gt;3. Bien s&#251;r, on doit stocker les jetons. Il faut les encapsuler dans une classe, comme cela ils seront bien cach&#233;s.&lt;/p&gt;
&lt;p&gt;Alors, incomp&#233;tence ou intox ? Ne s'agirait-il pas de faire croire &#224; un dispositif nouveau et cr&#233;diter ainsi l'existence d'un avantage comparatif sur la concurrence ?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pourquoi mentir ?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;OpenID Connect a une bonne image, cela se vend bien. Tant pis si les donn&#233;es ne sont s&#233;curis&#233;es que dans le cas des applications Web classiques. Vous voulez suivre la tendance des applications pour mobile ? Alors les marketeurs vous vendront OIDC sans vous avertir des limitations. &lt;br class='autobr' /&gt;
Mieux : ils mettront en avant les m&#233;thodes compl&#233;mentaires, telles que PKCE ou POP, en laissant croire qu'elles apportent la solution au probl&#232;me de l'authentification d'une l'application cliente sans back-end.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Qu'en est-il des serveurs headless ?&lt;/h3&gt;
&lt;p&gt;La configuration &#034;serveur headless&#034; est une architecture qui permet aux r&#233;dacteurs de produire et d'organiser du contenu, tout en fournissant aux d&#233;veloppeurs des donn&#233;es structur&#233;es qui peuvent &#234;tre affich&#233;es &#224; l'aide d'un syst&#232;me distinct sur le front-end d'un site Web ou d'une application.&lt;/p&gt;
&lt;p&gt;On aboutit souvent, c&#244;t&#233; front-end, &#224; une SPA.&lt;br class='autobr' /&gt;
Mais, puisque les donn&#233;es sont servies par une application avec back-end, il y a moyen de demander &#224; l'utilisateur final une authentification OIDC sur cette application, inscrite comme cliente du serveur OIDC. Si cela donne une garantie sur l'habilitation de l'utilisateur &#224; acc&#233;der aux donn&#233;es, cela ne permettra pas d'identifier la SPA et ce qu'elle fait des donn&#233;es.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Il n'y a donc aucun espoir de s&#233;curiser les SPA ?&lt;/h3&gt;
&lt;p&gt;Il y a une piste int&#233;ressante avec les applications install&#233;es sur mobile en mode Progressive Web App (PWA). Sous certaines conditions, le code et les donn&#233;es des PWA sont maintenus, c&#244;t&#233; mobile, identiques &#224; leur mod&#232;le c&#244;t&#233; serveur. Une telle architecture SPA - Serveur Headless (voyez &lt;a href=&#034;https://degoy.com/nos-techniques/spip-cms-headless-gatsby.html&#034; class='spip_out' rel='external'&gt;SPIP CMS headless + Gatsby&lt;/a&gt;) pourrait donc &#234;tre convenablement s&#233;curis&#233;e avec OIDC.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;i-Tego vous accompagne&lt;/h3&gt;
&lt;p&gt;i-Tego (h&#233;riti&#232;re de DnC) exerce un conseil et une assistance. Nous aidons nos clients &#224; mettre en &#339;uvre leur propre serveur OAuthSD. Nous accompagnons les Dev/Ops en leur transf&#233;rant notre comp&#233;tence, ce qui aboutit &#224; n'utiliser OIDC que dans des configurations s&#233;curis&#233;es. &lt;br class='autobr' /&gt;
Et nous reconnaissons &#224; sa juste valeur le travail des IT pour prot&#233;ger l'acc&#232;s au r&#233;seau, et cr&#233;er ainsi &#034;l'espace de confiance&#034; requis pour la bonne application d'OpenID Connect.&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;ce qui est non seulement le cas courant mais aussi le cas ( worst case ) que l'on doit prendre en compte pour une analyse de s&#233;curit&#233;&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;Tout comme dans le cas d'une application native de mobile et de toute application sans back-end. C'est le m&#234;me probl&#232;me, sauf peut-&#234;tre pour les applications de desktop dans un espace de confiance&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;Qui peut traduire &#034;Health Relationship Trust Profile&#034; ? Google Translator donne &#034;Profil de confiance des relations de sant&#233;&#034;. Ce titre incompr&#233;hensible aurait-il pour but de donner un aspect pseudo-scientifique &#224; un texte par ailleurs bien obscur ?&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>i-Tego vous offre plusieurs centaines de pages...</title>
		<link>https://oa.dnc.global/-Decouvrir-.html#itegovousoffreplusieurscentainesdepages</link>
		<guid isPermaLink="true">https://oa.dnc.global/-Decouvrir-.html#itegovousoffreplusieurscentainesdepages</guid>
		<dc:date>2021-08-04T15:35:17Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;En relation avec i-Tego, nous vous offrons plusieurs centaines de pages de documentation et de code sur l'authentification avec OpenID Connect et ses applications. &lt;br class='autobr' /&gt;
Vous &#234;tes ici au niveau le plus d&#233;taill&#233;. &lt;br class='autobr' /&gt;
Les documents sont distribu&#233;s sur trois niveaux : Le site i-Tego.com pr&#233;sente rapidement les concepts g&#233;n&#233;raux et fournit des entr&#233;es vers les points essentiels de la documentation. i-Tego SAS : la documentation offre un premier niveau de d&#233;tail d&#233;j&#224; tr&#232;s suffisant pour une bonne connaissance (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-Decouvrir-.html" rel="directory"&gt;D&#233;couvrir&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L150xH150/arton219-0f55e.jpg?1733820003' width='150' height='150' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;En relation avec i-Tego, nous vous offrons plusieurs centaines de pages de documentation et de code sur l'authentification avec OpenID Connect et ses applications.&lt;/p&gt;
&lt;p&gt;Vous &#234;tes ici au niveau le plus d&#233;taill&#233;.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;div style=&#034;clear:both&#034;&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
Les documents sont distribu&#233;s sur trois niveaux :&lt;br class='autobr' /&gt;
&lt;span class='spip_document_108 spip_documents spip_documents_center'&gt;
&lt;img src='https://oa.dnc.global/local/cache-vignettes/L500xH317/documentation_3_niveaux-a2bfe.png?1733820003' width='500' height='317' alt=&#034;le site https://i-tego.com offre plusieurs centaines de pages de documentation sur trois niveaux de d&#233;tail.&#034; title=&#034;le site https://i-tego.com offre plusieurs centaines de pages de documentation sur trois niveaux de d&#233;tail.&#034; /&gt;&lt;/span&gt;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Le site &lt;a href=&#034;https://i-tego.com?lang=fr&#034; class='spip_out' rel='external'&gt;i-Tego.com&lt;/a&gt; pr&#233;sente rapidement les concepts g&#233;n&#233;raux et fournit des entr&#233;es vers les points essentiels de la documentation.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;a href=&#034;https://doc.i-tego.com?lang=fr&#034; class='spip_out' rel='external'&gt;i-Tego SAS : la documentation&lt;/a&gt; offre un premier niveau de d&#233;tail d&#233;j&#224; tr&#232;s suffisant pour une bonne connaissance d'OpenID Connect et des opportunit&#233;s de travail avec l'&#233;quipe i-Tego. &lt;i&gt;De nombreux liens en font un guide pour aborder le niveau de d&#233;tail suivant.&lt;/i&gt;&lt;/p&gt;
&lt;center&gt;Peut-&#234;tre pourriez-vous &lt;a href=&#034;https://doc.i-tego.com/-Authentification-.html?lang=fr&#034; class='spip_out' rel='external'&gt;commencer ici&lt;/a&gt; ?&lt;/center&gt;
&lt;p&gt;. &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le pr&#233;sent site &lt;a href=&#034;https://oa.dnc.global/&#034;&gt;OpenID Connect OAuth Serveur D&#233;di&#233;&lt;/a&gt; s'adresse aux d&#233;veloppeurs. Avec quelques centaines de pages (dont du code), le site leur permettra d'acqu&#233;rir une connaissance approfondie d'OpenID Connect et du serveur OAuthSD d&#233;velopp&#233; par DnC.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;b&gt;En savoir plus sur l'accompagnement propos&#233; par &lt;a href=&#034;https://i-tego.com&#034; class='spip_out' rel='external'&gt;i-Tego&lt;/a&gt; : &lt;a href=&#034;https://doc.i-tego.com/-Authentification-.html&#034; class='spip_out' rel='external'&gt;authentification des utilisateurs et des applications avec OpenID Connect&lt;/a&gt;.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>SaaS et OIDC : un mariage r&#233;ussi gr&#226;ce &#224; OAuthSD !</title>
		<link>https://oa.dnc.global/-Decouvrir-.html#saasetoidcunmariagereussigraceaoauthsd</link>
		<guid isPermaLink="true">https://oa.dnc.global/-Decouvrir-.html#saasetoidcunmariagereussigraceaoauthsd</guid>
		<dc:date>2021-07-29T16:44:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Une des fonctionnalit&#233;s que DnC a d&#233;velopp&#233;es au plus haut niveau avec son serveur Open ID Connect (OIDC) consiste &#224; transmettre des informations s&#233;curis&#233;es au moyen du jeton d'identit&#233; JWT sign&#233; (JWS). &lt;br class='autobr' /&gt;
Nous d&#233;crivons dans cet article l'application i-Tego SaaS, un syst&#232;me de diffusion de logiciel en tant que service (Software as Service, SaaS). Dans cette application, OAuthSD fournit l'authentification OIDC et transmet de fa&#231;on s&#233;curis&#233;e aux applications SaaS les param&#232;tres relatifs aux abonnements des (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-Decouvrir-.html" rel="directory"&gt;D&#233;couvrir&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L120xH150/arton199-635d3.png?1733820003' width='120' height='150' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Une des fonctionnalit&#233;s que DnC a d&#233;velopp&#233;es au plus haut niveau avec son serveur Open ID Connect (OIDC) consiste &#224; transmettre des informations s&#233;curis&#233;es au moyen du jeton d'identit&#233; JWT sign&#233; (JWS).&lt;/p&gt;
&lt;p&gt;Nous d&#233;crivons dans cet article l'application &lt;a href=&#034;https://buyproto.dnc.global?lang=fr&#034; class='spip_out' rel='external'&gt;i-Tego SaaS&lt;/a&gt;, un syst&#232;me de diffusion de logiciel en tant que service (Software as Service, SaaS). Dans cette application, OAuthSD fournit l'authentification OIDC et transmet de fa&#231;on s&#233;curis&#233;e aux applications SaaS les param&#232;tres relatifs aux abonnements des souscripteurs.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;Position du probl&#232;me&lt;/h3&gt;
&lt;p&gt;La plupart des syst&#232;me SaaS int&#232;grent l'application et le syst&#232;me de vente dans un m&#234;me logiciel.&lt;/p&gt;
&lt;p&gt;Si diff&#233;rentes applications web doivent &#234;tre diffus&#233;es en mode SaaS par une m&#234;me entit&#233;, le premier probl&#232;me &#224; r&#233;soudre consiste &#224; &lt;strong&gt;assurer le service de connexion unique (SSO)&lt;/strong&gt; entre le syst&#232;me de vente et les diff&#233;rentes applications, sans oublier les sites support tels que la plateforme CRM et les sites de communaut&#233;. Pas de probl&#232;me, c'est le r&#244;le d'un serveur OIDC, OAuthSD fait cela tr&#232;s bien.&lt;/p&gt;
&lt;p&gt;Le deuxi&#232;me probl&#232;me, plus int&#233;ressant, consiste &#224; &lt;strong&gt;transmettre des informations du syst&#232;me de vente vers les applications&lt;/strong&gt;. &lt;br class='autobr' /&gt;
S'agissant de la validit&#233; de l'abonnement et des options (payantes), il faut s&#233;curiser ces donn&#233;es, c'est &#224; dire &lt;strong&gt;permettre &#224; l'application destinataire de contr&#244;ler :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'&lt;strong&gt;int&#233;grit&#233;&lt;/strong&gt; (les donn&#233;es n'ont pas &#233;t&#233; falsifi&#233;es), &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'&lt;strong&gt;authenticit&#233;&lt;/strong&gt; de leur origine (elles ont bien &#233;t&#233; d&#233;livr&#233;es par le syst&#232;me SaaS), &lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'&lt;strong&gt;actualit&#233;&lt;/strong&gt; (ce sont bien des donn&#233;es valides &#224; l'instant consid&#233;r&#233;),
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; la &lt;strong&gt;destination&lt;/strong&gt; (ce sont bien des donn&#233;es relatives &#224; cette application),
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; et bien s&#251;r l'&lt;strong&gt;identit&#233;&lt;/strong&gt; de l'utilisateur final (ce n'est pas un intrus qui utilise l'application).&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;La solution : OAuthSD&lt;/h3&gt;
&lt;p&gt;OAuthSD permet d'int&#233;grer les donn&#233;es SaaS sous forme de &lt;a href='https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#incorporeraujetonjwtdesdeclarationssupplementaires' class='spip_in'&gt;d&#233;clarations suppl&#233;mentaires dans la charge utile du jeton JWT&lt;/a&gt;. Il suffira &#224; l'application destinataire (cliente du serveur OIDC) de &lt;a href='https://oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectintrospectionintrospectionendpoint' class='spip_in'&gt;valider le jeton d'identit&#233; par introspection&lt;/a&gt; (et non localement afin d'assurer l'actualit&#233;) pour r&#233;aliser en une seule op&#233;ration les contr&#244;les d&#233;crits ci-dessus.&lt;/p&gt;
&lt;p&gt;Le syst&#232;me &lt;a href=&#034;https://buy.dnc.global?lang=fr&#034; class='spip_out' rel='external'&gt;i-Tego SaaS&lt;/a&gt; et l'une de ses applications &lt;a href=&#034;https://nss.dnc.global?lang=fr&#034; class='spip_out' rel='external'&gt;NSS Lite&lt;/a&gt; illustrent parfaitement cette technique.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pour r&#233;aliser cela, nous avons :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; int&#233;gr&#233; dans une m&#234;me application le serveur OIDC et le syst&#232;me de vente,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; d&#233;velopp&#233; des plugin d'extension OIDC-SaaS notamment pour des applications fond&#233;es sur SPIP ou Wordpress .&lt;/strong&gt;&lt;br class='autobr' /&gt;
&lt;span class='spip_document_109 spip_documents spip_documents_center'&gt;
&lt;img src='https://oa.dnc.global/local/cache-vignettes/L500xH354/saas-oidc_1-a0b9a.png?1733820003' width='500' height='354' alt=&#034;Echanges entre plateforme SaaS et le serveur d'authentification OAuthSD pour la s&#233;curit&#233; des applications. &#034; title=&#034;Echanges entre plateforme SaaS et le serveur d'authentification OAuthSD pour la s&#233;curit&#233; des applications. &#034; /&gt;&lt;/span&gt;&lt;br class='autobr' /&gt;
Le flux des &#233;changes est le suivant :&lt;br class='autobr' /&gt;
1 : l'utilisateur s'inscrit sur le syst&#232;me SaaS et souscrit un abonnement.&lt;br class='autobr' /&gt;
2 : Il se connecte depuis une application cliente du syst&#232;me SaaS. &lt;br class='autobr' /&gt;
3 : Le serveur d'authentification adresse &#224; l'application cliente un jeton JWT sign&#233; dont la charge utile a &#233;t&#233; compl&#233;t&#233;e avec :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; les donn&#233;es relatives &#224; l'abonnement, en particulier sa date de fin,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; les droits de l'utilisateur sur l'application,
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; les options souscrites.&lt;/p&gt;
&lt;p&gt;Rappelons que, selon le protocole OpenID Connect :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le jeton adresse &#233;galement les port&#233;es de l'autorisation (claims) donnant les droits de l'application sur les donn&#233;es de l'utilisateur.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le serveur d'authentification agit comme un service d'inscription et de connection unique (Single Sign On, SSO) . Ainsi, l'utilisateur connect&#233; &#224; une application cliente SaaS est &#233;galement connect&#233; aux autres applications pour lesquelles il a souscrit un abonnement&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Notre offre de services&lt;/h3&gt;
&lt;p&gt;Nous serions heureux de pouvoir assister les PME pour leur permettre de d&#233;velopper leur propre syst&#232;me de SaaS et d'adapter leurs applications web. &lt;br class='autobr' /&gt;
Notre positionnement de conseil et d'assistance permettrait un d&#233;veloppement ind&#233;pendant de prestataires ext&#233;rieurs co&#251;teux. Et de syst&#232;mes tiers hasardeux en termes de s&#233;curit&#233; : pourquoi nourrir le big-data au profit de vos concurrents ?&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>La fin des mots de passe : NoPassConnect</title>
		<link>https://oa.dnc.global/-Identifier-l-utilisateur-final-.html#lafindesmotsdepassenopassconnect</link>
		<guid isPermaLink="true">https://oa.dnc.global/-Identifier-l-utilisateur-final-.html#lafindesmotsdepassenopassconnect</guid>
		<dc:date>2021-05-25T14:43:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;i-Tego d&#233;veloppe NoPassConnect pour le serveur OAuthSD, une application de mobile permettant une identification tr&#232;s s&#233;curis&#233;e de l'utilisateur final sans mot de passe. Fond&#233;e sur les meilleures pratiques cryptographiques, cette m&#233;thode est ferm&#233;e &#224; une utilisation publique et se trouve donc particuli&#232;rement adapt&#233;e &#224; la s&#233;curisation des acc&#232;s aux donn&#233;es dans un domaine d'entreprise. &lt;br class='autobr' /&gt;
OAuthSD + NoPassConnect est une solution id&#233;ale pour s&#233;curiser les acc&#232;s aux applications des entreprises dans le cadre (...)&lt;/p&gt;


-
&lt;a href="https://oa.dnc.global/-Identifier-l-utilisateur-final-.html" rel="directory"&gt;Identifier l'utilisateur final&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://oa.dnc.global/local/cache-vignettes/L150xH111/arton194-ce8e6.jpg?1733820003' width='150' height='111' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;i-Tego&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb1' class='spip_note' rel='appendix' title='i-Tego est une nouvelle soci&#233;t&#233; cr&#233;&#233;e en juillet 2021 apr&#232;s la fermeture de DnC (...)' id='nh1'&gt;1&lt;/a&gt;]&lt;/span&gt; d&#233;veloppe NoPassConnect pour le serveur OAuthSD, une application de mobile permettant une identification tr&#232;s s&#233;curis&#233;e de l'utilisateur final sans mot de passe.&lt;/p&gt;
&lt;p&gt;Fond&#233;e sur les meilleures pratiques cryptographiques, cette m&#233;thode est ferm&#233;e &#224; une utilisation publique et se trouve donc particuli&#232;rement adapt&#233;e &#224; la &lt;a href=&#034;https://reseau-healthtech.fr/Un-rapport-deplore-le-niveau-de-la-securite-et-des-mots-de-passe-en-entreprise.html&#034; class='spip_out' rel='external'&gt;s&#233;curisation des acc&#232;s aux donn&#233;es dans un domaine d'entreprise&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;OAuthSD + NoPassConnect est une solution id&#233;ale pour s&#233;curiser les acc&#232;s aux applications des entreprises dans le cadre du t&#233;l&#233;travail.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;La vid&#233;o suivante montre comment ouvrir une session OpenID Connect en un clic et sans mot de passe :&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;center&gt;&lt;div class=&#034;playerVideo&#034;&gt; &lt;section&gt; &lt;figure&gt; &lt;video width=&#034;640&#034; height=&#034;420&#034; preload=&#034;metadata&#034; tabindex=&#034;-1&#034; controls autobuffer autoplay poster=&#034;IMG/plugins-dist/medias/prive/vignettes/m4v.png&#034;&gt; &lt;source src=&#034;IMG/m4v/smartconnect1.m4v?ctime=1689608165&#034; type='video/mp4' /&gt; &lt;/video&gt; &lt;/figure&gt; &lt;/section&gt; &lt;/div&gt; &lt;!-- Fermeture de ID : playerVideo --&gt;&lt;/center&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Pour fonctionner, NoPassConnect n&#233;cessite :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; l'application mobile NoPassConnect install&#233;e sur un smartphone. Celui-ci doit &#234;tre connect&#233; &#224; Internet ou connect&#233; au r&#233;seau WiFi de l'entreprise ce qui &lt;strong&gt; permet une utilisation sanctuaris&#233;e dans un espace restreint&lt;/strong&gt;.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; un serveur OAuthSD avec le module d'identification NoPassConnect.&lt;br class='autobr' /&gt;
Les applications compatibles OpenID Connect n'ont pas besoin d'&#234;tre modifi&#233;es.&lt;/p&gt;
&lt;p&gt;OAuthSD peut int&#233;grer NoPassConnect comme m&#233;thode d'identification primaire, qui remplacera avantageusement des syst&#232;mes fond&#233;s sur des lecteurs de carte par exemple.&lt;br class='autobr' /&gt;
NoPassConnect peut &#233;galement &#234;tre utilis&#233; comme &lt;a href='https://oa.dnc.global/-Identifier-l-utilisateur-final-.html#validationen2etapestwofactorauthentication2fa' class='spip_in'&gt;identification secondaire (Identification &#224; deux facteurs, TFA)&lt;/a&gt;.&lt;br class='autobr' /&gt;
&lt;span class='spip_document_100 spip_documents spip_documents_center'&gt;
&lt;img src='https://oa.dnc.global/local/cache-vignettes/L398xH497/smartconnect_login-f0cb6.png?1733820003' width='398' height='497' alt=&#034;Login SmartConnect - NopassConnect&#034; title=&#034;Login SmartConnect - NopassConnect&#034; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Les avantages de NoPassConnect :&lt;/h3&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;strong&gt;Productivit&#233;&lt;/strong&gt; : NoPassConnect permet une connexion ultra-rapide en mode SSO : il suffit de scanner un QR-Code pr&#233;sent&#233; &#224; l'&#233;cran par OAuthSD (une fois au d&#233;but d'une s&#233;ance de travail), le reste est automatique.&lt;br class='autobr' /&gt;
&lt;strong&gt;SmartConnect &#233;limine le besoin de mot de passe&lt;/strong&gt; et &#233;pargne le temps perdu &#224; r&#233;tablir les identifiants &#233;gar&#233;s.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;strong&gt;Economie&lt;/strong&gt; : NoPassConnect est install&#233; sur un mobile ordinaire&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb2' class='spip_note' rel='appendix' title='Actuellement sur syst&#232;me Android, IOS en cours de d&#233;veloppement.' id='nh2'&gt;2&lt;/a&gt;]&lt;/span&gt; sans n&#233;cessiter de mat&#233;riel suppl&#233;mentaire ni de protocoles d'installation complexes. Une entreprise peut envisager d'&#233;quiper un tr&#232;s grand nombre d'utilisateurs, y compris ext&#233;rieurs, pour une fraction du prix d'un syst&#232;me d'identification mat&#233;riel, avec un gain de temps pour l'administration et la maintenance. C'est &lt;strong&gt;l'id&#233;al pour le t&#233;l&#233;travail&lt;/strong&gt; !&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;strong&gt;Faible surface d'attaque&lt;/strong&gt; : les mots de passe sont le maillon faible de l'identification. NoPassConnect les remplace par des informations cryptographiques robustes, &#224; usage unique.&lt;br class='autobr' /&gt;
Les &#233;changes sont limit&#233;s &#224; une liaison crypt&#233;e mobile-serveur OAuthSD. &lt;br class='autobr' /&gt;
Il n'y a pas de logiciel &#224; installer sur les stations de travail ou sur les navigateurs (contrairement &#224; un lecteur d'ID card) ; ceux-ci n'interviennent pas dans le protocole d'identification de NoPassConnect, ni a fortiori leurs liaisons publiques, ce qui permet d'&#233;viter deux cibles d'attaques particuli&#232;rement vuln&#233;rables.&lt;/p&gt;
&lt;p&gt;De plus :&lt;br class='autobr' /&gt;
NoPassConnect est fond&#233; sur une communication par le r&#233;seau de donn&#233;es mobiles (et non l'Internet) entre un mobile connect&#233; et le serveur d'authentification (OP) auquel les applications ont d&#233;l&#233;gu&#233; l'identification des utilisateurs.&lt;/p&gt;
&lt;p&gt;NoPassConnect ne r&#233;pond jamais &#224; une demande et ne n&#233;cessite pas d'entr&#233;e au clavier (pas d'identifiant, de mot de passe ou de code) ce qui ferme la plupart des possibilit&#233; d'attaques et distingue la solution de ses concurrentes.&lt;/p&gt;
&lt;p&gt;Ces deux caract&#233;ristiques sont innovantes et constituent un apport original.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;strong&gt;S&#233;curit&#233;&lt;/strong&gt; : Mieux qu'un mot de passe qui peut &#234;tre compromis, un smartphone est un objet tr&#232;s personnel, mieux gard&#233; par son propri&#233;taire que tout autre objet. Sa perte ou son vol sont rapidement constat&#233;s (alors qu'il n'y a g&#233;n&#233;ralement pas moyen de savoir si un mot de passe a &#233;t&#233; compromis), ce qui permet &#224; un administrateur d'invalider rapidement son enregistrement sur le serveur OAuthSD.&lt;/p&gt;
&lt;p&gt;De plus, les smartphones sont &#233;quip&#233;s de syst&#232;mes de reconnaissance biom&#233;trique de plus en plus performants. L'identification au moyen du smartphone permet donc de pr&#233;juger valablement de l'identit&#233; de l'utilisateur final.&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;strong&gt;Segmentation g&#233;ographique&lt;/strong&gt; : Par d&#233;faut, l'usage de NoPassConnect peut se faire &#224; partir de n'importe quelle connexion de donn&#233;es, qu'il s'agisse du r&#233;seau d'un op&#233;rateur ou d'un r&#233;seau WiFi. L'usage de NoPassConnect peut-&#234;tre limit&#233; au r&#233;seau WiFi de l'entreprise, jusqu'&#224; s&#233;lectionner par leur IP locale les bornes autoris&#233;es. Il serait &#233;galement possible d'autoriser une connexion domestique donn&#233;e pour permettre le travail &#224; domicile. Il est &#233;galement possible, sur un r&#233;seau d'entreprise, de d&#233;finir les postes de travail capables ou non de se connecter avec NoPassConnect .&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; &lt;strong&gt;Authentification&lt;/strong&gt; : NoPassConnect impose l'identifiant OpenID de l'utilisateur, qui est int&#233;gr&#233; au moment de la &lt;strong&gt;configuration initiale du mobile sous le contr&#244;le d'un administrateur&lt;/strong&gt;. Au cours de cette op&#233;ration, le mobile doit scanner un QR-Code pr&#233;sent&#233; par l'administrateur, ce qui permet d'identifier l'utilisateur avec rigueur ( &#224; l'oppos&#233; de l'enregistrement &#224; distance tel que pratiqu&#233; par WebAuthn par exemple ).&lt;/p&gt;
&lt;p&gt;Les administrateurs peuvent affecter en temps r&#233;el les autorisations ou d&#233;nier les acc&#232;s. Plusieurs dispositifs permettent de d&#233;tecter et de bloquer automatiquement des usages d&#233;tourn&#233;s, comme par exemple l'utilisation d'une autre station de travail que celles qui auront &#233;t&#233; autoris&#233;es, etc.&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt; En r&#233;sum&#233;, les avantages d&#233;terminants pour la s&#233;curit&#233; des donn&#233;es d'une entreprise sont : l'utilisation de moyens priv&#233;s, l'identification de l'utilisateur assur&#233;e par un administrateur, la possibilit&#233; de limiter l'usage &#224; des lieux d&#233;termin&#233;s.&lt;/p&gt;
&lt;/blockquote&gt;&lt;h3 class=&#034;spip&#034;&gt;Entendu ...&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Bah, trop simple le QR-Code qui sert de mot de passe !&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pas du tout : le QR-Code n'est qu'un identifiant de session pour les &#233;changes qui vont suivre entre le serveur et le smartphone. Il est &#233;ph&#233;m&#232;re et ne peut donc &#234;tre r&#233;utilis&#233;. L'authentification r&#233;sulte d'un &#233;change de donn&#233;es faisant appel &#224; des techniques cryptographiques fortes. Le navigateur n'intervient pas dans les &#233;changes qui se font directement entre le smartphone et le serveur OAuthSD.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ah oui, c'est un Time-based One-time Password (TOTP) comme Google Authenticator !&lt;/strong&gt;&lt;br class='autobr' /&gt;
Eh bien non :&lt;/p&gt;
&lt;p&gt;NoPassConnect est un dispositif priv&#233;, ne faisant pas appel &#224; des syst&#232;mes tiers, pour une meilleure s&#233;curit&#233; et une parfaite confidentialit&#233;.&lt;/p&gt;
&lt;p&gt;NoPassConnect impose l'identit&#233; de l'utilisateur de l'entreprise, configur&#233;e par un administrateur. Un TOTP ne fait que v&#233;rifier que l'utilisateur est bien celui qui s'est inscrit lui-m&#234;me sur le syst&#232;me. En somme, un TOTP prot&#232;ge l'utilisateur tandis que NoPassConnect prot&#232;ge l'entreprise propri&#233;taire du serveur OAuthSD.&lt;/p&gt;
&lt;p&gt;OAuthSD propose le TOTP Google Authenticator pour l'authentification &#224; deux facteurs : jugez de la diff&#233;rence par vous m&#234;me.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ah oui, c'est comme la confirmation par SMS !&lt;/strong&gt;&lt;br class='autobr' /&gt;
Eh bien non :&lt;/p&gt;
&lt;p&gt;Le 2FA par SMS n'est pas s&#233;curis&#233;, alors que NoPassConnect &#233;change des donn&#233;es crypt&#233;es sur un canal s&#233;curis&#233; avec SSL/TLS.&lt;/p&gt;
&lt;p&gt;De plus le code re&#231;u par SMS doit &#234;tre retourn&#233; par le m&#234;me canal (le navigateur), ce qui ouvre la porte &#224; de nombreuses techniques d'interception telles que le l'ing&#233;nierie sociale, l'interception de trafic, le key-login ; avec NoPassConnect le navigateur n'intervient pas dans ces &#233;changes, l'identification se fait entre le smartphone et le serveur OAuthSD.&lt;/p&gt;
&lt;p&gt;Et si c'est l'utilisateur final lui-m&#234;me qui a fourni son num&#233;ro de portable au moment de son inscription, on n'a absolument aucune information sur son identit&#233; r&#233;elle ! NoPassConnect impose la configuration du smartphone sous le contr&#244;le d'un administrateur.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;J'ai trouv&#233; : c'est comme WebAuthn !&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;C'est assez proche en apparence, mais tr&#232;s diff&#233;rent : NoPassConnect concoure &#224; l'ouverture et &#224; la fermeture d'une session OpenID Connect &#224; partir d'une application qui lui est ext&#233;rieure, tandis que WebAuthn se limite &#224; l'identification directe de son porteur.&lt;/p&gt;
&lt;p&gt;C'est &#233;galement tr&#232;s diff&#233;rent en termes de s&#233;curit&#233; :&lt;/p&gt;
&lt;p&gt;WebAuthn pr&#233;sente un d&#233;savantage important pour la s&#233;curit&#233; d'une entreprise : comme la plupart des syst&#232;me de login, WebAuthn est un syst&#232;me public dans le sens o&#249; c'est l'utilisateur qui enregistre de fa&#231;on anonyme son mobile, rien ne permet de l'identifier. Permettre &#224; un utilisateur de s'enregistrer sans qu'il y ait une &#233;tape d'identification physique, c'est exactement comme lui permettre de fabriquer lui-m&#234;me sa carte d'identit&#233;, et encore : en rempla&#231;ant son nom par un pseudo.&lt;/p&gt;
&lt;p&gt;A l'inverse, l'enregistrement d'un mobile NoPassConnect est fait &#224; l'initiative et sous le contr&#244;le d'un administrateur de l'entreprise, en pr&#233;sentiel, ce qui permet d'enregistrer dans le serveur OpenID Connect l'identit&#233; r&#233;elle de l'utilisateur.&lt;/p&gt;
&lt;p&gt;Enfin, r&#233;p&#233;tons-le : avec NoPassConnect, le navigateur n'intervient pas dans le processus d'identification qui se fait directement entre le smartphone et le serveur OAuthSD.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ah oui, c'est un peu comme un lecteur d'ID card ...&lt;/strong&gt; &lt;br class='autobr' /&gt;
Presque ! En mieux :&lt;/p&gt;
&lt;p&gt;C'est plus &#233;conomique, plus facile &#224; d&#233;ployer, moins vuln&#233;rable.&lt;/p&gt;
&lt;p&gt;De plus, NoPassConnect n'&#233;tant pas li&#233; physiquement &#224; un poste de travail, il peut &#234;tre d&#233;ploy&#233; hors du p&#233;rim&#232;tre de l'entreprise. Cela n'interdit pas de limiter l'utilisation de NoPassConnect &#224; un ou plusieurs postes de travail, c'est l'un des avantages de scanner le QR-Code affich&#233; par le poste de travail !&lt;/p&gt;
&lt;p&gt;Enfin, si un utilisateur peut oublier sa carte dans le lecteur en quittant le bureau, il est probable qu'il n'oubliera pas de prendre son smartphone avec lui...&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;&lt;a href=&#034;https://i-tego.com&#034; class='spip_out' rel='external'&gt;i-Tego&lt;/a&gt; est une nouvelle soci&#233;t&#233; cr&#233;&#233;e en juillet 2021 apr&#232;s la fermeture de DnC en d&#233;cembre 2020. B.D. a commenc&#233; le d&#233;veloppement de SmartConnect dans l'intervalle en utilisant provisoirement ce site web en attendant qu'i-Tego poss&#232;de son propre site documentaire&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;Actuellement sur syst&#232;me Android, IOS en cours de d&#233;veloppement.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		&lt;div class='rss_ps'&gt;&lt;h3 class=&#034;spip&#034;&gt;[DR] Composants logiciels de OAuthSD / SmartConnect&lt;/h3&gt;
&lt;p&gt;&lt;span class='spip_document_102 spip_documents spip_documents_center'&gt;
&lt;img src='https://oa.dnc.global/IMG/png/smartconnect_composants_crobard.png' width=&#034;928&#034; height=&#034;619&#034; alt=&#034;Composants de SmartConnect&#034; title=&#034;Composants de SmartConnect&#034; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;SmartConnect est une &lt;strong&gt;application de mobile (4) &lt;/strong&gt; ( Android ou iOS) qui n&#233;cessite un &lt;strong&gt;serveur OAuthSD (1)&lt;/strong&gt;. Pour son fonctionnement, l'application SmartConnect est en relation avec un &lt;strong&gt;module d'authentification (2)&lt;/strong&gt; (Pluggable Authentication Module, PAM) int&#233;gr&#233; &#224; OAuthSD, mais n'est pas connect&#233; aux &lt;strong&gt;applications compatibles OpenID Connect (3)&lt;/strong&gt;. &lt;br class='autobr' /&gt;
SmartConnect se situe au sein des distributions OAuthSD comme repr&#233;sent&#233; dans le le tableau suivant :&lt;/p&gt;
&lt;p&gt;Dans ce tableau, les composants sur fond bleu-clair sont d&#233;velopp&#233;s par DnC :&lt;br class='autobr' /&gt;
&lt;span class='spip_document_101 spip_documents spip_documents_center'&gt;
&lt;img src='https://oa.dnc.global/IMG/png/smartconnect_composants.png' width=&#034;1075&#034; height=&#034;476&#034; alt=&#034;&#034; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;OAuthSD comprend trois groupes de composants :
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; le &lt;strong&gt;Superviseur&lt;/strong&gt;, est une application Web permettant aux administrateurs d'enregistrer les applications clientes d'OAuthSD, de contr&#244;ler l'inscription des utilisateurs et de leurs droits sur les applications et enfin de suivre le fonctionnement des authentifications. &lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; Le Daemon (le serveur OIDC &#224; proprement parler) qui est construit sur des modules interm&#233;diaires (&lt;strong&gt;middleware&lt;/strong&gt;) d&#233;velopp&#233;s par DnC fournissant la version haut-niveau des contr&#244;leurs Authorize, Token etc., et finalement sur des biblioth&#232;ques open-source pour le code de bas-niveau.
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; Des &lt;strong&gt;modules d'authentification&lt;/strong&gt; (Pluggable Authentification Modules (PAM)) int&#233;gr&#233;s &#224; OAuthSD assurant l'identification primaire et secondaire pour l'identification &#224; deux facteurs.&lt;/p&gt;
&lt;p&gt;Le &lt;strong&gt;module NoPassConnect&lt;/strong&gt; (ex IdentMaster, SmartConnect) assure la communication entre le mobile &#233;quip&#233; de l'application NoPassConnectet le serveur. Il comporte &#233;galement une application qui permet aux administrateurs de configurer l'instance NoPassConnectd'un mobile donn&#233; et de l'enregistrer sur le serveur.&lt;/p&gt;
&lt;p&gt;Pour pouvoir d&#233;l&#233;guer l'authentification au serveur OAuthSD, les applications doivent &#234;tre dot&#233;s d'un &lt;strong&gt;module OpenID Connect&lt;/strong&gt;. De plus en plus d'applications professionnelles int&#232;grent un tel module. Les applications qui ne sont pas directement compatibles offrent souvent un syst&#232;me de modules qui permet d'ajouter la fonctionnalit&#233; OIDC. Il en est ainsi de WordPress et de phpBB.&lt;/p&gt;
&lt;p&gt;Les applications d'Identit&#233; sont des logiciels d&#233;di&#233;s install&#233;s sur le mobile au-dessus du syst&#232;me d'exploitation Android, iOS, BlackBerry, etc. Ce sont donc des applications natives, &#224; l'inverse par exemple de l'authentification par SMS qui s'appuie sur une application existante ou d'autres proc&#233;d&#233;s s'appuyant sur le navigateur. L'&lt;strong&gt;application NoPassConnect&lt;/strong&gt; est une application native, d&#233;velopp&#233;e en Java, qui peut &#234;tre install&#233;e par l'utilisateur.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;[CONF] Particularit&#233;s du proc&#233;d&#233; en faveur de la s&#233;curit&#233;&lt;/h3&gt;
&lt;p&gt;[CONF] Compar&#233; au principe du TOTP ou de la v&#233;rification par SMS (un code d&#233;pendant de l'utilisateur et limit&#233; dans le temps), SmartConnect est beaucoup plus s&#233;curis&#233; : le QR-Code est &#224; usage unique, et la r&#233;ponse de l'application SmartConnect int&#232;gre l'identifiant OpenID de l'utilisateur et l'ID du mobile, mix&#233; avec un alea qui rend la r&#233;ponse unique, le tout transmis au moyen d'un jeton crypt&#233;.&lt;/p&gt;
&lt;p&gt;[CONF] Notons &#233;galement que, contrairement &#224; un syst&#232;me de confirmation TFA, l'utilisateur n'est pas interrog&#233; &#224; l'initiative d'un syst&#232;me dont il ignore le lien r&#233;el avec l'application l&#233;gitime (celle qu'il veut lancer), mais c'est lui qui prend l'initiative de poursuivre (en scannant le QR-Code) le dialogue d'authentification qu'il a initialis&#233; depuis l'application. L'utilisateur est actif au lieu d'&#234;tre passif. Le mobile ne traite pas de connexion entrante, mais utilise le canal de retour de la connexion qu'il a lui-m&#234;me &#233;tablie, le mettant ainsi &#224; l'abri d'attaques web.&lt;/p&gt;
&lt;p&gt;[CONF] Enfin, le terminal sur lequel s'affiche le QR-Code se trouve li&#233; dans le processus d'authentification, ce qui permet au serveur OAuthSD de s'assurer que l'utilisateur est bien devant le terminal. Ainsi, les authentifications ne peuvent &#234;tre initi&#233;es que depuis des terminaux r&#233;pertori&#233;s.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Exp&#233;rimental : t&#233;l&#233;chargez et installez l'application sur votre mobile Android&lt;/h3&gt;
&lt;p&gt;Sur votre mobile Android :&lt;/p&gt;
&lt;p&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; T&#233;l&#233;chargez l'APK : &lt;br class='autobr' /&gt;
&lt;a href=&#034;https://i-tego.com/store/app-release.apk&#034; class='spip_out' rel='external'&gt;i-tego.com/store/app-release.apk&lt;/a&gt;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; Activez les sources inconnues :&lt;br class='autobr' /&gt;
Allez dans les param&#232;tres, puis S&#233;curit&#233;
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; Recherchez l'APK sur votre t&#233;l&#233;phone (&#224; l'aide d'un explorateur de fichiers par exemple)
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; Lancez le fichier APK et suivez les instructions
&lt;br /&gt;&lt;img src='https://oa.dnc.global/squelettes-dist/puce.gif' width=&#034;8&#034; height=&#034;11&#034; class=&#034;puce&#034; alt=&#034;-&#034; /&gt; D&#233;sactivez les sources inconnues&lt;/p&gt;&lt;/div&gt;
		</content:encoded>


		
		<enclosure url="https://oa.dnc.global/IMG/m4v/smartconnect1.m4v" length="2578001" type="video/x-m4v" />
		

	</item>



</channel>

</rss>
