feat:添加安防小板设备相关接口

This commit is contained in:
listom
2024-08-13 11:22:26 +08:00
parent e0389a15da
commit 6822b5f354
7 changed files with 549 additions and 15 deletions

View File

@ -27,8 +27,7 @@ import com.fastbee.framework.security.handle.LogoutSuccessHandlerImpl;
*/
//@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter
{
public class SecurityConfig extends WebSecurityConfigurerAdapter {
/**
* 自定义用户认证逻辑
*/
@ -73,8 +72,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception
{
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@ -94,8 +92,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* authenticated | 用户登录后可访问
*/
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception
{
protected void configure(HttpSecurity httpSecurity) throws Exception {
// 注解标记允许匿名访问的url
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests();
permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll());
@ -112,14 +109,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage","/iot/tool/register","/iot/tool/ntp","/iot/tool/download",
"/iot/tool/mqtt/auth","/iot/tool/mqtt/authv5","/iot/tool/mqtt/webhook","/iot/tool/mqtt/webhookv5","/auth/**/**",
.antMatchers("/login", "/register", "/captchaImage", "/iot/tool/register", "/iot/tool/ntp", "/iot/tool/download",
"/iot/tool/mqtt/auth", "/iot/tool/mqtt/authv5", "/iot/tool/mqtt/webhook", "/iot/tool/mqtt/webhookv5", "/auth/**/**",
"/wechat/mobileLogin", "/wechat/miniLogin", "/wechat/wxBind/callback").permitAll()
.antMatchers("/zlmhook/**").permitAll()
.antMatchers("/ruleengine/rulemanager/**").permitAll()
.antMatchers("/goview/sys/login","/goview/project/getData").permitAll()
.antMatchers("/notify/smsLoginCaptcha","/auth/sms/login", "/notify/weComVerifyUrl"
,"/wechat/publicAccount/callback","/notify/smsRegisterCaptcha").permitAll()
.antMatchers("/goview/sys/login", "/goview/project/getData").permitAll()
.antMatchers("/notify/smsLoginCaptcha", "/auth/sms/login", "/notify/weComVerifyUrl"
, "/wechat/publicAccount/callback", "/notify/smsRegisterCaptcha").permitAll()
.antMatchers("/app/language/list").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
@ -130,6 +127,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// .antMatchers("/oauth/css/**","/oauth/fonts/**","/oauth/js/**").permitAll()
// dueros
.antMatchers("/dueros").permitAll()
//安防小板
.antMatchers("/iot/photos").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
@ -158,8 +157,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* 强散列哈希加密实现
*/
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder()
{
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
@ -167,8 +165,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* 身份认证接口
*/
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception
{
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
}