Securing RESTful Web Services

 Securing RESTful Web Services

As RESTful web services use the HTTP transport protocol for communication, they are equally vulnerable to security risks observed with web applications. Often, the development of RESTful web services is focused on the functional requirements, and the security requirements get overlooked. As a best practice, a RESTful web service must be designed considering the security requirements to ensure that it is made bulletproof from security threats or attacks.

In this chapter, you will learn the different ways of securing RESTful web services from a development standpoint, and you will learn the applicable best practices. The following topics are discussed in this chapter:

  • HTTP basic authentication
  • HTTP digest authentication
  • JWT authentication
  • Securing RESTful web services with OAuth
  • Authorizing the RESTful web service accesses
  • Input validation
  • Best practices for securing RESTful services

Securing and authenticating web services

Security on the internet takes many forms. In the context of RESTful web services and this book, we are only interested in two forms of security1.securing access to web services 
2. and accessing web services on behalf of the allowed users.

Security on the internet takes many forms. In the context of RESTful web services and this book, we are only interested in two forms of security—securing access to web services and accessing web services on behalf of the allowed users.

What we accomplish with securing web services is the calculated control of resources. Even though most web services are publicly available, we still need to control the data access and traffic throughput. We can do both by restricting the access through subscription accounts. For example, the API access can be limited based on the number of queries a registered user could execute daily. Similarly, many other API vendors restrict the access of their APIs.

Security has two essential elements:

    Authentication: This involves verifying the identity of the user who is tryingto access the application or web service. This is typically performed by obtaining the login credentials and validating them against the user details configured on the server.
  • AuthorizationThis involves verifying what an authenticated user is permitted to do in the application or service.

In this chapter, we will take a look at the various approaches for authenticating and authorizing RESTful web services. We will start with the simplest mechanism among all of them. 



Comments

Popular posts from this blog

Understanding the JAX-RS resource life cycle

Generating a chunked output using Jersey APIs