I'm building a restful API using Spring 4.1.6 and spring-boot-starter-data-rest
.
To make the rest api fully functional I need the last piece of the puzzle: security. Now I noticed spring has it's own spring-security-*
packages that can aid with that task.
I tried using spring-security-config
and spring-security-web
and it works like a charm, with the exception that if the user is not authenticated, spring will redirect the user to login, thus giving a HTML login form.
Because it's a Restful API, I just need an error to be returned in a JSON object if the user lacks the credentials or does not have enough permissions to read a particular resource.
I'm sure I'm not the first to ask this question and searched all over the web for people asking the same thing, but couldn't quite find was I was looking for. So.. should I continue my research in this direction with spring-security, or should I find something?
Any advice is welcome, thank you