@Secured({"ROLE_ADMIN", "ROLE_USER"})
 @RequestMapping(value = "/api/profile", method = RequestMethod.GET, produces = "application/json")
 public User getProfile() {
   Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
   String email = authentication.getName();
   User user = userBean.findByEmail(email);
   return user;
 }
 @Secured({"ROLE_ADMIN", "ROLE_USER"})
 @RequestMapping(value = "/api/profile/picture/update", method = RequestMethod.POST)
 public void updateProfilePicture(@RequestBody final Picture picture) {
   Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
   String email = authentication.getName();
   pictureBean.create(picture);
   User user = userBean.findByEmail(email);
   user.setPicture(picture);
   userBean.update(user);
 }
 /*
  * It works fine, you need just authorization from Gmail
  */
 @RequestMapping(value = "/forgotpassword", method = RequestMethod.POST, produces = "text/plain")
 public ResponseEntity<String> forgotPassword(@RequestBody String email) {
   System.out.println("Email:" + email);
   User user = userBean.findByEmail(email);
   if (user != null) {
     // emailService.send(email, "*****@*****.**", "Property for Sales Password",
     // "Your password is :"+user.getPassword());
     return new ResponseEntity("Password sent to email", HttpStatus.ACCEPTED);
   } else
     return new ResponseEntity("Email doesnt match to any existing user", HttpStatus.BAD_REQUEST);
 }
 @RequestMapping(value = "/isconnected", method = RequestMethod.GET, produces = "application/json")
 public ResponseEntity<Role> isConnected() {
   Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
   String email = authentication.getName();
   User user = userBean.findByEmail(email);
   Role role = new Role();
   role.setName(authentication.getAuthorities().iterator().next().toString());
   System.out.println("now is connected: " + user + " " + email + " " + role);
   if (user == null) return new ResponseEntity(role, HttpStatus.FORBIDDEN);
   return new ResponseEntity(role, HttpStatus.ACCEPTED);
 }