public UserInfo getUserInfo(String username, String appId, String repoCode) {
Map<String, Object> parameterMap = new HashMap<String, Object>();
parameterMap.put("username", username);
parameterMap.put("appId", appId);
parameterMap.put("repoCode", repoCode);
try {
String content = httpHandler.readText(url, parameterMap);
logger.info(content);
JsonMapper jsonMapper = new JsonMapper();
Map map = jsonMapper.fromJson(content, Map.class);
logger.debug("{}", map);
long userId = ((Number) map.get("userId")).longValue();
List<String> authorities = (List<String>) map.get("authorities");
List<String> attributes = (List<String>) map.get("attributes");
UserInfoImpl userInfo = new UserInfoImpl();
userInfo.setUsername(username);
userInfo.setPassword((String) map.get("password"));
userInfo.setAuthorities(authorities);
userInfo.setAttributes(attributes);
userInfo.getExtra().put("userId", userId);
userInfo.getExtra().put("appId", appId);
return userInfo;
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
throw new UsernameNotFoundException(username, ex);
}
}
HttpUserFetcher.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:lemon
作者:
评论列表
文章目录