Add rest2F code activation in manager (#2762)

This commit is contained in:
Maxime Besson 2022-06-20 17:44:31 +02:00
parent 20d994ccac
commit 93cb4df897
17 changed files with 46 additions and 14 deletions

View File

@ -12,6 +12,9 @@ All parameters are set in "General Parameters » Portal Parameters »
Second Factors » REST 2nd Factor".
- **Activation**
- **Code regex**: regular expression to create an OTP code. If this option is
set, LemonLDAP::NG will generate the code and send it through the Init URL,
then verify it internally.
- **Init URL** *(optional)*: REST URL to initialize dialog *(send
OTP)*. Leave it blank if your API doesn't need any initialization
- **Init arguments**: list of arguments to send *(see below)*
@ -34,20 +37,31 @@ Arguments are a list of key/value. Key is the name of JSON entry, value
is attribute or macro name.
.. attention::
For Verify URL, you should send ``$code`` at least
REST Dialog
REST Dialog
-----------
REST web services have just to reply with a "result" key in a JSON file.
Auth/UserDB can add an "info" array. It will be stored in session data
(without reading "Exported variables").
If *Code regex* is set
~~~~~~~~~~~~~~~~~~~~~~
========== ================================================ ====================================
URL Query Response
========== ================================================ ====================================
Init URL JSON file: ``{"user":$user,...}`` JSON file: ``{"result":true/false}``
Verify URL JSON file: ``{"user":$user,"code":"$code",...}`` JSON file: ``{"result":true/false}``
Init URL JSON body: ``{"user":$user,"code":"$code",...}`` JSON body: ``{"result":true/false}``
========== ================================================ ====================================
The Verify URL is not called, since the code is checked against the internally saved value
If *Code regex* is not set
~~~~~~~~~~~~~~~~~~~~~~~~~~
========== ================================================ ====================================
URL Query Response
========== ================================================ ====================================
Init URL JSON body: ``{"user":$user,...}`` JSON body: ``{"result":true/false}``
Verify URL JSON body: ``{"user":$user,"code":"$code",...}`` JSON body: ``{"result":true/false}``
========== ================================================ ====================================

View File

@ -3195,6 +3195,9 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'rest2fAuthnLevel' => {
'type' => 'int'
},
'rest2fCodeActivation' => {
'type' => 'pcre'
},
'rest2fInitArgs' => {
'keyMsgFail' => '__badKeyName__',
'keyTest' => qr/^\w+$/,

View File

@ -2121,6 +2121,10 @@ sub attributes {
default => 0,
documentation => 'REST second factor activation',
},
rest2fCodeActivation => {
type => 'pcre',
documentation => 'OTP generated by Portal',
},
rest2fInitUrl => {
type => 'url',
documentation => 'REST 2F init URL',

View File

@ -994,11 +994,11 @@ sub tree {
help => 'rest2f.html',
form => 'simpleInputContainer',
nodes => [
'rest2fActivation', 'rest2fInitUrl',
'rest2fInitArgs', 'rest2fVerifyUrl',
'rest2fVerifyArgs', 'rest2fResendInterval',
'rest2fAuthnLevel', 'rest2fLabel',
'rest2fLogo'
'rest2fActivation', 'rest2fCodeActivation',
'rest2fInitUrl', 'rest2fInitArgs',
'rest2fVerifyUrl', 'rest2fVerifyArgs',
'rest2fResendInterval', 'rest2fAuthnLevel',
'rest2fLabel', 'rest2fLogo'
]
},
{

View File

@ -890,6 +890,7 @@
"requireToken":"يتطلب توكن للإستمارة",
"rest2f":"REST second factor",
"rest2fActivation":"تفعيل",
"rest2fCodeActivation":"Code regex",
"rest2fAuthnLevel":"مستوى إثبات الهوية",
"rest2fInitArgs":"Init arguments",
"rest2fInitUrl":"Init URL",

View File

@ -890,6 +890,7 @@
"requireToken":"Require token for forms",
"rest2f":"REST second factor",
"rest2fActivation":"Activation",
"rest2fCodeActivation":"Code regex",
"rest2fAuthnLevel":"Authentication level",
"rest2fInitArgs":"Init arguments",
"rest2fInitUrl":"Init URL",

View File

@ -890,6 +890,7 @@
"requireToken":"Require token for forms",
"rest2f":"Previo",
"rest2fActivation":"Activación",
"rest2fCodeActivation":"Expresión regular",
"rest2fAuthnLevel":"Nivel de autentificación",
"rest2fInitArgs":"Argumentos de inicio",
"rest2fInitUrl":"URL de inicio",

View File

@ -890,6 +890,7 @@
"requireToken":"Exiger un jeton pour les formulaires",
"rest2f":"Second facteur REST",
"rest2fActivation":"Activation",
"rest2fCodeActivation":"Expression régulière pour la génération du code",
"rest2fAuthnLevel":"Niveau d'authentification",
"rest2fInitArgs":"Arguments d'initialisation",
"rest2fInitUrl":"URL d'initialisation",

View File

@ -890,6 +890,7 @@
"requireToken":"דרישת אסימון לטפסים",
"rest2f":"אימות דו־שלבי ב־REST",
"rest2fActivation":"הפעלה",
"rest2fCodeActivation":"Code regex",
"rest2fAuthnLevel":"דרגת אימות",
"rest2fInitArgs":"Init arguments",
"rest2fInitUrl":"כתובת אתחול",

View File

@ -890,6 +890,7 @@
"requireToken":"Richiede il token per i moduli",
"rest2f":"REST secondo fattore",
"rest2fActivation":"Attivazione",
"rest2fCodeActivation":"Codice regex",
"rest2fAuthnLevel":"Livello di autenticazione",
"rest2fInitArgs":"Argomenti di init",
"rest2fInitUrl":"URL iniziale",

View File

@ -890,6 +890,7 @@
"requireToken":"Wymagaj tokena do formularzy",
"rest2f":"Drugi czynnik REST",
"rest2fActivation":"Aktywacja",
"rest2fCodeActivation":"Wyrażenie regularne kodu",
"rest2fAuthnLevel":"Poziom uwierzytelnienia",
"rest2fInitArgs":"Początkowe argumenty",
"rest2fInitUrl":"Początkowy adres URL",

View File

@ -890,6 +890,7 @@
"requireToken":"Formlar için jeton gerekir",
"rest2f":"REST ile ikinci faktör",
"rest2fActivation":"Aktivasyon",
"rest2fCodeActivation":"Düzenli ifade kodla",
"rest2fAuthnLevel":"Doğrulama seviyesi",
"rest2fInitArgs":"Başlangıç argümanları",
"rest2fInitUrl":"Başlangıç URL",

View File

@ -890,6 +890,7 @@
"requireToken":"Yêu cầu token cho các biểu mẫu",
"rest2f":"REST second factor",
"rest2fActivation":"Kích hoạt",
"rest2fCodeActivation":"Code regex",
"rest2fAuthnLevel":"Mức xác thực",
"rest2fInitArgs":"Init arguments",
"rest2fInitUrl":"Init URL",

View File

@ -890,6 +890,7 @@
"requireToken":"需要表單權杖",
"rest2f":"REST 第二因素",
"rest2fActivation":"激活",
"rest2fCodeActivation":"代碼正規表示式",
"rest2fAuthnLevel":"认证等级",
"rest2fInitArgs":"初始化參數",
"rest2fInitUrl":"初始化 URL",

View File

@ -890,6 +890,7 @@
"requireToken":"需要表單權杖",
"rest2f":"REST 第二因素",
"rest2fActivation":"啟用",
"rest2fCodeActivation":"代碼正規表示式",
"rest2fAuthnLevel":"驗證等級",
"rest2fInitArgs":"初始化參數",
"rest2fInitUrl":"初始化 URL",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long