..
This idea is based on this youtube video by: MrCubey.. for a working key card secure door.
The command creates a villager who will give you a key card to the secure entrance, if you give him your VIP ticket.
Both the tickets, and the key cards, must be IDENTICAL originals as the video explains. That means.. you must generate both the ticket and the key card with your own custom attributes before you even start to make the door. The key card you make to open the door and which you will use to pre-fill the hopper with, must have the EXACT same properties as the key card the villager sells you. The the VIP Ticket you give him, must have the identical properties of what he accepts. I would suggest using a command block to create them so you know they will always be the same, or a separate "ticket sales" villager, to sell you a VIP Ticket. Maybe I'll add that one later.
Btw~ you can change the villager skin (head).. to the skin of ANY player, by changing.. SkullOwner:"SECURITY" .. to.. SkullOwner:"Name_of_the_player"