首页>代码>基于Spring Boot+Spring Data Jpa+apache shiro+easyui+bootstrap开发的电影推酷网站源码>/src/main/java/com/java1234/config/WebSecurityConfig.java
package com.java1234.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; /** * spring security配置 * @author user * */ @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true)//开启security注解 public class WebSecurityConfig extends WebSecurityConfigurerAdapter{ /** * 请求授权 */ @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable().cors().disable().headers().disable() .authorizeRequests() .antMatchers("/","/film/**","/webSite/**","/webSiteInfo/**","/aboutMe","/static/**").permitAll() //其他地址的访问均需验证权限 .anyRequest().authenticated() .and() .formLogin() //指定登录页是"/login" .loginPage("/login") .defaultSuccessUrl("/admin")//登录成功后默认跳转到"/hello" .permitAll() .and() .logout() .logoutSuccessUrl("/login")//退出登录后的默认url是"/home" .permitAll(); } /** * 用户认证 */ @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("java1234") .password("123456") .roles("ADMIN"); } }

admin_z LV22
2023年12月26日
huyuxin LV3
2023年12月10日
chj173 LV1
2023年5月30日
qiangmin1223 LV12
2023年4月22日
计算机暴龙战士 LV19
2023年4月2日
admin115 LV6
2022年11月19日
1025490081 LV2
2022年11月7日
testuser1234567 LV24
2022年6月30日
877549024 LV8
2022年4月21日
AlanLi LV19
2022年4月8日

yyhrhv LV8
2024年9月3日
wyyz5211314 LV4
2024年4月23日
微信网友_6934136125804544
2024年4月2日
暂无贡献等级
微信网友_6927932988952576 LV12
2024年3月31日
Denck1111
2024年3月27日
暂无贡献等级
zolscy LV24
2024年3月24日
ming_123_9715 LV23
2024年3月8日
微信网友_6872834902118400
2024年2月19日
暂无贡献等级
fzlzxc LV10
2024年1月23日
小草12345
2023年12月26日
暂无贡献等级