/*无需做链接,这是OpenID的回调地址*/
@At("/login/?/callback")
@Ok(">>:${obj.nickName == null ? '/me' : '/'}")
public User returnPoint(String providerId, HttpServletRequest request, HttpSession session) throws Exception {
SocialAuthManager manager = (SocialAuthManager) session.getAttribute("openid_manager");
if (manager == null)
throw new SocialAuthException("Not manager found!");
session.removeAttribute("openid_manager"); //防止重复登录的可能性
Map<String, String> paramsMap = SocialAuthUtil.getRequestParametersMap(request);
AuthProvider provider = manager.connect(paramsMap);
Profile p = provider.getUserProfile();
BasicDBObject query = new BasicDBObject().append("validatedId", p.getValidatedId()).append("provider", providerId);
User user = dao.findOne(User.class, query);
if (user == null) {
user = new User();