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/save","/zhyh/dzxgcglgcxx/**","/zhyh/dzxgcglgcjd/**","/zhyh/dzxgcgljlzf/**","/zhyh/dzxgcglysgl/**")
        .permitAll()
        .anyRequest()
        .authenticated()
        .and()
        .csrf()
        .disable();
  }
}
