Too Long; Didn't Read
This article guides you through the creation of a simple library which allows you to grant your HTTP requests with the required authorization token. The authorization flow is described in the image above: authorization request is sent from client to OAuth server. Access token is then sent to API service (acting as resource server) on each request for a protected resource access. This way we would have a maintainable integration, isolated from the REST client we are using. We will need a few libraries to build our custom OAuth2 client, such as Apache and cxf-rt-rs-security-oauth2.