Java集成融云服务端

复制官方demo中pom中的jar资源位置登录controller(登录时获取融云提供得token,通过用户账户当作融云获取token得ID)融云用户关系需要自己实现import java.util.*;import java.util.concurrent.TimeUnit;import javax.servlet.http.HttpServletRequest;impo...
摘要由CSDN通过智能技术生成

复制官方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 = ""
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值