Fixes #815
* Add identity_policies to token lookup * add tests * naming change * add commenting in tests