Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.openmbee.mms.authenticator.config.AuthSecurityConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
Expand Down Expand Up @@ -31,6 +32,9 @@
@EnableAsync
public class ExampleSecurityConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {

@Value("${cors.allowed.origins:*}")
private String allowedOrigins;

@Autowired
AuthSecurityConfig authSecurityConfig;

Expand All @@ -57,7 +61,7 @@ public AuthenticationManager authenticationManagerBean() throws Exception {

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE");
registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS");
}

private CorsFilter corsFilter() {
Expand All @@ -70,7 +74,9 @@ private CorsFilter corsFilter() {

CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
for(String origin: allowedOrigins.split(",")) {
config.addAllowedOrigin(origin);
}
config.addAllowedHeader(ORIGIN);
config.addAllowedHeader(CONTENT_TYPE);
config.addAllowedHeader(ACCEPT);
Expand Down
2 changes: 2 additions & 0 deletions example/src/main/resources/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ mms.admin.password=test

mms.stream.batch.size=100000

cors.allowed.origins=*

jwt.secret=12345678901234567890123456789012
jwt.expiration=86400
jwt.header=Authorization
Expand Down
3 changes: 3 additions & 0 deletions example/src/main/resources/application.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ mms.admin.password=test

mms.stream.batch.size=100000

#Comma Separated list of allowed cross site origins
cors.allowed.origins=*

jwt.secret=make_me_something_really_long
jwt.expiration=86400
jwt.header=Authorization
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.