我已经实现了 spring 基本身份验证,但是有一些我不想通过身份验证的 url。例如,http://www.mywebsite.com/rest/signUp
如何使这个未经身份验证?
@Transactional
@RequestMapping(value = "/signUp", headers = "Accept=application/json", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
public @ResponseBody String signUp(@RequestParam("user_name") String login,
@RequestParam("pass_word") String passWord,
@RequestParam("first_name") String firstName,
@RequestParam("last_name") String lastName,
@RequestParam("network_name") String networkName,
@RequestParam("email") String email) {
if(!userDAO.loginExists(login)) {
User user = new User();
user.setLogin(login);
user.setFirstName(firstName);
user.setLastName(lastName);
user.setNetworkName(networkName);
user.setEmail(email);
user.setPassword(passWord);
sessionFactory.getCurrentSession().save(user);
return json("success");
}
return json("failure");
}