Hi everybody
I am currently trying to set up ZAP for a modern single page application utilizing 2FA within a rather complicated IAM architecture. For this reason I opted for authenticating through a browser using zest. I would like to be able to do so, from an automation plan.
From the documentation I gather, there are two different types of authentication:
- Browser Based Authentication and
- Client Based Authentication
The browser based authentication defines the login steps directly in the automation plan and the client based authentication defines the steps in a separate zest script. I went with the zest script, because zest allows me to take screenshots of individual steps to better understand what is going on and debug things.
My automation plan executes the Zest script in the context section:
```
env:
contexts:
- name: my context
...
authentication:
method: client
parameters:
script: /zap/wrk/my-zest-script.zst
...
```
Inside my Zest Script, the parameters-Section defines credentials and the TOTP secret as follows:
```
...
"parameters": {
"tokenStart": "{{",
"tokenEnd": "}}",
"tokens": {
"Username": "myusername",
"Password": "mypasswd",
"totp": "mytotpsecret"
...
```
The {{Username}} and {{Password}} values are expanded as expected into the respective input Tags later in my Zest Script.
However, I can't figure out, how to expand the calculated TOTP value (not the secret!) into the appropriate field, through any ZestElement in my script and can't find any hints in the documentation either.
Can you point me in the right direction?
Thanks and best
Mike