| | |
| | | import org.springframework.security.web.AuthenticationEntryPoint; |
| | | import org.springframework.security.web.access.AccessDeniedHandler; |
| | | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| | | import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | public static final String[] FILTER_PATH = new String[]{ |
| | | "/api/auth/host", |
| | | "/api/language/json", |
| | | "/test/**", |
| | | "/api/login", |
| | | "/api/code/auth", |
| | | "/druid/**", |
| | | "/swagger-ui.html", |
| | | "/swagger-resources/**", |
| | |
| | | private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint; |
| | | @Resource |
| | | private JwtAuthenticationFilter jwtAuthenticationFilter; |
| | | @Resource |
| | | private CacheFilter cacheFilter; |
| | | |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | |
| | | .accessDeniedHandler(jwtAccessDeniedHandler) |
| | | .authenticationEntryPoint(jwtAuthenticationEntryPoint) |
| | | .and() |
| | | .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); |
| | | .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) |
| | | .addFilterBefore(cacheFilter, BasicAuthenticationFilter.class); |
| | | } |
| | | |
| | | @Bean |