Esempio n. 1
0
  @RequestMapping(value = "/authorization")
  public String authorization(@RequestParam("code") String code, HttpSession session) {
    String url = "redirect:/";

    try {
      Token tokenInfo = oauthService.getToken(code);
      if (tokenInfo != null) {
        UserVO user = oauthService.getUserInfo(tokenInfo);
        session.setAttribute("userInfo", user);
      }
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
    return url;
  }
Esempio n. 2
0
  @RequestMapping(value = "/")
  public String index(
      HttpSession session,
      @RequestParam(required = false, defaultValue = "1", value = "currentPage") int currentPage) {
    String url = "redirect:" + oauthService.getUriPath().toString();

    try {
      if (session.getAttribute("userInfo") != null) {
        String absolutePath = environment.getRequiredProperty("absolute.path");
        session.setAttribute("path", absolutePath);
        session.setAttribute("list", dataService.getFileFolderList(absolutePath, currentPage));
        session.setAttribute("parentDirectory", "");
        url = "cloud";
      }
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
    return url;
  }