View Javadoc

1   package org.springframework.security.oauth.examples.sparklr.mvc;
2   
3   import java.security.Principal;
4   
5   import org.springframework.security.oauth.examples.sparklr.PhotoServiceUser;
6   import org.springframework.stereotype.Controller;
7   import org.springframework.web.bind.annotation.RequestMapping;
8   import org.springframework.web.bind.annotation.ResponseBody;
9   
10  /**
11   * @author Michael Lavelle
12   * 
13   * Added to provide an endpoint from which Spring Social can obtain authentication details
14   */
15  @RequestMapping("/me")
16  @Controller
17  public class PhotoServiceUserController {
18  	
19  	@ResponseBody
20  	@RequestMapping("")
21  	public PhotoServiceUser getPhotoServiceUser(Principal principal)
22  	{
23  		return new PhotoServiceUser(principal.getName(),principal.getName());
24  	}
25  }