Extensions/Users pin verification

Does anyone know how I could link a user to a pin? I want to be able to have a user “John Doe” assigned a pin number “123456”. With that pin he would go off hook from any extension try to make a call then he would be prompted for his pin for verification.

Off hook---->input btn---->(prompt)Please enter pin----->(if failed)hang-up---->(if true)send call out.

Thanks!