How to implement temporary user access?

How do I manage temporary user access, like for contractors, and ensure their permissions are automatically revoked after a certain period?