Add Credentials and Token generation/verfication
Session context maanager utils.

Functionality copied from old models code to avoid issues when working with
sessions.