|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.logpm.factorydata.suofeiya.config; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
@ -25,6 +26,7 @@ import java.io.ObjectInputStream;
|
|
|
|
|
import java.io.ObjectStreamClass; |
|
|
|
|
import java.io.Serializable; |
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -64,7 +66,16 @@ public class CustomMessageConverter extends AllowedListDeserializingMessageConve
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Map<String, Object> headers = properties.getHeaders(); |
|
|
|
|
ThreadLocalUtil.put("bladeContext", headers); |
|
|
|
|
HttpHeaders httpHeaders = new HttpHeaders(); |
|
|
|
|
for (Map.Entry<String, Object> entry : headers.entrySet()) { |
|
|
|
|
if (StrUtil.equals("Blade-Auth", entry.getKey()) || StrUtil.equals("Authorization", entry.getKey())) { |
|
|
|
|
List value = (List) entry.getValue(); |
|
|
|
|
for (Object o : value) { |
|
|
|
|
httpHeaders.add(entry.getKey(), String.valueOf(o)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ThreadLocalUtil.put("bladeContext", httpHeaders); |
|
|
|
|
Object bladeUser = headers.get("bladeUser"); |
|
|
|
|
MockHttpServletRequest request = new MockHttpServletRequest(); |
|
|
|
|
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class); |
|
|
|
|