Package org.brickred.socialauth

Examples of org.brickred.socialauth.SocialAuthManager


      for (Object name : req.getParameterMap().keySet()) {
        sb.append(name).append('=').append(URLEncoder.encode(req.getParameter(name.toString()), Encoding.UTF8)).append("&");
      }
      returnTo = sb.toString();
    }
    SocialAuthManager manager = new SocialAuthManager(); //每次都要新建哦
    manager.setSocialAuthConfig(config);
    String url = manager.getAuthenticationUrl(provider, returnTo);
    Mvcs.getResp().setHeader("Location", url);
    Mvcs.getResp().setStatus(302);
    session.setAttribute("openid_manager", manager);
  }
View Full Code Here


 
  /*无需做链接,这是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();
View Full Code Here

TOP

Related Classes of org.brickred.socialauth.SocialAuthManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.