Well, a module called PAM (Pluggable Authentication module) can be customized to achieve your need. A beautiful article is available on linuxconfig describing this in detail.
The steps are:
Install PAM
$ sudo apt-get install pamusb-tools libpam-usb
Add USB device to PAM config
$ sudo pamusb-conf --add-device <my-usb-stick>
Select your volume and "Y" to save
Define user for PAM auth
$ sudo pamusb-conf --add-user <ubuntu-user>
Select and "Y" to save
Configure PAM
$ sudo gedit /etc/pam.d/common-auth
Add the line below and save
auth sufficient pam_usb.so
Test the PAM auth
$ su ubuntu-user
Lock when disconnected
$ sudo gedit /etc/pamusb.conf
Modify the block "user" block to look like:
<user id="ubuntu-user">
<device>
my-usb-stick
</device>
<agent event="lock">gnome-screensaver-command -l</agent>
<agent event="unlock">gnome-screensaver-command -d</agent>
</user>*
cuttlefish could be one solution to do it as @maythux suggested. I really can't comment on its capabilities, I prefer to stay away from 3rd party apps as much as possible.