复制官方demo中pom中的jar资源位置
登录controller(登录时获取融云提供得token,通过用户账户当作融云获取token得ID)
融云用户关系需要自己实现
import java.util.*;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.fun.RongCloud;
import com.fun.api.service.MemInfoService;
import com.fun.models.response.TokenResult;
import com.fun.models.user.UserModel;
import com.fun.util.KeyUtil;
import org.apache.commons.lang3.Validate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.fun.api.domain.MemInfo;
import com.fun.api.service.LoginService;
import com.fun.framework.domain.AjaxReturn;
import com.fun.framework.utils.CollectionUtils;
import com.fun.framework.utils.Constants;
import com.fun.framework.utils.DigestUtils;
import com.fun.framework.utils.NumberUtils;
import com.fun.framework.utils.StringUtils;
import com.github.benmanes.caffeine.cache.Cache;
import com.fun.framework.web.controller.BaseController;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequestMapping("/api")
public class LoginController extends BaseController {
private @Autowired LoginService loginService;
private @Autowired MemInfoService memInfoService;
private final Cache<String, Integer> cache = Caffeine.newBuilder().expireAfterWrite(60, TimeUnit.SECONDS)
.initialCapacity(10000).maximumSize(100000).build();
@RequestMapping(path = { "/login" }, method = { RequestMethod.GET, RequestMethod.POST })
public AjaxReturn login(//
@RequestParam(value = "account") String account, //
@RequestParam(value = "password") String password, //
// @RequestParam(value = "v", required = false, defaultValue = ""