From 083c96002e0121c45480fd8ed161d709acd4913e Mon Sep 17 00:00:00 2001
From: liucong
+ * 服务类
+ *
+ * 服务类
+ *
@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
*
+ * 服务类
+ *
+ * 服务实现类
+ *
+ * 服务实现类
+ *
+ * 服务实现类 + *
+ * + * @author liucong + * @since 2021-12-04 + */ +@Service +public class UserRoleServiceImpl extends ServiceImpl+ * + *
+ * + * @author liucong + * @since 2021-12-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="Permission对象", description="") +public class Permission implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "权限编码") + private String permissionCode; + + @ApiModelProperty(value = "权限名称") + private String permissionName; + + @ApiModelProperty(value = "描述") + private String description; + + @ApiModelProperty(value = "状态: 01 启用 02停用") + private String status; + + @ApiModelProperty(value = "创建人") + private Long createUserId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "修改人") + private Long updateUserId; + + @ApiModelProperty(value = "修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "版本") + @Version + @TableField(fill = FieldFill.UPDATE, condition = SqlCondition.EQUAL) + private Long version; + + +} diff --git a/src/main/java/org/micai/platform/auth/entity/SysDictItem.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/Role.java similarity index 70% rename from src/main/java/org/micai/platform/auth/entity/SysDictItem.java rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/Role.java index f16e584..aa8e8f3 100644 --- a/src/main/java/org/micai/platform/auth/entity/SysDictItem.java +++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/Role.java @@ -1,4 +1,4 @@ -package org.micai.platform.auth.entity; +package org.micai.platform.resourcesserver.entity; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; @@ -16,34 +16,31 @@ import java.util.Date; * * * @author liucong - * @since 2021-12-10 + * @since 2021-12-04 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) -@ApiModel(value="SysDictItem对象", description="") -public class SysDictItem implements Serializable { +@ApiModel(value="Role对象", description="") +public class Role implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "主键id") + @ApiModelProperty(value = "主键") @TableId(value = "id", type = IdType.AUTO) private Long id; - @ApiModelProperty(value = "字典表id") - private Long dictId; + @ApiModelProperty(value = "角色编码") + private String roleCode; - @ApiModelProperty(value = "字典项文本") - private String itemText; - - @ApiModelProperty(value = "字典项值") - private String itemValue; + @ApiModelProperty(value = "角色名称") + private String roleName; @ApiModelProperty(value = "描述") private String description; - @ApiModelProperty(value = "排序") - private Integer sn; + @ApiModelProperty(value = "状态: 01 启用 02停用") + private String status; @ApiModelProperty(value = "创建人") private Long createUserId; @@ -59,11 +56,9 @@ public class SysDictItem implements Serializable { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; - @ApiModelProperty(value = "状态: 01 启用 02停用") - private String status; - @ApiModelProperty(value = "版本号") @Version + @TableField(fill = FieldFill.UPDATE, condition = SqlCondition.EQUAL) private Long version; diff --git a/src/main/java/org/micai/platform/auth/entity/PermissionMenu.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/RolePermission.java similarity index 82% rename from src/main/java/org/micai/platform/auth/entity/PermissionMenu.java rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/RolePermission.java index 3518962..4dafa61 100644 --- a/src/main/java/org/micai/platform/auth/entity/PermissionMenu.java +++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/RolePermission.java @@ -1,4 +1,4 @@ -package org.micai.platform.auth.entity; +package org.micai.platform.resourcesserver.entity; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; @@ -16,25 +16,25 @@ import java.util.Date; * * * @author liucong - * @since 2021-12-06 + * @since 2021-12-04 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) -@ApiModel(value="PermissionMenu对象", description="") -public class PermissionMenu implements Serializable { +@ApiModel(value="RolePermission对象", description="") +public class RolePermission implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Long id; + @ApiModelProperty(value = "角色id") + private Long roleId; + @ApiModelProperty(value = "权限id") private Long permissionId; - @ApiModelProperty(value = "菜单id") - private Long menuId; - @ApiModelProperty(value = "创建人id") private Long createUserId; diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/User.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/User.java new file mode 100644 index 0000000..7f39f88 --- /dev/null +++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/User.java @@ -0,0 +1,68 @@ +package org.micai.platform.resourcesserver.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *+ * + *
+ * + * @author liucong + * @since 2021-12-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="User对象", description="") +public class User implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "用户名") + private String username; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "创建人") + private Long createUserId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "修改人") + private Long updateUserId; + + @ApiModelProperty(value = "修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "状态: 01 启用 02停用") + private String status; + + @ApiModelProperty(value = "版本") + @Version + @TableField(fill = FieldFill.UPDATE, condition = SqlCondition.EQUAL) + private Long version; + + +} diff --git a/src/main/java/org/micai/platform/auth/entity/OrganUser.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/UserRole.java similarity index 74% rename from src/main/java/org/micai/platform/auth/entity/OrganUser.java rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/UserRole.java index bd5b74d..2d5f44b 100644 --- a/src/main/java/org/micai/platform/auth/entity/OrganUser.java +++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/entity/UserRole.java @@ -1,4 +1,4 @@ -package org.micai.platform.auth.entity; +package org.micai.platform.resourcesserver.entity; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; @@ -16,27 +16,28 @@ import java.util.Date; * * * @author liucong - * @since 2021-12-06 + * @since 2021-12-04 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) -@ApiModel(value="OrganUser对象", description="") -public class OrganUser implements Serializable { +@ApiModel(value="UserRole对象", description="") +public class UserRole implements Serializable { private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "主键id") @TableId(value = "id", type = IdType.AUTO) private Long id; - @ApiModelProperty(value = "组织机构id") - private Long organId; - @ApiModelProperty(value = "用户id") private Long userId; - @ApiModelProperty(value = "创建人") - private Long createUserId; + @ApiModelProperty(value = "角色id") + private Long roleId; + + @ApiModelProperty(value = "创建用户id") + private Long creatUserId; @ApiModelProperty(value = "创建时间") @TableField(fill = FieldFill.INSERT) diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java new file mode 100644 index 0000000..2155e9c --- /dev/null +++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java @@ -0,0 +1,139 @@ +package org.micai.platform.resourcesserver.filter; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import io.jsonwebtoken.*; +import lombok.extern.slf4j.Slf4j; +import org.micai.platform.common.base.constant.ConstantCode; +import org.micai.platform.common.base.constant.ConstantEnum; +import org.micai.platform.common.base.exception.PlatformException; +import org.micai.platform.resourcesserver.service.impl.GrantedAuthorityImpl; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + * 自定义JWT认证过滤器 + * 该类继承自BasicAuthenticationFilter,在doFilterInternal方法中, + * 从http头的Authorization 项读取token数据,然后用Jwts包提供的方法校验token的合法性。 + * 如果校验通过,就认为这是一个取得授权的合法请求 + * @author zhaoxinguo on 2017/9/13. + */ +@Slf4j +public class JWTAuthenticationFilter extends BasicAuthenticationFilter { + + private final String signKey; + + public JWTAuthenticationFilter(AuthenticationManager authenticationManager, String signKey) { + super(authenticationManager); + this.signKey = signKey; + } + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { + String header = request.getHeader(ConstantCode.AUTHORIZATION); + if (ObjectUtil.isEmpty(header) || !header.startsWith(ConstantCode.HEADER_BEARER)) { + chain.doFilter(request, response); + return; + } + UsernamePasswordAuthenticationToken authentication = getAuthentication(request, response); + SecurityContextHolder.getContext().setAuthentication(authentication); + chain.doFilter(request, response); + } + + private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + try { + long start = System.currentTimeMillis(); + String token = request.getHeader(ConstantCode.AUTHORIZATION); + if (ObjectUtil.isEmpty(token)) { + throw new PlatformException(ConstantEnum.TOKEN_MISS); + } + // parse the token. + String user = null; + Claims claims = Jwts.parser().setSigningKey(signKey).parseClaimsJws(token.replace(ConstantCode.HEADER_BEARER, "")).getBody(); + log.info("相关信息 : {}",claims.getSubject()); + // token签发时间 + long issuedAt = claims.getIssuedAt().getTime(); + // 当前时间 + long currentTimeMillis = System.currentTimeMillis(); + // token过期时间 + long expirationTime = claims.getExpiration().getTime(); + // 1. 签发时间 < 当前时间 < (签发时间+((token过期时间-token签发时间)/2)) 不刷新token + // 2. (签发时间+((token过期时间-token签发时间)/2)) < 当前时间 < token过期时间 刷新token并返回给前端 + // 3. tokne过期时间 < 当前时间 跳转登录,重新登录获取token + // 验证token时间有效性 + if ((issuedAt + ((expirationTime - issuedAt) / 2)) < currentTimeMillis && currentTimeMillis < expirationTime) { + + // 重新生成token start + Calendar calendar = Calendar.getInstance(); + Date now = calendar.getTime(); + // 设置签发时间 + calendar.setTime(new Date()); + // 设置过期时间 + calendar.add(Calendar.MINUTE, Long.bitCount(expirationTime)); + Date time = calendar.getTime(); + String refreshToken = Jwts.builder() + .setSubject(claims.getSubject()) + .setIssuedAt(now)//签发时间 + .setExpiration(time)//过期时间 + .signWith(SignatureAlgorithm.HS512, signKey) //采用什么算法是可以自己选择的,不一定非要采用HS512 + .compact(); + // 重新生成token end + + // 主动刷新token,并返回给前端 + response.addHeader(ConstantCode.REFRESH_TOKEN, refreshToken); + } + long end = System.currentTimeMillis(); + logger.info("执行时间: " + (end - start) + " 毫秒"); + user = claims.getSubject(); + if (ObjectUtil.isNotEmpty(user)) { + String authStr = user.split("-")[ConstantCode.INT_TWO]; + List+ * Mapper 接口 + *
+ * + * @author liucong + * @since 2021-12-04 + */ +public interface PermissionMapper extends BaseMapper+ * Mapper 接口 + *
+ * + * @author liucong + * @since 2021-12-04 + */ +public interface RoleMapper extends BaseMapper+ * Mapper 接口 + *
+ * + * @author liucong + * @since 2021-12-04 + */ +public interface RolePermissionMapper extends BaseMapper+ * Mapper 接口 + *
+ * + * @author liucong + * @since 2021-12-04 + */ +public interface UserRoleMapper extends BaseMapper null code>(如果 AuthenticationProvider code>无法支持)
+ * 对传递的 Authentication code>对象的身份验证。 在这种情况下,
+ * 支持所提供的下一个 AuthenticationProvider code>
+ * 将尝试 Authentication code>类。
+ *
+ * @throws AuthenticationException 如果身份验证失败。
+ */
+ @Override
+ public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+ // 获取认证的用户名 & 密码
+ String name = authentication.getName();
+ String password = authentication.getCredentials().toString();
+ // 认证逻辑
+ User userDetails = userService.getOne(new LambdaQueryWrapper().eq(User::getUsername,name));
+ if (ObjectUtil.isEmpty(userDetails)) {
+ throw new MyAuthException(ConstantEnum.USER_CODE_ERROR);
+ }
+
+ if (!bCryptPasswordEncoder.matches(password, userDetails.getPassword())) {
+ throw new MyAuthException(ConstantEnum.USER_CODE_ERROR);
+ }
+ //获取用户权限
+ List userRoleList = userRoleService.list(new QueryWrapper().lambda().eq(UserRole::getUserId,userDetails.getId()));
+ if (ObjectUtil.isEmpty(userRoleList)){
+ throw new MyAuthException(ConstantEnum.NO_ROLE);
+ }
+ List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList());
+ List roleList = roleService.list(new QueryWrapper().lambda()
+ .in(Role::getId,roleIdList).eq(Role::getStatus, ConstantCode.STR_Z_ONE));
+ if (ObjectUtil.isEmpty(roleList)){
+ throw new MyAuthException(ConstantEnum.NO_ROLE);
+ }
+ List rolePermissionList = rolePermissionService.list(new QueryWrapper().lambda()
+ .in(RolePermission::getRoleId,roleIdList));
+ if (ObjectUtil.isEmpty(rolePermissionList)){
+ throw new MyAuthException(ConstantEnum.NO_PERMISSION);
+ }
+ List permissionIdList = rolePermissionList.stream().map(RolePermission::getPermissionId).collect(Collectors.toList());
+ List permissionList = permissionService.list(new QueryWrapper().lambda()
+ .in(Permission::getId,permissionIdList).eq(Permission::getStatus,ConstantCode.STR_Z_ONE));
+ if (ObjectUtil.isEmpty(permissionList)){
+ throw new MyAuthException(ConstantEnum.NO_PERMISSION);
+ }
+
+ String roleStr = roleList.stream().distinct().map(Role::getRoleCode).collect(Collectors.joining(","));
+ String permissionStr = permissionList.stream().distinct().map(Permission::getPermissionCode).collect(Collectors.joining(","));
+ String authStr = roleStr + ConstantCode.SEPARATOR + permissionStr;
+ // 这里设置权限和角色
+ List grantedAuthorities = AuthorityUtils.commaSeparatedStringToAuthorityList(authStr);
+ // 生成令牌 这里令牌里面存入了:name,password,authorities, 当然你也可以放其他内容
+ name = userDetails.getId() + "-" + name;
+ log.info("authStr:{} , 用户:{}", authStr, name);
+ return new UsernamePasswordAuthenticationToken(name, password, grantedAuthorities);
+ }
+
+ /**
+ * 是否可以提供输入类型的认证服务
+ * @param authentication
+ * @return
+ */
+ @Override
+ public boolean supports(Class> authentication) {
+ return authentication.equals(UsernamePasswordAuthenticationToken.class);
+ }
+
+}
diff --git a/src/main/java/org/micai/platform/auth/service/PermissionService.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/PermissionService.java
similarity index 56%
rename from src/main/java/org/micai/platform/auth/service/PermissionService.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/PermissionService.java
index 7d213f4..ca8a3cb 100644
--- a/src/main/java/org/micai/platform/auth/service/PermissionService.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/PermissionService.java
@@ -1,13 +1,13 @@
-package org.micai.platform.auth.service;
+package org.micai.platform.resourcesserver.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
-import org.micai.platform.auth.bo.PermissionDelBo;
-import org.micai.platform.auth.bo.PermissionFindBo;
-import org.micai.platform.auth.bo.PermissionSaveBo;
-import org.micai.platform.auth.bo.PermissionUpdateBo;
-import org.micai.platform.auth.entity.Permission;
-import org.micai.platform.auth.vo.RoleListVo;
+import org.micai.platform.resourcesserver.bo.PermissionDelBo;
+import org.micai.platform.resourcesserver.bo.PermissionFindBo;
+import org.micai.platform.resourcesserver.bo.PermissionSaveBo;
+import org.micai.platform.resourcesserver.bo.PermissionUpdateBo;
+import org.micai.platform.resourcesserver.entity.Permission;
+import org.micai.platform.resourcesserver.vo.RoleListVo;
/**
*
diff --git a/src/main/java/org/micai/platform/auth/service/RolePermissionService.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/RolePermissionService.java
similarity index 55%
rename from src/main/java/org/micai/platform/auth/service/RolePermissionService.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/RolePermissionService.java
index e1697c8..4a17ca5 100644
--- a/src/main/java/org/micai/platform/auth/service/RolePermissionService.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/RolePermissionService.java
@@ -1,9 +1,9 @@
-package org.micai.platform.auth.service;
+package org.micai.platform.resourcesserver.service;
-import org.micai.platform.auth.bo.RolePermissionDelBo;
-import org.micai.platform.auth.bo.RolePermissionSaveBo;
-import org.micai.platform.auth.bo.RolePermissionUpdateBo;
-import org.micai.platform.auth.entity.RolePermission;
+import org.micai.platform.resourcesserver.bo.RolePermissionDelBo;
+import org.micai.platform.resourcesserver.bo.RolePermissionSaveBo;
+import org.micai.platform.resourcesserver.bo.RolePermissionUpdateBo;
+import org.micai.platform.resourcesserver.entity.RolePermission;
import com.baomidou.mybatisplus.extension.service.IService;
/**
diff --git a/src/main/java/org/micai/platform/auth/service/RoleService.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/RoleService.java
similarity index 55%
rename from src/main/java/org/micai/platform/auth/service/RoleService.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/RoleService.java
index 9a925dc..ffe0696 100644
--- a/src/main/java/org/micai/platform/auth/service/RoleService.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/RoleService.java
@@ -1,13 +1,13 @@
-package org.micai.platform.auth.service;
+package org.micai.platform.resourcesserver.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.micai.platform.auth.bo.RoleDelBo;
-import org.micai.platform.auth.bo.RoleFindBo;
-import org.micai.platform.auth.bo.RoleSaveBo;
-import org.micai.platform.auth.bo.RoleUpdateBo;
-import org.micai.platform.auth.entity.Role;
+import org.micai.platform.resourcesserver.bo.RoleDelBo;
+import org.micai.platform.resourcesserver.bo.RoleFindBo;
+import org.micai.platform.resourcesserver.bo.RoleSaveBo;
+import org.micai.platform.resourcesserver.bo.RoleUpdateBo;
+import org.micai.platform.resourcesserver.entity.Role;
import com.baomidou.mybatisplus.extension.service.IService;
-import org.micai.platform.auth.vo.UserListVo;
+import org.micai.platform.resourcesserver.vo.UserListVo;
/**
*
diff --git a/src/main/java/org/micai/platform/auth/service/UserRoleService.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/UserRoleService.java
similarity index 55%
rename from src/main/java/org/micai/platform/auth/service/UserRoleService.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/UserRoleService.java
index 45ce2f0..8d3c12b 100644
--- a/src/main/java/org/micai/platform/auth/service/UserRoleService.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/UserRoleService.java
@@ -1,9 +1,9 @@
-package org.micai.platform.auth.service;
+package org.micai.platform.resourcesserver.service;
-import org.micai.platform.auth.bo.UserRoleDelBo;
-import org.micai.platform.auth.bo.UserRoleSaveBo;
-import org.micai.platform.auth.bo.UserRoleUpdateBo;
-import org.micai.platform.auth.entity.UserRole;
+import org.micai.platform.resourcesserver.bo.UserRoleDelBo;
+import org.micai.platform.resourcesserver.bo.UserRoleSaveBo;
+import org.micai.platform.resourcesserver.bo.UserRoleUpdateBo;
+import org.micai.platform.resourcesserver.entity.UserRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
diff --git a/src/main/java/org/micai/platform/auth/service/UserService.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/UserService.java
similarity index 56%
rename from src/main/java/org/micai/platform/auth/service/UserService.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/UserService.java
index 68ff57d..3027e06 100644
--- a/src/main/java/org/micai/platform/auth/service/UserService.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/UserService.java
@@ -1,13 +1,13 @@
-package org.micai.platform.auth.service;
+package org.micai.platform.resourcesserver.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
-import org.micai.platform.auth.bo.UserDelBo;
-import org.micai.platform.auth.bo.UserFindBo;
-import org.micai.platform.auth.bo.UserSaveBo;
-import org.micai.platform.auth.bo.UserUpdateBo;
-import org.micai.platform.auth.entity.User;
-import org.micai.platform.auth.vo.UserListVo;
+import org.micai.platform.resourcesserver.bo.UserDelBo;
+import org.micai.platform.resourcesserver.bo.UserFindBo;
+import org.micai.platform.resourcesserver.bo.UserSaveBo;
+import org.micai.platform.resourcesserver.bo.UserUpdateBo;
+import org.micai.platform.resourcesserver.entity.User;
+import org.micai.platform.resourcesserver.vo.UserListVo;
import java.util.List;
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/GrantedAuthorityImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/GrantedAuthorityImpl.java
new file mode 100644
index 0000000..551c06f
--- /dev/null
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/GrantedAuthorityImpl.java
@@ -0,0 +1,26 @@
+package org.micai.platform.resourcesserver.service.impl;
+
+import org.springframework.security.core.GrantedAuthority;
+
+/**
+ * 权限类型,负责存储权限和角色
+ *
+ * @author zhaoxinguo on 2017/9/12.
+ */
+public class GrantedAuthorityImpl implements GrantedAuthority {
+
+ private String authority;
+
+ public GrantedAuthorityImpl(String authority) {
+ this.authority = authority;
+ }
+
+ public void setAuthority(String authority) {
+ this.authority = authority;
+ }
+
+ @Override
+ public String getAuthority() {
+ return this.authority;
+ }
+}
diff --git a/src/main/java/org/micai/platform/auth/service/impl/PermissionServiceImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/PermissionServiceImpl.java
similarity index 78%
rename from src/main/java/org/micai/platform/auth/service/impl/PermissionServiceImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/PermissionServiceImpl.java
index b5aa464..d948a3a 100644
--- a/src/main/java/org/micai/platform/auth/service/impl/PermissionServiceImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/PermissionServiceImpl.java
@@ -1,23 +1,23 @@
-package org.micai.platform.auth.service.impl;
+package org.micai.platform.resourcesserver.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.bo.PermissionDelBo;
-import org.micai.platform.auth.bo.PermissionFindBo;
-import org.micai.platform.auth.bo.PermissionSaveBo;
-import org.micai.platform.auth.bo.PermissionUpdateBo;
-import org.micai.platform.auth.constant.ConstantCode;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.dto.UserAuthenticationDto;
-import org.micai.platform.auth.entity.Permission;
-import org.micai.platform.auth.mapper.PermissionMapper;
-import org.micai.platform.auth.service.PermissionService;
-import org.micai.platform.auth.utils.AuthenticationManger;
-import org.micai.platform.auth.vo.RoleListVo;
+import org.micai.platform.common.base.constant.ConstantCode;
+import org.micai.platform.common.base.constant.ConstantEnum;
+import org.micai.platform.common.base.exception.PlatformException;
+import org.micai.platform.resourcesserver.bo.PermissionDelBo;
+import org.micai.platform.resourcesserver.bo.PermissionFindBo;
+import org.micai.platform.resourcesserver.bo.PermissionSaveBo;
+import org.micai.platform.resourcesserver.bo.PermissionUpdateBo;
+import org.micai.platform.resourcesserver.dto.UserAuthenticationDto;
+import org.micai.platform.resourcesserver.entity.Permission;
+import org.micai.platform.resourcesserver.mapper.PermissionMapper;
+import org.micai.platform.resourcesserver.service.PermissionService;
+import org.micai.platform.resourcesserver.utils.AuthenticationManger;
+import org.micai.platform.resourcesserver.vo.RoleListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/main/java/org/micai/platform/auth/service/impl/RolePermissionServiceImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/RolePermissionServiceImpl.java
similarity index 77%
rename from src/main/java/org/micai/platform/auth/service/impl/RolePermissionServiceImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/RolePermissionServiceImpl.java
index 9e36ca8..bb91cd9 100644
--- a/src/main/java/org/micai/platform/auth/service/impl/RolePermissionServiceImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/RolePermissionServiceImpl.java
@@ -1,19 +1,19 @@
-package org.micai.platform.auth.service.impl;
+package org.micai.platform.resourcesserver.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.bo.RolePermissionDelBo;
-import org.micai.platform.auth.bo.RolePermissionSaveBo;
-import org.micai.platform.auth.bo.RolePermissionUpdateBo;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.dto.UserAuthenticationDto;
-import org.micai.platform.auth.entity.RolePermission;
-import org.micai.platform.auth.mapper.RolePermissionMapper;
-import org.micai.platform.auth.service.RolePermissionService;
-import org.micai.platform.auth.utils.AuthenticationManger;
+import org.micai.platform.common.base.constant.ConstantEnum;
+import org.micai.platform.common.base.exception.PlatformException;
+import org.micai.platform.resourcesserver.bo.RolePermissionDelBo;
+import org.micai.platform.resourcesserver.bo.RolePermissionSaveBo;
+import org.micai.platform.resourcesserver.bo.RolePermissionUpdateBo;
+import org.micai.platform.resourcesserver.dto.UserAuthenticationDto;
+import org.micai.platform.resourcesserver.entity.RolePermission;
+import org.micai.platform.resourcesserver.mapper.RolePermissionMapper;
+import org.micai.platform.resourcesserver.service.RolePermissionService;
+import org.micai.platform.resourcesserver.utils.AuthenticationManger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/main/java/org/micai/platform/auth/service/impl/RoleServiceImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/RoleServiceImpl.java
similarity index 78%
rename from src/main/java/org/micai/platform/auth/service/impl/RoleServiceImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/RoleServiceImpl.java
index 4f7d412..4388d94 100644
--- a/src/main/java/org/micai/platform/auth/service/impl/RoleServiceImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/RoleServiceImpl.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.service.impl;
+package org.micai.platform.resourcesserver.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -6,19 +6,19 @@ import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.bo.RoleDelBo;
-import org.micai.platform.auth.bo.RoleFindBo;
-import org.micai.platform.auth.bo.RoleSaveBo;
-import org.micai.platform.auth.bo.RoleUpdateBo;
-import org.micai.platform.auth.constant.ConstantCode;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.dto.UserAuthenticationDto;
-import org.micai.platform.auth.entity.Role;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.mapper.RoleMapper;
-import org.micai.platform.auth.service.RoleService;
-import org.micai.platform.auth.utils.AuthenticationManger;
-import org.micai.platform.auth.vo.UserListVo;
+import org.micai.platform.common.base.constant.ConstantCode;
+import org.micai.platform.common.base.constant.ConstantEnum;
+import org.micai.platform.common.base.exception.PlatformException;
+import org.micai.platform.resourcesserver.bo.RoleDelBo;
+import org.micai.platform.resourcesserver.bo.RoleFindBo;
+import org.micai.platform.resourcesserver.bo.RoleSaveBo;
+import org.micai.platform.resourcesserver.bo.RoleUpdateBo;
+import org.micai.platform.resourcesserver.dto.UserAuthenticationDto;
+import org.micai.platform.resourcesserver.entity.Role;
+import org.micai.platform.resourcesserver.mapper.RoleMapper;
+import org.micai.platform.resourcesserver.service.RoleService;
+import org.micai.platform.resourcesserver.utils.AuthenticationManger;
+import org.micai.platform.resourcesserver.vo.UserListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserDetailsServiceImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserDetailsServiceImpl.java
new file mode 100644
index 0000000..cc9659a
--- /dev/null
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserDetailsServiceImpl.java
@@ -0,0 +1,76 @@
+package org.micai.platform.resourcesserver.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.micai.platform.common.base.constant.ConstantCode;
+import org.micai.platform.common.base.constant.ConstantEnum;
+import org.micai.platform.common.base.exception.MyAuthException;
+import org.micai.platform.resourcesserver.entity.*;
+import org.micai.platform.resourcesserver.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.authority.AuthorityUtils;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Author liuCong
+ * @Date 2022/11/24 下午 1:36
+ * @ClassName UserDetailsServiceImpl
+ * @Description
+ */
+public class UserDetailsServiceImpl implements UserDetailsService {
+
+ @Autowired
+ private UserService userService;
+
+ @Autowired
+ private UserRoleService userRoleService;
+
+ @Autowired
+ private RoleService roleService;
+
+ @Autowired
+ private RolePermissionService rolePermissionService;
+
+ @Autowired
+ private PermissionService permissionService;
+
+ @Override
+ public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+ User user = userService.getOne(new LambdaQueryWrapper().eq(User::getUsername,username));
+ if (user == null){
+ throw new UsernameNotFoundException("未找到该用户");
+ }
+ //获取用户权限
+ List userRoleList = userRoleService.list(new QueryWrapper().lambda().eq(UserRole::getUserId,user.getId()));
+ if (ObjectUtil.isEmpty(userRoleList)){
+ throw new MyAuthException(ConstantEnum.NO_ROLE);
+ }
+ List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList());
+ List roleList = roleService.list(new QueryWrapper().lambda()
+ .in(Role::getId,roleIdList).eq(Role::getStatus, ConstantCode.STR_Z_ONE));
+ if (ObjectUtil.isEmpty(roleList)){
+ throw new MyAuthException(ConstantEnum.NO_ROLE);
+ }
+ List rolePermissionList = rolePermissionService.list(new QueryWrapper().lambda()
+ .in(RolePermission::getRoleId,roleIdList));
+ if (ObjectUtil.isEmpty(rolePermissionList)){
+ throw new MyAuthException(ConstantEnum.NO_PERMISSION);
+ }
+ List permissionIdList = rolePermissionList.stream().map(RolePermission::getPermissionId).collect(Collectors.toList());
+ List permissionList = permissionService.list(new QueryWrapper().lambda()
+ .in(Permission::getId,permissionIdList).eq(Permission::getStatus,ConstantCode.STR_Z_ONE));
+ if (ObjectUtil.isEmpty(permissionList)){
+ throw new MyAuthException(ConstantEnum.NO_PERMISSION);
+ }
+
+ String collect = permissionList.stream().map(Permission::getPermissionCode).collect(Collectors.joining(","));
+ return new org.springframework.security.core.userdetails.User(user.getUsername(), user.getPassword(), AuthorityUtils.createAuthorityList(collect));
+ }
+
+}
diff --git a/src/main/java/org/micai/platform/auth/service/impl/UserRoleServiceImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserRoleServiceImpl.java
similarity index 76%
rename from src/main/java/org/micai/platform/auth/service/impl/UserRoleServiceImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserRoleServiceImpl.java
index c9d7a45..4fdfa8e 100644
--- a/src/main/java/org/micai/platform/auth/service/impl/UserRoleServiceImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserRoleServiceImpl.java
@@ -1,19 +1,19 @@
-package org.micai.platform.auth.service.impl;
+package org.micai.platform.resourcesserver.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.bo.UserRoleDelBo;
-import org.micai.platform.auth.bo.UserRoleSaveBo;
-import org.micai.platform.auth.bo.UserRoleUpdateBo;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.dto.UserAuthenticationDto;
-import org.micai.platform.auth.entity.UserRole;
-import org.micai.platform.auth.mapper.UserRoleMapper;
-import org.micai.platform.auth.service.UserRoleService;
-import org.micai.platform.auth.utils.AuthenticationManger;
+import org.micai.platform.common.base.constant.ConstantEnum;
+import org.micai.platform.common.base.exception.PlatformException;
+import org.micai.platform.resourcesserver.bo.UserRoleDelBo;
+import org.micai.platform.resourcesserver.bo.UserRoleSaveBo;
+import org.micai.platform.resourcesserver.bo.UserRoleUpdateBo;
+import org.micai.platform.resourcesserver.dto.UserAuthenticationDto;
+import org.micai.platform.resourcesserver.entity.UserRole;
+import org.micai.platform.resourcesserver.mapper.UserRoleMapper;
+import org.micai.platform.resourcesserver.service.UserRoleService;
+import org.micai.platform.resourcesserver.utils.AuthenticationManger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/main/java/org/micai/platform/auth/service/impl/UserServiceImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserServiceImpl.java
similarity index 83%
rename from src/main/java/org/micai/platform/auth/service/impl/UserServiceImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserServiceImpl.java
index a81eed7..6f67536 100644
--- a/src/main/java/org/micai/platform/auth/service/impl/UserServiceImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/service/impl/UserServiceImpl.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.service.impl;
+package org.micai.platform.resourcesserver.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -7,19 +7,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.bo.UserDelBo;
-import org.micai.platform.auth.bo.UserFindBo;
-import org.micai.platform.auth.bo.UserSaveBo;
-import org.micai.platform.auth.bo.UserUpdateBo;
-import org.micai.platform.auth.constant.ConstantCode;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.dto.UserAuthenticationDto;
-import org.micai.platform.auth.entity.User;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.mapper.UserMapper;
-import org.micai.platform.auth.service.UserService;
-import org.micai.platform.auth.utils.AuthenticationManger;
-import org.micai.platform.auth.vo.UserListVo;
+import org.micai.platform.common.base.constant.ConstantCode;
+import org.micai.platform.common.base.constant.ConstantEnum;
+import org.micai.platform.common.base.exception.PlatformException;
+import org.micai.platform.resourcesserver.bo.UserDelBo;
+import org.micai.platform.resourcesserver.bo.UserFindBo;
+import org.micai.platform.resourcesserver.bo.UserSaveBo;
+import org.micai.platform.resourcesserver.bo.UserUpdateBo;
+import org.micai.platform.resourcesserver.dto.UserAuthenticationDto;
+import org.micai.platform.resourcesserver.entity.User;
+import org.micai.platform.resourcesserver.mapper.UserMapper;
+import org.micai.platform.resourcesserver.service.UserService;
+import org.micai.platform.resourcesserver.utils.AuthenticationManger;
+import org.micai.platform.resourcesserver.vo.UserListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
diff --git a/src/main/java/org/micai/platform/auth/base/storage/Storage.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/Storage.java
similarity index 95%
rename from src/main/java/org/micai/platform/auth/base/storage/Storage.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/Storage.java
index f794eab..060537e 100644
--- a/src/main/java/org/micai/platform/auth/base/storage/Storage.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/Storage.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.base.storage;
+package org.micai.platform.resourcesserver.storage;
import org.springframework.web.multipart.MultipartFile;
diff --git a/src/main/java/org/micai/platform/auth/base/storage/StorageFactory.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/StorageFactory.java
similarity index 82%
rename from src/main/java/org/micai/platform/auth/base/storage/StorageFactory.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/StorageFactory.java
index ac8e0d1..b39278a 100644
--- a/src/main/java/org/micai/platform/auth/base/storage/StorageFactory.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/StorageFactory.java
@@ -1,13 +1,14 @@
-package org.micai.platform.auth.base.storage;
+package org.micai.platform.resourcesserver.storage;
import org.apache.commons.lang3.StringUtils;
-import org.micai.platform.auth.base.storage.impl.NativeStorageImpl;
-import org.micai.platform.auth.base.storage.impl.OssStorageImpl;
-import org.micai.platform.auth.config.SiteOptions;
+import org.micai.platform.resourcesserver.config.SiteOptions;
+import org.micai.platform.resourcesserver.storage.impl.NativeStorageImpl;
+import org.micai.platform.resourcesserver.storage.impl.OssStorageImpl;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
+
import java.util.HashMap;
import java.util.Map;
diff --git a/src/main/java/org/micai/platform/auth/base/storage/impl/AbstractStorage.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/AbstractStorage.java
similarity index 82%
rename from src/main/java/org/micai/platform/auth/base/storage/impl/AbstractStorage.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/AbstractStorage.java
index fec60bb..21718bf 100644
--- a/src/main/java/org/micai/platform/auth/base/storage/impl/AbstractStorage.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/AbstractStorage.java
@@ -1,14 +1,14 @@
-package org.micai.platform.auth.base.storage.impl;
+package org.micai.platform.resourcesserver.storage.impl;
import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.base.storage.Storage;
-import org.micai.platform.auth.config.SiteOptions;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.utils.FileKit;
-import org.micai.platform.auth.utils.FilePathUtils;
-import org.micai.platform.auth.utils.ImageUtils;
-import org.micai.platform.auth.utils.MD5;
+import org.micai.platform.common.base.constant.ConstantEnum;
+import org.micai.platform.common.base.exception.PlatformException;
+import org.micai.platform.resourcesserver.config.SiteOptions;
+import org.micai.platform.resourcesserver.storage.Storage;
+import org.micai.platform.resourcesserver.utils.FileKit;
+import org.micai.platform.resourcesserver.utils.FilePathUtils;
+import org.micai.platform.resourcesserver.utils.ImageUtils;
+import org.micai.platform.resourcesserver.utils.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
diff --git a/src/main/java/org/micai/platform/auth/base/storage/impl/MinioStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/MinioStorageImpl.java
similarity index 78%
rename from src/main/java/org/micai/platform/auth/base/storage/impl/MinioStorageImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/MinioStorageImpl.java
index c167acf..475e8a6 100644
--- a/src/main/java/org/micai/platform/auth/base/storage/impl/MinioStorageImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/MinioStorageImpl.java
@@ -1,7 +1,7 @@
-package org.micai.platform.auth.base.storage.impl;
+package org.micai.platform.resourcesserver.storage.impl;
import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.base.storage.Storage;
+import org.micai.platform.resourcesserver.storage.Storage;
import org.springframework.stereotype.Component;
/**
diff --git a/src/main/java/org/micai/platform/auth/base/storage/impl/NativeStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/NativeStorageImpl.java
similarity index 83%
rename from src/main/java/org/micai/platform/auth/base/storage/impl/NativeStorageImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/NativeStorageImpl.java
index 69399bc..22add12 100644
--- a/src/main/java/org/micai/platform/auth/base/storage/impl/NativeStorageImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/NativeStorageImpl.java
@@ -1,8 +1,8 @@
-package org.micai.platform.auth.base.storage.impl;
+package org.micai.platform.resourcesserver.storage.impl;
import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.base.storage.Storage;
-import org.micai.platform.auth.utils.FileKit;
+import org.micai.platform.resourcesserver.storage.Storage;
+import org.micai.platform.resourcesserver.utils.FileKit;
import org.springframework.stereotype.Component;
import java.io.File;
diff --git a/src/main/java/org/micai/platform/auth/base/storage/impl/OssStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/OssStorageImpl.java
similarity index 89%
rename from src/main/java/org/micai/platform/auth/base/storage/impl/OssStorageImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/OssStorageImpl.java
index b1a02bf..93b0ce2 100644
--- a/src/main/java/org/micai/platform/auth/base/storage/impl/OssStorageImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/OssStorageImpl.java
@@ -1,14 +1,15 @@
-package org.micai.platform.auth.base.storage.impl;
+package org.micai.platform.resourcesserver.storage.impl;
import com.aliyun.oss.OSSClient;
import com.upyun.UpYunUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
-import org.micai.platform.auth.base.storage.Storage;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.utils.FileKit;
+import org.micai.platform.common.base.constant.ConstantEnum;
+import org.micai.platform.common.base.exception.PlatformException;
+import org.micai.platform.resourcesserver.storage.Storage;
+import org.micai.platform.resourcesserver.utils.FileKit;
import org.springframework.stereotype.Component;
+
import java.io.ByteArrayInputStream;
/**
diff --git a/src/main/java/org/micai/platform/auth/base/storage/impl/QiniuStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/QiniuStorageImpl.java
similarity index 78%
rename from src/main/java/org/micai/platform/auth/base/storage/impl/QiniuStorageImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/QiniuStorageImpl.java
index 4d44193..02005ed 100644
--- a/src/main/java/org/micai/platform/auth/base/storage/impl/QiniuStorageImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/QiniuStorageImpl.java
@@ -1,7 +1,7 @@
-package org.micai.platform.auth.base.storage.impl;
+package org.micai.platform.resourcesserver.storage.impl;
import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.base.storage.Storage;
+import org.micai.platform.resourcesserver.storage.Storage;
import org.springframework.stereotype.Component;
/**
diff --git a/src/main/java/org/micai/platform/auth/base/storage/impl/UpYunStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/UpYunStorageImpl.java
similarity index 70%
rename from src/main/java/org/micai/platform/auth/base/storage/impl/UpYunStorageImpl.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/UpYunStorageImpl.java
index a3895ca..5fb3ebe 100644
--- a/src/main/java/org/micai/platform/auth/base/storage/impl/UpYunStorageImpl.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/UpYunStorageImpl.java
@@ -1,6 +1,7 @@
-package org.micai.platform.auth.base.storage.impl;
+package org.micai.platform.resourcesserver.storage.impl;
-import org.micai.platform.auth.base.storage.Storage;
+
+import org.micai.platform.resourcesserver.storage.Storage;
public class UpYunStorageImpl extends AbstractStorage implements Storage {
diff --git a/src/main/java/org/micai/platform/auth/utils/ApplicationUtil.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/ApplicationUtil.java
similarity index 97%
rename from src/main/java/org/micai/platform/auth/utils/ApplicationUtil.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/ApplicationUtil.java
index 4d7d882..62d073b 100644
--- a/src/main/java/org/micai/platform/auth/utils/ApplicationUtil.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/ApplicationUtil.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
diff --git a/src/main/java/org/micai/platform/auth/utils/AuthenticationManger.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/AuthenticationManger.java
similarity index 90%
rename from src/main/java/org/micai/platform/auth/utils/AuthenticationManger.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/AuthenticationManger.java
index 89e180f..89555c9 100644
--- a/src/main/java/org/micai/platform/auth/utils/AuthenticationManger.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/AuthenticationManger.java
@@ -1,8 +1,8 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.dto.UserAuthenticationDto;
-import org.micai.platform.auth.constant.ConstantCode;
+import org.micai.platform.common.base.constant.ConstantCode;
+import org.micai.platform.resourcesserver.dto.UserAuthenticationDto;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
diff --git a/src/main/java/org/micai/platform/auth/utils/FileKit.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FileKit.java
similarity index 96%
rename from src/main/java/org/micai/platform/auth/utils/FileKit.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FileKit.java
index 0b7b03c..25115b7 100644
--- a/src/main/java/org/micai/platform/auth/utils/FileKit.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FileKit.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import com.sun.istack.internal.NotNull;
import org.apache.commons.io.FileUtils;
diff --git a/src/main/java/org/micai/platform/auth/utils/FilePathUtils.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FilePathUtils.java
similarity index 97%
rename from src/main/java/org/micai/platform/auth/utils/FilePathUtils.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FilePathUtils.java
index 5c49ce5..054ecea 100644
--- a/src/main/java/org/micai/platform/auth/utils/FilePathUtils.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FilePathUtils.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import org.apache.commons.text.RandomStringGenerator;
diff --git a/src/main/java/org/micai/platform/auth/utils/ImageUtils.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/ImageUtils.java
similarity index 99%
rename from src/main/java/org/micai/platform/auth/utils/ImageUtils.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/ImageUtils.java
index 0b14bcb..8c7edd2 100644
--- a/src/main/java/org/micai/platform/auth/utils/ImageUtils.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/ImageUtils.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import lombok.extern.slf4j.Slf4j;
import net.coobird.thumbnailator.Thumbnails;
diff --git a/src/main/java/org/micai/platform/auth/utils/JwtHelper.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/JwtHelper.java
similarity index 98%
rename from src/main/java/org/micai/platform/auth/utils/JwtHelper.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/JwtHelper.java
index 0e05aec..a0fd9c0 100644
--- a/src/main/java/org/micai/platform/auth/utils/JwtHelper.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/JwtHelper.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtBuilder;
diff --git a/src/main/java/org/micai/platform/auth/utils/MD5.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/MD5.java
similarity index 90%
rename from src/main/java/org/micai/platform/auth/utils/MD5.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/MD5.java
index 5a3ecc8..92b172b 100644
--- a/src/main/java/org/micai/platform/auth/utils/MD5.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/MD5.java
@@ -1,7 +1,7 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import org.apache.commons.lang3.StringUtils;
-import org.micai.platform.auth.base.exception.PlatformException;
+import org.micai.platform.common.base.exception.PlatformException;
import java.math.BigInteger;
import java.security.MessageDigest;
diff --git a/src/main/java/org/micai/platform/auth/utils/PdfMergeUtils.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/PdfMergeUtils.java
similarity index 98%
rename from src/main/java/org/micai/platform/auth/utils/PdfMergeUtils.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/PdfMergeUtils.java
index 343c658..d1c60c0 100644
--- a/src/main/java/org/micai/platform/auth/utils/PdfMergeUtils.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/PdfMergeUtils.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfContentByte;
diff --git a/src/main/java/org/micai/platform/auth/utils/WatermarkOffice.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkOffice.java
similarity index 99%
rename from src/main/java/org/micai/platform/auth/utils/WatermarkOffice.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkOffice.java
index 36bb9f2..43dad6f 100644
--- a/src/main/java/org/micai/platform/auth/utils/WatermarkOffice.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkOffice.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import java.io.FileInputStream;
import java.io.FileOutputStream;
diff --git a/src/main/java/org/micai/platform/auth/utils/WatermarkPdf.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkPdf.java
similarity index 97%
rename from src/main/java/org/micai/platform/auth/utils/WatermarkPdf.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkPdf.java
index 0085e1b..9e6207d 100644
--- a/src/main/java/org/micai/platform/auth/utils/WatermarkPdf.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkPdf.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
import java.io.FileOutputStream;
import java.io.IOException;
diff --git a/src/main/java/org/micai/platform/auth/utils/WatermarkUtils.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkUtils.java
similarity index 96%
rename from src/main/java/org/micai/platform/auth/utils/WatermarkUtils.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkUtils.java
index 87fd700..b0a8699 100644
--- a/src/main/java/org/micai/platform/auth/utils/WatermarkUtils.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkUtils.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.utils;
+package org.micai.platform.resourcesserver.utils;
/**
* @ClassName WatermarkUtils
diff --git a/src/main/java/org/micai/platform/auth/vo/OrganListVo.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/OrganListVo.java
similarity index 95%
rename from src/main/java/org/micai/platform/auth/vo/OrganListVo.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/OrganListVo.java
index c799fe9..e3fc46c 100644
--- a/src/main/java/org/micai/platform/auth/vo/OrganListVo.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/OrganListVo.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.vo;
+package org.micai.platform.resourcesserver.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/src/main/java/org/micai/platform/auth/vo/PermissionListVo.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/PermissionListVo.java
similarity index 95%
rename from src/main/java/org/micai/platform/auth/vo/PermissionListVo.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/PermissionListVo.java
index 282c771..9e5fd09 100644
--- a/src/main/java/org/micai/platform/auth/vo/PermissionListVo.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/PermissionListVo.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.vo;
+package org.micai.platform.resourcesserver.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/src/main/java/org/micai/platform/auth/vo/RoleListVo.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/RoleListVo.java
similarity index 95%
rename from src/main/java/org/micai/platform/auth/vo/RoleListVo.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/RoleListVo.java
index d0d1d36..0dcb67d 100644
--- a/src/main/java/org/micai/platform/auth/vo/RoleListVo.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/RoleListVo.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.vo;
+package org.micai.platform.resourcesserver.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/src/main/java/org/micai/platform/auth/vo/UserListVo.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/UserListVo.java
similarity index 95%
rename from src/main/java/org/micai/platform/auth/vo/UserListVo.java
rename to platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/UserListVo.java
index d4796ec..ad824c3 100644
--- a/src/main/java/org/micai/platform/auth/vo/UserListVo.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/vo/UserListVo.java
@@ -1,4 +1,4 @@
-package org.micai.platform.auth.vo;
+package org.micai.platform.resourcesserver.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/platform-resources-server/src/main/resources/application-dev.yml b/platform-resources-server/src/main/resources/application-dev.yml
new file mode 100644
index 0000000..c4ec76e
--- /dev/null
+++ b/platform-resources-server/src/main/resources/application-dev.yml
@@ -0,0 +1,22 @@
+#dev 开发环境
+#服务
+server:
+ port: 8081
+#spring
+spring:
+ datasource:
+ driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:mysql://localhost:3306/security?prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true
+ username: root
+ password: ly1218
+
+#jwt相关配置
+jwt:
+ #sign key
+ sign:
+ key: spring-security-@Jwt!&Secret^#
+ #jwt 过期时间
+ expiration:
+ time: 15
+
+resource-ids: user
diff --git a/platform-resources-server/src/main/resources/application-pro.yml b/platform-resources-server/src/main/resources/application-pro.yml
new file mode 100644
index 0000000..e69de29
diff --git a/src/main/resources/application.yml b/platform-resources-server/src/main/resources/application.yml
similarity index 100%
rename from src/main/resources/application.yml
rename to platform-resources-server/src/main/resources/application.yml
diff --git a/platform-resources-server/src/main/resources/logback-spring.xml b/platform-resources-server/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000..4a1d217
--- /dev/null
+++ b/platform-resources-server/src/main/resources/logback-spring.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ logback
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ trace
+
+
+ ${PATTERN_COLOR}
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 20e3007..18fe870 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,14 +11,19 @@
org.micai.platform
micai-platform-auth
0.0.1-SNAPSHOT
- micai-platform-auth
+ pom
+ micai-platform-auth
Micai platform project for Spring Boot
-
+
+ platform-auth-server
+ platform-resources-server
+ platform-common
+
+
1.8
5.1.30
0.7.0
1.2.78
- 5.7.16
2.7.0
1.3.2
1.3
@@ -31,10 +36,11 @@
3.4.3.4
1.9.2
3.4.0
- 3.4.0
3.16
3.16
2.0
+ 1.7.30
+ 2.2.6.RELEASE
@@ -81,12 +87,6 @@
fastjson
${fastjson.version}
-
-
- cn.hutool
- hutool-all
- ${hutool.version}
-
io.springfox
@@ -103,11 +103,6 @@
mybatis-plus-generator
${mybatis-plus-generator.version}
-
- com.baomidou
- mybatis-plus
- ${mybatis-plus.version}
-
org.apache.velocity
velocity-engine-core
@@ -181,6 +176,17 @@
spring-boot-devtools
true
+
+
+ org.springframework.security.oauth.boot
+ spring-security-oauth2-autoconfigure
+ ${oauth2.version}
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j-api.version}
+
diff --git a/src/main/java/org/micai/platform/auth/config/ThreadConfig.java b/src/main/java/org/micai/platform/auth/config/ThreadConfig.java
deleted file mode 100644
index 5135f45..0000000
--- a/src/main/java/org/micai/platform/auth/config/ThreadConfig.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.micai.platform.auth.config;
-
-import org.micai.platform.auth.utils.ApplicationUtil;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-
-/**
- * @FileName: ThreadConfig
- * @Author: zhaoxinguo
- * @Date: 2019/3/20 18:24
- * @Description: 线程池配置
- */
-@Configuration
-public class ThreadConfig {
-
- @Bean
- public ThreadPoolTaskExecutor taskExecutor() {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setCorePoolSize(20);
- executor.setMaxPoolSize(100);
- executor.setKeepAliveSeconds(30000);
- executor.setQueueCapacity(100);
- executor.setThreadNamePrefix("default_task_executor_thread");
- executor.initialize();
- return executor;
- }
-
- @Bean
- public BCryptPasswordEncoder bCryptPasswordEncoder() {
- return new BCryptPasswordEncoder();
- }
-
- @Bean
- public ApplicationUtil applicationUtil() {
- return new ApplicationUtil();
- }
-
-}
diff --git a/src/main/java/org/micai/platform/auth/controller/ImageCodeController.java b/src/main/java/org/micai/platform/auth/controller/ImageCodeController.java
deleted file mode 100644
index 64bbe2b..0000000
--- a/src/main/java/org/micai/platform/auth/controller/ImageCodeController.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.micai.platform.auth.controller;
-
-import cn.hutool.captcha.CaptchaUtil;
-import cn.hutool.captcha.LineCaptcha;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.constant.ConstantCode;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @Author liuCong
- * @Date 2022/1/4 10:53
- * @ClassName ImageCodeController
- * @Description
- */
-@Controller
-@Api(tags = "图形验证码", value = "图形验证码")
-@RequestMapping("/image")
-@Slf4j
-public class ImageCodeController extends BaseController {
-
-
- @GetMapping("/code")
- @ApiOperation(value = "获取图形验证码", notes = "获取图形验证码")
- public void getImage(HttpServletRequest request, HttpServletResponse response) {
- try {
- LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(ConstantCode.INT_TWO_HUNDRED, ConstantCode.INT_ONE_HUNDRED);
- String code = lineCaptcha.getCode();
- log.info("code info:{}", code);
- request.getSession().setAttribute(ConstantCode.SESSION_KEY, code);
- ServletOutputStream outputStream = response.getOutputStream();
- lineCaptcha.write(outputStream);
- outputStream.flush();
- outputStream.close();
- } catch (Exception e) {
- log.error("error info:", e);
- }
- }
-
-}
diff --git a/src/main/java/org/micai/platform/auth/controller/JwtExceptionController.java b/src/main/java/org/micai/platform/auth/controller/JwtExceptionController.java
deleted file mode 100644
index 7777f5e..0000000
--- a/src/main/java/org/micai/platform/auth/controller/JwtExceptionController.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.micai.platform.auth.controller;
-
-import io.jsonwebtoken.ExpiredJwtException;
-import io.jsonwebtoken.MalformedJwtException;
-import io.jsonwebtoken.SignatureException;
-import io.jsonwebtoken.UnsupportedJwtException;
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.base.result.Result;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.annotations.ApiIgnore;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @ClassName JwtExceptionController
- * @Description Jwt异常处理类
- * @Author zhaoxinguo
- * @Date 2021/11/26 15:58
- * @Version 1.0
- */
-@RestController
-@ApiIgnore
-@Slf4j
-public class JwtExceptionController {
-
- @RequestMapping("/expiredJwtException")
- public Result expiredJwtException(HttpServletRequest request) {
- if (request.getAttribute("expiredJwtException") instanceof ExpiredJwtException) {
- return new Result(ConstantEnum.EXPIRED_JWT);
- }
- return null;
- }
-
- @RequestMapping("/unsupportedJwtException")
- public Result unsupportedJwtException(HttpServletRequest request) {
- if (request.getAttribute("unsupportedJwtException") instanceof UnsupportedJwtException) {
- log.error("unsupportedJwtException");
- return new Result(ConstantEnum.TOKEN_ERROR);
- }
- return null;
- }
-
- @RequestMapping("/signatureException")
- public Result signatureException(HttpServletRequest request) {
- if (request.getAttribute("signatureException") instanceof SignatureException) {
- log.error("signatureException");
- return new Result(ConstantEnum.TOKEN_ERROR);
- }
- return null;
- }
-
- @RequestMapping("/illegalArgumentException")
- public Result illegalArgumentException(HttpServletRequest request) {
- if (request.getAttribute("illegalArgumentException") instanceof IllegalArgumentException) {
- log.error("illegalArgumentException");
- return new Result(ConstantEnum.TOKEN_ERROR);
- }
- return null;
- }
-
-
- @RequestMapping("/malformedJwtException")
- public Result malformedJwtException(HttpServletRequest request) {
- if (request.getAttribute("malformedJwtException") instanceof MalformedJwtException) {
- log.error("malformedJwtException");
- return new Result(ConstantEnum.TOKEN_ERROR);
- }
- return null;
- }
-
-}
diff --git a/src/main/java/org/micai/platform/auth/controller/OrganInfoController.java b/src/main/java/org/micai/platform/auth/controller/OrganInfoController.java
deleted file mode 100644
index 1a1cd03..0000000
--- a/src/main/java/org/micai/platform/auth/controller/OrganInfoController.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.micai.platform.auth.controller;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.bo.*;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.base.result.Result;
-import org.micai.platform.auth.service.OrganInfoService;
-import org.micai.platform.auth.vo.OrganListVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.validation.Valid;
-
-/**
- *
- * 前端控制器
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-@RestController
-@RequestMapping("/organ")
-@Api(tags = "组织管理", value = "组织管理")
-@Slf4j
-public class OrganInfoController {
-
- @Autowired
- private OrganInfoService organInfoService;
-
- @ApiOperation(value = "获取组织列表", notes = "获取组织列表")
- @PostMapping("/getOrganList")
- @PreAuthorize("hasAnyAuthority('root')")
- public Result getOrganList(@RequestBody OrganFindBo bo){
- Result result;
- try {
- Page page = organInfoService.getOrganList(bo);
- result = new Result(ConstantEnum.SUCCESS,page);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-
-
- @ApiOperation(value = "更新组织信息", notes = "更新组织信息")
- @PostMapping("/updateOrgan")
- @PreAuthorize("hasAnyAuthority('root')")
- public Result updateOrgan(@RequestBody @Valid OrganUpdateBo bo){
- Result result;
- try {
- organInfoService.updateOrgan(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-
- @ApiOperation(value = "新增组织", notes = "新增组织")
- @PostMapping("/saveOrgan")
- @PreAuthorize("hasAnyAuthority('root')")
- public Result saveOrgan(@RequestBody @Valid OrganSaveBo bo){
- Result result;
- try {
- organInfoService.saveOrgan(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-
- @ApiOperation(value = "删除组织", notes = "删除组织")
- @PostMapping("/delOrgan")
- @PreAuthorize("hasAnyAuthority('root')")
- public Result delOrgan(@RequestBody @Valid OrganDelBo bo){
- Result result;
- try {
- organInfoService.delOrgan(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-}
-
diff --git a/src/main/java/org/micai/platform/auth/controller/OrganUserController.java b/src/main/java/org/micai/platform/auth/controller/OrganUserController.java
deleted file mode 100644
index b7afab9..0000000
--- a/src/main/java/org/micai/platform/auth/controller/OrganUserController.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.micai.platform.auth.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- *
- * 前端控制器
- *
- *
- * @author liucong
- * @since 2022-01-13
- */
-@RestController
-@RequestMapping("/Tb/organUser")
-public class OrganUserController {
-
-}
-
diff --git a/src/main/java/org/micai/platform/auth/controller/PermissionMenuController.java b/src/main/java/org/micai/platform/auth/controller/PermissionMenuController.java
deleted file mode 100644
index 17a8707..0000000
--- a/src/main/java/org/micai/platform/auth/controller/PermissionMenuController.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.micai.platform.auth.controller;
-
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.base.result.Result;
-import org.micai.platform.auth.bo.*;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.service.PermissionMenuService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-
-/**
- *
- * 前端控制器
- *
- *
- * @author liucong
- * @since 2022-01-13
- */
-@RestController
-@RequestMapping("/permissionMenu")
-@Slf4j
-@Api(tags = "权限菜单管理", value = "权限菜单管理")
-public class PermissionMenuController extends BaseController{
- @Autowired
- private PermissionMenuService permissionMenuService;
-
-
- @ApiOperation(value = "更新角色菜单权限", notes = "更新角色菜单权限")
- @PostMapping("/update")
- @PreAuthorize("hasAnyAuthority('sys:permissionMenu:update')")
- public Result updatePM(@RequestBody @Valid PermissionMenuUpdateBo bo){
- Result result;
- try {
- permissionMenuService.updatePM(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-
- @ApiOperation(value = "新增角色菜单权限", notes = "新增角色菜单权限")
- @PostMapping("/save")
- @PreAuthorize("hasAnyAuthority('sys:permissionMenu:save')")
- public Result savePM(@RequestBody @Valid PermissionMenuSaveBo bo){
- Result result;
- try {
- permissionMenuService.savePM(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-
- @ApiOperation(value = "删除角色菜单权限", notes = "删除角色菜单权限")
- @DeleteMapping("/del")
- @PreAuthorize("hasAnyAuthority('sys:permissionMenu:del')")
- public Result delPM(@RequestBody @Valid PermissionMenuDelBo bo){
- Result result;
- try {
- permissionMenuService.delPM(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-}
-
diff --git a/src/main/java/org/micai/platform/auth/controller/SysDictController.java b/src/main/java/org/micai/platform/auth/controller/SysDictController.java
deleted file mode 100644
index ef77b8a..0000000
--- a/src/main/java/org/micai/platform/auth/controller/SysDictController.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.micai.platform.auth.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- *
- * 前端控制器
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-@RestController
-@RequestMapping("/Tb/sysDict")
-public class SysDictController {
-
-}
-
diff --git a/src/main/java/org/micai/platform/auth/controller/SysMenuController.java b/src/main/java/org/micai/platform/auth/controller/SysMenuController.java
deleted file mode 100644
index d593be8..0000000
--- a/src/main/java/org/micai/platform/auth/controller/SysMenuController.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.micai.platform.auth.controller;
-
-
-import cn.hutool.core.lang.tree.Tree;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.base.result.Result;
-import org.micai.platform.auth.bo.MenuDelBo;
-import org.micai.platform.auth.bo.MenuSaveBo;
-import org.micai.platform.auth.bo.MenuUpdateBo;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.service.SysMenuService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import java.util.List;
-
-/**
- *
- * 前端控制器
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-@RestController
-@RequestMapping("/sysMenu")
-@Api(tags = "菜单管理", value = "菜单管理")
-@Slf4j
-public class SysMenuController extends BaseController{
-
- @Autowired
- private SysMenuService sysMenuService;
-
-
- @PostMapping("/list")
- @PreAuthorize("hasAnyAuthority('sys:sysMenu:list')")
- @ApiOperation(value = "查询菜单", notes = "登录后查询菜单列表")
- public Result find() {
- Result result;
- try {
- List> treeList = sysMenuService.find();
- result = new Result(ConstantEnum.SUCCESS,treeList);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-
-
- @ApiOperation(value = "更新菜单", notes = "更新菜单")
- @PostMapping("/update")
- @PreAuthorize("hasAnyAuthority('sys:sysMenu:update')")
- public Result updateMenu(@RequestBody @Valid MenuUpdateBo bo){
- Result result;
- try {
- sysMenuService.updateMenu(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-
- @ApiOperation(value = "新增菜单", notes = "新增菜单")
- @PostMapping("/save")
- @PreAuthorize("hasAnyAuthority('sys:sysMenu:save')")
- public Result saveMenu(@RequestBody @Valid MenuSaveBo bo){
- Result result;
- try {
- sysMenuService.saveMenu(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-
- @ApiOperation(value = "删除菜单", notes = "删除菜单")
- @DeleteMapping("/del")
- @PreAuthorize("hasAnyAuthority('sys:sysMenu:del')")
- public Result delMenu(@RequestBody @Valid MenuDelBo bo){
- Result result;
- try {
- sysMenuService.delMenu(bo);
- result = new Result(ConstantEnum.SUCCESS);
- } catch (PlatformException e) {
- log.error("error info:",e);
- result = new Result(e.getErrorCode(), e.getErrorMessage());
- } catch (Exception e) {
- log.error("error info:",e);
- result = new Result(ConstantEnum.FAIL);
- }
- return result;
- }
-}
-
diff --git a/src/main/java/org/micai/platform/auth/controller/SysRegionController.java b/src/main/java/org/micai/platform/auth/controller/SysRegionController.java
deleted file mode 100644
index 75bc2ab..0000000
--- a/src/main/java/org/micai/platform/auth/controller/SysRegionController.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.micai.platform.auth.controller;
-
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.base.result.Result;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.entity.SysRegion;
-import org.micai.platform.auth.entity.User;
-import org.micai.platform.auth.service.SysRegionService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 区域管理控制层
- * @author yangtao
- * @since 2021-12-31
- */
-@Slf4j
-@Api(tags = "区域管理", value = "区域管理")
-@RestController
-@RequestMapping("/sysRegion")
-public class SysRegionController {
-
- @Autowired
- private SysRegionService sysRegionService;
-
- @ApiOperation(value = "根据区域用户名查询",notes = "根据区域用户名查询")
- @PostMapping("/findByRegionName")
- public Result findByRegionName(@RequestBody SysRegion sysRegion) throws Exception {
- SysRegion sysRegion1 = sysRegionService.findByRegionName(sysRegion.getRegionName());
- return new Result(ConstantEnum.SUCCESS);
- }
-
-
- @ApiOperation(value = "获取区域列表",notes = "获取区域列表")
- @GetMapping("/sysRegionList")
- public Map sysRegionList() throws Exception{
- List sysRegions = sysRegionService.findSysRegionList();
- Map map = new HashMap();
- map.put("sysRegions",sysRegions);
- return map;
- }
-
-
-
-
-
-}
-
diff --git a/src/main/java/org/micai/platform/auth/entity/OrganInfo.java b/src/main/java/org/micai/platform/auth/entity/OrganInfo.java
deleted file mode 100644
index 9064c21..0000000
--- a/src/main/java/org/micai/platform/auth/entity/OrganInfo.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.micai.platform.auth.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- *
- *
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value="OrganInfo对象", description="")
-public class OrganInfo implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "主键id")
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @ApiModelProperty(value = "机构编码")
- private String code;
-
- @ApiModelProperty(value = "机构名称")
- private String name;
-
- @ApiModelProperty(value = "机构类型")
- private String type;
-
- @ApiModelProperty(value = "创建人")
- private Long createUserId;
-
- @ApiModelProperty(value = "创建时间")
- @TableField(fill = FieldFill.INSERT)
- private Date createTime;
-
- @ApiModelProperty(value = "修改人")
- private Long updateUserId;
-
- @ApiModelProperty(value = "修改时间")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Date updateTime;
-
- @ApiModelProperty(value = "状态 默认01 启用")
- private String status;
-
- @ApiModelProperty(value = "版本号")
- @Version
- private Long version;
-
-
-}
diff --git a/src/main/java/org/micai/platform/auth/entity/SysDict.java b/src/main/java/org/micai/platform/auth/entity/SysDict.java
deleted file mode 100644
index 59dc14b..0000000
--- a/src/main/java/org/micai/platform/auth/entity/SysDict.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.micai.platform.auth.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- *
- *
- *
- *
- * @author liucong
- * @since 2021-12-10
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value="SysDict对象", description="")
-public class SysDict implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "主键id")
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @ApiModelProperty(value = "字段名称")
- private String dictName;
-
- @ApiModelProperty(value = "字段编码")
- private String dictCode;
-
- @ApiModelProperty(value = "创建人id")
- private Long createUserId;
-
- @ApiModelProperty(value = "创建时间")
- @TableField(fill = FieldFill.INSERT)
- private Date createTime;
-
- @ApiModelProperty(value = "修改人id")
- private Long updateUserId;
-
- @ApiModelProperty(value = "修改时间")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Date updateTime;
-
- @ApiModelProperty(value = "状态: 01 启用 02停用")
- private String status;
-
- @ApiModelProperty(value = "版本号")
- @Version
- private Long version;
-
-
-}
diff --git a/src/main/java/org/micai/platform/auth/entity/SysMenu.java b/src/main/java/org/micai/platform/auth/entity/SysMenu.java
deleted file mode 100644
index 21698c7..0000000
--- a/src/main/java/org/micai/platform/auth/entity/SysMenu.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.micai.platform.auth.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- *
- *
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value="SysMenu对象", description="")
-public class SysMenu implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "主键id")
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @ApiModelProperty(value = "菜单编码")
- private String menuCode;
-
- @ApiModelProperty(value = "菜单名称")
- private String menuName;
-
- @ApiModelProperty(value = "业务系统标识,区分不同业务系统菜单")
- private String systemCode;
-
- @ApiModelProperty(value = "业务系统名称")
- private String systemName;
-
- @ApiModelProperty(value = "终端类型,00:平台")
- private String application;
-
- @ApiModelProperty(value = "父级菜单编码")
- private String parentCode;
-
- @ApiModelProperty(value = "菜单图标")
- private String menuIcon;
-
- @ApiModelProperty(value = "菜单访问路径")
- private String url;
-
- @ApiModelProperty(value = "菜单打开类型,1:路由 2:新标签页 3:iframe")
- private String openType;
-
- @ApiModelProperty(value = "序号")
- private Integer sn;
-
- @ApiModelProperty(value = "创建时间")
- @TableField(fill = FieldFill.INSERT)
- private Date createTime;
-
- @ApiModelProperty(value = "创建人")
- private Long createUserId;
-
- @ApiModelProperty(value = "修改人")
- private Long updateUserId;
-
- @ApiModelProperty(value = "修改时间")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Date updateTime;
-
- @ApiModelProperty(value = "启用标识 01 启用")
- private String status;
-
- @ApiModelProperty(value = "版本号")
- @Version
- private Long version;
-
-
-}
diff --git a/src/main/java/org/micai/platform/auth/entity/SysRegion.java b/src/main/java/org/micai/platform/auth/entity/SysRegion.java
deleted file mode 100644
index f3f98e7..0000000
--- a/src/main/java/org/micai/platform/auth/entity/SysRegion.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.micai.platform.auth.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.Version;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- *
- * 区域地址表
- *
- *
- * @author yangtao
- * @since 2021-12-31
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value="SysRegion对象", description="区域地址表")
-public class SysRegion implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "区域主键编号")
- @TableId(value = "region_id", type = IdType.AUTO)
- private String regionId;
-
- @ApiModelProperty(value = "区域名称")
- private String regionName;
-
- @ApiModelProperty(value = "区域缩写")
- private String regionShortName;
-
- @ApiModelProperty(value = "行政区域编号")
- private String regionCode;
-
- @ApiModelProperty(value = "区域父id")
- private String regionParentId;
-
- @ApiModelProperty(value = "区域级别 1-省、自治区、直辖市 2-地级市、地区、自治州、盟 3-市辖区、县级市、县")
- private Integer regionLevel;
-
- @ApiModelProperty(value = "创建人")
- private Long createUserId;
-
- @ApiModelProperty(value = "创建时间")
- private Date createTime;
-
- @ApiModelProperty(value = "修改人")
- private Long updateUserId;
-
- @ApiModelProperty(value = "修改时间")
- private Date updateTime;
-
- @ApiModelProperty(value = "版本号")
- @Version
- private Long version;
-
-
-}
diff --git a/src/main/java/org/micai/platform/auth/mapper/OrganInfoMapper.java b/src/main/java/org/micai/platform/auth/mapper/OrganInfoMapper.java
deleted file mode 100644
index 1c8a58d..0000000
--- a/src/main/java/org/micai/platform/auth/mapper/OrganInfoMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.micai.platform.auth.mapper;
-
-import org.micai.platform.auth.entity.OrganInfo;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- *
- * Mapper 接口
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-public interface OrganInfoMapper extends BaseMapper {
-
-}
diff --git a/src/main/java/org/micai/platform/auth/mapper/OrganUserMapper.java b/src/main/java/org/micai/platform/auth/mapper/OrganUserMapper.java
deleted file mode 100644
index bc426d3..0000000
--- a/src/main/java/org/micai/platform/auth/mapper/OrganUserMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.micai.platform.auth.mapper;
-
-import org.micai.platform.auth.entity.OrganUser;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- *
- * Mapper 接口
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-public interface OrganUserMapper extends BaseMapper {
-
-}
diff --git a/src/main/java/org/micai/platform/auth/mapper/PermissionMenuMapper.java b/src/main/java/org/micai/platform/auth/mapper/PermissionMenuMapper.java
deleted file mode 100644
index 501110a..0000000
--- a/src/main/java/org/micai/platform/auth/mapper/PermissionMenuMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.micai.platform.auth.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.micai.platform.auth.entity.PermissionMenu;
-
-/**
- *
- * Mapper 接口
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-public interface PermissionMenuMapper extends BaseMapper {
-
-}
diff --git a/src/main/java/org/micai/platform/auth/mapper/SysDictItemMapper.java b/src/main/java/org/micai/platform/auth/mapper/SysDictItemMapper.java
deleted file mode 100644
index 78b16fd..0000000
--- a/src/main/java/org/micai/platform/auth/mapper/SysDictItemMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.micai.platform.auth.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.micai.platform.auth.entity.SysDictItem;
-
-/**
- *
- * Mapper 接口
- *
- *
- * @author liucong
- * @since 2021-12-10
- */
-public interface SysDictItemMapper extends BaseMapper {
-
-}
diff --git a/src/main/java/org/micai/platform/auth/mapper/SysDictMapper.java b/src/main/java/org/micai/platform/auth/mapper/SysDictMapper.java
deleted file mode 100644
index 26a634a..0000000
--- a/src/main/java/org/micai/platform/auth/mapper/SysDictMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.micai.platform.auth.mapper;
-
-import org.micai.platform.auth.entity.SysDict;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- *
- * Mapper 接口
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-public interface SysDictMapper extends BaseMapper {
-
-}
diff --git a/src/main/java/org/micai/platform/auth/mapper/SysMenuMapper.java b/src/main/java/org/micai/platform/auth/mapper/SysMenuMapper.java
deleted file mode 100644
index 7c90b05..0000000
--- a/src/main/java/org/micai/platform/auth/mapper/SysMenuMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.micai.platform.auth.mapper;
-
-import org.micai.platform.auth.entity.SysMenu;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- *
- * Mapper 接口
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-public interface SysMenuMapper extends BaseMapper {
-
-}
diff --git a/src/main/java/org/micai/platform/auth/mapper/SysRegionMapper.java b/src/main/java/org/micai/platform/auth/mapper/SysRegionMapper.java
deleted file mode 100644
index 91ce651..0000000
--- a/src/main/java/org/micai/platform/auth/mapper/SysRegionMapper.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.micai.platform.auth.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.micai.platform.auth.entity.SysRegion;
-
-
-/**
- *
- * 区域地址表 Mapper 接口
- *
- *
- * @author yangtao
- * @since 2021-12-31
- */
-public interface SysRegionMapper extends BaseMapper {
-
- SysRegion findByRegionName(String regionName);
-
-}
diff --git a/src/main/java/org/micai/platform/auth/service/OrganInfoService.java b/src/main/java/org/micai/platform/auth/service/OrganInfoService.java
deleted file mode 100644
index 5016f2f..0000000
--- a/src/main/java/org/micai/platform/auth/service/OrganInfoService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.micai.platform.auth.service;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.micai.platform.auth.bo.OrganDelBo;
-import org.micai.platform.auth.bo.OrganFindBo;
-import org.micai.platform.auth.bo.OrganSaveBo;
-import org.micai.platform.auth.bo.OrganUpdateBo;
-import org.micai.platform.auth.entity.OrganInfo;
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.micai.platform.auth.vo.OrganListVo;
-
-/**
- *
- * 服务类
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-public interface OrganInfoService extends IService {
-
- Page getOrganList(OrganFindBo bo);
-
- void updateOrgan(OrganUpdateBo bo);
-
- void saveOrgan(OrganSaveBo bo);
-
- void delOrgan(OrganDelBo bo);
-}
diff --git a/src/main/java/org/micai/platform/auth/service/PermissionMenuService.java b/src/main/java/org/micai/platform/auth/service/PermissionMenuService.java
deleted file mode 100644
index 68688ce..0000000
--- a/src/main/java/org/micai/platform/auth/service/PermissionMenuService.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.micai.platform.auth.service;
-
-import org.micai.platform.auth.bo.PermissionMenuDelBo;
-import org.micai.platform.auth.bo.PermissionMenuSaveBo;
-import org.micai.platform.auth.bo.PermissionMenuUpdateBo;
-
-/**
- * @Author liuCong
- * @Date 2022/1/13 16:54
- * @ClassName PermissionMenuService
- * @Description
- */
-public interface PermissionMenuService {
- void updatePM(PermissionMenuUpdateBo bo) throws Exception;
-
- void savePM(PermissionMenuSaveBo bo) throws Exception;
-
- void delPM(PermissionMenuDelBo bo) throws Exception;
-}
diff --git a/src/main/java/org/micai/platform/auth/service/SysMenuService.java b/src/main/java/org/micai/platform/auth/service/SysMenuService.java
deleted file mode 100644
index e9bccda..0000000
--- a/src/main/java/org/micai/platform/auth/service/SysMenuService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.micai.platform.auth.service;
-
-import cn.hutool.core.lang.tree.Tree;
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.micai.platform.auth.bo.MenuDelBo;
-import org.micai.platform.auth.bo.MenuSaveBo;
-import org.micai.platform.auth.bo.MenuUpdateBo;
-import org.micai.platform.auth.entity.SysMenu;
-
-import java.util.List;
-
-/**
- *
- * 服务类
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-public interface SysMenuService extends IService {
-
- List> find() throws Exception;
-
- void updateMenu(MenuUpdateBo bo) throws Exception;
-
- void saveMenu(MenuSaveBo bo) throws Exception;
-
- void delMenu(MenuDelBo bo) throws Exception;
-}
diff --git a/src/main/java/org/micai/platform/auth/service/SysRegionService.java b/src/main/java/org/micai/platform/auth/service/SysRegionService.java
deleted file mode 100644
index df1b234..0000000
--- a/src/main/java/org/micai/platform/auth/service/SysRegionService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.micai.platform.auth.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.micai.platform.auth.entity.SysRegion;
-import org.micai.platform.auth.entity.User;
-
-import java.util.List;
-
-/**
- *
- * 区域地址表 服务类
- *
- *
- * @author yangtao
- * @since 2021-12-31
- */
-public interface SysRegionService extends IService {
- /**
- * 根据区域名称进行查询
- * @param regionName
- * @return
- */
- SysRegion findByRegionName(String regionName) throws Exception;
-
- /**
- * 获取区域列表
- * @return
- */
- List findSysRegionList() throws Exception;
-
-}
diff --git a/src/main/java/org/micai/platform/auth/service/impl/OrganInfoServiceImpl.java b/src/main/java/org/micai/platform/auth/service/impl/OrganInfoServiceImpl.java
deleted file mode 100644
index 4960b04..0000000
--- a/src/main/java/org/micai/platform/auth/service/impl/OrganInfoServiceImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.micai.platform.auth.service.impl;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.micai.platform.auth.bo.OrganDelBo;
-import org.micai.platform.auth.bo.OrganFindBo;
-import org.micai.platform.auth.bo.OrganSaveBo;
-import org.micai.platform.auth.bo.OrganUpdateBo;
-import org.micai.platform.auth.entity.OrganInfo;
-import org.micai.platform.auth.mapper.OrganInfoMapper;
-import org.micai.platform.auth.service.OrganInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.vo.OrganListVo;
-import org.springframework.stereotype.Service;
-
-/**
- *
- * 服务实现类
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-@Service
-public class OrganInfoServiceImpl extends ServiceImpl implements OrganInfoService {
-
- @Override
- public Page getOrganList(OrganFindBo bo) {
- return null;
- }
-
- @Override
- public void updateOrgan(OrganUpdateBo bo) {
-
- }
-
- @Override
- public void saveOrgan(OrganSaveBo bo) {
-
- }
-
- @Override
- public void delOrgan(OrganDelBo bo) {
-
- }
-}
diff --git a/src/main/java/org/micai/platform/auth/service/impl/PermissionMenuServiceImpl.java b/src/main/java/org/micai/platform/auth/service/impl/PermissionMenuServiceImpl.java
deleted file mode 100644
index 5bf5a2f..0000000
--- a/src/main/java/org/micai/platform/auth/service/impl/PermissionMenuServiceImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.micai.platform.auth.service.impl;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.bo.PermissionMenuDelBo;
-import org.micai.platform.auth.bo.PermissionMenuSaveBo;
-import org.micai.platform.auth.bo.PermissionMenuUpdateBo;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.dto.UserAuthenticationDto;
-import org.micai.platform.auth.entity.PermissionMenu;
-import org.micai.platform.auth.mapper.PermissionMenuMapper;
-import org.micai.platform.auth.service.PermissionMenuService;
-import org.micai.platform.auth.utils.AuthenticationManger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-/**
- * @Author liuCong
- * @Date 2022/1/13 16:54
- * @ClassName PermissionMenuServiceImpl
- * @Description
- */
-@Service
-public class PermissionMenuServiceImpl extends ServiceImpl implements PermissionMenuService {
- @Autowired
- private PermissionMenuMapper permissionMenuMapper;
-
- @Override
- public void updatePM(PermissionMenuUpdateBo bo) throws Exception {
- PermissionMenu permissionMenu = BeanUtil.copyProperties(bo, PermissionMenu.class);
- UserAuthenticationDto authentication = AuthenticationManger.getAuthentication();
- permissionMenu.setUpdateUserId(authentication.getId());
- PermissionMenu permissionMenuEn = permissionMenuMapper.selectById(permissionMenu.getId());
- permissionMenu.setVersion(permissionMenuEn.getVersion());
- permissionMenuMapper.updateById(permissionMenu);
- }
-
- @Override
- public void savePM(PermissionMenuSaveBo bo) throws Exception {
- PermissionMenu permissionMenu = BeanUtil.copyProperties(bo, PermissionMenu.class);
-
- //不能有重复的
- List permissionMenus = permissionMenuMapper.selectList(new QueryWrapper().lambda()
- .eq(PermissionMenu::getPermissionId, bo.getPermissionId())
- .eq(PermissionMenu::getMenuId, bo.getMenuId()));
-
- if (ObjectUtil.isNotEmpty(permissionMenus)) {
- throw new PlatformException(ConstantEnum.DATA_DUPLICATION);
- }
-
- UserAuthenticationDto authentication = AuthenticationManger.getAuthentication();
- permissionMenu
- .setCreateUserId(authentication.getId())
- .setUpdateUserId(authentication.getId());
- permissionMenuMapper.insert(permissionMenu);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void delPM(PermissionMenuDelBo bo) throws Exception {
- List idList = bo.getIdList();
- int deleteBatchIds = permissionMenuMapper.deleteBatchIds(idList);
- if (idList.size() != deleteBatchIds){
- throw new PlatformException(ConstantEnum.UPDATE_ERROR);
- }
- }
-}
diff --git a/src/main/java/org/micai/platform/auth/service/impl/SysMenuServiceImpl.java b/src/main/java/org/micai/platform/auth/service/impl/SysMenuServiceImpl.java
deleted file mode 100644
index 8edcb2d..0000000
--- a/src/main/java/org/micai/platform/auth/service/impl/SysMenuServiceImpl.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.micai.platform.auth.service.impl;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.lang.tree.Tree;
-import cn.hutool.core.lang.tree.TreeNodeConfig;
-import cn.hutool.core.lang.tree.TreeUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.RandomUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.bo.MenuDelBo;
-import org.micai.platform.auth.bo.MenuSaveBo;
-import org.micai.platform.auth.bo.MenuUpdateBo;
-import org.micai.platform.auth.constant.ConstantCode;
-import org.micai.platform.auth.constant.ConstantEnum;
-import org.micai.platform.auth.dto.UserAuthenticationDto;
-import org.micai.platform.auth.entity.Permission;
-import org.micai.platform.auth.entity.PermissionMenu;
-import org.micai.platform.auth.entity.SysMenu;
-import org.micai.platform.auth.base.exception.PlatformException;
-import org.micai.platform.auth.mapper.PermissionMapper;
-import org.micai.platform.auth.mapper.PermissionMenuMapper;
-import org.micai.platform.auth.mapper.SysMenuMapper;
-import org.micai.platform.auth.service.SysMenuService;
-import org.micai.platform.auth.utils.AuthenticationManger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- *
- * 服务实现类
- *
- *
- * @author liucong
- * @since 2021-12-06
- */
-@Service
-public class SysMenuServiceImpl extends ServiceImpl implements SysMenuService {
-
- @Autowired
- private PermissionMapper permissionMapper;
-
- @Autowired
- private PermissionMenuMapper permissionMenuMapper;
-
- @Autowired
- private SysMenuMapper sysMenuMapper;
-
- @Override
- public List> find() throws Exception{
- UserAuthenticationDto authentication = AuthenticationManger.getAuthentication();
- List permissions = authentication.getPermissions();
- List permissionList = permissionMapper.selectList(new QueryWrapper().lambda().in(Permission::getPermissionCode, permissions));
- List permissionCodeList = permissionList.stream().map(Permission::getId).collect(Collectors.toList());
- List permissionMenus = permissionMenuMapper.selectList(new QueryWrapper().in("permission_id",permissionCodeList));
- if (ObjectUtil.isEmpty(permissionMenus)){
- return null;
- }
- List menuIds = permissionMenus.stream().map(PermissionMenu::getMenuId).collect(Collectors.toList());
- List menuList = sysMenuMapper.selectList(new QueryWrapper().in("id", menuIds).eq("status", ConstantCode.STR_Z_ONE));
- if (ObjectUtil.isNotEmpty(menuList)){
- //配置
- TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
- // 自定义属性名 都要默认值的
- treeNodeConfig.setWeightKey("order");
- treeNodeConfig.setIdKey("rid");
- // 最大递归深度
- treeNodeConfig.setDeep(ConstantCode.INT_THREE);
- //转换器 00代表根目录
- return TreeUtil.build(menuList, ConstantCode.STR_DOUBLE_ZONE, treeNodeConfig,
- (treeNode, tree) -> {
- tree.setId(treeNode.getMenuCode());
- tree.setParentId(treeNode.getParentCode());
- tree.setWeight(treeNode.getSn());
- // 扩展属性 ...
- tree.putExtra("menuIcon", treeNode.getMenuIcon());
- tree.putExtra("url", treeNode.getUrl());
- tree.putExtra("openType", treeNode.getOpenType());
- tree.putExtra("sn", treeNode.getSn());
- tree.putExtra("menuName", treeNode.getMenuName());
- tree.putExtra("menuCode", treeNode.getMenuCode());
- });
- }
-
- return null;
- }
-
- @Override
- public void updateMenu(MenuUpdateBo bo) throws Exception {
- SysMenu sysMenu = BeanUtil.copyProperties(bo, SysMenu.class);
- UserAuthenticationDto authentication = AuthenticationManger.getAuthentication();
- sysMenu.setUpdateUserId(authentication.getId());
- SysMenu sysMenuEn = sysMenuMapper.selectById(sysMenu.getId());
- sysMenu.setVersion(sysMenuEn.getVersion());
- int i = sysMenuMapper.updateById(sysMenu);
- if (ConstantCode.INT_ONE != i){
- throw new PlatformException(ConstantEnum.UPDATE_ERROR);
- }
- }
-
- @Override
- public void saveMenu(MenuSaveBo bo) throws Exception {
- SysMenu sysMenu = BeanUtil.copyProperties(bo, SysMenu.class);
- UserAuthenticationDto authentication = AuthenticationManger.getAuthentication();
- sysMenu.setMenuCode(RandomUtil.randomString(ConstantCode.INT_TEN))
- .setCreateUserId(authentication.getId())
- .setUpdateUserId(authentication.getId())
- .setStatus(ConstantCode.STR_Z_ONE);
- int i = sysMenuMapper.insert(sysMenu);
- if (ConstantCode.INT_ONE != i){
- throw new PlatformException(ConstantEnum.UPDATE_ERROR);
- }
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void delMenu(MenuDelBo bo) throws Exception {
- List idList = bo.getIdList();
- int deleteBatchIds = permissionMapper.deleteBatchIds(idList);
- if (idList.size() != deleteBatchIds){
- throw new PlatformException(ConstantEnum.UPDATE_ERROR);
- }
- }
-}
diff --git a/src/main/java/org/micai/platform/auth/service/impl/SysRegionServiceImpl.java b/src/main/java/org/micai/platform/auth/service/impl/SysRegionServiceImpl.java
deleted file mode 100644
index cc2de03..0000000
--- a/src/main/java/org/micai/platform/auth/service/impl/SysRegionServiceImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.micai.platform.auth.service.impl;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.micai.platform.auth.entity.SysRegion;
-import org.micai.platform.auth.entity.User;
-import org.micai.platform.auth.mapper.SysRegionMapper;
-import org.micai.platform.auth.service.SysRegionService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- *
- * 区域地址表 服务实现类
- *
- *
- * @author yangtao
- * @since 2021-12-31
- */
-@Service
-public class SysRegionServiceImpl extends ServiceImpl implements SysRegionService {
-
- @Autowired
- private SysRegionMapper sysRegionMapper;
-
- @Override
- public SysRegion findByRegionName(String regionName) {
- if (ObjectUtil.isNotEmpty(regionName)){
- SysRegion sysRegion = sysRegionMapper.selectOne(new QueryWrapper().lambda().eq(SysRegion::getRegionName, regionName));
- return sysRegion;
- }
- return null;
- }
-
- @Override
- public List findSysRegionList() {
- List sysRegionList = sysRegionMapper.selectList(Wrappers.lambdaQuery());
- return sysRegionList;
- }
-}
diff --git a/src/test/java/org/micai/platform/auth/LogTests.java b/src/test/java/org/micai/platform/auth/LogTests.java
deleted file mode 100644
index c9d5418..0000000
--- a/src/test/java/org/micai/platform/auth/LogTests.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.micai.platform.auth;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-/**
- * @Author zhaoxinguo
- * @Date 2021-12-13 15:34
- * @ClassName LogTests
- * @Description 日志输出测试类
- */
-@SpringBootTest
-@RunWith(SpringJUnit4ClassRunner.class)
-public class LogTests {
-
- Logger logger = LoggerFactory.getLogger(Logger.class);
-
- @Test
- public void contextLoad() {
- // 可以调整日志级别、日志的输出会按照这个配置的级别及以上的级别生效
- // 日志级别从低到高分为:TRACE < DEBUG < INFO < WARN < ERROR < FATAL
- logger.trace("这是trace日志......");
- logger.debug("这是debug日志......");
- logger.info("这是info日志......");
- logger.warn("这是warn日志......");
- logger.error("这是error日志......");
- }
-
-
-}
diff --git a/src/test/java/org/micai/platform/auth/MicaiPlatformAuthApplicationTests.java b/src/test/java/org/micai/platform/auth/MicaiPlatformAuthApplicationTests.java
deleted file mode 100644
index 6a6b48f..0000000
--- a/src/test/java/org/micai/platform/auth/MicaiPlatformAuthApplicationTests.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.micai.platform.auth;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class MicaiPlatformAuthApplicationTests {
-
- @Test
- void contextLoads() {
- }
-
-}
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
deleted file mode 100644
index c921663..0000000
--- a/src/test/resources/application.properties
+++ /dev/null
@@ -1,42 +0,0 @@
-# MySQL
-spring.datasource.driverClassName=com.mysql.jdbc.Driver
-spring.datasource.url=jdbc:mysql://localhost:3306/security?prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true
-spring.datasource.username=root
-spring.datasource.password=root
-
-# JPA
-#spring.jpa.hibernate.ddl-auto=update
-#spring.jpa.show-sql=true
-#spring.jackson.serialization.indent_output=true
-spring.mvc.pathmatch.matching-strategy=ant_path_matcher
-
-# JWT Config
-jwt.header=Authorization
-jwt.secret=NDU0NTY4amhmc3NkeHp6eGNxdzIlMjFAJTIxQCUyM2ZmNQ==
-jwt.expiration=7200000
-
-#mybatis-plus
-mybatis-plus.global-config.db-config.insert-strategy=not_empty
-mybatis-plus.global-config.db-config.update-strategy=not_empty
-mybatis-plus.global-config.db-config.where-strategy=not_empty
-#mybatis-plus.mapper-locations=
-mybatis-plus.global-config.db-config.id-type=auto
-mybatis-plus.configuration.map-underscore-to-camel-case=true
-mybatis-plus.global-config.db-config.table-prefix=tb_
-mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
-
-#log level config
-logging.level.org.micai.platform.auto=warn
-logging.level.org.springframework.web=debug
-#logging.level.org.hibernate=error
-logging.file.name=auth.log
-logging.file.path=/opt/auth/logs
-
-site.location=${user.dir}
-site.options.storage_max_width=800
-site.options.storage_limit_size=2
-site.options.thumbnail_channel_size=200x112
-site.options.thumbnail_post_size=360x200
-
-
-
--
Gitee
From bcc2642051d7b4bd5276ab2d295ce1554d00fced Mon Sep 17 00:00:00 2001
From: liucong
Date: Mon, 12 Dec 2022 14:44:56 +0800
Subject: [PATCH 03/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=A4=A7=E4=BD=93?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0-=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=AE=9E=E7=8E=B0jwt=E5=92=8Coauth22?=
=?UTF-8?q?=E7=A7=8D=E6=96=B9=E6=A1=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AuthorizationServerConfiguration.java | 29 ++---
.../authserver/config/TokenConfig.java | 2 +-
.../authserver/filter/JWTLoginFilter.java | 2 +-
.../base/exception/DefaultException.java | 26 -----
.../exception/GlobalExceptionHandler.java | 19 +++
.../resourcesserver/config/CodeGenerator.java | 3 +-
.../config/RequestMatcherConfig.java | 52 +++++++++
.../config/ResourceServerConfig.java | 108 ++++++++++++++++++
.../resourcesserver/config/SwaggerConfig.java | 5 +-
.../config/WebSecurityConfig.java | 105 +----------------
.../filter/AuthHeaderFilter.java | 90 +++++++++++++++
.../filter/JWTAuthenticationFilter.java | 8 +-
.../src/main/resources/application-dev.yml | 8 ++
.../src/main/resources/logback-spring.xml | 6 +-
14 files changed, 305 insertions(+), 158 deletions(-)
delete mode 100644 platform-common/src/main/java/org/micai/platform/common/base/exception/DefaultException.java
create mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/RequestMatcherConfig.java
create mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
index f81103f..d35df53 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
@@ -11,7 +11,6 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.A
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
-import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices;
@@ -62,7 +61,7 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
/**
* @Author : liuCong
* @Date : 2022/11/24 下午 2:50
- * @Description :在认证管理器的令牌端点配置中添加---用在密码模式授权
+ * @Description :用来配置授权(authorization)以及令牌(token)的访问端点和令牌服务(token services)。
* @Throws : //
* @Params : [endpoints]
* @Return : void
@@ -93,6 +92,12 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
}
}
+ /**
+ * 用来配置令牌端点(Token Endpoint)的安全约束
+ *
+ * @param security 安全
+ * @throws Exception 异常
+ */
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
// 获取密钥需要身份认证,使用单点登录时必须配置
@@ -103,25 +108,15 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
.allowFormAuthenticationForClients();
}
-
- /**
- * 基于jdbc存储客户端信息,需要先进行配置
- *
- * @return
- */
- public ClientDetailsService clientDetailsService() {
- return new JdbcClientDetailsService(dataSource);
- }
-
/**
- * 配置客户端信息
- * 数据库模式
- * @param clients
- * @throws Exception
+ * 用来配置客户端详情服务(ClientDetailsService),客户端详情信息在这里进行初始化,你能够把客户端详情信息写死在这里或者是通过数据库来存储调取详情信息。
+ * 包含3种方法 withClientDetails() inMemory() jdbc()
+ * @param clients 客户
+ * @throws Exception 异常
*/
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
- clients.withClientDetails(clientDetailsService());
+ clients.withClientDetails(new JdbcClientDetailsService(dataSource));
}
}
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/TokenConfig.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/TokenConfig.java
index 30dd59e..0ee57c3 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/TokenConfig.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/TokenConfig.java
@@ -26,7 +26,7 @@ public class TokenConfig {
* @Throws : //
* @Params : []
* @Return : org.springframework.security.oauth2.provider.token.store.JwtTokenStore
- * 默认使用的是InMemoryTokenStore来存储,如果用数据库,那么每次token服务查询、存储,都需要SQL操作。这里重点 JdbcTokenStore。
+ * 默认使用的是InMemoryTokenStore来存储,如果用数据库,那么每次token服务查询、存储,都需要SQL操作。
**/
@Bean
public JwtTokenStore jwtTokenStore(){
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTLoginFilter.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTLoginFilter.java
index dcd24ff..d2bf16a 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTLoginFilter.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTLoginFilter.java
@@ -150,7 +150,7 @@ public class JWTLoginFilter extends UsernamePasswordAuthenticationFilter {
writer.flush();
writer.close();
} catch (Exception e) {
- log.error("successfulAuthentication error:" + e);
+ log.error("successfulAuthentication error:{}",e.toString());
}
}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/exception/DefaultException.java b/platform-common/src/main/java/org/micai/platform/common/base/exception/DefaultException.java
deleted file mode 100644
index 621c06e..0000000
--- a/platform-common/src/main/java/org/micai/platform/common/base/exception/DefaultException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.micai.platform.common.base.exception;
-
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.common.base.constant.ConstantEnum;
-import org.micai.platform.common.base.result.Result;
-import org.springframework.context.support.DefaultMessageSourceResolvable;
-import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-import java.util.stream.Collectors;
-
-@RestControllerAdvice
-@Slf4j
-public class DefaultException {
-
- @ExceptionHandler(MethodArgumentNotValidException.class)
- @ResponseBody
- public Result methodArgumentNotValidException(MethodArgumentNotValidException exception) {
- log.info("捕获异常MethodArgumentNotValidException");
- String message = exception.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
- return new Result(ConstantEnum.FAIL,message);
- }
-
-}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
index c40349d..e113cad 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
@@ -1,10 +1,13 @@
package org.micai.platform.common.base.exception;
+import io.jsonwebtoken.SignatureException;
import lombok.extern.slf4j.Slf4j;
import org.micai.platform.common.base.constant.ConstantEnum;
import org.micai.platform.common.base.result.Result;
+import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.access.AccessDeniedException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -12,6 +15,7 @@ import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.servlet.NoHandlerFoundException;
import java.net.ConnectException;
+import java.util.stream.Collectors;
/**
* @ClassName GlobalExceptionHandler
@@ -54,4 +58,19 @@ public class GlobalExceptionHandler {
log.error(e.getMessage(), e);
return new Result(ConstantEnum.ACCESS_DENIED);
}
+
+ @ExceptionHandler(value = SignatureException.class)
+ @ResponseBody
+ public Result signatureException(AccessDeniedException e) {
+ log.error(e.getMessage(), e);
+ return new Result(ConstantEnum.SIGNATURE_EX);
+ }
+
+ @ExceptionHandler(MethodArgumentNotValidException.class)
+ @ResponseBody
+ public Result methodArgumentNotValidException(MethodArgumentNotValidException exception) {
+ log.info("捕获异常MethodArgumentNotValidException");
+ String message = exception.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
+ return new Result(ConstantEnum.FAIL,message);
+ }
}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/CodeGenerator.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/CodeGenerator.java
index 752af62..e5706a7 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/CodeGenerator.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/CodeGenerator.java
@@ -25,8 +25,7 @@ public class CodeGenerator {
// 2、全局配置
GlobalConfig gc = new GlobalConfig();
- String projectPath = System.getProperty("user.dir");
- gc.setOutputDir(projectPath + "/src/main/java");
+ gc.setOutputDir("D:\\AStudySpace\\springsecurity-oauth2\\oauth-sso-server\\src\\main\\java");
gc.setAuthor("liucong");
gc.setOpen(false); //生成后是否打开资源管理器
gc.setFileOverride(false); //重新生成时文件是否覆盖
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/RequestMatcherConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/RequestMatcherConfig.java
new file mode 100644
index 0000000..b11baf9
--- /dev/null
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/RequestMatcherConfig.java
@@ -0,0 +1,52 @@
+package org.micai.platform.resourcesserver.config;
+
+import cn.hutool.core.util.ObjectUtil;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author liuCong
+ * @Date 2022/12/12 下午 2:01
+ * @ClassName RequestMatcherConfig
+ * @Description
+ */
+@Component
+@Slf4j
+@ConfigurationProperties(prefix = "request.matcher")
+@Data
+public class RequestMatcherConfig {
+
+ private List authJwtRequestMatcher = new ArrayList<>();
+
+ private List authOAuth2RequestMatcher = new ArrayList<>();
+
+
+ private List jwtAuthList;
+
+ private List oauth2AuthList;
+
+ @PostConstruct
+ public void initMatcher() {
+ if (ObjectUtil.isNotEmpty(jwtAuthList)) {
+ for (String jwtAuth : jwtAuthList) {
+ authJwtRequestMatcher.add(new AntPathRequestMatcher(jwtAuth));
+ }
+ }
+
+ if (ObjectUtil.isNotEmpty(oauth2AuthList)) {
+ for (String oauth2Auth : oauth2AuthList) {
+ authOAuth2RequestMatcher.add(new AntPathRequestMatcher(oauth2Auth));
+ }
+ }
+ log.info("init request matcher list:==========================>>>>>>>>>>>>>>>>> \n" +
+ "authJwtRequestMatcher:{},authOAuth2RequestMatcher{} "
+ , authJwtRequestMatcher, authOAuth2RequestMatcher);
+ }
+}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
index 7213971..db2d2a7 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
@@ -1,12 +1,28 @@
package org.micai.platform.resourcesserver.config;
+import org.micai.platform.common.base.constant.ConstantCode;
+import org.micai.platform.resourcesserver.filter.AuthHeaderFilter;
+import org.micai.platform.resourcesserver.filter.JWTAuthenticationFilter;
+import org.micai.platform.resourcesserver.handler.Http401AuthenticationEntryPoint;
+import org.micai.platform.resourcesserver.provider.CustomAuthenticationProvider;
+import org.micai.platform.resourcesserver.service.PermissionService;
+import org.micai.platform.resourcesserver.service.RolePermissionService;
+import org.micai.platform.resourcesserver.service.RoleService;
+import org.micai.platform.resourcesserver.service.UserRoleService;
+import org.micai.platform.resourcesserver.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
+import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
+import org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter;
/**
* @Author liuCong
@@ -18,12 +34,63 @@ import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
+ /**
+ * 需要放行的URL
+ */
+ private static final String[] AUTH_WHITELIST = {
+ // -- register url
+ "/users/signup",
+ "/upload/store",
+
+ // -- swagger ui
+ "/v2/api-docs",
+ "/swagger-resources",
+ "/swagger-resources/**",
+ "/webjars/**",
+ "/doc.html",
+
+ // other public endpoints of your API may be appended to this array
+ };
+
@Autowired
private JwtTokenStore jwtTokenStore;
@Value("${resource-ids}")
private String resourceIds;
+ @Value("${jwt.sign.key}")
+ private String signKey;
+
+ @Autowired
+ private UserService userService;
+
+ @Autowired
+ private BCryptPasswordEncoder bCryptPasswordEncoder;
+
+ @Autowired
+ private UserRoleService userRoleService;
+
+ @Autowired
+ private RoleService roleService;
+
+ @Autowired
+ private RolePermissionService rolePermissionService;
+
+ @Autowired
+ private PermissionService permissionService;
+
+ @Autowired
+ private AuthenticationManager authenticationManager;
+
+ @Autowired
+ private RequestMatcherConfig requestMatcherConfig;
+
+ /**
+ * 配置:设置oauth2验证规则
+ *
+ * @param resources 资源
+ * @throws Exception 异常
+ */
@Override
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
resources
@@ -32,4 +99,45 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
;
}
+
+ /**
+ * 设置 HTTP 验证规则
+ *
+ * @param http
+ * @throws Exception
+ */
+ @Override
+ public void configure(HttpSecurity http) throws Exception {
+ http
+ .cors().and().csrf().disable()//禁止跨域
+ .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)//session管理机制: 不会保存session状态
+
+ .and()
+ .exceptionHandling()// 自定义异常处理
+ .authenticationEntryPoint(new Http401AuthenticationEntryPoint(ConstantCode.BASE_REALM)) // 未登录处理
+
+ .and()
+ // 自定义过滤器
+ //.addFilter(new JWTAuthenticationFilter(authenticationManager, signKey))
+ .authorizeRequests()// 验证策略
+ .antMatchers(AUTH_WHITELIST).permitAll()// 无需验证路径
+ .anyRequest().authenticated() // 所有请求需要身份认证
+
+ .and()
+ .logout() // 默认注销行为为logout,可以通过下面的方式来修改
+ .logoutUrl("/logout")
+ .logoutSuccessUrl("/")// 设置注销成功后跳转页面,默认是跳转到登录页面;
+ .permitAll();
+
+ AuthHeaderFilter authHeaderFilter = new AuthHeaderFilter();
+ authHeaderFilter.setAuthHeaderRequestMatcher(requestMatcherConfig.getAuthJwtRequestMatcher(), requestMatcherConfig.getAuthOAuth2RequestMatcher());
+ //为什么要在after
+ //因为OAuth2AuthenticationProcessingFilter.doFilter()包含了SecurityContextHolder.clearContext();
+ http.addFilterAfter(new JWTAuthenticationFilter(authenticationManager,signKey), AbstractPreAuthenticatedProcessingFilter.class);
+ http.addFilterAfter(authHeaderFilter, X509AuthenticationFilter.class);
+ // 使用自定义身份验证组件
+ http.authenticationProvider(new CustomAuthenticationProvider(userService, bCryptPasswordEncoder,userRoleService,
+ roleService,rolePermissionService,permissionService));
+ }
+
}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SwaggerConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SwaggerConfig.java
index 45294c8..e0cac6e 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SwaggerConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SwaggerConfig.java
@@ -42,16 +42,15 @@ public class SwaggerConfig {
List pars = new ArrayList();
tokenPar.name("Authorization").description("令牌").modelRef(new ModelRef("string")).parameterType("header").required(true).build();
pars.add(tokenPar.build());
- Docket docket = new Docket(DocumentationType.SWAGGER_2)
+ return new Docket(DocumentationType.SWAGGER_2)
.select()
- .apis(RequestHandlerSelectors.basePackage("org.micai.platform.auth.controller"))
+ .apis(RequestHandlerSelectors.basePackage("org.micai.platform.resourcesserver.controller"))
.paths(PathSelectors.ant("/**"))
.build()
.globalOperationParameters(pars)
.apiInfo(apiInfo())
.useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 queue").responseModel(new ModelRef("Error")).build(), new ResponseMessageBuilder().code(403).message("Forbidden!!!!!").build()));
- return docket;
}
private ApiInfo apiInfo() {
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/WebSecurityConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/WebSecurityConfig.java
index aedabf1..9092654 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/WebSecurityConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/WebSecurityConfig.java
@@ -1,23 +1,11 @@
package org.micai.platform.resourcesserver.config;
-import org.micai.platform.common.base.constant.ConstantCode;
-import org.micai.platform.resourcesserver.filter.JWTAuthenticationFilter;
-import org.micai.platform.resourcesserver.handler.CustomAuthenticationFailureHandler;
-import org.micai.platform.resourcesserver.handler.Http401AuthenticationEntryPoint;
-import org.micai.platform.resourcesserver.provider.CustomAuthenticationProvider;
-import org.micai.platform.resourcesserver.service.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.config.http.SessionCreationPolicy;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
/**
* SpringSecurity的配置
@@ -30,101 +18,10 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
- /**
- * 需要放行的URL
- */
- private static final String[] AUTH_WHITELIST = {
- // -- register url
- "/users/signup",
- "/upload/store",
-
- // -- swagger ui
- "/v2/api-docs",
- "/swagger-resources",
- "/swagger-resources/**",
- "/webjars/**",
- "/doc.html",
-
- // other public endpoints of your API may be appended to this array
- //oauth2
- };
-
- @Autowired
- private UserService userService;
-
- @Autowired
- private BCryptPasswordEncoder bCryptPasswordEncoder;
-
- @Autowired
- private UserRoleService userRoleService;
-
- @Autowired
- private RoleService roleService;
-
- @Autowired
- private RolePermissionService rolePermissionService;
-
- @Autowired
- private PermissionService permissionService;
-
- @Autowired
- private CustomAuthenticationFailureHandler customAuthenticationFailureHandler;
-
- @Value("${jwt.sign.key}")
- private String signKey;
-
- @Value("${jwt.expiration.time}")
- private int expirationTime;
-
@Bean
@Override
protected AuthenticationManager authenticationManager() throws Exception {
- return super.authenticationManager();
- }
-
- /**
- * 设置 HTTP 验证规则
- *
- * @param http
- * @throws Exception
- */
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http
- .cors().and().csrf().disable()//禁止跨域
- .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)//session管理机制: 不会保存session状态
-
- .and()
- .exceptionHandling()// 自定义异常处理
- .authenticationEntryPoint(new Http401AuthenticationEntryPoint(ConstantCode.BASE_REALM)) // 未登录处理
-// .and()//权限不足处理.exceptionHandling().accessDeniedHandler(customAccessDeniedHandler) // 自定义访问失败处理器
-
- .and()
- // 自定义过滤器
- .addFilter(new JWTAuthenticationFilter(authenticationManager(), signKey))
- .authorizeRequests()// 验证策略
- .antMatchers(AUTH_WHITELIST).permitAll()// 无需验证路径
- .anyRequest().authenticated() // 所有请求需要身份认证
-
- .and()
- .logout() // 默认注销行为为logout,可以通过下面的方式来修改
- .logoutUrl("/logout")
- .logoutSuccessUrl("/login")// 设置注销成功后跳转页面,默认是跳转到登录页面;
-// .logoutSuccessHandler(customLogoutSuccessHandler)
- .permitAll();
+ return super.authenticationManager();
}
-
- /**
- * 该方法是登录的时候会进入
- *
- * @param auth
- * @throws Exception
- */
- @Override
- public void configure(AuthenticationManagerBuilder auth) throws Exception {
- // 使用自定义身份验证组件
- auth.authenticationProvider(new CustomAuthenticationProvider(userService, bCryptPasswordEncoder,userRoleService,
- roleService,rolePermissionService,permissionService));
- }
}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
new file mode 100644
index 0000000..9fa2360
--- /dev/null
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
@@ -0,0 +1,90 @@
+package org.micai.platform.resourcesserver.filter;
+
+import cn.hutool.core.util.ObjectUtil;
+import org.micai.platform.common.base.constant.ConstantCode;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+import org.springframework.util.Assert;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * @Author liuCong
+ * @Date 2022/12/12 上午 9:58
+ * @ClassName AuthHeaderFilter
+ * @Description
+ */
+public class AuthHeaderFilter implements Filter {
+
+ //拦截接口让JWTAuthenticationFilter去验证
+ private List authJwtRequestMatcher;
+
+ //拦截接口让OAuth2AuthenticationProcessingFilter去验证
+ private List authOAuth2RequestMatcher;
+
+ public void setAuthHeaderRequestMatcher(List authJwtRequestMatcher, List authOAuth2RequestMatcher) {
+ Assert.notNull(authJwtRequestMatcher, "authJwtRequestMatcher cannot be null");
+ Assert.notNull(authOAuth2RequestMatcher, "authOAuth2RequestMatcher cannot be null");
+ this.authJwtRequestMatcher = authJwtRequestMatcher;
+ this.authOAuth2RequestMatcher = authOAuth2RequestMatcher;
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+ HttpServletRequest request = (HttpServletRequest) servletRequest;
+ HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper((HttpServletRequest) servletRequest) {
+
+
+ /**
+ * 得到头
+ *为了让在
+ *JWTAuthenticationFilter 获取token时为空
+ * @param name 名字
+ * @return {@link String}
+ */
+ @Override
+ public String getHeader(String name) {
+ if (ObjectUtil.isNotEmpty(authJwtRequestMatcher)) {
+ for (AntPathRequestMatcher antPathRequestMatcher : authJwtRequestMatcher) {
+ if (antPathRequestMatcher.matches(request) && ConstantCode.AUTHORIZATION.equalsIgnoreCase(name)) {
+ return super.getHeader(name);
+ }
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * 重写得到头方法
+ * 为了让在
+ * OAuth2AuthenticationProcessingFilter
+ * org.springframework.security.oauth2.provider.authentication.BearerTokenExtractor#extractHeaderToken(javax.servlet.http.HttpServletRequest)
+ * 获取的token时候为空
+ * @param name 名字
+ * @return {@link Enumeration}<{@link String}>
+ */
+ @Override
+ public Enumeration getHeaders(String name) {
+ if (ObjectUtil.isNotEmpty(authOAuth2RequestMatcher)) {
+ for (AntPathRequestMatcher antPathRequestMatcher : authOAuth2RequestMatcher) {
+ if (antPathRequestMatcher.matches(request) && ConstantCode.AUTHORIZATION.equalsIgnoreCase(name)) {
+ return super.getHeaders(name);
+ }
+ }
+ }
+ return new Vector().elements();
+ }
+ };
+ filterChain.doFilter(requestWrapper, servletResponse);
+ }
+}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java
index 2155e9c..5e80b66 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java
@@ -2,7 +2,13 @@ package org.micai.platform.resourcesserver.filter;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
-import io.jsonwebtoken.*;
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.ExpiredJwtException;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.MalformedJwtException;
+import io.jsonwebtoken.SignatureAlgorithm;
+import io.jsonwebtoken.SignatureException;
+import io.jsonwebtoken.UnsupportedJwtException;
import lombok.extern.slf4j.Slf4j;
import org.micai.platform.common.base.constant.ConstantCode;
import org.micai.platform.common.base.constant.ConstantEnum;
diff --git a/platform-resources-server/src/main/resources/application-dev.yml b/platform-resources-server/src/main/resources/application-dev.yml
index c4ec76e..0dcb455 100644
--- a/platform-resources-server/src/main/resources/application-dev.yml
+++ b/platform-resources-server/src/main/resources/application-dev.yml
@@ -20,3 +20,11 @@ jwt:
time: 15
resource-ids: user
+
+request:
+ matcher:
+ jwtAuthList:
+ - /user/info
+ - /user/list
+ oauth2AuthList:
+ - /demo
diff --git a/platform-resources-server/src/main/resources/logback-spring.xml b/platform-resources-server/src/main/resources/logback-spring.xml
index 4a1d217..896f83d 100644
--- a/platform-resources-server/src/main/resources/logback-spring.xml
+++ b/platform-resources-server/src/main/resources/logback-spring.xml
@@ -26,8 +26,8 @@
-
- trace
+ debug
+
${PATTERN_COLOR}
@@ -42,7 +42,7 @@
-
+
--
Gitee
From 13a238546a32ddf628c7c7bd6ea56a0957e1e2b2 Mon Sep 17 00:00:00 2001
From: liucong
Date: Mon, 12 Dec 2022 17:24:37 +0800
Subject: [PATCH 04/16] =?UTF-8?q?platform-common=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8=E8=A3=85=E9=85=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/base/WebStarterAutoConfig.java | 20 +++++++
.../base/controller/ExceptionController.java | 56 +++++++++++++++++++
.../exception/GlobalExceptionHandler.java | 14 +++--
.../main/resources/META-INF/spring.factories | 3 +
pom.xml | 6 +-
5 files changed, 91 insertions(+), 8 deletions(-)
create mode 100644 platform-common/src/main/java/org/micai/platform/common/base/WebStarterAutoConfig.java
create mode 100644 platform-common/src/main/java/org/micai/platform/common/base/controller/ExceptionController.java
create mode 100644 platform-common/src/main/resources/META-INF/spring.factories
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/WebStarterAutoConfig.java b/platform-common/src/main/java/org/micai/platform/common/base/WebStarterAutoConfig.java
new file mode 100644
index 0000000..6924fa4
--- /dev/null
+++ b/platform-common/src/main/java/org/micai/platform/common/base/WebStarterAutoConfig.java
@@ -0,0 +1,20 @@
+package org.micai.platform.common.base;
+
+import org.micai.platform.common.base.controller.ExceptionController;
+import org.micai.platform.common.base.exception.GlobalExceptionHandler;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+
+/**
+ * @Author liuCong
+ * @Date 2022/12/12 下午 3:55
+ * @ClassName WebStarterAutoConfig
+ * @Description
+ */
+@Configuration
+@Import({GlobalExceptionHandler.class, ExceptionController.class})
+public class WebStarterAutoConfig {
+
+ public WebStarterAutoConfig() {
+ }
+}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/controller/ExceptionController.java b/platform-common/src/main/java/org/micai/platform/common/base/controller/ExceptionController.java
new file mode 100644
index 0000000..1b3ccc1
--- /dev/null
+++ b/platform-common/src/main/java/org/micai/platform/common/base/controller/ExceptionController.java
@@ -0,0 +1,56 @@
+package org.micai.platform.common.base.controller;
+
+import io.jsonwebtoken.ExpiredJwtException;
+import io.jsonwebtoken.MalformedJwtException;
+import io.jsonwebtoken.UnsupportedJwtException;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.SignatureException;
+
+/**
+ * @Author liuCong
+ * @Date 2022/12/12 下午 3:24
+ * @ClassName ExceptionController
+ * @Description
+ */
+@RestController
+public class ExceptionController {
+
+ @RequestMapping("/expiredJwtException")
+ public void expiredJwtException(HttpServletRequest request) throws ExpiredJwtException {
+ if (request.getAttribute("expiredJwtException") instanceof ExpiredJwtException) {
+ throw ((ExpiredJwtException) request.getAttribute("expiredJwtException"));
+ }
+ }
+
+ @RequestMapping("/unsupportedJwtException")
+ public void unsupportedJwtException(HttpServletRequest request) throws UnsupportedJwtException {
+ if (request.getAttribute("unsupportedJwtException") instanceof UnsupportedJwtException) {
+ throw ((UnsupportedJwtException) request.getAttribute("unsupportedJwtException"));
+ }
+ }
+
+ @RequestMapping("/signatureException")
+ public void signatureException(HttpServletRequest request) throws SignatureException {
+ if (request.getAttribute("signatureException") instanceof SignatureException) {
+ throw ((SignatureException) request.getAttribute("signatureException"));
+ }
+ }
+
+ @RequestMapping("/illegalArgumentException")
+ public void illegalArgumentException(HttpServletRequest request) throws IllegalArgumentException {
+ if (request.getAttribute("illegalArgumentException") instanceof IllegalArgumentException) {
+ throw ((IllegalArgumentException) request.getAttribute("illegalArgumentException"));
+ }
+ }
+
+ @RequestMapping("/malformedJwtException")
+ public void malformedJwtException(HttpServletRequest request) throws MalformedJwtException {
+ if (request.getAttribute("malformedJwtException") instanceof MalformedJwtException) {
+ throw ((MalformedJwtException) request.getAttribute("malformedJwtException"));
+ }
+ }
+
+}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
index e113cad..b1f96b7 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
@@ -8,9 +8,8 @@ import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.servlet.NoHandlerFoundException;
@@ -24,7 +23,7 @@ import java.util.stream.Collectors;
* @Date 2021/11/26 15:59
* @Version 1.0
*/
-@ControllerAdvice
+@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
@@ -53,24 +52,27 @@ public class GlobalExceptionHandler {
}
@ExceptionHandler(value = AccessDeniedException.class)
- @ResponseBody
public Result accessDeniedException(AccessDeniedException e) {
log.error(e.getMessage(), e);
return new Result(ConstantEnum.ACCESS_DENIED);
}
@ExceptionHandler(value = SignatureException.class)
- @ResponseBody
public Result signatureException(AccessDeniedException e) {
log.error(e.getMessage(), e);
return new Result(ConstantEnum.SIGNATURE_EX);
}
@ExceptionHandler(MethodArgumentNotValidException.class)
- @ResponseBody
public Result methodArgumentNotValidException(MethodArgumentNotValidException exception) {
log.info("捕获异常MethodArgumentNotValidException");
String message = exception.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
return new Result(ConstantEnum.FAIL,message);
}
+
+ @ExceptionHandler(value = Exception.class)
+ public Result exception(Exception e) {
+ log.error(e.getMessage(), e);
+ return new Result(ConstantEnum.FAIL);
+ }
}
diff --git a/platform-common/src/main/resources/META-INF/spring.factories b/platform-common/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..a4bf2f1
--- /dev/null
+++ b/platform-common/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,3 @@
+# Auto Configure
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.micai.platform.common.base.WebStarterAutoConfig
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 18fe870..d442899 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,9 @@
platform-common
- 1.8
+ 8
+ 8
+ UTF-8
5.1.30
0.7.0
1.2.78
@@ -197,7 +199,7 @@
-
+
spring-milestones
--
Gitee
From 95cd4cb38dca61d236e73f26ddf4b63956e17a49 Mon Sep 17 00:00:00 2001
From: liucong
Date: Mon, 12 Dec 2022 17:40:40 +0800
Subject: [PATCH 05/16] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BC=82=E5=B8=B8?=
=?UTF-8?q?=E5=A4=84=E7=90=86=E7=B1=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../exception/GlobalExceptionHandler.java | 32 +++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
index b1f96b7..7c5b9b0 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
@@ -1,6 +1,9 @@
package org.micai.platform.common.base.exception;
+import io.jsonwebtoken.ExpiredJwtException;
+import io.jsonwebtoken.MalformedJwtException;
import io.jsonwebtoken.SignatureException;
+import io.jsonwebtoken.UnsupportedJwtException;
import lombok.extern.slf4j.Slf4j;
import org.micai.platform.common.base.constant.ConstantEnum;
import org.micai.platform.common.base.result.Result;
@@ -51,18 +54,43 @@ public class GlobalExceptionHandler {
return new Result(ConstantEnum.RESOURCE_ACCESS);
}
- @ExceptionHandler(value = AccessDeniedException.class)
+ @ExceptionHandler(AccessDeniedException.class)
public Result accessDeniedException(AccessDeniedException e) {
log.error(e.getMessage(), e);
return new Result(ConstantEnum.ACCESS_DENIED);
}
- @ExceptionHandler(value = SignatureException.class)
+ @ExceptionHandler(SignatureException.class)
public Result signatureException(AccessDeniedException e) {
log.error(e.getMessage(), e);
return new Result(ConstantEnum.SIGNATURE_EX);
}
+ @ExceptionHandler(ExpiredJwtException.class)
+ public Result expiredJwtException(ExpiredJwtException e) {
+ log.error(e.getMessage(), e);
+ return new Result(ConstantEnum.EXPIRED_JWT);
+ }
+
+ @ExceptionHandler(UnsupportedJwtException.class)
+ public Result unsupportedJwtException(UnsupportedJwtException e) {
+ log.error(e.getMessage(), e);
+ return new Result(ConstantEnum.TOKEN_ERROR);
+ }
+
+ @ExceptionHandler(MalformedJwtException.class)
+ public Result MalformedJwtException(MalformedJwtException e) {
+ log.error(e.getMessage(), e);
+ return new Result(ConstantEnum.ACCESS_DENIED);
+ }
+
+ @ExceptionHandler(IllegalArgumentException.class)
+ public Result illegalArgumentException(IllegalArgumentException e) {
+ log.error(e.getMessage(), e);
+ return new Result(ConstantEnum.ACCESS_DENIED);
+ }
+
+
@ExceptionHandler(MethodArgumentNotValidException.class)
public Result methodArgumentNotValidException(MethodArgumentNotValidException exception) {
log.info("捕获异常MethodArgumentNotValidException");
--
Gitee
From a4a85d6adccc8271a6307bf7ea2e44a8dfdd748d Mon Sep 17 00:00:00 2001
From: liucong
Date: Tue, 13 Dec 2022 14:47:43 +0800
Subject: [PATCH 06/16] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BC=82=E5=B8=B8?=
=?UTF-8?q?=E5=A4=84=E7=90=86=E7=B1=BB,=E5=B9=B6=E7=BB=9F=E4=B8=80?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AuthorizationServerConfiguration.java | 14 ++
.../authserver/config/TokenConfig.java | 8 +-
.../authserver/config/WebSecurityConfig.java | 19 +-
.../filter/JWTAuthenticationFilter.java | 22 +-
.../authserver/filter/JWTLoginFilter.java | 38 ++--
.../src/main/resources/application-dev.yml | 20 ++
.../src/main/resources/application.yml | 6 -
.../base/config/MicaiPlatformOauthConfig.java | 35 +++
.../config/MicaiPlatformRequestMatcher.java | 21 ++
.../config/MicaiPlatformResourcesConfig.java | 23 ++
.../base/config/MicaiPlatformTokenConfig.java | 31 +++
.../exception/GlobalExceptionHandler.java | 2 +-
.../main/resources/META-INF/spring.factories | 5 +-
.../config/RequestMatcherConfig.java | 52 -----
.../config/ResourceServerConfig.java | 20 +-
.../resourcesserver/config/TokenConfig.java | 7 +-
.../filter/AuthHeaderFilter.java | 26 ++-
.../filter/JWTAuthenticationFilter.java | 22 +-
.../resourcesserver/utils/JwtHelper.java | 212 +++++++++---------
.../src/main/resources/application-dev.yml | 41 ++--
.../src/main/resources/application.yml | 6 -
21 files changed, 377 insertions(+), 253 deletions(-)
create mode 100644 platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformOauthConfig.java
create mode 100644 platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformRequestMatcher.java
create mode 100644 platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformResourcesConfig.java
create mode 100644 platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformTokenConfig.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/RequestMatcherConfig.java
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
index d35df53..bc8c96c 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
@@ -1,6 +1,7 @@
package org.micai.platform.authserver.config;
import org.micai.platform.authserver.handler.AuthApprovalHandler;
+import org.micai.platform.common.base.config.MicaiPlatformOauthConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -14,6 +15,7 @@ import org.springframework.security.oauth2.config.annotation.web.configurers.Aut
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices;
+import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
import org.springframework.security.oauth2.provider.token.TokenEnhancer;
import org.springframework.security.oauth2.provider.token.TokenEnhancerChain;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
@@ -52,6 +54,9 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
@Autowired
private JwtTokenEnhancer jwtTokenEnhancer;
+ @Autowired
+ private MicaiPlatformOauthConfig micaiPlatformOauthConfig;
+
@Bean
public AuthorizationCodeServices jdbcAuthorizationCodeServices() {
// JDBC方式保存授权码到 oauth_code 表中
@@ -90,6 +95,15 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
enhancerChain.setTokenEnhancers(enhancers);
endpoints.tokenEnhancer(enhancerChain);
}
+
+ DefaultTokenServices tokenServices = new DefaultTokenServices();
+ tokenServices.setTokenStore(endpoints.getTokenStore());
+ tokenServices.setSupportRefreshToken(true);
+ tokenServices.setClientDetailsService(endpoints.getClientDetailsService());
+ tokenServices.setTokenEnhancer(endpoints.getTokenEnhancer());
+ tokenServices.setAccessTokenValiditySeconds(micaiPlatformOauthConfig.getTokenTimeout());
+ tokenServices.setRefreshTokenValiditySeconds(micaiPlatformOauthConfig.getRefreshTimeout());
+ endpoints.tokenServices(tokenServices);
}
/**
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/TokenConfig.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/TokenConfig.java
index 0ee57c3..2c3a9fb 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/TokenConfig.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/TokenConfig.java
@@ -1,5 +1,7 @@
package org.micai.platform.authserver.config;
+import org.micai.platform.common.base.config.MicaiPlatformOauthConfig;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
@@ -15,8 +17,8 @@ import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
public class TokenConfig {
- // jwt模式token
- private static final String SIGN_KEY = "2728689210118790161";
+ @Autowired
+ private MicaiPlatformOauthConfig micaiPlatformOauthConfig;
/**
@@ -44,7 +46,7 @@ public class TokenConfig {
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(){
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
- converter.setSigningKey(SIGN_KEY);
+ converter.setSigningKey(micaiPlatformOauthConfig.getSignKey());
return converter;
}
}
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/WebSecurityConfig.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/WebSecurityConfig.java
index b8d764e..3107519 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/WebSecurityConfig.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/WebSecurityConfig.java
@@ -6,11 +6,15 @@ import org.micai.platform.authserver.filter.JWTLoginFilter;
import org.micai.platform.authserver.handler.CustomAuthenticationFailureHandler;
import org.micai.platform.authserver.handler.Http401AuthenticationEntryPoint;
import org.micai.platform.authserver.provider.CustomAuthenticationProvider;
-import org.micai.platform.authserver.service.*;
+import org.micai.platform.authserver.service.PermissionService;
+import org.micai.platform.authserver.service.RolePermissionService;
+import org.micai.platform.authserver.service.RoleService;
+import org.micai.platform.authserver.service.UserRoleService;
+import org.micai.platform.authserver.service.UserService;
import org.micai.platform.authserver.service.impl.UserDetailsServiceImpl;
+import org.micai.platform.common.base.config.MicaiPlatformTokenConfig;
import org.micai.platform.common.base.constant.ConstantCode;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
@@ -55,11 +59,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CustomAuthenticationFailureHandler customAuthenticationFailureHandler;
- @Value("${jwt.sign.key}")
- private String signKey;
-
- @Value("${jwt.expiration.time}")
- private int expirationTime;
+ @Autowired
+ private MicaiPlatformTokenConfig micaiPlatformTokenConfig;
@Bean
@Override
@@ -86,8 +87,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.and()
// 自定义过滤器
- .addFilter(new JWTLoginFilter(authenticationManager(), signKey, expirationTime, customAuthenticationFailureHandler))
- .addFilter(new JWTAuthenticationFilter(authenticationManager(), signKey))
+ .addFilter(new JWTLoginFilter(authenticationManager(), micaiPlatformTokenConfig, customAuthenticationFailureHandler))
+ .addFilter(new JWTAuthenticationFilter(authenticationManager(), micaiPlatformTokenConfig))
.authorizeRequests()// 验证策略
.anyRequest().authenticated() // 所有请求需要身份认证
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTAuthenticationFilter.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTAuthenticationFilter.java
index 7fc83f1..426fdef 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTAuthenticationFilter.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTAuthenticationFilter.java
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import io.jsonwebtoken.*;
import lombok.extern.slf4j.Slf4j;
import org.micai.platform.authserver.service.impl.GrantedAuthorityImpl;
+import org.micai.platform.common.base.config.MicaiPlatformTokenConfig;
import org.micai.platform.common.base.constant.ConstantCode;
import org.micai.platform.common.base.constant.ConstantEnum;
import org.micai.platform.common.base.exception.PlatformException;
@@ -34,17 +35,17 @@ import java.util.List;
@Slf4j
public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
- private final String signKey;
+ private final MicaiPlatformTokenConfig micaiPlatformTokenConfig;
- public JWTAuthenticationFilter(AuthenticationManager authenticationManager, String signKey) {
+ public JWTAuthenticationFilter(AuthenticationManager authenticationManager, MicaiPlatformTokenConfig micaiPlatformTokenConfig) {
super(authenticationManager);
- this.signKey = signKey;
+ this.micaiPlatformTokenConfig = micaiPlatformTokenConfig;
}
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
- String header = request.getHeader(ConstantCode.AUTHORIZATION);
- if (ObjectUtil.isEmpty(header) || !header.startsWith(ConstantCode.HEADER_BEARER)) {
+ String header = request.getHeader(micaiPlatformTokenConfig.getTokenName());
+ if (ObjectUtil.isEmpty(header) || !header.startsWith(micaiPlatformTokenConfig.getTokenPrefix())) {
chain.doFilter(request, response);
return;
}
@@ -56,13 +57,16 @@ public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
long start = System.currentTimeMillis();
- String token = request.getHeader(ConstantCode.AUTHORIZATION);
+ String token = request.getHeader(micaiPlatformTokenConfig.getTokenName());
if (ObjectUtil.isEmpty(token)) {
throw new PlatformException(ConstantEnum.TOKEN_MISS);
}
// parse the token.
String user = null;
- Claims claims = Jwts.parser().setSigningKey(signKey).parseClaimsJws(token.replace(ConstantCode.HEADER_BEARER, "")).getBody();
+ Claims claims = Jwts.parser()
+ .setSigningKey(micaiPlatformTokenConfig.getSignKey())
+ .parseClaimsJws(token.replace(micaiPlatformTokenConfig.getTokenPrefix(), ""))
+ .getBody();
log.info("相关信息 : {}",claims.getSubject());
// token签发时间
long issuedAt = claims.getIssuedAt().getTime();
@@ -88,7 +92,7 @@ public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
.setSubject(claims.getSubject())
.setIssuedAt(now)//签发时间
.setExpiration(time)//过期时间
- .signWith(SignatureAlgorithm.HS512, signKey) //采用什么算法是可以自己选择的,不一定非要采用HS512
+ .signWith(SignatureAlgorithm.HS512, micaiPlatformTokenConfig.getSignKey()) //采用什么算法是可以自己选择的,不一定非要采用HS512
.compact();
// 重新生成token end
@@ -96,7 +100,7 @@ public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
response.addHeader(ConstantCode.REFRESH_TOKEN, refreshToken);
}
long end = System.currentTimeMillis();
- logger.info("执行时间: " + (end - start) + " 毫秒");
+ log.info("执行时间: " + (end - start) + " 毫秒");
user = claims.getSubject();
if (ObjectUtil.isNotEmpty(user)) {
String authStr = user.split("-")[ConstantCode.INT_TWO];
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTLoginFilter.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTLoginFilter.java
index d2bf16a..59ecd4b 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTLoginFilter.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/filter/JWTLoginFilter.java
@@ -7,6 +7,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
import lombok.extern.slf4j.Slf4j;
import org.micai.platform.authserver.bo.UserQueryBo;
import org.micai.platform.authserver.handler.CustomAuthenticationFailureHandler;
+import org.micai.platform.common.base.config.MicaiPlatformTokenConfig;
import org.micai.platform.common.base.constant.ConstantCode;
import org.micai.platform.common.base.constant.ConstantEnum;
import org.micai.platform.common.base.result.Result;
@@ -23,7 +24,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* 自定义JWT登录过滤器
@@ -31,6 +38,7 @@ import java.util.*;
* 该类继承自UsernamePasswordAuthenticationFilter,重写了其中的2个方法
* attemptAuthentication :接收并解析用户凭证。
* successfulAuthentication :用户成功登录后,这个方法会被调用,我们在这个方法里生成token。
+ *
* @author zhaoxinguo on 2017/9/12.
*/
@Slf4j
@@ -38,22 +46,19 @@ public class JWTLoginFilter extends UsernamePasswordAuthenticationFilter {
private final AuthenticationManager authenticationManager;
- private final String signKey;
-
- private final int expirationTime;
+ private final MicaiPlatformTokenConfig micaiPlatformTokenConfig;
private final CustomAuthenticationFailureHandler customAuthenticationFailureHandler;
- public JWTLoginFilter(AuthenticationManager authenticationManager, String signKey, int expirationTime,
- CustomAuthenticationFailureHandler customAuthenticationFailureHandler) {
+ public JWTLoginFilter(AuthenticationManager authenticationManager, MicaiPlatformTokenConfig micaiPlatformTokenConfig, CustomAuthenticationFailureHandler customAuthenticationFailureHandler) {
this.authenticationManager = authenticationManager;
- this.signKey = signKey;
- this.expirationTime = expirationTime;
+ this.micaiPlatformTokenConfig = micaiPlatformTokenConfig;
this.customAuthenticationFailureHandler = customAuthenticationFailureHandler;
}
/**
* 尝试身份认证(接收并解析用户凭证)
+ *
* @param req
* @param res
* @return
@@ -63,7 +68,7 @@ public class JWTLoginFilter extends UsernamePasswordAuthenticationFilter {
public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res) {
Authentication authenticate = null;
try {
- Map requestMap = new ObjectMapper().readValue(req.getInputStream(), HashMap.class);
+ Map requestMap = new ObjectMapper().readValue(req.getInputStream(), HashMap.class);
UserQueryBo userQueryBo = new UserQueryBo()
.setUsername(requestMap.get(ConstantCode.USERNAME))
.setPassword(requestMap.get(ConstantCode.PASSWORD));
@@ -73,9 +78,9 @@ public class JWTLoginFilter extends UsernamePasswordAuthenticationFilter {
userQueryBo.getPassword(),
new ArrayList<>())
);
- }catch (AuthenticationException e) {
+ } catch (AuthenticationException e) {
try {
- customAuthenticationFailureHandler.onAuthenticationFailure(req,res,e);
+ customAuthenticationFailureHandler.onAuthenticationFailure(req, res, e);
} catch (IOException ex) {
log.error("IOException:", ex);
} catch (ServletException ex) {
@@ -101,6 +106,7 @@ public class JWTLoginFilter extends UsernamePasswordAuthenticationFilter {
/**
* 认证成功(用户成功登录后,这个方法会被调用,我们在这个方法里生成token)
+ *
* @param request
* @param response
* @param chain
@@ -122,26 +128,26 @@ public class JWTLoginFilter extends UsernamePasswordAuthenticationFilter {
for (GrantedAuthority grantedAuthority : authorities) {
roleList.add(grantedAuthority.getAuthority());
}
-
+
// 生成token start
Calendar calendar = Calendar.getInstance();
Date now = calendar.getTime();
// 设置签发时间
calendar.setTime(new Date());
// 设置过期时间
- calendar.add(Calendar.MINUTE, expirationTime);// 5分钟
+ calendar.add(Calendar.SECOND, micaiPlatformTokenConfig.getTimeout());
Date time = calendar.getTime();
String rolesStr = JSON.toJSONString(roleList);
token = Jwts.builder()
.setSubject(auth.getName() + "-" + rolesStr)
.setIssuedAt(now)//签发时间
.setExpiration(time)//过期时间
- .signWith(SignatureAlgorithm.HS512, signKey) //采用什么算法是可以自己选择的,不一定非要采用HS512
+ .signWith(SignatureAlgorithm.HS512, micaiPlatformTokenConfig.getSignKey()) //采用什么算法是可以自己选择的,不一定非要采用HS512
.compact();
// 生成token end
// 登录成功后,返回token到body里面
Map resultMap = new HashMap<>();
- resultMap.put(ConstantCode.AUTHORIZATION, ConstantCode.HEADER_BEARER + token);
+ resultMap.put(micaiPlatformTokenConfig.getTokenName(), micaiPlatformTokenConfig.getTokenPrefix() + " " + token);
Result result = new Result(ConstantEnum.SUCCESS, resultMap);
response.setContentType(ConstantCode.CONTENT_TYPE_JSON);
response.setStatus(HttpServletResponse.SC_OK);
@@ -150,7 +156,7 @@ public class JWTLoginFilter extends UsernamePasswordAuthenticationFilter {
writer.flush();
writer.close();
} catch (Exception e) {
- log.error("successfulAuthentication error:{}",e.toString());
+ log.error("successfulAuthentication error:{}", e.toString());
}
}
diff --git a/platform-auth-server/src/main/resources/application-dev.yml b/platform-auth-server/src/main/resources/application-dev.yml
index 4d1326a..06768b5 100644
--- a/platform-auth-server/src/main/resources/application-dev.yml
+++ b/platform-auth-server/src/main/resources/application-dev.yml
@@ -18,3 +18,23 @@ jwt:
#jwt 过期时间
expiration:
time: 15
+
+micai-platform-auth:
+ #jwt相关配置
+ token:
+ #sign key
+ sign-key: micai-security-@Jwt!&Secret^#
+ #jwt 过期时间 单位:分钟
+ timeout: 60
+ # token名称
+ token-name: Authorization
+ # token前缀
+ token-prefix: Bearer
+
+ oauth-auth:
+ #sign key
+ sign-key: micai-oauth2-@Jwt!&Secret^#
+ #oauth 过期时间 单位:分钟
+ token-timeout: 60
+ #刷新token
+ refresh-timeout: 60
diff --git a/platform-auth-server/src/main/resources/application.yml b/platform-auth-server/src/main/resources/application.yml
index f57047c..99f2ad1 100644
--- a/platform-auth-server/src/main/resources/application.yml
+++ b/platform-auth-server/src/main/resources/application.yml
@@ -21,9 +21,3 @@ mybatis-plus:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-
-#jwt config
-jwt:
- header: Authorization
- secret: NDU0NTY4amhmc3NkeHp6eGNxdzIlMjFAJTIxQCUyM2ZmNQ==
- expiration: 7200000
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformOauthConfig.java b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformOauthConfig.java
new file mode 100644
index 0000000..4e199a3
--- /dev/null
+++ b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformOauthConfig.java
@@ -0,0 +1,35 @@
+package org.micai.platform.common.base.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @Author liuCong
+ * @Date 2022/12/13 上午 9:38
+ * @ClassName MicaiPlatformAuthConfig
+ * @Description
+ */
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "micai-platform-auth.oauth-auth")
+public class MicaiPlatformOauthConfig {
+
+ /** JWT*/
+ private String signKey;
+
+ /** access_token的长久有效期(单位:分钟) 默认1分钟*/
+ private Integer tokenTimeout = 1;
+
+ /** refresh_token的长久有效期(单位:分钟) 默认1分钟*/
+ private Integer refreshTimeout = 1;
+
+ public Integer getTokenTimeout() {
+ return tokenTimeout;
+ }
+
+ public Integer getRefreshTimeout() {
+ return refreshTimeout;
+ }
+
+}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformRequestMatcher.java b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformRequestMatcher.java
new file mode 100644
index 0000000..fdd0c9d
--- /dev/null
+++ b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformRequestMatcher.java
@@ -0,0 +1,21 @@
+package org.micai.platform.common.base.config;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author liuCong
+ * @Date 2022/12/13 下午 2:08
+ * @ClassName MicaiPlatformRequestMatcher
+ * @Description
+ */
+@Data
+public class MicaiPlatformRequestMatcher {
+
+ private List jwtAuth;
+ private List oauth2Auth;
+
+
+
+}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformResourcesConfig.java b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformResourcesConfig.java
new file mode 100644
index 0000000..c3b3268
--- /dev/null
+++ b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformResourcesConfig.java
@@ -0,0 +1,23 @@
+package org.micai.platform.common.base.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @Author liuCong
+ * @Date 2022/12/13 上午 9:38
+ * @ClassName MicaiPlatformAuthConfig
+ * @Description
+ */
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "micai-platform-auth.oauth-resources")
+public class MicaiPlatformResourcesConfig {
+
+ /** JWT*/
+ private String signKey;
+ private String resourceIds;
+ private MicaiPlatformRequestMatcher requestMatcher;
+
+}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformTokenConfig.java b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformTokenConfig.java
new file mode 100644
index 0000000..4386710
--- /dev/null
+++ b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformTokenConfig.java
@@ -0,0 +1,31 @@
+package org.micai.platform.common.base.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @Author liuCong
+ * @Date 2022/12/13 上午 9:38
+ * @ClassName MicaiPlatformAuthConfig
+ * @Description
+ */
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "micai-platform-auth.token")
+public class MicaiPlatformTokenConfig {
+
+ /** JWT */
+ private String signKey;
+ /** token的长久有效期(单位:分钟) 默认1分钟*/
+ private Integer timeout = 1;
+ /** token名称 (同时也是cookie名称) */
+ private String tokenName;
+ /** token前缀*/
+ private String tokenPrefix;
+
+
+ public Integer getTimeout() {
+ return timeout * 60;
+ }
+}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
index 7c5b9b0..6d8790b 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
@@ -61,7 +61,7 @@ public class GlobalExceptionHandler {
}
@ExceptionHandler(SignatureException.class)
- public Result signatureException(AccessDeniedException e) {
+ public Result signatureException(SignatureException e) {
log.error(e.getMessage(), e);
return new Result(ConstantEnum.SIGNATURE_EX);
}
diff --git a/platform-common/src/main/resources/META-INF/spring.factories b/platform-common/src/main/resources/META-INF/spring.factories
index a4bf2f1..de58a04 100644
--- a/platform-common/src/main/resources/META-INF/spring.factories
+++ b/platform-common/src/main/resources/META-INF/spring.factories
@@ -1,3 +1,6 @@
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.micai.platform.common.base.WebStarterAutoConfig
\ No newline at end of file
+org.micai.platform.common.base.WebStarterAutoConfig,\
+org.micai.platform.common.base.config.MicaiPlatformOauthConfig,\
+org.micai.platform.common.base.config.MicaiPlatformTokenConfig,\
+org.micai.platform.common.base.config.MicaiPlatformResourcesConfig
\ No newline at end of file
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/RequestMatcherConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/RequestMatcherConfig.java
deleted file mode 100644
index b11baf9..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/RequestMatcherConfig.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.micai.platform.resourcesserver.config;
-
-import cn.hutool.core.util.ObjectUtil;
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @Author liuCong
- * @Date 2022/12/12 下午 2:01
- * @ClassName RequestMatcherConfig
- * @Description
- */
-@Component
-@Slf4j
-@ConfigurationProperties(prefix = "request.matcher")
-@Data
-public class RequestMatcherConfig {
-
- private List authJwtRequestMatcher = new ArrayList<>();
-
- private List authOAuth2RequestMatcher = new ArrayList<>();
-
-
- private List jwtAuthList;
-
- private List oauth2AuthList;
-
- @PostConstruct
- public void initMatcher() {
- if (ObjectUtil.isNotEmpty(jwtAuthList)) {
- for (String jwtAuth : jwtAuthList) {
- authJwtRequestMatcher.add(new AntPathRequestMatcher(jwtAuth));
- }
- }
-
- if (ObjectUtil.isNotEmpty(oauth2AuthList)) {
- for (String oauth2Auth : oauth2AuthList) {
- authOAuth2RequestMatcher.add(new AntPathRequestMatcher(oauth2Auth));
- }
- }
- log.info("init request matcher list:==========================>>>>>>>>>>>>>>>>> \n" +
- "authJwtRequestMatcher:{},authOAuth2RequestMatcher{} "
- , authJwtRequestMatcher, authOAuth2RequestMatcher);
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
index db2d2a7..cb7b16e 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
@@ -1,5 +1,7 @@
package org.micai.platform.resourcesserver.config;
+import org.micai.platform.common.base.config.MicaiPlatformResourcesConfig;
+import org.micai.platform.common.base.config.MicaiPlatformTokenConfig;
import org.micai.platform.common.base.constant.ConstantCode;
import org.micai.platform.resourcesserver.filter.AuthHeaderFilter;
import org.micai.platform.resourcesserver.filter.JWTAuthenticationFilter;
@@ -11,7 +13,6 @@ import org.micai.platform.resourcesserver.service.RoleService;
import org.micai.platform.resourcesserver.service.UserRoleService;
import org.micai.platform.resourcesserver.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -55,12 +56,6 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
@Autowired
private JwtTokenStore jwtTokenStore;
- @Value("${resource-ids}")
- private String resourceIds;
-
- @Value("${jwt.sign.key}")
- private String signKey;
-
@Autowired
private UserService userService;
@@ -83,7 +78,10 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
private AuthenticationManager authenticationManager;
@Autowired
- private RequestMatcherConfig requestMatcherConfig;
+ private MicaiPlatformResourcesConfig micaiPlatformResourcesConfig;
+
+ @Autowired
+ private MicaiPlatformTokenConfig micaiPlatformTokenConfig;
/**
* 配置:设置oauth2验证规则
@@ -94,7 +92,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
@Override
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
resources
- .resourceId(resourceIds)//设置资源id
+ .resourceId(micaiPlatformResourcesConfig.getResourceIds())//设置资源id
.tokenStore(jwtTokenStore)
;
}
@@ -130,10 +128,10 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
.permitAll();
AuthHeaderFilter authHeaderFilter = new AuthHeaderFilter();
- authHeaderFilter.setAuthHeaderRequestMatcher(requestMatcherConfig.getAuthJwtRequestMatcher(), requestMatcherConfig.getAuthOAuth2RequestMatcher());
+ authHeaderFilter.setAuthHeaderRequestMatcher(micaiPlatformResourcesConfig.getRequestMatcher().getJwtAuth(), micaiPlatformResourcesConfig.getRequestMatcher().getOauth2Auth());
//为什么要在after
//因为OAuth2AuthenticationProcessingFilter.doFilter()包含了SecurityContextHolder.clearContext();
- http.addFilterAfter(new JWTAuthenticationFilter(authenticationManager,signKey), AbstractPreAuthenticatedProcessingFilter.class);
+ http.addFilterAfter(new JWTAuthenticationFilter(authenticationManager,micaiPlatformTokenConfig), AbstractPreAuthenticatedProcessingFilter.class);
http.addFilterAfter(authHeaderFilter, X509AuthenticationFilter.class);
// 使用自定义身份验证组件
http.authenticationProvider(new CustomAuthenticationProvider(userService, bCryptPasswordEncoder,userRoleService,
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/TokenConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/TokenConfig.java
index 7b0bbcd..af7b49a 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/TokenConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/TokenConfig.java
@@ -1,5 +1,7 @@
package org.micai.platform.resourcesserver.config;
+import org.micai.platform.common.base.config.MicaiPlatformResourcesConfig;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
@@ -16,7 +18,8 @@ public class TokenConfig {
// jwt模式token
- private static final String SIGN_KEY = "2728689210118790161";
+ @Autowired
+ private MicaiPlatformResourcesConfig micaiPlatformResourcesConfig;
@Bean
public JwtTokenStore jwtTokenStore(){
@@ -35,7 +38,7 @@ public class TokenConfig {
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(){
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
- converter.setSigningKey(SIGN_KEY);
+ converter.setSigningKey(micaiPlatformResourcesConfig.getSignKey());
return converter;
}
}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
index 9fa2360..32012ef 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
@@ -1,6 +1,7 @@
package org.micai.platform.resourcesserver.filter;
import cn.hutool.core.util.ObjectUtil;
+import lombok.extern.slf4j.Slf4j;
import org.micai.platform.common.base.constant.ConstantCode;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.util.Assert;
@@ -13,6 +14,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Vector;
@@ -23,19 +25,33 @@ import java.util.Vector;
* @ClassName AuthHeaderFilter
* @Description
*/
+@Slf4j
public class AuthHeaderFilter implements Filter {
//拦截接口让JWTAuthenticationFilter去验证
- private List authJwtRequestMatcher;
+ private final List authJwtRequestMatcher = new ArrayList<>();
//拦截接口让OAuth2AuthenticationProcessingFilter去验证
- private List authOAuth2RequestMatcher;
+ private final List authOAuth2RequestMatcher = new ArrayList<>();
- public void setAuthHeaderRequestMatcher(List authJwtRequestMatcher, List authOAuth2RequestMatcher) {
+ public void setAuthHeaderRequestMatcher(List jwtAuthList, List oauth2AuthList) {
Assert.notNull(authJwtRequestMatcher, "authJwtRequestMatcher cannot be null");
Assert.notNull(authOAuth2RequestMatcher, "authOAuth2RequestMatcher cannot be null");
- this.authJwtRequestMatcher = authJwtRequestMatcher;
- this.authOAuth2RequestMatcher = authOAuth2RequestMatcher;
+
+ if (ObjectUtil.isNotEmpty(jwtAuthList)) {
+ for (String jwtAuth : jwtAuthList) {
+ authJwtRequestMatcher.add(new AntPathRequestMatcher(jwtAuth));
+ }
+ }
+
+ if (ObjectUtil.isNotEmpty(oauth2AuthList)) {
+ for (String oauth2Auth : oauth2AuthList) {
+ authOAuth2RequestMatcher.add(new AntPathRequestMatcher(oauth2Auth));
+ }
+ }
+ log.info("init request matcher list:==========================>>>>>>>>>>>>>>>>> \n" +
+ "authJwtRequestMatcher:{},authOAuth2RequestMatcher{} "
+ , authJwtRequestMatcher, authOAuth2RequestMatcher);
}
@Override
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java
index 5e80b66..aecfc42 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/JWTAuthenticationFilter.java
@@ -10,6 +10,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.SignatureException;
import io.jsonwebtoken.UnsupportedJwtException;
import lombok.extern.slf4j.Slf4j;
+import org.micai.platform.common.base.config.MicaiPlatformTokenConfig;
import org.micai.platform.common.base.constant.ConstantCode;
import org.micai.platform.common.base.constant.ConstantEnum;
import org.micai.platform.common.base.exception.PlatformException;
@@ -40,17 +41,17 @@ import java.util.List;
@Slf4j
public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
- private final String signKey;
+ private final MicaiPlatformTokenConfig micaiPlatformTokenConfig;
- public JWTAuthenticationFilter(AuthenticationManager authenticationManager, String signKey) {
+ public JWTAuthenticationFilter(AuthenticationManager authenticationManager, MicaiPlatformTokenConfig micaiPlatformTokenConfig) {
super(authenticationManager);
- this.signKey = signKey;
+ this.micaiPlatformTokenConfig = micaiPlatformTokenConfig;
}
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
- String header = request.getHeader(ConstantCode.AUTHORIZATION);
- if (ObjectUtil.isEmpty(header) || !header.startsWith(ConstantCode.HEADER_BEARER)) {
+ String header = request.getHeader(micaiPlatformTokenConfig.getTokenName());
+ if (ObjectUtil.isEmpty(header) || !header.startsWith(micaiPlatformTokenConfig.getTokenPrefix())) {
chain.doFilter(request, response);
return;
}
@@ -62,13 +63,16 @@ public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
long start = System.currentTimeMillis();
- String token = request.getHeader(ConstantCode.AUTHORIZATION);
+ String token = request.getHeader(micaiPlatformTokenConfig.getTokenName());
if (ObjectUtil.isEmpty(token)) {
throw new PlatformException(ConstantEnum.TOKEN_MISS);
}
// parse the token.
String user = null;
- Claims claims = Jwts.parser().setSigningKey(signKey).parseClaimsJws(token.replace(ConstantCode.HEADER_BEARER, "")).getBody();
+ Claims claims = Jwts.parser()
+ .setSigningKey(micaiPlatformTokenConfig.getSignKey())
+ .parseClaimsJws(token.replace(micaiPlatformTokenConfig.getTokenPrefix(), ""))
+ .getBody();
log.info("相关信息 : {}",claims.getSubject());
// token签发时间
long issuedAt = claims.getIssuedAt().getTime();
@@ -94,7 +98,7 @@ public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
.setSubject(claims.getSubject())
.setIssuedAt(now)//签发时间
.setExpiration(time)//过期时间
- .signWith(SignatureAlgorithm.HS512, signKey) //采用什么算法是可以自己选择的,不一定非要采用HS512
+ .signWith(SignatureAlgorithm.HS512, micaiPlatformTokenConfig.getSignKey()) //采用什么算法是可以自己选择的,不一定非要采用HS512
.compact();
// 重新生成token end
@@ -102,7 +106,7 @@ public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
response.addHeader(ConstantCode.REFRESH_TOKEN, refreshToken);
}
long end = System.currentTimeMillis();
- logger.info("执行时间: " + (end - start) + " 毫秒");
+ log.info("执行时间: " + (end - start) + " 毫秒");
user = claims.getSubject();
if (ObjectUtil.isNotEmpty(user)) {
String authStr = user.split("-")[ConstantCode.INT_TWO];
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/JwtHelper.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/JwtHelper.java
index a0fd9c0..cc37c4d 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/JwtHelper.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/JwtHelper.java
@@ -1,106 +1,106 @@
-package org.micai.platform.resourcesserver.utils;
-
-import io.jsonwebtoken.Claims;
-import io.jsonwebtoken.JwtBuilder;
-import io.jsonwebtoken.Jwts;
-import io.jsonwebtoken.SignatureAlgorithm;
-import org.springframework.beans.factory.annotation.Value;
-
-import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
-import java.security.Key;
-import java.util.Date;
-
-/**
- * @FileName: JwtHelper
- * @Author: zhaoxinguo
- * @Date: 2018/12/10 19:39
- * @Description: 实现Jwt
- */
-public class JwtHelper {
-
- //token超时时间
- @Value("${jwt.expiration}")
- public long expiration;
-
- //生成token的秘钥
- @Value("${jwt.secret}")
- public String base64Security;
-
- /**
- * 解析token
- * @param jsonWebToken
- * @return
- */
- public Claims parseToken(String jsonWebToken) {
- Claims claims = Jwts.parser().setSigningKey(DatatypeConverter.parseBase64Binary(base64Security)).parseClaimsJws(jsonWebToken).getBody();
- return claims;
- }
-
- /**
- * 新建token
- * @param audience
- * @param issuer
- * @return
- */
- public String createToken(String audience, String issuer) {
- SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
-
- long nowMillis = System.currentTimeMillis();
- Date now = new Date(nowMillis);
-
- // 生成签名密钥
- byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(base64Security);
- Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
-
- // 添加构成JWT的参数
- JwtBuilder builder = Jwts.builder().setHeaderParam("typ", "JWT").setIssuer(issuer).setAudience(audience)
- .signWith(signatureAlgorithm, signingKey);
-
- // 添加Token签发时间
- builder.setIssuedAt(now);
- // 添加Token过期时间
- if (expiration >= 0) {
- long expMillis = nowMillis + expiration;
- Date exp = new Date(expMillis);
- builder.setExpiration(exp).setNotBefore(now);
- }
-
- // 生成JWT
- return builder.compact();
- }
-
- /**
- * 刷新令牌
- *
- * @param claims
- * @return
- */
- public String refreshToken(Claims claims) {
- SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
-
- long nowMillis = System.currentTimeMillis();
- Date now = new Date(nowMillis);
-
- // 生成签名密钥
- byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(base64Security);
- Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
-
- // 添加构成JWT的参数
- JwtBuilder builder = Jwts.builder().setHeaderParam("typ", "JWT")
- .setIssuer((String) claims.get("iss")).setAudience((String) claims.get("aud"))
- .signWith(signatureAlgorithm, signingKey);
-
- // 添加Token签发时间
- builder.setIssuedAt(now);
- // 添加Token过期时间
- if (expiration >= 0) {
- long expMillis = nowMillis + expiration;
- Date exp = new Date(expMillis);
- builder.setExpiration(exp).setNotBefore(now);
- }
-
- // 生成Token
- return builder.compact();
- }
-}
+//package org.micai.platform.resourcesserver.utils;
+//
+//import io.jsonwebtoken.Claims;
+//import io.jsonwebtoken.JwtBuilder;
+//import io.jsonwebtoken.Jwts;
+//import io.jsonwebtoken.SignatureAlgorithm;
+//import org.springframework.beans.factory.annotation.Value;
+//
+//import javax.crypto.spec.SecretKeySpec;
+//import javax.xml.bind.DatatypeConverter;
+//import java.security.Key;
+//import java.util.Date;
+//
+///**
+// * @FileName: JwtHelper
+// * @Author: zhaoxinguo
+// * @Date: 2018/12/10 19:39
+// * @Description: 实现Jwt
+// */
+//public class JwtHelper {
+//
+// //token超时时间
+// @Value("${jwt.expiration}")
+// public long expiration;
+//
+// //生成token的秘钥
+// @Value("${jwt.secret}")
+// public String base64Security;
+//
+// /**
+// * 解析token
+// * @param jsonWebToken
+// * @return
+// */
+// public Claims parseToken(String jsonWebToken) {
+// Claims claims = Jwts.parser().setSigningKey(DatatypeConverter.parseBase64Binary(base64Security)).parseClaimsJws(jsonWebToken).getBody();
+// return claims;
+// }
+//
+// /**
+// * 新建token
+// * @param audience
+// * @param issuer
+// * @return
+// */
+// public String createToken(String audience, String issuer) {
+// SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
+//
+// long nowMillis = System.currentTimeMillis();
+// Date now = new Date(nowMillis);
+//
+// // 生成签名密钥
+// byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(base64Security);
+// Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
+//
+// // 添加构成JWT的参数
+// JwtBuilder builder = Jwts.builder().setHeaderParam("typ", "JWT").setIssuer(issuer).setAudience(audience)
+// .signWith(signatureAlgorithm, signingKey);
+//
+// // 添加Token签发时间
+// builder.setIssuedAt(now);
+// // 添加Token过期时间
+// if (expiration >= 0) {
+// long expMillis = nowMillis + expiration;
+// Date exp = new Date(expMillis);
+// builder.setExpiration(exp).setNotBefore(now);
+// }
+//
+// // 生成JWT
+// return builder.compact();
+// }
+//
+// /**
+// * 刷新令牌
+// *
+// * @param claims
+// * @return
+// */
+// public String refreshToken(Claims claims) {
+// SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
+//
+// long nowMillis = System.currentTimeMillis();
+// Date now = new Date(nowMillis);
+//
+// // 生成签名密钥
+// byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(base64Security);
+// Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
+//
+// // 添加构成JWT的参数
+// JwtBuilder builder = Jwts.builder().setHeaderParam("typ", "JWT")
+// .setIssuer((String) claims.get("iss")).setAudience((String) claims.get("aud"))
+// .signWith(signatureAlgorithm, signingKey);
+//
+// // 添加Token签发时间
+// builder.setIssuedAt(now);
+// // 添加Token过期时间
+// if (expiration >= 0) {
+// long expMillis = nowMillis + expiration;
+// Date exp = new Date(expMillis);
+// builder.setExpiration(exp).setNotBefore(now);
+// }
+//
+// // 生成Token
+// return builder.compact();
+// }
+//}
diff --git a/platform-resources-server/src/main/resources/application-dev.yml b/platform-resources-server/src/main/resources/application-dev.yml
index 0dcb455..047f682 100644
--- a/platform-resources-server/src/main/resources/application-dev.yml
+++ b/platform-resources-server/src/main/resources/application-dev.yml
@@ -10,21 +10,28 @@ spring:
username: root
password: ly1218
-#jwt相关配置
-jwt:
- #sign key
- sign:
- key: spring-security-@Jwt!&Secret^#
- #jwt 过期时间
- expiration:
- time: 15
+micai-platform-auth:
+ #jwt相关配置
+ token:
+ #sign key
+ sign-key: micai-security-@Jwt!&Secret^#
+ #jwt 过期时间 单位:分钟
+ timeout: 60
+ # token名称
+ token-name: Authorization
+ # token前缀
+ token-prefix: Bearer
-resource-ids: user
-
-request:
- matcher:
- jwtAuthList:
- - /user/info
- - /user/list
- oauth2AuthList:
- - /demo
+ oauth-resources:
+ #sign key
+ sign-key: micai-oauth2-@Jwt!&Secret^#
+ #资源id
+ resource-ids: resources-server
+ #过滤器匹配路径 可以使用**
+ request-matcher:
+ jwt-auth:
+ - /user/info
+ - /user/list
+ oauth2-auth:
+ - /demo
+ - /user/list111
diff --git a/platform-resources-server/src/main/resources/application.yml b/platform-resources-server/src/main/resources/application.yml
index 7d53115..9111316 100644
--- a/platform-resources-server/src/main/resources/application.yml
+++ b/platform-resources-server/src/main/resources/application.yml
@@ -22,12 +22,6 @@ mybatis-plus:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-#jwt config
-jwt:
- header: Authorization
- secret: NDU0NTY4amhmc3NkeHp6eGNxdzIlMjFAJTIxQCUyM2ZmNQ==
- expiration: 7200000
-
site:
location: ${user.dir}
options:
--
Gitee
From 755b4617cd241e462b78a0c692b17ee386bdc64c Mon Sep 17 00:00:00 2001
From: liucong
Date: Tue, 13 Dec 2022 16:46:12 +0800
Subject: [PATCH 07/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9SignatureException?=
=?UTF-8?q?=E7=9A=84=E5=8C=85import?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../base/controller/ExceptionController.java | 2 +-
.../exception/GlobalExceptionHandler.java | 6 ----
.../config/ResourceServerConfig.java | 2 ++
.../CustomAuthenticationFailureHandler.java | 34 -------------------
4 files changed, 3 insertions(+), 41 deletions(-)
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/handler/CustomAuthenticationFailureHandler.java
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/controller/ExceptionController.java b/platform-common/src/main/java/org/micai/platform/common/base/controller/ExceptionController.java
index 1b3ccc1..73c6e77 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/controller/ExceptionController.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/controller/ExceptionController.java
@@ -2,12 +2,12 @@ package org.micai.platform.common.base.controller;
import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.MalformedJwtException;
+import io.jsonwebtoken.SignatureException;
import io.jsonwebtoken.UnsupportedJwtException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
-import java.security.SignatureException;
/**
* @Author liuCong
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
index 6d8790b..b231c2e 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
@@ -97,10 +97,4 @@ public class GlobalExceptionHandler {
String message = exception.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
return new Result(ConstantEnum.FAIL,message);
}
-
- @ExceptionHandler(value = Exception.class)
- public Result exception(Exception e) {
- log.error(e.getMessage(), e);
- return new Result(ConstantEnum.FAIL);
- }
}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
index cb7b16e..621aa10 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
@@ -50,6 +50,8 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
"/webjars/**",
"/doc.html",
+ "/exception/**",
+
// other public endpoints of your API may be appended to this array
};
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/handler/CustomAuthenticationFailureHandler.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/handler/CustomAuthenticationFailureHandler.java
deleted file mode 100644
index 25cc053..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/handler/CustomAuthenticationFailureHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.micai.platform.resourcesserver.handler;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.micai.platform.common.base.constant.ConstantCode;
-import org.micai.platform.common.base.result.Result;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @Author liuCong
- * @Date 2022/1/4 17:20
- * @ClassName CustomAuthenticationFailureHandler
- * @Description
- */
-@Component
-public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
- @Override
- public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
- response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
- response.setContentType(ConstantCode.CONTENT_TYPE_JSON);
- Result result = new Result(HttpServletResponse.SC_UNAUTHORIZED,exception.getMessage());
- PrintWriter out = response.getWriter();
- out.write(new ObjectMapper().writeValueAsString(result));
- out.flush();
- out.close();
- }
-}
--
Gitee
From dfd8a2a6fd856448e7f3dc96c2a21cb8eecaaaab Mon Sep 17 00:00:00 2001
From: liucong
Date: Tue, 13 Dec 2022 16:46:59 +0800
Subject: [PATCH 08/16] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=97=A0=E7=94=A8?=
=?UTF-8?q?=E7=9A=84=E6=94=BE=E5=BC=80=E8=B7=AF=E5=BE=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../platform/resourcesserver/config/ResourceServerConfig.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
index 621aa10..cb7b16e 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
@@ -50,8 +50,6 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
"/webjars/**",
"/doc.html",
- "/exception/**",
-
// other public endpoints of your API may be appended to this array
};
--
Gitee
From 11396f7ee1d3bb60fffd8246dffcfadabe041792 Mon Sep 17 00:00:00 2001
From: liucong
Date: Sat, 17 Dec 2022 12:16:05 +0800
Subject: [PATCH 09/16] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=BC=83=E7=94=A8?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81-=E6=94=B9=E7=94=A8=E9=80=9A=E8=BF=87?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=8E=B7=E5=8F=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AuthorizationServerConfiguration.java | 13 +----
.../handler/AuthApprovalHandler.java | 51 -------------------
.../src/main/resources/application-dev.yml | 4 --
3 files changed, 1 insertion(+), 67 deletions(-)
delete mode 100644 platform-auth-server/src/main/java/org/micai/platform/authserver/handler/AuthApprovalHandler.java
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
index bc8c96c..2f8a121 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/AuthorizationServerConfiguration.java
@@ -1,6 +1,5 @@
package org.micai.platform.authserver.config;
-import org.micai.platform.authserver.handler.AuthApprovalHandler;
import org.micai.platform.common.base.config.MicaiPlatformOauthConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@@ -15,7 +14,6 @@ import org.springframework.security.oauth2.config.annotation.web.configurers.Aut
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices;
-import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
import org.springframework.security.oauth2.provider.token.TokenEnhancer;
import org.springframework.security.oauth2.provider.token.TokenEnhancerChain;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
@@ -83,7 +81,7 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
// 授权码使用
.authorizationCodeServices(jdbcAuthorizationCodeServices())
//实现自动授权 不需要用户点击授权
- .userApprovalHandler(new AuthApprovalHandler())
+// .userApprovalHandler(new AuthApprovalHandler())
;
if (jwtTokenEnhancer != null ){
@@ -95,15 +93,6 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
enhancerChain.setTokenEnhancers(enhancers);
endpoints.tokenEnhancer(enhancerChain);
}
-
- DefaultTokenServices tokenServices = new DefaultTokenServices();
- tokenServices.setTokenStore(endpoints.getTokenStore());
- tokenServices.setSupportRefreshToken(true);
- tokenServices.setClientDetailsService(endpoints.getClientDetailsService());
- tokenServices.setTokenEnhancer(endpoints.getTokenEnhancer());
- tokenServices.setAccessTokenValiditySeconds(micaiPlatformOauthConfig.getTokenTimeout());
- tokenServices.setRefreshTokenValiditySeconds(micaiPlatformOauthConfig.getRefreshTimeout());
- endpoints.tokenServices(tokenServices);
}
/**
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/handler/AuthApprovalHandler.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/handler/AuthApprovalHandler.java
deleted file mode 100644
index 2d3143b..0000000
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/handler/AuthApprovalHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.micai.platform.authserver.handler;
-
-import org.springframework.security.core.Authentication;
-import org.springframework.security.oauth2.provider.AuthorizationRequest;
-import org.springframework.security.oauth2.provider.approval.UserApprovalHandler;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @Author liuCong
- * @Date 2022/12/6 下午 3:32
- * @ClassName AuthApprovalHandler
- * @Description
- */
-public class AuthApprovalHandler implements UserApprovalHandler {
-
- private String approvalParameter = "user_oauth_approval";
- /**
- * 被批准 默认是false 需要手动授权
- *
- * @param authorizationRequest 授权请求
- * @param authentication 身份验证
- * @return boolean
- */
- @Override
- public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication authentication) {
- return true;
- }
-
- @Override
- public AuthorizationRequest checkForPreApproval(AuthorizationRequest authorizationRequest, Authentication authentication) {
- return authorizationRequest;
- }
-
- @Override
- public AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, Authentication authentication) {
- Map approvalParameters = authorizationRequest.getApprovalParameters();
- String flag = (String)approvalParameters.get(this.approvalParameter);
- boolean approved = flag != null && flag.toLowerCase().equals("true");
- authorizationRequest.setApproved(approved);
- return authorizationRequest;
- }
-
- @Override
- public Map getUserApprovalRequest(AuthorizationRequest authorizationRequest, Authentication authentication) {
- Map model = new HashMap();
- model.putAll(authorizationRequest.getRequestParameters());
- return model;
- }
-}
diff --git a/platform-auth-server/src/main/resources/application-dev.yml b/platform-auth-server/src/main/resources/application-dev.yml
index 06768b5..477da8a 100644
--- a/platform-auth-server/src/main/resources/application-dev.yml
+++ b/platform-auth-server/src/main/resources/application-dev.yml
@@ -34,7 +34,3 @@ micai-platform-auth:
oauth-auth:
#sign key
sign-key: micai-oauth2-@Jwt!&Secret^#
- #oauth 过期时间 单位:分钟
- token-timeout: 60
- #刷新token
- refresh-timeout: 60
--
Gitee
From 990c0c59a80f187f2da2fc1d835d554935ddc431 Mon Sep 17 00:00:00 2001
From: liucong
Date: Mon, 26 Dec 2022 15:18:29 +0800
Subject: [PATCH 10/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9pom=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
platform-auth-server/pom.xml | 44 +++
platform-common/pom.xml | 10 +-
.../exception/GlobalExceptionHandler.java | 7 -
platform-resources-server/pom.xml | 94 ++++++
.../resourcesserver/config/SwaggerConfig.java | 2 -
pom.xml | 286 ++++++++++--------
6 files changed, 314 insertions(+), 129 deletions(-)
diff --git a/platform-auth-server/pom.xml b/platform-auth-server/pom.xml
index 0f1bc6c..91b39b7 100644
--- a/platform-auth-server/pom.xml
+++ b/platform-auth-server/pom.xml
@@ -23,6 +23,50 @@
platform-common
0.0.1-SNAPSHOT
+
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ com.alibaba
+ fastjson
+
+
+
+ org.apache.commons
+ commons-io
+
+
+ org.apache.commons
+ commons-text
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+
+ com.github.xiaoymin
+
+ knife4j-spring-boot-starter
+
+
+
+
+ org.projectlombok
+ lombok
+
\ No newline at end of file
diff --git a/platform-common/pom.xml b/platform-common/pom.xml
index 53f791d..b94f33d 100644
--- a/platform-common/pom.xml
+++ b/platform-common/pom.xml
@@ -15,7 +15,6 @@
8
8
UTF-8
- 5.7.16
@@ -23,8 +22,15 @@
cn.hutool
hutool-all
- ${hutool.version}
+
+
+
+
+ org.projectlombok
+ lombok
+
+
\ No newline at end of file
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
index b231c2e..1d70755 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
@@ -8,7 +8,6 @@ import lombok.extern.slf4j.Slf4j;
import org.micai.platform.common.base.constant.ConstantEnum;
import org.micai.platform.common.base.result.Result;
import org.springframework.context.support.DefaultMessageSourceResolvable;
-import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
@@ -36,12 +35,6 @@ public class GlobalExceptionHandler {
return new Result(ConstantEnum.NOT_FOUND);
}
- @ExceptionHandler(DuplicateKeyException.class)
- public Result handleDuplicateKeyException(DuplicateKeyException e){
- log.error(e.getMessage(), e);
- return new Result(ConstantEnum.DUPLICATE_KEY);
- }
-
@ExceptionHandler(ConnectException.class)
public Result connectException(ConnectException e){
log.error(e.getMessage(), e);
diff --git a/platform-resources-server/pom.xml b/platform-resources-server/pom.xml
index 0ad5c86..bc76206 100644
--- a/platform-resources-server/pom.xml
+++ b/platform-resources-server/pom.xml
@@ -24,5 +24,99 @@
platform-common
0.0.1-SNAPSHOT
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+
+ com.alibaba
+ fastjson
+
+
+
+ com.baomidou
+ mybatis-plus-generator
+
+
+ org.apache.velocity
+ velocity-engine-core
+
+
+
+ org.apache.commons
+ commons-io
+
+
+ org.apache.commons
+ commons-text
+
+
+
+ com.itextpdf
+ itextpdf
+
+
+ com.itextpdf
+ itext-asian
+
+
+ org.apache.poi
+ poi
+
+
+ org.apache.poi
+ poi-ooxml
+
+
+ net.coobird
+ thumbnailator
+
+
+
+ com.upyun
+ java-sdk
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+
+
+
+ com.qiniu
+ qiniu-java-sdk
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+
+ com.github.xiaoymin
+
+ knife4j-spring-boot-starter
+
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SwaggerConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SwaggerConfig.java
index e0cac6e..f61b54f 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SwaggerConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SwaggerConfig.java
@@ -1,6 +1,5 @@
package org.micai.platform.resourcesserver.config;
-import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -30,7 +29,6 @@ import static cn.hutool.core.collection.CollUtil.newArrayList;
*/
@Configuration
@EnableSwagger2
-@EnableSwaggerBootstrapUI
public class SwaggerConfig {
// 设置默认TOKEN,方便测试
diff --git a/pom.xml b/pom.xml
index d442899..9eab1b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,9 +43,15 @@
2.0
1.7.30
2.2.6.RELEASE
+ 2.0.9
+ 1.18.24
+ 2.6.6
+ 5.7.16
+ 2.7.5
-
-
+
+
+
org.springframework.boot
spring-boot-starter
@@ -60,137 +66,181 @@
org.springframework.boot
spring-boot-starter-web
-
-
- com.baomidou
- mybatis-plus-boot-starter
- ${mybatis-plus-boot-starter.version}
-
-
-
- mysql
- mysql-connector-java
- ${mysql.version}
-
-
-
- org.springframework.boot
- spring-boot-starter-security
-
+
io.jsonwebtoken
jjwt
- ${jjwt.version}
-
-
-
- com.alibaba
- fastjson
- ${fastjson.version}
-
-
-
- io.springfox
- springfox-swagger2
- ${springfox-swagger2.version}
-
-
-
- org.projectlombok
- lombok
-
-
- com.baomidou
- mybatis-plus-generator
- ${mybatis-plus-generator.version}
-
-
- org.apache.velocity
- velocity-engine-core
- ${velocity-engine-core.version}
-
-
- org.springframework.boot
- spring-boot-starter-validation
-
-
- com.github.xiaoymin
- swagger-bootstrap-ui
- ${swagger-bootstrap-ui.version}
-
-
- org.apache.commons
- commons-io
- ${commons.io}
-
-
- org.apache.commons
- commons-text
- ${commons.text}
-
-
-
- com.itextpdf
- itextpdf
- ${commons.itextpdf}
-
-
- com.itextpdf
- itext-asian
- ${commons.itext-asian}
-
-
- org.apache.poi
- poi
- ${poi.version}
-
-
- org.apache.poi
- poi-ooxml
- ${poi-ooxml.version}
-
-
- net.coobird
- thumbnailator
- ${coobird.thumbnailator}
-
-
-
- com.upyun
- java-sdk
- ${upyun.sdk.version}
-
-
-
- com.aliyun.oss
- aliyun-sdk-oss
- ${aliyun.sdk.version}
-
-
-
- com.qiniu
- qiniu-java-sdk
- ${qiniu.sdk.version}
+
org.springframework.boot
- spring-boot-devtools
- true
+ spring-boot-starter-security
org.springframework.security.oauth.boot
spring-security-oauth2-autoconfigure
- ${oauth2.version}
-
-
- org.slf4j
- slf4j-api
- ${slf4j-api.version}
+
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ ${mybatis-plus-boot-starter.version}
+
+
+
+ mysql
+ mysql-connector-java
+ ${mysql.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+ ${security.version}
+
+
+
+ io.jsonwebtoken
+ jjwt
+ ${jjwt.version}
+
+
+
+ com.alibaba
+ fastjson
+ ${fastjson.version}
+
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox-swagger2.version}
+
+
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+
+
+ com.baomidou
+ mybatis-plus-generator
+ ${mybatis-plus-generator.version}
+
+
+ org.apache.velocity
+ velocity-engine-core
+ ${velocity-engine-core.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+ ${validation.version}
+
+
+ com.github.xiaoymin
+ swagger-bootstrap-ui
+ ${swagger-bootstrap-ui.version}
+
+
+ org.apache.commons
+ commons-io
+ ${commons.io}
+
+
+ org.apache.commons
+ commons-text
+ ${commons.text}
+
+
+
+ com.itextpdf
+ itextpdf
+ ${commons.itextpdf}
+
+
+ com.itextpdf
+ itext-asian
+ ${commons.itext-asian}
+
+
+ org.apache.poi
+ poi
+ ${poi.version}
+
+
+ org.apache.poi
+ poi-ooxml
+ ${poi-ooxml.version}
+
+
+ net.coobird
+ thumbnailator
+ ${coobird.thumbnailator}
+
+
+
+ com.upyun
+ java-sdk
+ ${upyun.sdk.version}
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ ${aliyun.sdk.version}
+
+
+
+ com.qiniu
+ qiniu-java-sdk
+ ${qiniu.sdk.version}
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
+
+
+ org.springframework.security.oauth.boot
+ spring-security-oauth2-autoconfigure
+ ${oauth2.version}
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j-api.version}
+
+
+
+
+ com.github.xiaoymin
+
+ knife4j-spring-boot-starter
+ ${knife4j.version}
+
+
+
+
+ cn.hutool
+ hutool-all
+ ${hutool.version}
+
+
+
+
+
--
Gitee
From d9fdeb49b5a1debdb0c453e6cc7847e10cb7a6df Mon Sep 17 00:00:00 2001
From: liucong
Date: Mon, 26 Dec 2022 15:56:21 +0800
Subject: [PATCH 11/16] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84sql?=
=?UTF-8?q?=E8=84=9A=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
doc/sql/micai_platform.sql | 174 +++++++------------------------------
pom.xml | 6 --
2 files changed, 29 insertions(+), 151 deletions(-)
diff --git a/doc/sql/micai_platform.sql b/doc/sql/micai_platform.sql
index 2157441..5263838 100644
--- a/doc/sql/micai_platform.sql
+++ b/doc/sql/micai_platform.sql
@@ -11,35 +11,44 @@
Target Server Version : 50736
File Encoding : 65001
- Date: 14/01/2022 10:44:34
+ Date: 26/12/2022 15:51:51
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
--- Table structure for tb_organ_info
+-- Table structure for oauth_client_details
-- ----------------------------
-DROP TABLE IF EXISTS `tb_organ_info`;
-CREATE TABLE `tb_organ_info` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
- `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构编码',
- `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构名称',
- `type` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构类型',
- `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '父类id',
- `sn` int(10) NULL DEFAULT NULL COMMENT '排序',
- `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
- `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
- `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
- `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
- `status` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态 默认01 启用',
- `version` bigint(20) NULL DEFAULT 0 COMMENT '版本号',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+DROP TABLE IF EXISTS `oauth_client_details`;
+CREATE TABLE `oauth_client_details` (
+ `client_id` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+ `resource_ids` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `client_secret` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `scope` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `authorized_grant_types` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `web_server_redirect_uri` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `authorities` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `access_token_validity` int(11) NULL DEFAULT NULL,
+ `refresh_token_validity` int(11) NULL DEFAULT NULL,
+ `additional_information` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `autoapprove` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`client_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
--- Records of tb_organ_info
+-- Records of oauth_client_details
-- ----------------------------
+INSERT INTO `oauth_client_details` VALUES ('pc', 'resources-server', '$2a$10$XyKNPWArxeVGjOKFF.pF7ONmv9NMAN5Bkkiwy8MutFTUKXhHFv.zC', 'pc', 'authorization_code,password,refresh_token', 'http://www.baidu.com/', 'info,sys:user:List', NULL, NULL, NULL, 'true');
+
+-- ----------------------------
+-- Table structure for oauth_code
+-- ----------------------------
+DROP TABLE IF EXISTS `oauth_code`;
+CREATE TABLE `oauth_code` (
+ `code` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `authentication` blob NULL
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for tb_organ_user
@@ -108,41 +117,6 @@ INSERT INTO `tb_permission` VALUES (24, 'sys:userRole:update', '更新用户角
INSERT INTO `tb_permission` VALUES (25, 'sys:userRole:save', '新增用户角色', '新增用户角色', '01', 1, '2022-01-14 10:41:54', 1, '2022-01-14 10:41:54', 0);
INSERT INTO `tb_permission` VALUES (26, 'sys:userRole:del', '删除用户角色', '删除用户角色', '01', 1, '2022-01-14 10:42:14', 1, '2022-01-14 10:42:14', 0);
--- ----------------------------
--- Table structure for tb_permission_menu
--- ----------------------------
-DROP TABLE IF EXISTS `tb_permission_menu`;
-CREATE TABLE `tb_permission_menu` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `permission_id` bigint(20) NOT NULL COMMENT '权限id',
- `menu_id` bigint(20) NOT NULL COMMENT '菜单id',
- `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人id',
- `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
- `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '修改用户id',
- `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
- `version` bigint(20) NOT NULL DEFAULT 0 COMMENT '版本号',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of tb_permission_menu
--- ----------------------------
-INSERT INTO `tb_permission_menu` VALUES (1, 6, 1, 1, '2022-01-13 17:36:59', 1, '2022-01-13 17:36:59', 0);
-INSERT INTO `tb_permission_menu` VALUES (2, 6, 2, 1, '2022-01-13 17:37:06', 1, '2022-01-13 17:37:06', 0);
-INSERT INTO `tb_permission_menu` VALUES (3, 6, 3, 1, '2022-01-13 17:37:10', 1, '2022-01-13 17:37:10', 0);
-INSERT INTO `tb_permission_menu` VALUES (4, 6, 4, 1, '2022-01-13 17:37:15', 1, '2022-01-13 17:37:15', 0);
-INSERT INTO `tb_permission_menu` VALUES (5, 6, 5, 1, '2022-01-13 17:37:18', 1, '2022-01-13 17:37:18', 0);
-INSERT INTO `tb_permission_menu` VALUES (6, 6, 6, 1, '2022-01-13 17:37:21', 1, '2022-01-13 17:37:21', 0);
-INSERT INTO `tb_permission_menu` VALUES (7, 6, 7, 1, '2022-01-13 17:37:25', 1, '2022-01-13 17:37:25', 0);
-INSERT INTO `tb_permission_menu` VALUES (8, 6, 8, 1, '2022-01-13 17:37:28', 1, '2022-01-13 17:37:28', 0);
-INSERT INTO `tb_permission_menu` VALUES (9, 6, 9, 1, '2022-01-13 17:37:32', 1, '2022-01-13 17:37:32', 0);
-INSERT INTO `tb_permission_menu` VALUES (10, 6, 10, 1, '2022-01-13 17:37:42', 1, '2022-01-13 17:37:42', 0);
-INSERT INTO `tb_permission_menu` VALUES (11, 6, 11, 1, '2022-01-13 17:37:46', 1, '2022-01-13 17:37:46', 0);
-INSERT INTO `tb_permission_menu` VALUES (12, 6, 12, 1, '2022-01-13 17:37:52', 1, '2022-01-13 17:37:52', 0);
-INSERT INTO `tb_permission_menu` VALUES (13, 6, 13, 1, '2022-01-13 17:37:55', 1, '2022-01-13 17:37:55', 0);
-INSERT INTO `tb_permission_menu` VALUES (14, 6, 14, 1, '2022-01-13 17:37:59', 1, '2022-01-13 17:37:59', 0);
-INSERT INTO `tb_permission_menu` VALUES (15, 6, 15, 1, '2022-01-13 17:38:03', 1, '2022-01-13 17:38:03', 0);
-
-- ----------------------------
-- Table structure for tb_role
-- ----------------------------
@@ -164,7 +138,7 @@ CREATE TABLE `tb_role` (
-- ----------------------------
-- Records of tb_role
-- ----------------------------
-INSERT INTO `tb_role` VALUES (1, 'root', '院长', '最高权限', '01', NULL, '2021-12-04 14:12:34', NULL, '2021-12-04 14:12:38', 1);
+INSERT INTO `tb_role` VALUES (1, 'ROLE_root', '院长', '最高权限', '01', NULL, '2021-12-04 14:12:34', NULL, '2021-12-04 14:12:38', 1);
-- ----------------------------
-- Table structure for tb_role_permission
@@ -208,96 +182,6 @@ INSERT INTO `tb_role_permission` VALUES (29, 1, 20, 1, '2022-01-13 16:38:20', 1,
INSERT INTO `tb_role_permission` VALUES (30, 1, 21, 1, '2022-01-13 17:36:25', 1, '2022-01-13 17:36:25', 0);
INSERT INTO `tb_role_permission` VALUES (31, 1, 22, 1, '2022-01-13 17:36:25', 1, '2022-01-13 17:36:25', 0);
INSERT INTO `tb_role_permission` VALUES (32, 1, 23, 1, '2022-01-13 17:36:25', 1, '2022-01-13 17:36:25', 0);
-
--- ----------------------------
--- Table structure for tb_sys_dict
--- ----------------------------
-DROP TABLE IF EXISTS `tb_sys_dict`;
-CREATE TABLE `tb_sys_dict` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
- `dict_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字段名称',
- `dict_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字段编码',
- `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人id',
- `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
- `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '修改人id',
- `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
- `status` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '01' COMMENT '状态: 01 启用 02停用',
- `version` bigint(20) NULL DEFAULT 0 COMMENT '版本号',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of tb_sys_dict
--- ----------------------------
-
--- ----------------------------
--- Table structure for tb_sys_dict_item
--- ----------------------------
-DROP TABLE IF EXISTS `tb_sys_dict_item`;
-CREATE TABLE `tb_sys_dict_item` (
- `id` bigint(20) NOT NULL COMMENT '主键id',
- `dict_id` bigint(20) NULL DEFAULT NULL COMMENT '字典表id',
- `item_text` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字典项文本',
- `item_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字典项值',
- `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
- `sn` int(4) NULL DEFAULT NULL COMMENT '排序',
- `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
- `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
- `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
- `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
- `status` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '01' COMMENT '状态: 01 启用 02停用',
- `version` bigint(20) NULL DEFAULT 0 COMMENT '版本号',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of tb_sys_dict_item
--- ----------------------------
-
--- ----------------------------
--- Table structure for tb_sys_menu
--- ----------------------------
-DROP TABLE IF EXISTS `tb_sys_menu`;
-CREATE TABLE `tb_sys_menu` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
- `menu_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单编码',
- `menu_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单名称',
- `system_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务系统标识,区分不同业务系统菜单',
- `system_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务系统名称',
- `application` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '终端类型,00:平台',
- `parent_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级菜单编码',
- `menu_icon` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单图标',
- `url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单访问路径',
- `open_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单打开类型,1:路由 2:新标签页 3:iframe',
- `sn` int(4) NULL DEFAULT NULL COMMENT '序号',
- `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
- `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
- `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
- `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
- `status` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '01' COMMENT '启用标识 01 启用',
- `version` bigint(20) NULL DEFAULT 0 COMMENT '版本号',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of tb_sys_menu
--- ----------------------------
-INSERT INTO `tb_sys_menu` VALUES (1, '00', '迷彩平台', '1', '1', '00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (2, '1', '区域管理', '1', '1', '00', '00', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (3, '2', '日志管理', '1', '1', '00', '00', NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (4, '3', '字典管理', '1', '1', '00', '00', NULL, NULL, NULL, 3, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (5, '4', '权限管理', '1', '1', '00', '00', NULL, NULL, NULL, 4, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (6, '5', '菜单管理', '1', '1', '00', '00', NULL, NULL, NULL, 5, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (7, '6', '组织管理', '1', '1', '00', '00', NULL, NULL, NULL, 6, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (8, '7', '角色管理', '1', '1', '00', '00', NULL, NULL, NULL, 7, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (9, '8', '用户管理', '1', '1', '00', '00', NULL, NULL, NULL, 8, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (10, '10', '子菜单-区域管理1', '1', '1', '00', '1', NULL, NULL, NULL, 3, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (11, '11', '子菜单-区域管理2', '1', '1', '00', '1', NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (12, '12', '子菜单-区域管理3', '1', '1', '00', '1', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (13, '13', '子菜单-区域管理1-详细1', '1', '1', '00', '10', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (14, '14', '子菜单-区域管理1-详细2', '1', '1', '00', '10', NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, '01', NULL);
-INSERT INTO `tb_sys_menu` VALUES (15, '15', '子菜单-区域管理1-详细3', '1', '1', '00', '10', NULL, NULL, NULL, 3, NULL, NULL, NULL, NULL, '01', NULL);
-
-- ----------------------------
-- Table structure for tb_user
-- ----------------------------
diff --git a/pom.xml b/pom.xml
index 9eab1b2..1cfbc9f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,7 +36,6 @@
2.8.3
7.2.18
3.4.3.4
- 1.9.2
3.4.0
3.16
3.16
@@ -147,11 +146,6 @@
spring-boot-starter-validation
${validation.version}
-
- com.github.xiaoymin
- swagger-bootstrap-ui
- ${swagger-bootstrap-ui.version}
-
org.apache.commons
commons-io
--
Gitee
From adc3a9a41e27831e4c9dbea0901a074cd8991789 Mon Sep 17 00:00:00 2001
From: liucong
Date: Tue, 27 Dec 2022 10:26:16 +0800
Subject: [PATCH 12/16] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?=
=?UTF-8?q?=E7=9A=84=E7=B1=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../authserver/config/JwtTokenEnhancer.java | 3 +-
.../micai/platform/common/base/sms/Sms.java | 18 --
.../common/base/sms/impl/AbstractSms.java | 13 --
.../common/base/sms/impl/QiniuSmsImpl.java | 19 ---
.../resourcesserver/config/SiteOptions.java | 60 -------
.../controller/BaseController.java | 6 -
.../controller/UploadController.java | 110 ------------
.../resourcesserver/storage/Storage.java | 58 -------
.../storage/StorageFactory.java | 45 -----
.../storage/impl/AbstractStorage.java | 100 -----------
.../storage/impl/MinioStorageImpl.java | 23 ---
.../storage/impl/NativeStorageImpl.java | 38 -----
.../storage/impl/OssStorageImpl.java | 80 ---------
.../storage/impl/QiniuStorageImpl.java | 23 ---
.../storage/impl/UpYunStorageImpl.java | 17 --
.../resourcesserver/utils/FileKit.java | 54 ------
.../resourcesserver/utils/FilePathUtils.java | 53 ------
.../resourcesserver/utils/PdfMergeUtils.java | 103 ------------
.../utils/WatermarkOffice.java | 158 ------------------
.../resourcesserver/utils/WatermarkPdf.java | 76 ---------
.../resourcesserver/utils/WatermarkUtils.java | 58 -------
21 files changed, 1 insertion(+), 1114 deletions(-)
delete mode 100644 platform-common/src/main/java/org/micai/platform/common/base/sms/Sms.java
delete mode 100644 platform-common/src/main/java/org/micai/platform/common/base/sms/impl/AbstractSms.java
delete mode 100644 platform-common/src/main/java/org/micai/platform/common/base/sms/impl/QiniuSmsImpl.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SiteOptions.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/UploadController.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/Storage.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/StorageFactory.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/AbstractStorage.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/MinioStorageImpl.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/NativeStorageImpl.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/OssStorageImpl.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/QiniuStorageImpl.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/UpYunStorageImpl.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FileKit.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FilePathUtils.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/PdfMergeUtils.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkOffice.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkPdf.java
delete mode 100644 platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkUtils.java
diff --git a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/JwtTokenEnhancer.java b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/JwtTokenEnhancer.java
index 7767160..dfd7983 100644
--- a/platform-auth-server/src/main/java/org/micai/platform/authserver/config/JwtTokenEnhancer.java
+++ b/platform-auth-server/src/main/java/org/micai/platform/authserver/config/JwtTokenEnhancer.java
@@ -33,8 +33,7 @@ public class JwtTokenEnhancer implements TokenEnhancer {
public OAuth2AccessToken enhance(OAuth2AccessToken oAuth2AccessToken, OAuth2Authentication oAuth2Authentication) {
Map info = new HashMap<>();
//自定义的信息
- info.put("com", "liucong");
- info.put("with", "micai");
+ info.put("author", "liucong");
((DefaultOAuth2AccessToken) oAuth2AccessToken).setAdditionalInformation(info);
return oAuth2AccessToken;
}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/sms/Sms.java b/platform-common/src/main/java/org/micai/platform/common/base/sms/Sms.java
deleted file mode 100644
index 4eb175d..0000000
--- a/platform-common/src/main/java/org/micai/platform/common/base/sms/Sms.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.micai.platform.common.base.sms;
-
-/**
- * @Author zhaoxinguo
- * @Date 2021-12-10 13:26
- * @ClassName Sms
- * @Description 短信发送接口
- */
-public interface Sms {
-
- /**
- * 发送短信
- * @param messageContent 短信内容
- * @param receiveNumber 接收人手机号
- * @return
- */
- String sendSms(String messageContent, String receiveNumber);
-}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/sms/impl/AbstractSms.java b/platform-common/src/main/java/org/micai/platform/common/base/sms/impl/AbstractSms.java
deleted file mode 100644
index 92e18d3..0000000
--- a/platform-common/src/main/java/org/micai/platform/common/base/sms/impl/AbstractSms.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.micai.platform.common.base.sms.impl;
-
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.common.base.sms.Sms;
-
-/**
- * 系统短信接口抽象实现类
- */
-@Slf4j
-public abstract class AbstractSms implements Sms {
-
-
-}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/sms/impl/QiniuSmsImpl.java b/platform-common/src/main/java/org/micai/platform/common/base/sms/impl/QiniuSmsImpl.java
deleted file mode 100644
index 7871dae..0000000
--- a/platform-common/src/main/java/org/micai/platform/common/base/sms/impl/QiniuSmsImpl.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.micai.platform.common.base.sms.impl;
-
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.common.base.sms.Sms;
-import org.springframework.stereotype.Component;
-
-/**
- * 七牛云-短信接口抽象实现类
- */
-@Slf4j
-@Component
-public class QiniuSmsImpl extends AbstractSms implements Sms {
-
- @Override
- public String sendSms(String messageContent, String receiveNumber) {
-
- return null;
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SiteOptions.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SiteOptions.java
deleted file mode 100644
index 2594617..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/SiteOptions.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.micai.platform.resourcesserver.config;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author : langhsu
- * @version : 1.0
- * @date : 2019/01/18
- */
-@Component
-@ConfigurationProperties(prefix = "site")
-public class SiteOptions {
-
- /**
- * 运行文件存储路径
- */
- private String location;
-
- /**
- * 属性配置
- */
- private Map options = new HashMap<>();
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public Integer[] getIntegerArrayValue(String key, String separator) {
- String value = getValue(key);
- String[] array = value.split(separator);
- Integer[] ret = new Integer[array.length];
- for (int i = 0; i < array.length; i ++) {
- ret[i] = Integer.parseInt(array[i]);
- }
- return ret;
- }
-
- public Integer getIntegerValue(String key) {
- return Integer.parseInt(options.get(key));
- }
-
- public String getValue(String key) {
- String value = options.get(key);
- return null != value ? value.trim() : null;
- }
-
- public boolean hasValue(String key) {
- return StringUtils.isNotBlank(options.get(key));
- }
-
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/BaseController.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/BaseController.java
index b610148..c80dc65 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/BaseController.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/BaseController.java
@@ -1,9 +1,7 @@
package org.micai.platform.resourcesserver.controller;
import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.resourcesserver.config.SiteOptions;
import org.micai.platform.resourcesserver.service.UserService;
-import org.micai.platform.resourcesserver.storage.StorageFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
@@ -28,10 +26,6 @@ public abstract class BaseController {
protected UserService userService;
@Autowired
protected BCryptPasswordEncoder bCryptPasswordEncoder;
- @Autowired
- protected StorageFactory storageFactory;
- @Autowired
- protected SiteOptions siteOptions;
/**
* 获取用户所拥有的权限列表
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/UploadController.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/UploadController.java
deleted file mode 100644
index 3e7dabd..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/UploadController.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.micai.platform.resourcesserver.controller;
-
-import cn.hutool.core.util.ObjectUtil;
-import io.swagger.annotations.Api;
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.common.base.constant.ConstantCode;
-import org.micai.platform.common.base.constant.ConstantEnum;
-import org.micai.platform.common.base.result.UploadResult;
-import org.micai.platform.resourcesserver.utils.FileKit;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.ServletRequestUtils;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * 文件上传
- *
- */
-@Controller
-@RequestMapping("/upload")
-@Api(tags = "文件上传", value = "文件上传")
-@Slf4j
-public class UploadController extends BaseController {
-
- @PostMapping("/store")
- @ResponseBody
- public UploadResult store(@RequestParam(value = "file", required = false) MultipartFile file,
- HttpServletRequest request){
- // 检查空
- if (ObjectUtil.isEmpty(file)) {
- return new UploadResult(ConstantEnum.NO_FILE);
- }
-
- String fileName = file.getOriginalFilename();
-
- // 检查类型
- if (!FileKit.checkFileType(fileName)) {
- return new UploadResult(ConstantEnum.TYPE);
- }
-
- // 检查大小
- String limitSize = siteOptions.getValue(ConstantCode.STORAGE_LIMIT_SIZE);
- if (ObjectUtil.isEmpty(limitSize)) {
- limitSize = ConstantCode.STR_TWO;
- }
- if (file.getSize() > (Long.parseLong(limitSize) * ConstantCode.DING * ConstantCode.DING)) {
- return new UploadResult(ConstantEnum.SIZE);
- }
-
- // 保存图片
- try {
- String path = storageFactory.get().store(file, ConstantCode.thumbnailPath);
- return new UploadResult(ConstantEnum.SUCCESS).setName(fileName).setPath(path).setSize(file.getSize());
- } catch (Exception e) {
- log.error("error info:",e);
- return new UploadResult(ConstantEnum.UNKNOWN);
- }
- }
-
- @PostMapping("/storeScale")
- @ResponseBody
- public UploadResult storeScale(@RequestParam(value = "file", required = false) MultipartFile file,
- HttpServletRequest request) {
- String crop = request.getParameter("crop");
- int size = ServletRequestUtils.getIntParameter(request, ConstantCode.SIZE, siteOptions.getIntegerValue(ConstantCode.STORAGE_MAX_WIDTH));
-
- // 检查空
- if (ObjectUtil.isEmpty(file)) {
- return new UploadResult(ConstantEnum.NO_FILE);
- }
-
- String fileName = file.getOriginalFilename();
-
- // 检查类型
- if (!FileKit.checkFileType(fileName)) {
- return new UploadResult(ConstantEnum.TYPE);
- }
-
- // 检查大小
- String limitSize = siteOptions.getValue(ConstantCode.STORAGE_LIMIT_SIZE);
- if (ObjectUtil.isEmpty(limitSize)) {
- limitSize = ConstantCode.STR_TWO;
- }
- if (file.getSize() > (Long.parseLong(limitSize) * ConstantCode.DING * ConstantCode.DING)) {
- return new UploadResult(ConstantEnum.SIZE);
- }
-
- // 保存图片
- try {
- String path;
- if (ObjectUtil.isEmpty(crop)) {
- Integer[] imageSize = siteOptions.getIntegerArrayValue(crop, ConstantCode.SEPARATOR_X);
- int width = ServletRequestUtils.getIntParameter(request, ConstantCode.WIDTH, imageSize[ConstantCode.INT_ZERO]);
- int height = ServletRequestUtils.getIntParameter(request, ConstantCode.HEIGHT, imageSize[ConstantCode.INT_ONE]);
- path = storageFactory.get().storeScale(file, ConstantCode.thumbnailPath, width, height);
- } else {
- path = storageFactory.get().storeScale(file, ConstantCode.thumbnailPath, size);
- }
- return new UploadResult(ConstantEnum.SUCCESS).setName(fileName).setPath(path).setSize(file.getSize());
- } catch (Exception e) {
- log.error("error info:",e);
- return new UploadResult(ConstantEnum.UNKNOWN);
- }
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/Storage.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/Storage.java
deleted file mode 100644
index 060537e..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/Storage.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.micai.platform.resourcesserver.storage;
-
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-
-/**
- * 系统存储接口
- */
-public interface Storage {
-
- /**
- * 存储图片
- *
- * @param file
- * @param basePath
- * @return
- * @throws IOException
- */
- String store(MultipartFile file, String basePath) throws Exception;
-
- /**
- * 存储压缩图片
- *
- * @param file
- * @param basePath
- * @return
- * @throws IOException
- */
- String storeScale(MultipartFile file, String basePath, int maxWidth) throws Exception;
-
- /**
- * 存储压缩图片
- *
- * @param file
- * @param basePath
- * @return
- * @throws IOException
- */
- String storeScale(MultipartFile file, String basePath, int width, int height) throws Exception;
-
- /**
- * 存储路径
- *
- * @param storePath
- */
- void deleteFile(String storePath);
-
- /**
- * 写入字节到指定的目录文件
- *
- * @param bytes
- * @param pathAndFileName
- * @return
- * @throws Exception
- */
- String writeToStore(byte[] bytes, String pathAndFileName) throws Exception;
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/StorageFactory.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/StorageFactory.java
deleted file mode 100644
index b39278a..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/StorageFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.micai.platform.resourcesserver.storage;
-
-import org.apache.commons.lang3.StringUtils;
-import org.micai.platform.resourcesserver.config.SiteOptions;
-import org.micai.platform.resourcesserver.storage.impl.NativeStorageImpl;
-import org.micai.platform.resourcesserver.storage.impl.OssStorageImpl;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@Component
-public class StorageFactory implements InitializingBean {
-
- @Autowired
- private ApplicationContext applicationContext;
- @Autowired
- private SiteOptions siteOptions;
- private Map fileRepoMap = new HashMap<>();
-
- @Override
- public void afterPropertiesSet() throws Exception {
- fileRepoMap.put("native", applicationContext.getBean(NativeStorageImpl.class));
- fileRepoMap.put("aliyun", applicationContext.getBean(OssStorageImpl.class));
- }
-
- public boolean registry(String key, Storage storage) {
- if (fileRepoMap.containsKey(key)) {
- return false;
- }
- fileRepoMap.put(key, storage);
- return true;
- }
-
- public Storage get() {
- String scheme = siteOptions.getValue("storage_scheme");
- if (StringUtils.isBlank(scheme)) {
- scheme = "native";
- }
- return fileRepoMap.get(scheme);
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/AbstractStorage.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/AbstractStorage.java
deleted file mode 100644
index 21718bf..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/AbstractStorage.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.micai.platform.resourcesserver.storage.impl;
-
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.common.base.constant.ConstantEnum;
-import org.micai.platform.common.base.exception.PlatformException;
-import org.micai.platform.resourcesserver.config.SiteOptions;
-import org.micai.platform.resourcesserver.storage.Storage;
-import org.micai.platform.resourcesserver.utils.FileKit;
-import org.micai.platform.resourcesserver.utils.FilePathUtils;
-import org.micai.platform.resourcesserver.utils.ImageUtils;
-import org.micai.platform.resourcesserver.utils.MD5;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.multipart.MultipartFile;
-
-/**
- * 系统存储接口抽象实现类
- */
-@Slf4j
-public abstract class AbstractStorage implements Storage {
-
- @Autowired
- protected SiteOptions siteOptions;
-
- /**
- * 验证文件
- *
- * @param file
- */
- protected void validateFile(MultipartFile file) {
- if (file == null || file.isEmpty()) {
- throw new PlatformException(ConstantEnum.NO_FILE);
- }
- if (!FileKit.checkFileType(file.getOriginalFilename())) {
- throw new PlatformException(ConstantEnum.TYPE);
- }
- }
-
- /**
- * 存储图片
- * @param file
- * @param basePath
- * @return
- * @throws Exception
- */
- @Override
- public String store(MultipartFile file, String basePath) throws Exception {
- validateFile(file);
- return writeToStore(file.getBytes(), basePath, file.getOriginalFilename());
- }
-
- /**
- * 存储压缩图片
- * @param file
- * @param basePath
- * @param maxWidth
- * @return
- * @throws Exception
- */
- @Override
- public String storeScale(MultipartFile file, String basePath, int maxWidth) throws Exception {
- validateFile(file);
- byte[] bytes = ImageUtils.scaleByWidth(file, maxWidth);
- return writeToStore(bytes, basePath, file.getOriginalFilename());
- }
-
- /**
- * 存储压缩图片
- * @param file
- * @param basePath
- * @param width
- * @param height
- * @return
- * @throws Exception
- */
- @Override
- public String storeScale(MultipartFile file, String basePath, int width, int height) throws Exception {
- validateFile(file);
- byte[] bytes = ImageUtils.screenshot(file, width, height);
- return writeToStore(bytes, basePath, file.getOriginalFilename());
- }
-
- public String writeToStore(byte[] bytes, String src, String originalFilename) throws Exception {
- String md5 = MD5.md5(bytes);
- /*Resource resource = resourceRepository.findByMd5(md5);
- if (resource != null){
- return resource.getPath();
- }*/
- String path = FilePathUtils.wholePathName(src, originalFilename, md5);
- path = writeToStore(bytes, path);
-
- // 图片入库
- /*resource = new Resource();
- resource.setMd5(md5);
- resource.setPath(path);
- resource.setCreateTime(LocalDateTime.now());
- resourceRepository.save(resource);*/
- return path;
- }
-
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/MinioStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/MinioStorageImpl.java
deleted file mode 100644
index 475e8a6..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/MinioStorageImpl.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.micai.platform.resourcesserver.storage.impl;
-
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.resourcesserver.storage.Storage;
-import org.springframework.stereotype.Component;
-
-/**
- * MinIO-存储接口抽象实现类
- */
-@Slf4j
-@Component
-public class MinioStorageImpl extends AbstractStorage implements Storage {
-
- @Override
- public void deleteFile(String storePath) {
-
- }
-
- @Override
- public String writeToStore(byte[] bytes, String pathAndFileName) throws Exception {
- return null;
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/NativeStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/NativeStorageImpl.java
deleted file mode 100644
index 22add12..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/NativeStorageImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.micai.platform.resourcesserver.storage.impl;
-
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.resourcesserver.storage.Storage;
-import org.micai.platform.resourcesserver.utils.FileKit;
-import org.springframework.stereotype.Component;
-
-import java.io.File;
-
-/**
- * 本地-存储接口抽象实现类
- */
-@Slf4j
-@Component
-public class NativeStorageImpl extends AbstractStorage implements Storage {
-
- @Override
- public void deleteFile(String storePath) {
- File file = new File(getStoragePath() + storePath);
-
- // 文件存在, 且不是目录
- if (file.exists() && !file.isDirectory()) {
- file.delete();
- log.info("fileRepo delete " + storePath);
- }
- }
-
- @Override
- public String writeToStore(byte[] bytes, String pathAndFileName) throws Exception {
- String dest = getStoragePath() + pathAndFileName;
- FileKit.writeByteArrayToFile(bytes, dest);
- return pathAndFileName;
- }
-
- private String getStoragePath() {
- return siteOptions.getLocation();
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/OssStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/OssStorageImpl.java
deleted file mode 100644
index 93b0ce2..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/OssStorageImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.micai.platform.resourcesserver.storage.impl;
-
-import com.aliyun.oss.OSSClient;
-import com.upyun.UpYunUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.micai.platform.common.base.constant.ConstantEnum;
-import org.micai.platform.common.base.exception.PlatformException;
-import org.micai.platform.resourcesserver.storage.Storage;
-import org.micai.platform.resourcesserver.utils.FileKit;
-import org.springframework.stereotype.Component;
-
-import java.io.ByteArrayInputStream;
-
-/**
- * 阿里云OSS-存储接口抽象实现类
- */
-@Slf4j
-@Component
-public class OssStorageImpl extends AbstractStorage implements Storage {
-
- private static final String oss_endpoint = "aliyun_oss_endpoint";
- private static final String oss_bucket = "aliyun_oss_bucket";
- private static final String oss_key = "aliyun_oss_key";
- private static final String oss_secret = "aliyun_oss_secret";
- private static final String oss_src = "aliyun_oss_src";
-
- @Override
- public void deleteFile(String storePath) {
- String bucket = siteOptions.getValue(oss_bucket);
- String endpoint = siteOptions.getValue(oss_endpoint);
- String path = StringUtils.remove(storePath, "//" + bucket.trim() + "." + endpoint.trim() + "/");
- OSSClient client = builder();
- try {
- client.doesObjectExist(bucket, path);
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- }
- }
-
- @Override
- public String writeToStore(byte[] bytes, String pathAndFileName) throws Exception {
- String endpoint = siteOptions.getValue(oss_endpoint);
- String bucket = siteOptions.getValue(oss_bucket);
- String src = siteOptions.getValue(oss_src);
-
- if (StringUtils.isAnyBlank(endpoint, bucket)) {
- throw new PlatformException(ConstantEnum.NO_ALIYUN_CONFIG);
- }
-
- if (StringUtils.isBlank(src)) {
- src = "";
- } else {
- if (src.startsWith("/")) {
- src = src.substring(1);
- }
-
- if (!src.endsWith("/")) {
- src = src + "/";
- }
- }
-
- String key = UpYunUtils.md5(bytes);
- String path = src + key + FileKit.getSuffix(pathAndFileName);
- OSSClient client = builder();
- client.putObject(bucket, path, new ByteArrayInputStream(bytes));
- return "//" + bucket.trim() + "." + endpoint.trim() + "/" + path;
- }
-
- private OSSClient builder() {
- String endpoint = siteOptions.getValue(oss_endpoint);
- String accessKeyId = siteOptions.getValue(oss_key);
- String accessKeySecret = siteOptions.getValue(oss_secret);
-
- if (StringUtils.isAnyBlank(endpoint, accessKeyId, accessKeySecret)) {
- throw new PlatformException(ConstantEnum.NO_ALIYUN_CONFIG);
- }
- return new OSSClient(endpoint, accessKeyId, accessKeySecret);
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/QiniuStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/QiniuStorageImpl.java
deleted file mode 100644
index 02005ed..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/QiniuStorageImpl.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.micai.platform.resourcesserver.storage.impl;
-
-import lombok.extern.slf4j.Slf4j;
-import org.micai.platform.resourcesserver.storage.Storage;
-import org.springframework.stereotype.Component;
-
-/**
- * 七牛云OSS-存储接口抽象实现类
- */
-@Slf4j
-@Component
-public class QiniuStorageImpl extends AbstractStorage implements Storage {
-
- @Override
- public void deleteFile(String storePath) {
-
- }
-
- @Override
- public String writeToStore(byte[] bytes, String pathAndFileName) throws Exception {
- return null;
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/UpYunStorageImpl.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/UpYunStorageImpl.java
deleted file mode 100644
index 5fb3ebe..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/storage/impl/UpYunStorageImpl.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.micai.platform.resourcesserver.storage.impl;
-
-
-import org.micai.platform.resourcesserver.storage.Storage;
-
-public class UpYunStorageImpl extends AbstractStorage implements Storage {
-
- @Override
- public void deleteFile(String storePath) {
-
- }
-
- @Override
- public String writeToStore(byte[] bytes, String pathAndFileName) throws Exception {
- return null;
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FileKit.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FileKit.java
deleted file mode 100644
index 25115b7..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FileKit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.micai.platform.resourcesserver.utils;
-
-import com.sun.istack.internal.NotNull;
-import org.apache.commons.io.FileUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author - langhsu
- * @create - 2018/3/9
- */
-public class FileKit {
-
- // 文件允许格式
- private final static List allowFiles = Arrays.asList(".gif", ".png", ".jpg", ".jpeg", ".bmp");
- private final static String PREFIX_VIDEO = "video/";
- private final static String PREFIX_IMAGE = "image/";
-
- /**
- * 文件类型判断
- *
- * @param fileName
- * @return
- */
- public static boolean checkFileType(String fileName) {
- Iterator type = allowFiles.iterator();
- while (type.hasNext()) {
- String ext = type.next();
- if (fileName.toLowerCase().endsWith(ext)) {
- return true;
- }
- }
- return false;
- }
-
- public static String getFilename(@NotNull String filename) {
- int pos = filename.lastIndexOf(".");
- return filename.substring(0, pos);
- }
-
- public static String getSuffix(String filename) {
- int pos = filename.lastIndexOf(".");
- return filename.substring(pos);
- }
-
- public static void writeByteArrayToFile(byte[] bytes, String dest) throws IOException {
- FileUtils.writeByteArrayToFile(new File(dest), bytes);
- }
-
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FilePathUtils.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FilePathUtils.java
deleted file mode 100644
index 054ecea..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/FilePathUtils.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.micai.platform.resourcesserver.utils;
-
-import org.apache.commons.text.RandomStringGenerator;
-
-/**
- * @author langhsu
- */
-public class FilePathUtils {
- private static final int[] AVATAR_GRIDS = new int[]{3, 3, 3};
- private static final int AVATAR_LENGTH = 9;
- private static final String Y = "/yyyy/";
- private static RandomStringGenerator randomString = new RandomStringGenerator.Builder().withinRange('a', 'z').build();
-
- public static String getAvatar(long key) {
- String r = String.format("%09d", key);
- StringBuffer buf = new StringBuffer(32);
- int pos = 0;
- for (int t : AVATAR_GRIDS) {
- buf.append(r.substring(pos, pos + t));
- pos += t;
- if (pos < AVATAR_LENGTH) {
- buf.append('/');
- }
- }
- return buf.toString();
- }
-
- /**
- * 生成路径和文件名
- * 以当前时间开头加4位随机数的文件名
- *
- * @param originalFilename 原始文件名
- * @return 10位长度文件名+文件后缀
- */
- public static String wholePathName(String originalFilename, String key) {
- StringBuilder builder = new StringBuilder(52);
- builder.append("/_signature/");
- builder.append(key);
- builder.append(FileKit.getSuffix(originalFilename));
- return builder.toString();
- }
-
- public static String wholePathName(String basePath, String ext, String key) {
- return basePath + wholePathName(ext, key);
- }
-
- public static void main(String[] args) {
- String base = FilePathUtils.getAvatar(50);
- System.out.println(String.format("/%s_%d.jpg", base, 100));
- System.out.println(FilePathUtils.wholePathName("a.jpg", "123"));
- }
-
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/PdfMergeUtils.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/PdfMergeUtils.java
deleted file mode 100644
index d1c60c0..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/PdfMergeUtils.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.micai.platform.resourcesserver.utils;
-
-import com.itextpdf.text.Document;
-import com.itextpdf.text.pdf.PdfContentByte;
-import com.itextpdf.text.pdf.PdfImportedPage;
-import com.itextpdf.text.pdf.PdfReader;
-import com.itextpdf.text.pdf.PdfWriter;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @ClassName PdfMergeUtils
- * @Description This class is used to merge two or more existing pdf file using iText jar.
- * @Author zhaoxinguo
- * @Date 2021/11/23 17:33
- * @Version 1.0
- */
-public class PdfMergeUtils {
-
- /**
- * 合并多个pdf到一个pdf
- * @param inputPdfList
- * @param outputStream
- * @throws Exception
- */
- public static void mergePdfFiles(List inputPdfList, OutputStream outputStream) throws Exception{
- //Create document and pdfReader objects.
- Document document = new Document();
- List readers =
- new ArrayList();
- int totalPages = 0;
-
- //Create pdf Iterator object using inputPdfList.
- Iterator pdfIterator =
- inputPdfList.iterator();
-
- // Create reader list for the input pdf files.
- while (pdfIterator.hasNext()) {
- InputStream pdf = pdfIterator.next();
- PdfReader pdfReader = new PdfReader(pdf);
- readers.add(pdfReader);
- totalPages = totalPages + pdfReader.getNumberOfPages();
- }
-
- // Create writer for the outputStream
- PdfWriter writer = PdfWriter.getInstance(document, outputStream);
-
- //Open document.
- document.open();
-
- //Contain the pdf data.
- PdfContentByte pageContentByte = writer.getDirectContent();
-
- PdfImportedPage pdfImportedPage;
- int currentPdfReaderPage = 1;
- Iterator iteratorPDFReader = readers.iterator();
-
- // Iterate and process the reader list.
- while (iteratorPDFReader.hasNext()) {
- PdfReader pdfReader = iteratorPDFReader.next();
- //Create page and add content.
- while (currentPdfReaderPage <= pdfReader.getNumberOfPages()) {
- document.newPage();
- pdfImportedPage = writer.getImportedPage(
- pdfReader,currentPdfReaderPage);
- pageContentByte.addTemplate(pdfImportedPage, 0, 0);
- currentPdfReaderPage++;
- }
- currentPdfReaderPage = 1;
- }
-
- //Close document and outputStream.
- outputStream.flush();
- document.close();
- outputStream.close();
-
- System.out.println("Pdf files merged successfully.");
- }
-
- public static void main(String args[]){
- try {
- //Prepare input pdf file list as list of input stream.
- List inputPdfList = new ArrayList();
- inputPdfList.add(new FileInputStream("E:\\BaiduNetdiskDownload\\批示件系统内-打印审核 - 副本.pdf"));
- inputPdfList.add(new FileInputStream("E:\\BaiduNetdiskDownload\\批示件系统内-打印审核.pdf"));
-
- //Prepare output stream for merged pdf file.
- OutputStream outputStream =
- new FileOutputStream("E:\\BaiduNetdiskDownload\\批示件系统内-打印审核-MergeFile.pdf");
-
- //call method to merge pdf files.
- mergePdfFiles(inputPdfList, outputStream);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkOffice.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkOffice.java
deleted file mode 100644
index 43dad6f..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkOffice.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.micai.platform.resourcesserver.utils;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.poi.EncryptedDocumentException;
-import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
-import org.apache.poi.hssf.usermodel.HSSFFont;
-import org.apache.poi.hssf.usermodel.HSSFPatriarch;
-import org.apache.poi.hssf.usermodel.HSSFRichTextString;
-import org.apache.poi.hssf.usermodel.HSSFShape;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFTextbox;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
-import org.apache.poi.ss.usermodel.WorkbookFactory;
-import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
-import org.apache.poi.xssf.usermodel.XSSFDrawing;
-import org.apache.poi.xssf.usermodel.XSSFFont;
-import org.apache.poi.xssf.usermodel.XSSFRichTextString;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFTextBox;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
-import org.apache.poi.xwpf.usermodel.XWPFDocument;
-
-public final class WatermarkOffice {
-
- public static void main(String[] args) throws IOException, EncryptedDocumentException, InvalidFormatException {
- try {
- String src = "D:\\test.docx";
- String target = "D:\\test-watermark.docx";
- String text = "YLIYUN";
- word(src, target, text);
- System.out.println("ok");
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- public static void word(String src, String target, String text) throws IOException {
- XWPFDocument doc = null;
- OutputStream out = null;
- try {
- doc = new XWPFDocument(new FileInputStream(src));
- XWPFHeaderFooterPolicy footer = new XWPFHeaderFooterPolicy(doc);
- footer.createWatermark(text);
- out = new FileOutputStream(target);
- doc.write(out);
- } finally {
- if (doc != null) {
- doc.close();
- }
- if (out != null) {
- out.close();
- }
- }
-
- }
-
- public static void excel2003(String src, String target, String text)
- throws IOException, EncryptedDocumentException, InvalidFormatException {
- HSSFWorkbook wb = null;
- OutputStream out = null;
- try {
- InputStream input = new FileInputStream(src);
-
- wb = (HSSFWorkbook) WorkbookFactory.create(input);
- HSSFSheet sheet = null;
-
- int sheetNumbers = wb.getNumberOfSheets();
-
- // sheet
- for (int i = 0; i < sheetNumbers; i++) {
- sheet = wb.getSheetAt(i);
- // sheet.createDrawingPatriarch();
-
- HSSFPatriarch dp = sheet.createDrawingPatriarch();
- HSSFClientAnchor anchor = new HSSFClientAnchor(0, 255, 550, 0, (short) 0, 1, (short) 6, 5);
-
- // HSSFComment comment = dp.createComment(anchor);
- HSSFTextbox txtbox = dp.createTextbox(anchor);
-
- HSSFRichTextString rtxt = new HSSFRichTextString(text);
- HSSFFont draftFont = (HSSFFont) wb.createFont();
- // 水印颜色
- draftFont.setColor((short) 55);
- draftFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
- // 字体大小
- draftFont.setFontHeightInPoints((short) 30);
- draftFont.setFontName("Verdana");
- rtxt.applyFont(draftFont);
- txtbox.setString(rtxt);
- // 倾斜度
- txtbox.setRotationDegree((short) 315);
- txtbox.setLineWidth(600);
- txtbox.setLineStyle(HSSFShape.LINESTYLE_NONE);
- txtbox.setNoFill(true);
- }
-
- out = new FileOutputStream(target);
- wb.write(out);
- } finally {
- if (wb != null) {
- wb.close();
- }
- if (out != null) {
- out.close();
- }
- }
-
- }
-
- public static void excel2007(String src, String target, String text)
- throws IOException, EncryptedDocumentException, InvalidFormatException {
- XSSFWorkbook wb = null;
- OutputStream out = null;
- try {
- InputStream input = new FileInputStream(src);
- wb = (XSSFWorkbook) WorkbookFactory.create(input);
-
- XSSFSheet sheet = null;
- int sheetNumbers = wb.getNumberOfSheets();
- for (int i = 0; i < sheetNumbers; i++) {
- sheet = wb.getSheetAt(i);
- XSSFDrawing dp = sheet.createDrawingPatriarch();
- XSSFClientAnchor anchor = new XSSFClientAnchor(0, 550, 550, 0, (short) 0, 1, (short) 6, 5);
- XSSFTextBox txtbox = dp.createTextbox(anchor);
- XSSFRichTextString rtxt = new XSSFRichTextString(text);
- XSSFFont draftFont = (XSSFFont) wb.createFont();
- draftFont.setColor((short) 55);
- draftFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
- draftFont.setFontHeightInPoints((short) 30);
- draftFont.setFontName("Verdana");
- rtxt.applyFont(draftFont);
- txtbox.setText(rtxt);
- // 倾斜度
- txtbox.setLineWidth(600);
- txtbox.setLineStyle(HSSFShape.LINESTYLE_NONE);
- txtbox.setNoFill(true);
- }
-
- out = new FileOutputStream(target);
- wb.write(out);
- } finally {
- if (wb != null) {
- wb.close();
- }
- if (out != null) {
- out.close();
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkPdf.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkPdf.java
deleted file mode 100644
index 9e6207d..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkPdf.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.micai.platform.resourcesserver.utils;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import com.itextpdf.text.BaseColor;
-import com.itextpdf.text.DocumentException;
-import com.itextpdf.text.Element;
-import com.itextpdf.text.Rectangle;
-import com.itextpdf.text.pdf.BaseFont;
-import com.itextpdf.text.pdf.PdfContentByte;
-import com.itextpdf.text.pdf.PdfGState;
-import com.itextpdf.text.pdf.PdfReader;
-import com.itextpdf.text.pdf.PdfStamper;
-
-public class WatermarkPdf {
-
- public static void main(String[] args) {
- try {
- String src = "E:\\BaiduNetdiskDownload\\Learn Microservices with Spring Boot.pdf";
- String target = "E:\\BaiduNetdiskDownload\\Learn Microservices with Spring Boot-watermark.pdf";
- String text = "YLIYUN";
- watermark(src, target, text);
- System.out.println("ok");
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- public static void watermark(String src, String target, String text) throws IOException, DocumentException {
- PdfReader reader = null;
- PdfStamper pdfStamper = null;
- try {
- reader = new PdfReader(src);
- pdfStamper = new PdfStamper(reader, new FileOutputStream(target));
-
- addWatermark(pdfStamper, text);
- } finally {
- if (pdfStamper != null) {
- pdfStamper.close();
- }
- }
- }
-
- private static void addWatermark(PdfStamper pdfStamper, String watermark) throws DocumentException, IOException {
- PdfGState gs = new PdfGState();
- // 设置透明度为0.4
- gs.setFillOpacity(0.4f);
- gs.setStrokeOpacity(0.4f);
-
- // 设置字体
- BaseFont base = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",BaseFont.EMBEDDED);
-
- int toPage = pdfStamper.getReader().getNumberOfPages();
-
- PdfContentByte content = null;
- Rectangle pageRect = null;
- for (int i = 1; i <= toPage; i++) {
- pageRect = pdfStamper.getReader().getPageSizeWithRotation(i);
- // 计算水印X,Y坐标
- float x = pageRect.getWidth() / 2;
- float y = pageRect.getHeight() / 2;
- //获得PDF最顶层
- content = pdfStamper.getOverContent(i);
- content.saveState();
- // set Transparency
- content.setGState(gs);
- content.beginText();
- content.setColorFill(BaseColor.GRAY);
- content.setFontAndSize(base, 100);
- // 水印文字成45度角倾斜
- content.showTextAligned(Element.ALIGN_CENTER, watermark, x, y, 315);
- content.endText();
- }
- }
-}
\ No newline at end of file
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkUtils.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkUtils.java
deleted file mode 100644
index b0a8699..0000000
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/utils/WatermarkUtils.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.micai.platform.resourcesserver.utils;
-
-/**
- * @ClassName WatermarkUtils
- * @Description 水印工具类
- * @Author zhaoxinguo
- * @Date 2021/11/23 17:33
- * @Version 1.0
- */
-public class WatermarkUtils {
-
- public static boolean watermark(String src, String target, String text) throws Exception {
- String ext = getFileExt(src);
- if ("pdf".equalsIgnoreCase(ext)) {
- WatermarkPdf.watermark(src, target, text);
- return true;
- } else if ("docx".equalsIgnoreCase(ext)) {
- WatermarkOffice.word(src, target, text);
- return true;
- } else if ("xlsx".equalsIgnoreCase(ext)) {
- WatermarkOffice.excel2007(src, target, text);
- return true;
- } else if ("xls".equalsIgnoreCase(ext)) {
- WatermarkOffice.excel2003(src, target, text);
- return true;
- }
- return false;
- }
-
- private static String getFileExt(String file) {
- int index = file.lastIndexOf(".");
- if (index != -1) {
- return file.substring(index + 1);
- }
- return "";
- }
-
- public static void main(String[] args) {
- if (args == null || args.length < 3) {
- System.exit(1);
- }
-
- String src = args[0];
- String target = args[1];
- String text = args[2];
-
- try {
- boolean b = watermark(src, target, text);
- if (b) {
- System.exit(0);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- System.exit(1);
- }
-}
--
Gitee
From 9f349bdfb998a07472e0151d3c4f8ec1a05840c1 Mon Sep 17 00:00:00 2001
From: liucong
Date: Tue, 27 Dec 2022 11:04:57 +0800
Subject: [PATCH 13/16] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=87=E6=BB=A4?=
=?UTF-8?q?=E5=99=A8=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../config/MicaiPlatformRequestMatcher.java | 21 ------------
.../config/MicaiPlatformResourcesConfig.java | 4 ++-
.../config/ResourceServerConfig.java | 2 +-
.../filter/AuthHeaderFilter.java | 34 ++++++++-----------
.../src/main/resources/application-dev.yml | 8 ++---
5 files changed, 21 insertions(+), 48 deletions(-)
delete mode 100644 platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformRequestMatcher.java
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformRequestMatcher.java b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformRequestMatcher.java
deleted file mode 100644
index fdd0c9d..0000000
--- a/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformRequestMatcher.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.micai.platform.common.base.config;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * @Author liuCong
- * @Date 2022/12/13 下午 2:08
- * @ClassName MicaiPlatformRequestMatcher
- * @Description
- */
-@Data
-public class MicaiPlatformRequestMatcher {
-
- private List jwtAuth;
- private List oauth2Auth;
-
-
-
-}
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformResourcesConfig.java b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformResourcesConfig.java
index c3b3268..70ab718 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformResourcesConfig.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/config/MicaiPlatformResourcesConfig.java
@@ -4,6 +4,8 @@ import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
+import java.util.List;
+
/**
* @Author liuCong
* @Date 2022/12/13 上午 9:38
@@ -18,6 +20,6 @@ public class MicaiPlatformResourcesConfig {
/** JWT*/
private String signKey;
private String resourceIds;
- private MicaiPlatformRequestMatcher requestMatcher;
+ private List requestMatcher;
}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
index cb7b16e..513ee3c 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/config/ResourceServerConfig.java
@@ -128,7 +128,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
.permitAll();
AuthHeaderFilter authHeaderFilter = new AuthHeaderFilter();
- authHeaderFilter.setAuthHeaderRequestMatcher(micaiPlatformResourcesConfig.getRequestMatcher().getJwtAuth(), micaiPlatformResourcesConfig.getRequestMatcher().getOauth2Auth());
+ authHeaderFilter.setAuthHeaderRequestMatcher(micaiPlatformResourcesConfig.getRequestMatcher());
//为什么要在after
//因为OAuth2AuthenticationProcessingFilter.doFilter()包含了SecurityContextHolder.clearContext();
http.addFilterAfter(new JWTAuthenticationFilter(authenticationManager,micaiPlatformTokenConfig), AbstractPreAuthenticatedProcessingFilter.class);
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
index 32012ef..4a59d23 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
@@ -28,30 +28,19 @@ import java.util.Vector;
@Slf4j
public class AuthHeaderFilter implements Filter {
- //拦截接口让JWTAuthenticationFilter去验证
- private final List authJwtRequestMatcher = new ArrayList<>();
-
//拦截接口让OAuth2AuthenticationProcessingFilter去验证
private final List authOAuth2RequestMatcher = new ArrayList<>();
- public void setAuthHeaderRequestMatcher(List jwtAuthList, List oauth2AuthList) {
- Assert.notNull(authJwtRequestMatcher, "authJwtRequestMatcher cannot be null");
+ public void setAuthHeaderRequestMatcher(List oauth2AuthList) {
Assert.notNull(authOAuth2RequestMatcher, "authOAuth2RequestMatcher cannot be null");
- if (ObjectUtil.isNotEmpty(jwtAuthList)) {
- for (String jwtAuth : jwtAuthList) {
- authJwtRequestMatcher.add(new AntPathRequestMatcher(jwtAuth));
- }
- }
-
if (ObjectUtil.isNotEmpty(oauth2AuthList)) {
for (String oauth2Auth : oauth2AuthList) {
authOAuth2RequestMatcher.add(new AntPathRequestMatcher(oauth2Auth));
}
}
log.info("init request matcher list:==========================>>>>>>>>>>>>>>>>> \n" +
- "authJwtRequestMatcher:{},authOAuth2RequestMatcher{} "
- , authJwtRequestMatcher, authOAuth2RequestMatcher);
+ "authOAuth2RequestMatcher{} ", authOAuth2RequestMatcher);
}
@Override
@@ -69,15 +58,22 @@ public class AuthHeaderFilter implements Filter {
*/
@Override
public String getHeader(String name) {
- if (ObjectUtil.isNotEmpty(authJwtRequestMatcher)) {
- for (AntPathRequestMatcher antPathRequestMatcher : authJwtRequestMatcher) {
- if (antPathRequestMatcher.matches(request) && ConstantCode.AUTHORIZATION.equalsIgnoreCase(name)) {
- return super.getHeader(name);
+ if (ObjectUtil.isEmpty(authOAuth2RequestMatcher)){
+ return super.getHeader(name);
+ }
+ boolean isMatcher = Boolean.TRUE;
+ if (ObjectUtil.isNotEmpty(authOAuth2RequestMatcher)) {
+ for (AntPathRequestMatcher antPathRequestMatcher : authOAuth2RequestMatcher) {
+ if (antPathRequestMatcher.matches(request)) {
+ isMatcher = Boolean.FALSE;
}
}
}
- return null;
-
+ if (isMatcher){
+ return super.getHeader(name);
+ }else {
+ return null;
+ }
}
/**
diff --git a/platform-resources-server/src/main/resources/application-dev.yml b/platform-resources-server/src/main/resources/application-dev.yml
index 047f682..91dde2b 100644
--- a/platform-resources-server/src/main/resources/application-dev.yml
+++ b/platform-resources-server/src/main/resources/application-dev.yml
@@ -29,9 +29,5 @@ micai-platform-auth:
resource-ids: resources-server
#过滤器匹配路径 可以使用**
request-matcher:
- jwt-auth:
- - /user/info
- - /user/list
- oauth2-auth:
- - /demo
- - /user/list111
+ - /demo
+ - /user/list
--
Gitee
From ce7cc4fd44eceab458b8c9f027d53836d386a619 Mon Sep 17 00:00:00 2001
From: liucong
Date: Tue, 27 Dec 2022 16:24:24 +0800
Subject: [PATCH 14/16] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=87=E6=BB=A4?=
=?UTF-8?q?=E5=99=A8=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
doc/sql/micai_platform.sql | 7 +++--
.../exception/GlobalExceptionHandler.java | 2 +-
.../controller/UserController.java | 29 ++++++-------------
.../filter/AuthHeaderFilter.java | 3 +-
.../src/main/resources/logback-spring.xml | 2 +-
5 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/doc/sql/micai_platform.sql b/doc/sql/micai_platform.sql
index 5263838..d0cd668 100644
--- a/doc/sql/micai_platform.sql
+++ b/doc/sql/micai_platform.sql
@@ -39,7 +39,7 @@ CREATE TABLE `oauth_client_details` (
-- ----------------------------
-- Records of oauth_client_details
-- ----------------------------
-INSERT INTO `oauth_client_details` VALUES ('pc', 'resources-server', '$2a$10$XyKNPWArxeVGjOKFF.pF7ONmv9NMAN5Bkkiwy8MutFTUKXhHFv.zC', 'pc', 'authorization_code,password,refresh_token', 'http://www.baidu.com/', 'info,sys:user:List', NULL, NULL, NULL, 'true');
+INSERT INTO `oauth_client_details` VALUES ('pc', 'resources-server', '$2a$10$XyKNPWArxeVGjOKFF.pF7ONmv9NMAN5Bkkiwy8MutFTUKXhHFv.zC', 'pc', 'authorization_code,password,refresh_token', 'http://www.baidu.com/', 'info,sys:user:list', NULL, NULL, NULL, 'true');
-- ----------------------------
-- Table structure for oauth_code
@@ -92,7 +92,7 @@ CREATE TABLE `tb_permission` (
-- Records of tb_permission
-- ----------------------------
INSERT INTO `tb_permission` VALUES (1, 'sys:permission:save', '新增权限', '新增权限', '01', 1, '2022-01-13 12:58:32', 1, '2022-01-13 12:58:32', 0);
-INSERT INTO `tb_permission` VALUES (2, 'sys:user:List', '获取用户列表', '获取用户列表', '01', 1, '2022-01-13 13:41:09', 1, '2022-01-13 13:41:09', 0);
+INSERT INTO `tb_permission` VALUES (2, 'sys:user:list', '获取用户列表', '获取用户列表', '01', 1, '2022-01-13 13:41:09', 1, '2022-01-13 13:41:09', 0);
INSERT INTO `tb_permission` VALUES (3, 'sys:user:update', '更新用户', '更新用户', '01', 1, '2022-01-13 13:43:59', 1, '2022-01-13 13:43:59', 0);
INSERT INTO `tb_permission` VALUES (4, 'sys:user:save', '新增用户', '新增用户', '01', 1, '2022-01-13 13:44:28', 1, '2022-01-13 13:44:28', 0);
INSERT INTO `tb_permission` VALUES (5, 'sys:user:del', '删除用户', '删除用户', '01', 1, '2022-01-13 13:44:46', 1, '2022-01-13 13:44:46', 0);
@@ -116,6 +116,7 @@ INSERT INTO `tb_permission` VALUES (23, 'sys:permissionMenu:del', '删除角色
INSERT INTO `tb_permission` VALUES (24, 'sys:userRole:update', '更新用户角色', '更新用户角色', '01', 1, '2022-01-14 10:41:35', 1, '2022-01-14 10:41:35', 0);
INSERT INTO `tb_permission` VALUES (25, 'sys:userRole:save', '新增用户角色', '新增用户角色', '01', 1, '2022-01-14 10:41:54', 1, '2022-01-14 10:41:54', 0);
INSERT INTO `tb_permission` VALUES (26, 'sys:userRole:del', '删除用户角色', '删除用户角色', '01', 1, '2022-01-14 10:42:14', 1, '2022-01-14 10:42:14', 0);
+INSERT INTO `tb_permission` VALUES (27, 'sys:user:authorityList', '获取用户权限', '获取用户权限', '01', 1, '2022-12-27 11:18:16', 1, '2022-12-27 11:18:24', 0);
-- ----------------------------
-- Table structure for tb_role
@@ -182,6 +183,8 @@ INSERT INTO `tb_role_permission` VALUES (29, 1, 20, 1, '2022-01-13 16:38:20', 1,
INSERT INTO `tb_role_permission` VALUES (30, 1, 21, 1, '2022-01-13 17:36:25', 1, '2022-01-13 17:36:25', 0);
INSERT INTO `tb_role_permission` VALUES (31, 1, 22, 1, '2022-01-13 17:36:25', 1, '2022-01-13 17:36:25', 0);
INSERT INTO `tb_role_permission` VALUES (32, 1, 23, 1, '2022-01-13 17:36:25', 1, '2022-01-13 17:36:25', 0);
+INSERT INTO `tb_role_permission` VALUES (33, 1, 27, 1, '2022-12-27 11:19:38', 1, '2022-12-27 11:19:46', 0);
+
-- ----------------------------
-- Table structure for tb_user
-- ----------------------------
diff --git a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
index 1d70755..76323ad 100644
--- a/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
+++ b/platform-common/src/main/java/org/micai/platform/common/base/exception/GlobalExceptionHandler.java
@@ -80,7 +80,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(IllegalArgumentException.class)
public Result illegalArgumentException(IllegalArgumentException e) {
log.error(e.getMessage(), e);
- return new Result(ConstantEnum.ACCESS_DENIED);
+ return new Result(ConstantEnum.ILLEGAL_ARG);
}
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/UserController.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/UserController.java
index 48f525e..70d7232 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/UserController.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/controller/UserController.java
@@ -14,13 +14,16 @@ import org.micai.platform.resourcesserver.bo.UserUpdateBo;
import org.micai.platform.resourcesserver.entity.User;
import org.micai.platform.resourcesserver.vo.UserListVo;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
/**
* @author zhaoxinguo on 2017/9/13.
@@ -49,20 +52,6 @@ public class UserController extends BaseController {
return new Result(ConstantEnum.SUCCESS,flag);
}
- /**
- * 获取用户列表
- * @return
- */
- @ApiIgnore
- @ApiOperation(value = "获取用户列表old",notes = "获取用户列表old")
- @GetMapping("/userList")
- public Map userList(){
- List users = userService.findUserList();
- Map map = new HashMap();
- map.put("users",users);
- return map;
- }
-
/**
* 获取用户权限
* @return
@@ -70,9 +59,9 @@ public class UserController extends BaseController {
@ApiIgnore
@ApiOperation(value = "获取用户权限",notes = "获取用户权限")
@GetMapping("/authorityList")
+ @PreAuthorize("hasAnyAuthority('sys:user:authorityList')")
public List authorityList(){
- List authentication = getAuthentication();
- return authentication;
+ return getAuthentication();
}
@@ -82,7 +71,7 @@ public class UserController extends BaseController {
*/
@ApiOperation(value = "获取用户列表", notes = "获取用户列表")
@PostMapping("/list")
- @PreAuthorize("hasAnyAuthority('sys:user:List')")
+ @PreAuthorize("hasAnyAuthority('sys:user:list')")
public Result getUserList(@RequestBody UserFindBo bo){
Result result;
try {
diff --git a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
index 4a59d23..75c0b8a 100644
--- a/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
+++ b/platform-resources-server/src/main/java/org/micai/platform/resourcesserver/filter/AuthHeaderFilter.java
@@ -64,8 +64,9 @@ public class AuthHeaderFilter implements Filter {
boolean isMatcher = Boolean.TRUE;
if (ObjectUtil.isNotEmpty(authOAuth2RequestMatcher)) {
for (AntPathRequestMatcher antPathRequestMatcher : authOAuth2RequestMatcher) {
- if (antPathRequestMatcher.matches(request)) {
+ if (antPathRequestMatcher.matches(request) && ConstantCode.AUTHORIZATION.equalsIgnoreCase(name)) {
isMatcher = Boolean.FALSE;
+ break;
}
}
}
diff --git a/platform-resources-server/src/main/resources/logback-spring.xml b/platform-resources-server/src/main/resources/logback-spring.xml
index 896f83d..b02d2b7 100644
--- a/platform-resources-server/src/main/resources/logback-spring.xml
+++ b/platform-resources-server/src/main/resources/logback-spring.xml
@@ -42,7 +42,7 @@
-
+
--
Gitee
From 105be312a526e2cb6da3b718f380f0a226dd9dab Mon Sep 17 00:00:00 2001
From: liucong
Date: Tue, 27 Dec 2022 16:38:00 +0800
Subject: [PATCH 15/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9readme=E6=96=87?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 356 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 343 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index a1995d2..b176e4a 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,351 @@
-### **一:后端技术选型**:
-1、Spring Boot 2.6.0
-2、Spring Security 5.6.0
-4、MyBatis 3.5.5
-5、MyBatis-Plus 3.4.3.4
-6、MySQL 5.1.30
+# 迷彩:micai-platform-auth
-### **二:接口访问地址**:
-http://localhost:8080/doc.html
-### **三:测试用户**
-最高权限用户 用户名:root 密码:root
-一般用户(没配置菜单) 用户名:user 密码:user
-### **四:参考资料**
-mblog:https://github.com/langhsu/mblog
+# 一.简介
+该项目是基于springboot、springsecurity、Spring security oauth以及jwt 搭建而成,实现RBAC权限模型。
+## **一.后端技术选型**:
+- Spring Boot 2.6.0
+- Spring Security 2.6.6
+- Spring security oauth 2 2.2.6.RELEASE
+- jjwt 0.7.0
+- MyBatis 3.5.5
+- MyBatis-Plus 3.4.3.4
+- MySQL 5.1.30
+- ......
+
+
+
+## 二.后端项目结构:
+
+```java
+micai
+ //认证服务
+|-- platform-auth-server
+| |-- platform-auth-server.iml
+| |-- pom.xml
+| `-- src
+| `-- main
+| |-- java
+| | `-- org
+| | `-- micai
+| | `-- platform
+| | `-- authserver
+| | |-- AuthServerApplication.java
+| | |-- bo //入参对象
+| | | `-- UserQueryBo.java
+| | |-- config //相关配置
+| | | |-- AuthorizationServerConfiguration.java
+| | | |-- JwtTokenEnhancer.java
+| | | |-- PasswordEncoder.java
+| | | |-- TokenConfig.java
+| | | `-- WebSecurityConfig.java
+| | |-- entity //相关实体类
+| | | |-- Permission.java
+| | | |-- Role.java
+| | | |-- RolePermission.java
+| | | |-- User.java
+| | | `-- UserRole.java
+| | |-- filter //相关过滤器
+| | | |-- JWTAuthenticationFilter.java
+| | | `-- JWTLoginFilter.java
+| | |-- handler //相关处理器
+| | | |-- CustomAuthenticationFailureHandler.java
+| | | |-- Http401AuthenticationEntryPoint.java
+| | | `-- MyMetaObjectHandler.java
+| | |-- interceptor //相关拦截器
+| | | `-- PlusInterceptor.java
+| | |-- mapper //mapper文件
+| | | |-- PermissionMapper.java
+| | | |-- RoleMapper.java
+| | | |-- RolePermissionMapper.java
+| | | |-- UserMapper.java
+| | | `-- UserRoleMapper.java
+| | |-- provider //security相关提供器
+| | | `-- CustomAuthenticationProvider.java
+| | `-- service //相关service类
+| | |-- PermissionService.java
+| | |-- RolePermissionService.java
+| | |-- RoleService.java
+| | |-- UserRoleService.java
+| | |-- UserService.java
+| | `-- impl
+| | |-- GrantedAuthorityImpl.java
+| | |-- PermissionServiceImpl.java
+| | |-- RolePermissionServiceImpl.java
+| | |-- RoleServiceImpl.java
+| | |-- UserDetailsServiceImpl.java
+| | |-- UserRoleServiceImpl.java
+| | `-- UserServiceImpl.java
+| `-- resources
+| |-- application-dev.yml
+| |-- application-pro.yml
+| `-- application.yml
+ //公共服务
+|-- platform-common
+| |-- platform-common.iml
+| |-- pom.xml
+| `-- src
+| `-- main
+| |-- java
+| | `-- org
+| | `-- micai
+| | `-- platform
+| | `-- common
+| | `-- base //公共包
+| | |-- WebStarterAutoConfig.java
+| | |-- config //公共配置
+| | | |-- MicaiPlatformOauthConfig.java
+| | | |-- MicaiPlatformRequestMatcher.java
+| | | |-- MicaiPlatformResourcesConfig.java
+| | | `-- MicaiPlatformTokenConfig.java
+| | |-- constant //常量和常枚举
+| | | |-- ConstantCode.java
+| | | `-- ConstantEnum.java
+| | |-- controller //异常处理controller
+| | | `-- ExceptionController.java
+| | |-- exception //异常处理和自定义异常
+| | | |-- GlobalExceptionHandler.java
+| | | |-- MyAuthException.java
+| | | `-- PlatformException.java
+| | |-- result //自定义返回对象
+| | | |-- Result.java
+| | | `-- UploadResult.java
+| | `-- sms //短信相关功能
+| | |-- Sms.java
+| | `-- impl
+| | |-- AbstractSms.java
+| | `-- QiniuSmsImpl.java
+| `-- resources
+| `-- META-INF
+| `-- spring.factories
+ //资源服务
+|-- platform-resources-server
+| |-- platform-resources-server.iml
+| |-- pom.xml
+| `-- src
+| `-- main
+| |-- java
+| | `-- org
+| | `-- micai
+| | `-- platform
+| | `-- resourcesserver
+| | |-- ResourcesServerApplication.java
+| | |-- bo //入参对象
+| | | |-- MenuDelBo.java
+| | | |-- MenuSaveBo.java
+| | | |-- MenuUpdateBo.java
+| | | |-- OrganDelBo.java
+| | | |-- OrganFindBo.java
+| | | |-- OrganSaveBo.java
+| | | |-- OrganUpdateBo.java
+| | | |-- PermissionDelBo.java
+| | | |-- PermissionFindBo.java
+| | | |-- PermissionMenuDelBo.java
+| | | |-- PermissionMenuSaveBo.java
+| | | |-- PermissionMenuUpdateBo.java
+| | | |-- PermissionSaveBo.java
+| | | |-- PermissionUpdateBo.java
+| | | |-- RoleDelBo.java
+| | | |-- RoleFindBo.java
+| | | |-- RolePermissionDelBo.java
+| | | |-- RolePermissionSaveBo.java
+| | | |-- RolePermissionUpdateBo.java
+| | | |-- RoleSaveBo.java
+| | | |-- RoleUpdateBo.java
+| | | |-- UserDelBo.java
+| | | |-- UserFindBo.java
+| | | |-- UserQueryBo.java
+| | | |-- UserRoleDelBo.java
+| | | |-- UserRoleSaveBo.java
+| | | |-- UserRoleUpdateBo.java
+| | | |-- UserSaveBo.java
+| | | `-- UserUpdateBo.java
+| | |-- config //相关配置类
+| | | |-- CodeGenerator.java
+| | | |-- PasswordEncoder.java
+| | | |-- ResourceServerConfig.java
+| | | |-- SiteOptions.java
+| | | |-- SwaggerConfig.java
+| | | |-- TokenConfig.java
+| | | `-- WebSecurityConfig.java
+| | |-- controller //表现层
+| | | |-- BaseController.java
+| | | |-- PermissionController.java
+| | | |-- RoleController.java
+| | | |-- RolePermissionController.java
+| | | |-- UploadController.java
+| | | |-- UserController.java
+| | | `-- UserRoleController.java
+| | |-- dto
+| | | `-- UserAuthenticationDto.java
+| | |-- entity
+| | | |-- Permission.java
+| | | |-- Role.java
+| | | |-- RolePermission.java
+| | | |-- User.java
+| | | `-- UserRole.java
+| | |-- filter //相关自定义过滤器
+| | | |-- AuthHeaderFilter.java
+| | | `-- JWTAuthenticationFilter.java
+| | |-- handler //相关自定义处理器
+| | | |-- Http401AuthenticationEntryPoint.java
+| | | `-- MyMetaObjectHandler.java
+| | |-- interceptor //相关拦截器
+| | | `-- PlusInterceptor.java
+| | |-- mapper
+| | | |-- PermissionMapper.java
+| | | |-- RoleMapper.java
+| | | |-- RolePermissionMapper.java
+| | | |-- UserMapper.java
+| | | `-- UserRoleMapper.java
+| | |-- provider //自定义security的提供器
+| | | `-- CustomAuthenticationProvider.java
+| | |-- service //相关的service
+| | | |-- PermissionService.java
+| | | |-- RolePermissionService.java
+| | | |-- RoleService.java
+| | | |-- UserRoleService.java
+| | | |-- UserService.java
+| | | `-- impl
+| | | |-- GrantedAuthorityImpl.java
+| | | |-- PermissionServiceImpl.java
+| | | |-- RolePermissionServiceImpl.java
+| | | |-- RoleServiceImpl.java
+| | | |-- UserDetailsServiceImpl.java
+| | | |-- UserRoleServiceImpl.java
+| | | `-- UserServiceImpl.java
+| | |-- storage
+| | | |-- Storage.java
+| | | |-- StorageFactory.java
+| | | `-- impl
+| | | |-- AbstractStorage.java
+| | | |-- MinioStorageImpl.java
+| | | |-- NativeStorageImpl.java
+| | | |-- OssStorageImpl.java
+| | | |-- QiniuStorageImpl.java
+| | | `-- UpYunStorageImpl.java
+| | |-- utils //相关工具类
+| | | |-- ApplicationUtil.java
+| | | |-- AuthenticationManger.java
+| | | |-- FileKit.java
+| | | |-- FilePathUtils.java
+| | | |-- ImageUtils.java
+| | | |-- JwtHelper.java
+| | | |-- MD5.java
+| | | |-- PdfMergeUtils.java
+| | | |-- WatermarkOffice.java
+| | | |-- WatermarkPdf.java
+| | | `-- WatermarkUtils.java
+| | `-- vo //返回前端对象
+| | |-- OrganListVo.java
+| | |-- PermissionListVo.java
+| | |-- RoleListVo.java
+| | `-- UserListVo.java
+| `-- resources
+| |-- application-dev.yml
+| |-- application-pro.yml
+| |-- application.yml
+| `-- logback-spring.xml
+`-- pom.xml
+
+```
+
+
+
+
+
+## 三.项目流程图:
+
+
+
+### 本系统登录流程:
+
+1. 调用登录接口http://localhost:8080/login 返回token令牌
+
+```java
+curl --location --request POST 'http://localhost:8080/login' \
+--header 'Content-Type: application/json' \
+--data-raw '{"username":"root","password":"root"}'
+```
+
+ 2.携带返回的token信息,访问需要获取资源接口
+
+
+
+### 第三方应用流程:
+
+1. 调用登录接口http://localhost:8080/login 返回token令牌
+
+```java
+curl --location --request POST 'http://localhost:8080/login' \
+--header 'Content-Type: application/json' \
+--data-raw '{"username":"root","password":"root"}'
+```
+
+ 2.携带返回的token信息,访问oauth2授权接口,使用授权码模式http://localhost:8080/oauth/authorize?response_type=code&client_id=pc,重定向到设定的**web_server_redirect_uri**地址并且地址拼接了授权码信息
+
+```java
+curl --location --request GET 'http://localhost:8080/oauth/authorize?response_type=code&client_id=pc' \
+--header 'Authorization: Bear xxxxxx'
+```
+
+ 3.根据获取的授权码信息,调用获取access_token信息http://localhost:8080/oauth/token?grant_type=authorization_code&client_id=pc&client_secret=admin&code=fQxVEU
+
+```java
+curl --location --request POST 'http://localhost:8080/oauth/token?grant_type=authorization_code&client_id=pc&client_secret=admin&code=fQxVEU'
+```
+
+返回的信息,如下:
+
+```java
+{
+ "access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb20iOiJsaXVjb25nIiwid2l0aCI6Im1pY2FpIiwiYXVkIjpbInJlc291cmNlcy1zZXJ2ZXIiXSwidXNlcl9uYW1lIjoiMS1yb290LVt",
+"token_type": "bearer",
+"refresh_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb20iOiJsaXVjb25nIiwid2l0aCI6Im1pY2FpIiwiYXVkIjpbInJlc291cmNlcy1zZXJ2ZXIiXSwidXNlcl9uYW1lIjoiMS1yb290LVtcIlJPTEVfcm9vdFwiLFwi",
+ "expires_in": 43199,
+ "scope": "pc",
+ "author": "liucong",
+ "jti": "cfc312f6-c38f-4670-9140-9985372cb7c9"
+}
+```
+
+access_token:返回的token令牌,可以访问对应资源服务;
+
+token_type:token类型,token前缀
+
+expires_in:过期时间
+
+scope:作用范围
+
+author:通过实现TokenEnhancer,添加自定义信息
+
+jti:jwt唯一标识
+
+
+
+4.携带access_token信息,访问需要获取资源接口
+
+
+
+## 四.swagger地址:
+
+- platform-auth-server:http://localhost:8080/doc.html
+- platform-resources-server:http://localhost:8081/doc.html
+
+
+
+## 五.为什么使用jwt令牌方式
+
+当认证服务器和资源服务器不是在同一工程时, 要使用 ResourceServerTokenServices 去远程请求认证服务器来校验
+令牌的合法性,如果用户访问量较大时将会影响系统的性能。
+
+此时,采用 JWT 格式就可以解决上面的问题。
+因为当用户认证后获取到一个JWT令牌,而这个 JWT 令牌包含了用户基本信息,客户端只需要携带JWT访问资源服
+务器,资源服务器会通过事先约定好的算法进行解析出来,然后直接对 JWT 令牌校验,不需要每次远程请求认证服
+务器完成授权。
--
Gitee
From 0f0d6db7be8bbfc851648d7b3fc4143be9b574f2 Mon Sep 17 00:00:00 2001
From: liucong
Date: Tue, 27 Dec 2022 16:41:49 +0800
Subject: [PATCH 16/16] =?UTF-8?q?=E6=B7=BB=E5=8A=A0readme=E5=9B=BE?=
=?UTF-8?q?=E7=89=87=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...210\346\235\203\346\265\201\347\250\213.png" | Bin 0 -> 87042 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 "README.assets/\350\277\267\345\275\251-\347\231\273\345\275\225\346\216\210\346\235\203\346\265\201\347\250\213.png"
diff --git "a/README.assets/\350\277\267\345\275\251-\347\231\273\345\275\225\346\216\210\346\235\203\346\265\201\347\250\213.png" "b/README.assets/\350\277\267\345\275\251-\347\231\273\345\275\225\346\216\210\346\235\203\346\265\201\347\250\213.png"
new file mode 100644
index 0000000000000000000000000000000000000000..ee5a35c055c9cf5ab765bfae7e4c3af0d52c900f
GIT binary patch
literal 87042
zcmce;g;$ho_dY&^0wOSkpfpkr-6<&`45fo~gLH#*D=12dfOM%tNHcUJCDM(wAl=ga
zz305=oX`9I{(#?FvzCjI=eh4^-+N#C+SlF>Z=a|=Cb&g;3j%={Da|!cq|Jk>Z4wRKt00_$D-yvyZ02{H
zYL^+5b;onJQFZ)v68!#t=iYv_!9`z>FY5(I=ZXUI;XxF5?;-#7kzT+JYx9&5H;Q#*rGvB(JNka@{VCr?YsT;0@)}x3U2SgYJm?lfLRFAR#
zej568>_+U}wW{m2@f&SYA$|2neFjTy!!&v`q`-_4Ssi>?P-|+(t;l*w+-AqDXW!xf
znxU3)9(VP;OtrNIrFUpvskZve$M(I&1!D^&GPUTNq{O6CO9$Zw7
zCEJ-GgRyv>=OMT)T$J7P!`6Q}P;f1YPQ4eeq;WNFhX0kQE5Gq$$FU8s(|GN@!On~m
z4}X^ObiTmtp8R#&2UNvu7+-V0E?6wdU{*RDUvB0f=~r}QE$`qE=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