12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package com.yihu.jw.config.security;
- import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
- import org.springframework.security.config.annotation.web.builders.HttpSecurity;
- import org.springframework.security.config.annotation.web.builders.WebSecurity;
- import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
- import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
- /**
- * Created by chenweida on 2017/11/29.
- */
- @EnableWebSecurity
- public class SecurityConfig extends WebSecurityConfigurerAdapter {
- /**
- * HttpSecurity:一般用它来具体控制权限,角色,url等安全的东西。
- * @param http
- * @throws Exception
- */
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.authorizeRequests()
- .anyRequest()
- .fullyAuthenticated()
- .and()
- .httpBasic()
- .and()
- .csrf().disable();
- }
- /**
- * :用来做登录认证的
- * @param auth
- * @throws Exception
- */
- @Override
- protected void configure(AuthenticationManagerBuilder auth) throws Exception {
- super.configure(auth);
- }
- /**
- * For example, if you wish to ignore certain requests
- * @param web
- * @throws Exception
- */
- @Override
- public void configure(WebSecurity web) throws Exception {
- super.configure(web);
- }
- }
|