Java Spring OAuth2 and Basic Auth Support

The goal of the post is to share an idea of how can we provide the basic authentication and OAuth 2 authentication for the APIs.