package com.elephant.framework.galaxy.aroad.security.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;

/**
 * @Description OAuth 资源服务器配置
 *
 * @auther wangjian
 * @create 2019-02-21 21:23
 */
@Configuration
@EnableResourceServer
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
	@Override
	public void configure(HttpSecurity http) throws Exception {
		http.formLogin()
				.and()
				.authorizeRequests()
				.antMatchers("/roadconditionevent/**", "/zhyh/lkpd/**","/zhyh/dzxgcglgcxx/**", "/zhyh/dzxgcglgcjd/**", "/zhyh/dzxgcgljlzf/**", "/zhyh/dzxgcglysgl/**",
						"/zhjc/ghjhghjdzb/**", "/zhjc/ghjhtzzh/**", "/zhjc/ghjh/**", "/zhjc/ghjhfghjdzb/**",
						"/zhyh/qldtjglrbsjhql/**", "/zhyh/qldtjgsjzdjgql/**", "/szgl/spdwvideo/**","/szgl/spdwvideojn/**","/zhjg/zhjgaqscyhpctj/save","/zhjg/zhjgaqscdsaqqklh/save","/upload/**")
				.permitAll()
				.anyRequest()
				.authenticated()
				.and()
				.csrf()
				.disable();
	}
}
