Skip to content

Commit 673722d

Browse files
authored
Fix the comparison for when both xfcc and apikey are enabled for auth… (#78)
1 parent 30c07cd commit 673722d

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Set postgres password by
1919
export POSTGRES_PASSWORD=<my db password>
2020
```
2121

22-
If config ```acdc.auth.enabled = true``` is enabled, authorization api-keys are SHA-256 hashed. The REST enb-points should include a http header key ```x-api-key``` with appropriate value.
22+
If config ```acdc.auth.enabled = true``` is enabled, authorization api-keys are SHA-256 hashed. The REST endpoints should include a http header key ```x-api-key``` with appropriate value.
2323

2424
Set an environment variable for the authorized x-api-key hashed string. Example:
2525

acdc-ws/app/utils/Authorization.scala

+6-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ class Authorization(private var authorizationSettings: AuthorizationSettings) {
2323
def getRoles(request: Request[_]): List[String] = {
2424
(authorizationSettings.apiKeyAuthEnabled, authorizationSettings.xfccKeyAuthEnabled) match {
2525
case (true, true) =>
26-
if (getKeyRoles(request.headers.get(authorizationSettings.apiKeyAuthHeader)) ==
27-
getXfccRoles(request.headers.get(authorizationSettings.xfccAuthHeader))) {
28-
List(Admin)
26+
if (!getKeyRoles(request.headers.get(authorizationSettings.apiKeyAuthHeader)).isEmpty) {
27+
if (!getXfccRoles(request.headers.get(authorizationSettings.xfccAuthHeader)).isEmpty) {
28+
List(Admin)
29+
} else {
30+
List.empty
31+
}
2932
} else {
3033
List.empty
3134
}

version.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ThisBuild / version := "0.11.0"
1+
ThisBuild / version := "0.11.1"

0 commit comments

Comments
 (0)