Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ecsec Public
reqesidta-prototype
client-signer
Commits
c05c7e26
Commit
c05c7e26
authored
Nov 07, 2019
by
Rene Lottes
Browse files
Allow CORS for '/reqesidta' path
parent
54c938c6
Changes
1
Show whitespace changes
Inline
Side-by-side
bindings/http/src/main/java/org/openecard/control/binding/http/handler/CORSFilter.java
View file @
c05c7e26
...
...
@@ -45,6 +45,8 @@ import org.openecard.control.binding.http.common.Http11Response;
public
class
CORSFilter
{
private
static
final
Collection
<
String
>
NO_CORS_PATHS
;
private
static
final
String
REQESIDTA_PATH
=
"/reqesidta"
;
private
static
final
String
REQESIDTA_ALLOWED_HEADERS
=
"content-type, X-SSA-API-Endpoint, X-Digest-Algorithm, X-Signature-Algorithm"
;
static
{
NO_CORS_PATHS
=
new
LinkedList
<>();
...
...
@@ -62,7 +64,7 @@ public class CORSFilter {
String
method
=
getMethod
(
httpRequest
);
if
(
method
!=
null
)
{
HttpResponse
res
=
new
Http11Response
(
HttpStatus
.
SC_OK
);
if
(
OriginsList
.
isValidOrigin
(
origin
))
{
if
(
OriginsList
.
isValidOrigin
(
origin
)
||
isReqesidtaPath
(
httpRequest
)
)
{
postProcess
(
httpRequest
,
res
,
context
);
}
return
res
;
...
...
@@ -97,7 +99,7 @@ public class CORSFilter {
httpResponse
.
addHeader
(
"Access-Control-Allow-Methods"
,
method
);
}
// TODO: figure out if we need this header stuff
//
httpResponse.addHeader("Access-Control-Allow-Headers",
headers
);
httpResponse
.
addHeader
(
"Access-Control-Allow-Headers"
,
REQESIDTA_ALLOWED_HEADERS
);
}
}
}
...
...
@@ -132,6 +134,11 @@ public class CORSFilter {
return
acrmStr
;
}
private
boolean
isReqesidtaPath
(
HttpRequest
httpRequest
)
{
String
uri
=
httpRequest
.
getRequestLine
().
getUri
();
return
uri
.
startsWith
(
REQESIDTA_PATH
);
}
private
boolean
isNoCorsPath
(
String
reqLineUri
)
{
for
(
String
nextPath
:
NO_CORS_PATHS
)
{
if
(
reqLineUri
.
startsWith
(
nextPath
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment