OAuth token via Basic Auth

Now, let's explore and implement a short example of using tokens. In order to build this example, we will create a class. This class, as in the previous example, will simulate a database client. It will have the same method, getCompactDiscs(), but we will modify the internal function in this example. Also, it won't receive any parameter this time.

Alright, let's do it! First, create two static string fields in the class. The first field will hold the URL for authentication in the auth-server. The other field will have the URL showing the compact discs list; you can reuse the same web page from the previous example. Then, you should have your variables as shown:

private static String urlAuth = "https://localhost:8443/auth-server ...

Get RESTful Java Web Services Security now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.