From 907641e56c2085aaa81f267946dc3e3e9fca73e7 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期三, 18 九月 2024 09:39:02 +0800 Subject: [PATCH] 代码提交 --- ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 30 +++++++++++------------------- 1 files changed, 11 insertions(+), 19 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index ff1fe21..38c4b6e 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -22,18 +22,17 @@ /** * spring security閰嶇疆 - * + * * @author ruoyi */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) -public class SecurityConfig extends WebSecurityConfigurerAdapter -{ +public class SecurityConfig extends WebSecurityConfigurerAdapter { /** * 鑷畾涔夌敤鎴疯璇侀�昏緫 */ @Autowired private UserDetailsService userDetailsService; - + /** * 璁よ瘉澶辫触澶勭悊绫� */ @@ -51,7 +50,7 @@ */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 璺ㄥ煙杩囨护鍣� */ @@ -72,8 +71,7 @@ */ @Bean @Override - public AuthenticationManager authenticationManagerBean() throws Exception - { + public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @@ -93,8 +91,7 @@ * authenticated | 鐢ㄦ埛鐧诲綍鍚庡彲璁块棶 */ @Override - protected void configure(HttpSecurity httpSecurity) throws Exception - { + protected void configure(HttpSecurity httpSecurity) throws Exception { // 娉ㄨВ鏍囪鍏佽鍖垮悕璁块棶鐨剈rl ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); @@ -111,14 +108,11 @@ // 杩囨护璇锋眰 .authorizeRequests() // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶 - .antMatchers("/login", "/register", "/captchaImage","/qrcode/generateStaticHtml","/qrcode/getQRcode","/qrcode/getFormDate").permitAll() + .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer","/smartor/import/download").permitAll() // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂� - .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() // 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇� - .anyRequest().authenticated() - .and() - .headers().frameOptions().disable(); + .anyRequest().authenticated().and().headers().frameOptions().disable(); // 娣诲姞Logout filter httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); // 娣诲姞JWT filter @@ -132,8 +126,7 @@ * 寮烘暎鍒楀搱甯屽姞瀵嗗疄鐜� */ @Bean - public BCryptPasswordEncoder bCryptPasswordEncoder() - { + public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } @@ -141,8 +134,7 @@ * 韬唤璁よ瘉鎺ュ彛 */ @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception - { + protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); } } -- Gitblit v1.9.3