Skip to content

Commit

Permalink
Fix typos (#1880)
Browse files Browse the repository at this point in the history
* Fix typo

* Fix typo

* Add applicationInitializer
  • Loading branch information
sukhpalp authored May 1, 2024
1 parent b8e306b commit db0f540
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ protected void beforeSpringSecurityFilterChain(ServletContext servletContext) {
versionForwardingFilter.setInitParameter(VersionForwardingFilter.RESPONSE_VERSION_PARAM, "1");
versionForwardingFilter.setInitParameter(VersionForwardingFilter.DEFAULT_REQUEST_VERSION_PARAM, "1");
versionForwardingFilter.addMappingForUrlPatterns(null, false, "/*");

FilterRegistration.Dynamic corsFilter = servletContext.addFilter("CORS Filter", CorsFilter.class);
corsFilter.addMappingForUrlPatterns(null, false, "/*");

LOGGER.info(">beforeSpringSecurityFilterChain");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
@Override
protected void configure(HttpSecurity http) throws Exception {

http.cors().and().csrf().disable();
http.cors().and().csrf().disable()
.oauth2ResourceServer(oauth2 -> oauth2
.authenticationManagerResolver(authenticationManagerResolver())
)
Expand All @@ -139,15 +139,16 @@ protected void configure(HttpSecurity http) throws Exception {

@Bean
public CorsConfigurationSource corsConfigurationSource() {
final CorsConfiguration configuration = new CorsConfiguration();
final CorsConfiguration configuration = new CorsConfiguration();

configuration.setAllowedOrigins(Collections.unmodifiableList(Arrays.asList("*")));
configuration.setAllowedMethods(
Collections.unmodifiableList(Arrays.asList("HEAD", "GET", "POST", "DELETE", "PUT", "OPTIONS")));
configuration.setAllowedHeaders(Collections.unmodifiableList(Arrays.asList("apikey")));
configuration.setAllowedOrigins(Collections.unmodifiableList(Arrays.asList("*")));
configuration.setAllowedMethods(
Collections.unmodifiableList(Arrays.asList("HEAD", "GET", "POST", "DELETE", "PUT", "OPTIONS")));
configuration.setAllowedHeaders(Collections.unmodifiableList(Arrays.asList("apikey")));

final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);

return source;
return source;
}
}

0 comments on commit db0f540

Please sign in to comment.