This will automatically lock the screen after a set amount of time. After either the computer's screen sleeps and turns black, a screensaver becomes active, or a laptop is closed. The currently active account will remain active in the background. The screen will show the currently logged in user with the following options:
Password Field - Allowing the currently active user to unlock the screen and continue working Cancel - Returning to a black screen (Sleep) or the screensaver Switch User - Allowing another user to log in, while leaving the previous user to stay active in the background
There are the settings that would need to be enabled to allow this experience. Otherwise, the client would only have the options of entering the current user's password or to cancel.
Security & Privacy
Open System Preferences via the Apple Menu in the upper-left-hand corner. Select the Security & Privacy preference pane. The General tab shows the "Require password…" option where you would select the amount time after putting the computer to sleep, a screen saver activating, or a laptop closing that the computer would lock. For example, in the screenshot below, this computer could have a screensaver activated and then move the mouse after 4 minutes and the computer would display the desktop. After 5 minutes, a password field would be presented and the computer would be locked.
Users & Groups
Select Login Options.
Users & Groups
The feature is called Fast User Switching. Check the box.
Desktop & Screen Saver
Change when a screensaver becomes active.
Change when the computer would go to sleep (screen goes black).
Lock Screen from the Apple menu.
Most users have the screensaver turn on after 5-10 minutes, then the computer goes to sleep in 10-15 minutes. If the user wants, they can always lock the screen immediately by selecting Lock Screen from the Apple menu.