log
潘志宝
2024-11-05 69bb473ba3fc3b6ddd774501afe224279f6cc642
提交 | 用户 | 时间
e7c126 1 package com.iailab.framework.security.config;
H 2
3 import com.iailab.framework.web.config.WebProperties;
4 import org.springframework.core.Ordered;
5 import org.springframework.security.config.Customizer;
6 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
7 import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
8
9 import javax.annotation.Resource;
10
11 /**
12  * 自定义的 URL 的安全配置
13  * 目的:每个 Maven Module 可以自定义规则!
14  *
15  * @author iailab
16  */
17 public abstract class AuthorizeRequestsCustomizer
18         implements Customizer<ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry>, Ordered {
19
20     @Resource
21     private WebProperties webProperties;
22
23     protected String buildAdminApi(String url) {
24         return webProperties.getAdminApi().getPrefix() + url;
25     }
26
27     protected String buildAppApi(String url) {
28         return webProperties.getAppApi().getPrefix() + url;
29     }
30
31     @Override
32     public int getOrder() {
33         return 0;
34     }
35
36 }