Skip to content

Commit d843f49

Browse files
committed
Fix NPE
1 parent ed700e4 commit d843f49

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/main/java/eu/openanalytics/containerproxy/service/AccessControlService.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public boolean canAccess(Authentication auth, String specId) {
7171
}
7272

7373
public boolean canAccess(Authentication auth, ProxySpec spec) {
74+
if (auth == null || spec == null) {
75+
return false;
76+
}
7477
Optional<String> sessionId = getSessionId();
7578
if (!sessionId.isPresent()) {
7679
return checkAccess(auth, spec);
@@ -91,10 +94,6 @@ private Optional<String> getSessionId() {
9194
}
9295

9396
private boolean checkAccess(Authentication auth, ProxySpec spec) {
94-
if (auth == null || spec == null) {
95-
return false;
96-
}
97-
9897
if (auth instanceof AnonymousAuthenticationToken) {
9998
// if anonymous -> only allow access if we the backend has no authorization enabled
10099
return !authBackend.hasAuthorization();

0 commit comments

Comments
 (0)