|
@@ -1,23 +1,21 @@
|
|
|
/*
|
|
|
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
|
|
|
*
|
|
|
- * Copyright (c) 2018-2025, lengleng All rights reserved.
|
|
|
- *
|
|
|
- * Redistribution and use in source and binary forms, with or without
|
|
|
- * modification, are permitted provided that the following conditions are met:
|
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
|
+ * modification, are permitted provided that the following conditions are met:
|
|
|
*
|
|
|
* Redistributions of source code must retain the above copyright notice,
|
|
|
- * this list of conditions and the following disclaimer.
|
|
|
- * Redistributions in binary form must reproduce the above copyright
|
|
|
- * notice, this list of conditions and the following disclaimer in the
|
|
|
- * documentation and/or other materials provided with the distribution.
|
|
|
- * Neither the name of the pig4cloud.com developer nor the names of its
|
|
|
- * contributors may be used to endorse or promote products derived from
|
|
|
- * this software without specific prior written permission.
|
|
|
- * Author: lengleng (wangiegie@gmail.com)
|
|
|
- *
|
|
|
+ * this list of conditions and the following disclaimer.
|
|
|
+ * Redistributions in binary form must reproduce the above copyright
|
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
|
+ * Neither the name of the pig4cloud.com developer nor the names of its
|
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
|
+ * this software without specific prior written permission.
|
|
|
+ * Author: lengleng (wangiegie@gmail.com)
|
|
|
*/
|
|
|
|
|
|
-package com.pig4cloud.pigx.auth.service;
|
|
|
+package com.pig4cloud.pigx.common.security.service;
|
|
|
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -27,12 +25,10 @@ import com.pig4cloud.pigx.admin.api.feign.RemoteUserService;
|
|
|
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
|
|
|
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
|
|
import com.pig4cloud.pigx.common.core.util.R;
|
|
|
-import com.pig4cloud.pigx.common.security.util.PigxUserDetailsService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.security.core.GrantedAuthority;
|
|
|
import org.springframework.security.core.authority.AuthorityUtils;
|
|
|
-import org.springframework.security.core.userdetails.User;
|
|
|
import org.springframework.security.core.userdetails.UserDetails;
|
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -104,7 +100,8 @@ public class PigxUserDetailsServiceImpl implements PigxUserDetailsService {
|
|
|
SysUser user = info.getSysUser();
|
|
|
boolean enabled = StrUtil.equals(user.getDelFlag(), CommonConstant.STATUS_NORMAL);
|
|
|
// 构造security用户
|
|
|
- return new User(info.getSysUser().getUsername(), SecurityConstants.BCRYPT + user.getPassword(), enabled,
|
|
|
+
|
|
|
+ return new PigxUser(user.getUserId(), user.getDeptId(), user.getUsername(), SecurityConstants.BCRYPT + user.getPassword(), enabled,
|
|
|
true, true, true, authorities);
|
|
|
}
|
|
|
}
|