wjdp / htmltest

:white_check_mark: Test generated HTML for problems
MIT License
323 stars 54 forks source link

Support authenticating to targeted URLs #206

Open ITler opened 1 year ago

ITler commented 1 year ago

Is your feature request related to a problem? Please describe. I would want to check pages that can only respond with a 200 after authentication. It would need to be ensured that tokens are sent only to the sites they belong to. Also, credentials shouldn't be stored as plain text in a configuration file.

Describe the solution you'd like I would like to see the possibility to provide a configuration like that:

auth:
  - site: <some site URL pattern>
    authType: basic
    userByEnvvar: <some envvar holding a user name>
    tokenByEnvvar: <some envvar holding a token>
  - site: <some other site URL pattern>
    authType: oauth2
    userByShellCommand: /path/to/my/script/retrieve-user.sh
    tokenByShellCommand: /path/to/my/script/retrieve-token.sh

Describe alternatives you've considered There could be dozens of secret sources or auth types, but starting with reading credentials via envvars and allow basic and oauth2 authentication should provide a valuable first iteration.

Maybe in addition something like this might be suitable:

echo "github.com:oauth2:username:token;mysite.com:basic:username:password" | htmltest --auth - 

Additional context Add any other context or screenshots about the feature request here.