houzhongjian
2024-12-03 874287a4c02d0a980d8b97c4a691b4f37ec5e812
提交 | 用户 | 时间
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;
874287 7 import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
e7c126 8 import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
H 9
10 import javax.annotation.Resource;
11
12 /**
13  * 自定义的 URL 的安全配置
14  * 目的:每个 Maven Module 可以自定义规则!
15  *
16  * @author iailab
17  */
18 public abstract class AuthorizeRequestsCustomizer
874287 19         implements Customizer<AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry>, Ordered {
e7c126 20
H 21     @Resource
22     private WebProperties webProperties;
23
24     protected String buildAdminApi(String url) {
25         return webProperties.getAdminApi().getPrefix() + url;
26     }
27
28     protected String buildAppApi(String url) {
29         return webProperties.getAppApi().getPrefix() + url;
30     }
31
32     @Override
33     public int getOrder() {
34         return 0;
35     }
36
37 }