update 优化 统一登录接口令牌key
parent
89d3c962d9
commit
e380bc250e
|
|
@ -1,10 +1,10 @@
|
|||
package com.ruoyi.auth.controller;
|
||||
|
||||
import com.alibaba.nacos.api.common.Constants;
|
||||
import com.ruoyi.auth.form.LoginBody;
|
||||
import com.ruoyi.auth.form.RegisterBody;
|
||||
import com.ruoyi.auth.form.SmsLoginBody;
|
||||
import com.ruoyi.auth.service.SysLoginService;
|
||||
import com.ruoyi.common.core.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -38,8 +38,8 @@ public class TokenController {
|
|||
String accessToken = sysLoginService.login(form.getUsername(), form.getPassword());
|
||||
|
||||
// 接口返回信息
|
||||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||
rspMap.put("access_token", accessToken);
|
||||
Map<String, Object> rspMap = new HashMap<>();
|
||||
rspMap.put(Constants.ACCESS_TOKEN, accessToken);
|
||||
return R.ok(rspMap);
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ public class TokenController {
|
|||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = sysLoginService.smsLogin(smsLoginBody.getPhonenumber(), smsLoginBody.getSmsCode());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
ajax.put(Constants.ACCESS_TOKEN, token);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ public class TokenController {
|
|||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = sysLoginService.xcxLogin(xcxCode);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
ajax.put(Constants.ACCESS_TOKEN, token);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,4 +81,6 @@ public interface Constants {
|
|||
*/
|
||||
String REPEAT_SUBMIT_KEY = "repeat_submit:";
|
||||
|
||||
String ACCESS_TOKEN = "access_token";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
package com.ruoyi.common.core.constant;
|
||||
|
||||
/**
|
||||
* 权限相关通用常量
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface SecurityConstants {
|
||||
/**
|
||||
* 用户ID字段
|
||||
*/
|
||||
String DETAILS_USER_ID = "user_id";
|
||||
|
||||
/**
|
||||
* 用户名字段
|
||||
*/
|
||||
String DETAILS_USERNAME = "username";
|
||||
|
||||
/**
|
||||
* 授权信息字段
|
||||
*/
|
||||
String AUTHORIZATION_HEADER = "authorization";
|
||||
|
||||
/**
|
||||
* 请求来源
|
||||
*/
|
||||
String FROM_SOURCE = "from-source";
|
||||
|
||||
/**
|
||||
* 内部请求
|
||||
*/
|
||||
String INNER = "inner";
|
||||
|
||||
/**
|
||||
* 用户标识
|
||||
*/
|
||||
String USER_KEY = "user_key";
|
||||
|
||||
/**
|
||||
* 登录用户
|
||||
*/
|
||||
String LOGIN_USER = "login_user";
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.ruoyi.common.core.constant;
|
||||
|
||||
/**
|
||||
* 服务名称
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface ServiceNameConstants {
|
||||
|
||||
String AUTH_SERVICE = "ruoyi-auth";
|
||||
String SYSTEM_SERVICE = "ruoyi-system";
|
||||
String FILE_SERVICE = "ruoyi-file";
|
||||
}
|
||||
Loading…
Reference in New Issue