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 @@ -33,6 +33,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter implements
@Value("${mms.hsts.enabled:false}")
private boolean hsts;

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

@Autowired
AuthSecurityConfig authSecurityConfig;

Expand Down Expand Up @@ -77,14 +80,16 @@ public void addCorsMappings(CorsRegistry registry) {
.allowedMethods("*")
.allowCredentials(true)
.maxAge(3600L)
.allowedOriginPatterns("*");
.allowedOriginPatterns(allowedOrigins.split(","));
}

private CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOriginPattern("*");
for (String origin: allowedOrigins.split(",")) {
config.addAllowedOriginPattern(origin);
}
config.addAllowedHeader("*");
config.addAllowedMethod("*");
config.setMaxAge(3600L);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ mms.admin.username=test
mms.admin.password=test
mms.stream.batch.size=100000

cors.allowed.origins=*

# jwt issued by mms for logins via /authentication
jwt.secret=make_me_something_really_long
jwt.expiration=86400
Expand Down