|
@@ -3,12 +3,16 @@ package com.fdkankan.ucenter.controller.inner;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.SecurityUtil;
|
|
|
+import com.fdkankan.sign.SignUtils;
|
|
|
import com.fdkankan.ucenter.annotation.CheckInnerApiPermit;
|
|
|
import com.fdkankan.ucenter.common.BaseController;
|
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
import com.fdkankan.ucenter.common.ResultData;
|
|
|
+import com.fdkankan.ucenter.common.constants.ResultCode;
|
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
+import com.fdkankan.ucenter.entity.AppSecret;
|
|
|
import com.fdkankan.ucenter.entity.User;
|
|
|
+import com.fdkankan.ucenter.service.IAppSecretService;
|
|
|
import com.fdkankan.ucenter.service.IInnerService;
|
|
|
import com.fdkankan.ucenter.service.IUserService;
|
|
|
import com.fdkankan.ucenter.service.impl.LoginService;
|
|
@@ -44,6 +48,8 @@ public class InnerController extends BaseController {
|
|
|
IUserService userService;
|
|
|
@Autowired
|
|
|
LoginService loginService;
|
|
|
+ @Autowired
|
|
|
+ IAppSecretService appSecretService;
|
|
|
|
|
|
/**
|
|
|
* 根据场景码获取token
|
|
@@ -137,4 +143,16 @@ public class InnerController extends BaseController {
|
|
|
}
|
|
|
return Result.success(innerService.getSceneBySnCode(param));
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping(value = "/pdsfsdfsrvateddsfeky/{appId}")
|
|
|
+ public Result getPrivateKey(@PathVariable String appId){
|
|
|
+ AppSecret appSecret = appSecretService.getByAppId("uenter");
|
|
|
+ if(appSecret == null){
|
|
|
+ throw new com.fdkankan.ucenter.exception.BusinessException(ResultCode.SIGN_ERROR);
|
|
|
+ }
|
|
|
+ if(!SignUtils.checkSign(getSign(),appId,appSecret.getPrivateKey())){
|
|
|
+ throw new com.fdkankan.ucenter.exception.BusinessException(ResultCode.SIGN_ERROR);
|
|
|
+ }
|
|
|
+ return Result.success(appSecretService.getByAppId(appId));
|
|
|
+ }
|
|
|
}
|