Web Programming

Todo REST Service (Authorization)

The objective of this exercise is to secure the REST interface of a todo service using authorization.

Tasks

  1. Modify the TodoServlet so that it checks whether the authenticated user is the owner of the accessed todo; if not, the error response 403 (Forbidden) is returned.
  2. Implement the MediaTypeFilter that immediately returns the error response 406 (Not Acceptable) or 415 (Unsupported Media Type), if the Accept or Content-Type header contains an invalid value.
  3. Study the OpenAPI specification and import as a collection into the Bruno utility and test the REST service manually.
  4. Add the dependencies junit-jupiter-engine and rest-assured to the Maven project, start the REST service and run the TodoRestServiceIT to test it automatically.
Solution