项目地址:https://github.com/lizhibin205/simple_web_v2
如果不适用spring boot security的默认配置,必须创建一个配置类继承org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
在开发中,我们可以重载特定的方法,实现不同的配置:
方法名 | 作用 | 默认配置 |
protected void configure(HttpSecurity http) throws Exception | 配置需要权限验证的url规则 | 适用httpbasic验证 所有url均验证权限 |
public UserDetailsService userDetailsService() | 自定义用户验证规则 | 使用默认账号密码(密码在控制台中输出) |
HttpSecurity对象
HttpSecurity允许我们配置那些url是需要权限验证的,已