|
|
@@ -34,15 +34,46 @@ public class StepWorkController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value="/blade-auth/oauth/token", method = RequestMethod.POST)
|
|
|
- public StepWorkApiResult<Map<String,Object>> getToken(HttpServletRequest request,String username,String password){
|
|
|
+ public Map<String,Object> getToken(HttpServletRequest request,String username,String password){
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
if(!StringUtil.hasText(username) || !StringUtil.hasText(password) ){
|
|
|
- return StepWorkApiResponse.failRsp(400,"用户名和密码必填!");
|
|
|
+ map.put("error","用户名和密码必填");
|
|
|
+ map.put("error_description","用户名和密码必填");
|
|
|
+ return map;
|
|
|
}
|
|
|
- map.put("accessToken",stepWorkService.login(username, password));
|
|
|
- map.put("tokenType","bearer");
|
|
|
- //refresh_token
|
|
|
- return StepWorkApiResponse.successRsp(map);
|
|
|
+ Map<String,Object> map2 = stepWorkService.login(username, password);
|
|
|
+ if(map2.get("success").equals("1")){
|
|
|
+ map.put("access_token",map2.get("token"));
|
|
|
+ map.put("token_type","bearer");
|
|
|
+ map.put("refresh_token","");
|
|
|
+ map.put("expires_in","");
|
|
|
+ map.put("scope","all");
|
|
|
+ map.put("tenant_id","");
|
|
|
+ map.put("login_type","");
|
|
|
+ map.put("user_name",username);
|
|
|
+ map.put("real_name",username);
|
|
|
+ map.put("avatar","");
|
|
|
+ map.put("client_id","");
|
|
|
+ map.put("role_name","");
|
|
|
+ map.put("license","");
|
|
|
+ map.put("post_id","");
|
|
|
+ map.put("user_id","");
|
|
|
+ map.put("role_id","");
|
|
|
+ map.put("nick_name",username);
|
|
|
+ map.put("oauth_id","");
|
|
|
+ Map<String,Object> map1 = new HashMap<>();
|
|
|
+ map1.put("type","web");
|
|
|
+ map.put("detail",map1);
|
|
|
+ map.put("dept_id","");
|
|
|
+ map.put("account",username);
|
|
|
+ map.put("jti",username);
|
|
|
+ //refresh_token
|
|
|
+ return map;
|
|
|
+ }else{
|
|
|
+ map2.remove("success");
|
|
|
+ return map2;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|