package com.kidgrow.web.config;
|
|
import cn.hutool.core.util.StrUtil;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
|
import org.springframework.context.annotation.Configuration;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
/**
|
* 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
|
*
|
* @Description: Security 配置<br>
|
* @Project: <br>
|
* @CreateDate: Created in 2020/3/04 10:25 <br>
|
* @Author: <a href="4345453@kidgrow.com">liuke</a>
|
*/
|
@EnableOAuth2Sso
|
@Configuration
|
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
@Value("${security.oauth2.sso.login-path:}")
|
private String loginPath;
|
|
@Override
|
public void configure(HttpSecurity http) throws Exception {
|
http.authorizeRequests().anyRequest().authenticated()
|
.and()
|
.csrf().disable();
|
if (StrUtil.isNotEmpty(loginPath)) {
|
http.formLogin().loginProcessingUrl(loginPath);
|
}
|
}
|
}
|