Utilizzo dell'API REST di ProvacyIDEA per autenticare utenti

From RVM Wiki
Revision as of 17:13, 4 February 2016 by Gabriele.vivinetto (talk | contribs) (Created page with "Il webserver di PrivacyIDEA espone un'api REST, interrogabile in HTTPS. =Test di un token specificando seriale e codice= Se si vuole testare un codice di token generico, sen...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Il webserver di PrivacyIDEA espone un'api REST, interrogabile in HTTPS.

Test di un token specificando seriale e codice

Se si vuole testare un codice di token generico, senza specificare l'utente che lo ha in gestione, utilizzare l'endpoint

/validate/check
  • Ad esempio, se si vuole validare il token con
seriale TOTP00003C77
pin MYPIN
codice 766791
  • Fare la get:

https://myserver.example.priv/validate/check?serial=TOTP00003C77&pass=MYPIN766791

  • Se tutto è corretto, si otterà una risposta JSON:
{"jsonrpc": "2.0", "signature": "12124818985355158246171511092669478424773999769106176361239650736102804198334152848918655224301630692386297031379981997801793455904676133797122078988625361921117819709588529325785682493622568530131233684358245095429248914603455581540075054207285344056258565243884175124905561374371271916040776109255278378369776916891342267849409344754712580711404970895439035533151604309213191008019548127528677003512401053920433154334186671010903465114883394274418640102813335012674763373384768049453985427836681332433273710803203650837145013891569481639714766561055619613347313054293823953405070228898159038970630043069074483575188", "detail": {"message": "matching 1 tokens", "type": "totp", "serial": "TOTP00003C77"}, "versionnumber": "2.9", "version": "privacyIDEA 2.9", "result": {"status": true, "value": true}, "time": 1454604427.09242, "id": 1}
  • Il campo che può essere utilizzato per la validazione è
{"message": "matching 1 tokens", "type": "totp", "serial": "TOTP00003C77"}
{"status": true, "value": true}
  • In caso di seriale inesistente:
{"message": "The token with this serial does not exist"}
{"status": true, "value": false}
  • In caso di pin errato:
{"message": "wrong otp pin"}
{"status": true, "value": false}
  • In caso di codice errato:
{"message": "wrong otp value", "type": "totp", "serial": "TOTP00003C77"}
{"status": true, "value": false}
  • La stessa cosa può essere fatta con una POST

Validazione di un codice otp specificando lo username

  • La stesa cosa può essere fatta specificando solo lo username invece del seriale del token: verranno ricercati tutti i token assegnati all'utente, e le risposte saranno le stesse

https://myserver.example.priv/validate/check?user=MYUSER&pass=MYPIN766791


Riferimenti