Work so far on OAuth2

- Implementation for a minimal server (used for testing purposes).
- Some refactoring of common classes and methods.