### 基于HTTP Basic認證
繼承`WebSecurityConfigurerAdapter`類修改配置
```java
@Configuration
public class BrowserSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic() // HTTP Basic方式
.and()
.authorizeRequests() // 授權配置
.anyRequest() // 所有請求
.authenticated(); // 都需要認證
}
}
```
重啟服務并訪問http://www.zhangpn.com/hello就會以HTTP Basic方式進行認證。