简体   繁体   中英

Spring Security 3 Web + Restful Login

I have a spring-mvc and spring-security + spring-security-social webapplication which I would like to provide restful login to allow a rest client to interact via this application. Let me explain a little bit more:

  • For the web application, everything is working fine. Login, roles, Facebook login, without any xml using Spring-Core version 4 and Spring-Security version 3.

Requirement

  • Provide a restful service in which will allow the user to sign in on the application and provide its user all the access like the web login.

I've been searching over the web, but I can only find old examples using older spring versions and with xml code.

REST is stateless. With that in mind, are you looking to still have authentication/authorization for the services in a RESTful fashion? To do this, you will have to authenticate the user on EVERY call. You can use Basic authentication to stick to strict REST principles or you can violate REST slightly by using OAuth yourself.

RESTful services are typically developed for other developers to incorporate in their code. They're not meant to be exposed directly to a user of a service.

If you need to provide client like functionality (login, allow user to access features/services, etc), then there is no need to develop a RESTful service. You can use Spring MVC in combination with Spring Security for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM