Authenticating over a BASIC scheme

Authenticating through a BASIC scheme is a popular solution for stateless applications like ours. Credentials are sent over with HTTP requests.

Getting ready

In this recipe, we complete the Spring Security configuration. We make it support the BASIC authentication scheme required for the application.

We slightly customize the generated response-headers, so they don't trigger the browser to show-up a native BASIC authentication form (which is not an optimal experience for our users).

How to do it...

  1. In order to use the Spring security namespace, we add the following filter to the cloudstreetmarket-api web.xml:
    <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class> org.sfw.web.filter.DelegatingFilterProxy ...

Get Spring MVC: Designing Real-World Web Applications now with O’Reilly online learning.

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