content: package com.anilallewar.microservices.task.config.security;
  
  import org.springframework.boot.autoconfigure.security.SecurityProperties;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.core.annotation.Order;
  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;
  
  @Configuration
  @EnableWebSecurity
  @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
  public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
  	@Override
  	protected void configure(HttpSecurity http) throws Exception {
  		// @formatter:off
  		http
  			.authorizeRequests()
  				.anyRequest()
  					.authenticated();
  		// @formatter:on
  	}
  
  	// Swagger specific, allow access
  	@Override
  	public void configure(WebSecurity web) throws Exception {
  		// @formatter:off
  		web
  			.ignoring()
  				.antMatchers("/v2/api-docs", "/configuration/ui", "/swagger-resources/**", "/configuration/**",
  				"/swagger-ui.html", "/webjars/**");
  		// @formatter:on
  	}
  }
  