Java 接入自己的用户体系

im 服务端接入

  • 实现AuthAecSupport 接口

实现AuthAecSupport例子

@Service
public class AuthAecSupportImpl implements AuthAecSupport{

	@Autowired
	private AuthService mAuthService;

	@Override
	public boolean verifyAccessToken(String accessToken) {
		// TODO Auto-generated method stub
		return mAuthService.verifyAccessToken(accessToken);
	}

	@Override
	public String getAccountByAccessToken(String accessToken) {
		// TODO Auto-generated method stub
		return mAuthService.getAccountByAccessToken(accessToken);
	}

}
  • 实现 UserAecSupport 接口

示例

@Service
public class UserAecSupportImpl implements UserAecSupport{

	@Autowired
	private UserService mUserService;

	@Override
	public MyUserInfo findUserInfo(String username) {
		UserInfo userInfo = mUserService.findByUsername(username);
		if(userInfo != null)
		{
			MyUserInfo myUserInfo = new MyUserInfo(userInfo.getName(), userInfo.getNickname(), userInfo.getAvatar());
			myUserInfo.setEnableStatus(userInfo.isEnableStatus());
			//
			myUserInfo.setShowAvatar(UserInfo.getAbsoluteAvatar(myUserInfo.getAvatar()));
			return myUserInfo;

		}
		return null;
	}

	@Override
	public String handleAvatar(String avatar) {
		return UserInfo.getAbsoluteAvatar(avatar);
	}
}

im 客户端接入

客户端接入就是要修改客户 UserApi 相关接口! 请对着用户相关Api进行相应的修改!