This project provides support for using Spring Security with Basic Auth in a Spring boot Jersey application using PostgreSQL database.
Download or clone from GIT and then use Maven (3.*) and Java (1.7 or better).
The basic access authentication is a method designed to allow a web browser, or other client program, to provide credentials in the form of a user name and password when making a request.
Before transmission, the user name is appended with a colon and concatenated with the password. The resulting string is encoded with the Base64 algorithm.
One thing I would like to mention regarding Basic Auth is,
Security is not the intent of the encoding step in Basic Auth. Rather, the intent of the encoding is to encode non-HTTP-compatible characters that may be in the user name or password into those that are HTTP-compatible.
The Basic Auth mechanism provides no confidentiality protection for the transmitted credentials. They are merely encoded with Base64 in transit, but not encrypted or hashed in any way. HTTPS is, therefore, typically preferred to use in conjunction with Basic Authentication.
SpringBoot , makes it easy to create stand-alone, production-grade Spring based Applications.
Jersey, one of the leading frameworks to develop RESTful Web services.
PostgreSQL, popular opensource DB.
The DB Script is provided in the resources package.
Get Postman Tool
Secured URI : http://localhost:8080/products/secure
In Authorization Tab ,choose Type = Basic Auth , fill the username and password and Click Update Request.
Postman will update the header with Authorization key and value. Now fire the request.
Open/Public URI : http://localhost:8080/products