diff --git a/pom.xml b/pom.xml
index 46ef961..31261bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.2.4.RELEASE
+ 2.3.1.RELEASE
io.qyi
@@ -35,16 +35,23 @@
-
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
+
+
org.springframework.boot
spring-boot-starter-log4j2
-
-
- org.springframework.boot
- spring-boot-starter-freemarker
-
org.springframework.boot
diff --git a/src/main/java/io/qyi/e5/config/rabbitMQ/RabbitMQConfig.java b/src/main/java/io/qyi/e5/config/rabbitMQ/RabbitMQConfig.java
index d52bc61..e332096 100644
--- a/src/main/java/io/qyi/e5/config/rabbitMQ/RabbitMQConfig.java
+++ b/src/main/java/io/qyi/e5/config/rabbitMQ/RabbitMQConfig.java
@@ -22,12 +22,13 @@ import java.util.Map;
public class RabbitMQConfig {
@Value("")
private String DirectQueueName;
+
/**
* 处理死信队列的消费队列
- * */
+ */
@Bean
public Queue fanoutQueue1() {
- return new Queue("delay_queue1", true, false, false);
+ return new Queue("delay_queue3", true, false, false);
}
/**
@@ -37,13 +38,14 @@ public class RabbitMQConfig {
* HeadersExchange :通过添加属性key-value匹配
* DirectExchange:按照routingkey分发到指定队列
* TopicExchange:多关键字匹配
+ *
* @return
*/
@Bean
public CustomExchange customExchangeDelay() {
Map arg = new HashMap<>();
arg.put("x-delayed-type", "direct");
- return new CustomExchange("delay","x-delayed-message",true, false,arg);
+ return new CustomExchange("delay3", "x-delayed-message", true, false, arg);
}
/*@Bean
@@ -54,7 +56,7 @@ public class RabbitMQConfig {
//绑定 将队列和交换机绑定,
@Bean
public Binding bindingFanoutQueue1() {
- return BindingBuilder.bind(fanoutQueue1()).to(customExchangeDelay()).with("delay").noargs();
+ return BindingBuilder.bind(fanoutQueue1()).to(customExchangeDelay()).with("delay3").noargs();
}
diff --git a/src/main/java/io/qyi/e5/config/security/MyAccessDecisionManager.java b/src/main/java/io/qyi/e5/config/security/MyAccessDecisionManager.java
new file mode 100644
index 0000000..2df3486
--- /dev/null
+++ b/src/main/java/io/qyi/e5/config/security/MyAccessDecisionManager.java
@@ -0,0 +1,65 @@
+package io.qyi.e5.config.security;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.access.AccessDecisionManager;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.access.ConfigAttribute;
+import org.springframework.security.authentication.InsufficientAuthenticationException;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * 决策管理器
+ *
+ * @program: e5
+ * @description:
+ * @author: 落叶随风
+ * @create: 2020-06-15 16:11
+ **/
+@Slf4j
+@Service
+public class MyAccessDecisionManager implements AccessDecisionManager {
+ @Override
+ public void decide(Authentication authentication, Object o, Collection collection) throws AccessDeniedException, InsufficientAuthenticationException {
+ if (collection == null) {
+ return;
+ }
+ System.out.println(o.toString()); // object is a URL.
+ log.info("object is a URL. {}", o.toString());
+ //所请求的资源拥有的权限(一个资源对多个权限)
+ Iterator iterator = collection.iterator();
+ while (iterator.hasNext()) {
+ ConfigAttribute configAttribute = iterator.next();
+ //访问所请求资源所需要的权限
+ String needPermission = configAttribute.getAttribute();
+ log.info("访问 " + o.toString() + " 需要的权限是:" + needPermission);
+ if (needPermission == null) {
+ break;
+ }
+ //用户所拥有的权限authentication
+ Collection extends GrantedAuthority> authorities = authentication.getAuthorities();
+ for (GrantedAuthority ga : authorities) {
+ if (needPermission.equals(ga.getAuthority())) {
+ return;
+ }
+ }
+ }
+ //没有权限
+ throw new AccessDeniedException(" 无权限! ");
+
+ }
+
+ @Override
+ public boolean supports(ConfigAttribute configAttribute) {
+ return true;
+ }
+
+ @Override
+ public boolean supports(Class> aClass) {
+ return true;
+ }
+}
diff --git a/src/main/java/io/qyi/e5/config/security/MyInvocationSecurityMetadataSourceService.java b/src/main/java/io/qyi/e5/config/security/MyInvocationSecurityMetadataSourceService.java
new file mode 100644
index 0000000..fc16cc7
--- /dev/null
+++ b/src/main/java/io/qyi/e5/config/security/MyInvocationSecurityMetadataSourceService.java
@@ -0,0 +1,68 @@
+package io.qyi.e5.config.security;
+
+import org.springframework.security.access.ConfigAttribute;
+import org.springframework.security.access.SecurityConfig;
+import org.springframework.security.web.FilterInvocation;
+import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+
+/**
+ * @program: e5
+ * @description:
+ * @author: 落叶随风
+ * @create: 2020-06-17 16:25
+ **/
+@Service
+public class MyInvocationSecurityMetadataSourceService implements FilterInvocationSecurityMetadataSource {
+
+ private HashMap> map =null;
+ /**
+ * 加载权限表中所有权限
+ */
+ public void loadResourceDefine(){
+ map = new HashMap<>();
+ Collection array;
+ ConfigAttribute cfg;
+ List