Skip to content

Commit f0da40d

Browse files
Use * for any CORS origin
At least for now
1 parent f36a683 commit f0da40d

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

.github/workflows/authorization-server-make.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
env:
1616
REGISTRY_IMAGE: pivotalrabbitmq/spring-authorization-server
17-
IMAGE_TAG: 0.0.2
17+
IMAGE_TAG: 0.0.3
1818
jobs:
1919
docker:
2020
runs-on: ubuntu-latest

selenium/authorization-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>com.rabbitmq</groupId>
1212
<artifactId>authorization-server</artifactId>
13-
<version>0.0.2</version>
13+
<version>0.0.3</version>
1414
<name>authorization-server</name>
1515
<description>Authorization Server for Selenium</description>
1616
<url/>

selenium/authorization-server/src/main/java/com/rabbitmq/authorization_server/SimpleCORSFilter.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,22 @@
2323
@Order(Ordered.HIGHEST_PRECEDENCE)
2424
public class SimpleCORSFilter implements Filter {
2525

26-
private final Set<String> allowedOrigins;
27-
2826
@Autowired
29-
public SimpleCORSFilter(@Value("${spring.security.cors.allowed-origins:*}") Set<String> allowedOrigins) {
30-
this.allowedOrigins = allowedOrigins;
27+
public SimpleCORSFilter() {
3128
}
3229

3330
@Override
3431
public void init(FilterConfig fc) throws ServletException {
35-
32+
System.out.println("Init SimpleCORSFilter");
3633
}
3734

3835
@Override
3936
public void doFilter(ServletRequest req, ServletResponse resp,
4037
FilterChain chain) throws IOException, ServletException {
38+
System.out.println("doFilter SimpleCORSFilter");
4139
HttpServletResponse response = (HttpServletResponse) resp;
4240
HttpServletRequest request = (HttpServletRequest) req;
43-
String origin = request.getHeader("referer");
44-
if(origin != null ){
45-
Optional<String> first = allowedOrigins.stream().filter(origin::startsWith).findFirst();
46-
first.ifPresent(s -> response.setHeader("Access-Control-Allow-Origin", s));
47-
}
41+
response.setHeader("Access-Control-Allow-Origin", "*");
4842
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
4943
response.setHeader("Access-Control-Max-Age", "3600");
5044
response.setHeader("Access-Control-Allow-Headers", "x-requested-with, authorization, Content-Type, Authorization, credential, X-XSRF-TOKEN");

0 commit comments

Comments
 (0)