Hands-On RESTful API Design Patterns and Best Practices
by Harihara Subramanian J, Anupama Murali, Pethuru Raj
Authorization
So far, we've built a sample application investor service with various incorporated patterns. Now, how do we ensure our REST API implementation is accessible only to genuine users and not to everyone? In our example, the investor's list should not be visible to all users, and the stocks URI should not be exposed to anyone other than the legitimate investor. Here comes the Authorization header to help us out. We'll use a scheme called basic authentication as it solves our current requirement. Please note that there are different schemes, such as basic authentication, hash-based message authentication (HMAC), JSON Web Token (JWT), and OAuth 2.0 bearer authentication token scheme, that are available to secure the REST APIs. However, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access