Done on macOS 10.15.3
This outlines basic instructions on how to make it so that when you run a sudo command, it asks for the touchbar. The only annoying part of this is that it pops up a window instead of just staying in the terminal.
WARNING: If you fuck up this file, you probably won't be able to execute sudo.
So, these lines will need to be at the top of the /etc/pam.d/sudo
file.
Stock Terminal App:
auth sufficient pam_tid.so
If you plan on using iTerm2:
auth optional pam_reattach.so
Also, you'll need to install this pam: https://github.com/fabianishere/pam_reattach
If you don't want to use pam_reattach
then you can go to iTerm2 > Preferences > Advanced > Search(allow session) and turn it to "No" but that turns off the ability to allow sessions to survive relog.