File tree Expand file tree Collapse file tree
src/main/java/io/papermc/fill/configuration Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import org .jspecify .annotations .NullMarked ;
2222import org .springframework .context .annotation .Bean ;
2323import org .springframework .context .annotation .Configuration ;
24+ import org .springframework .http .HttpMethod ;
2425import org .springframework .security .authentication .AuthenticationManager ;
2526import org .springframework .security .config .Customizer ;
2627import org .springframework .security .config .annotation .authentication .configuration .AuthenticationConfiguration ;
3738import org .springframework .security .provisioning .InMemoryUserDetailsManager ;
3839import org .springframework .security .web .SecurityFilterChain ;
3940import org .springframework .security .web .authentication .UsernamePasswordAuthenticationFilter ;
41+ import org .springframework .web .cors .CorsConfiguration ;
42+ import org .springframework .web .cors .CorsConfigurationSource ;
43+ import org .springframework .web .cors .UrlBasedCorsConfigurationSource ;
4044
4145@ Configuration
4246@ EnableWebSecurity
4347@ EnableMethodSecurity
4448@ NullMarked
4549public class SecurityConfiguration {
50+ @ Bean
51+ public CorsConfigurationSource corsConfigurationSource () {
52+ final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource ();
53+ final CorsConfiguration openapi = new CorsConfiguration ();
54+ openapi .addAllowedMethod (HttpMethod .GET );
55+ openapi .addAllowedOrigin ("*" );
56+ source .registerCorsConfiguration ("/openapi.yaml" , openapi );
57+ return source ;
58+ }
59+
4660 @ Bean
4761 public PasswordEncoder passwordEncoder () {
4862 return PasswordEncoderFactories .createDelegatingPasswordEncoder ();
You can’t perform that action at this time.
0 commit comments