PEP-8 fix, moved authentication logic to dirg-util, bug fix for rp1 and rp2.

Moved the logic for authentication methods to dirg-util.
Bugfixes for end_session and fixed PEP8 for rp1 and rp2.