diff --git a/gate-core/src/main/java/com/netflix/spinnaker/gate/services/AuthenticationService.java b/gate-core/src/main/java/com/netflix/spinnaker/gate/services/AuthenticationService.java index 14773db1b5..8682cbb4f2 100644 --- a/gate-core/src/main/java/com/netflix/spinnaker/gate/services/AuthenticationService.java +++ b/gate-core/src/main/java/com/netflix/spinnaker/gate/services/AuthenticationService.java @@ -20,6 +20,7 @@ import com.netflix.spinnaker.fiat.shared.FiatPermissionEvaluator; import com.netflix.spinnaker.fiat.shared.FiatService; import com.netflix.spinnaker.fiat.shared.FiatStatus; +import com.netflix.spinnaker.kork.retrofit.Retrofit2SyncCall; import com.netflix.spinnaker.security.AuthenticatedRequest; import io.micrometer.core.annotation.Counted; import java.util.Collection; @@ -59,7 +60,7 @@ public Collection login(String userid) { return AuthenticatedRequest.allowAnonymous( () -> { - getFiatServiceForLogin().loginUser(userid, ""); + Retrofit2SyncCall.execute(getFiatServiceForLogin().loginUser(userid)); return resolveAuthorities(userid); }); } @@ -73,7 +74,7 @@ public Collection loginWithRoles( return AuthenticatedRequest.allowAnonymous( () -> { - getFiatServiceForLogin().loginWithRoles(userid, roles); + Retrofit2SyncCall.execute(getFiatServiceForLogin().loginWithRoles(userid, roles)); return resolveAuthorities(userid); }); } @@ -84,7 +85,7 @@ public void logout(String userid) { return; } - getFiatServiceForLogin().logoutUser(userid); + Retrofit2SyncCall.execute(getFiatServiceForLogin().logoutUser(userid)); permissionEvaluator.invalidatePermission(userid); } diff --git a/gate-core/src/main/java/com/netflix/spinnaker/gate/services/PermissionService.java b/gate-core/src/main/java/com/netflix/spinnaker/gate/services/PermissionService.java index ec9f01b318..f302bfbeed 100644 --- a/gate-core/src/main/java/com/netflix/spinnaker/gate/services/PermissionService.java +++ b/gate-core/src/main/java/com/netflix/spinnaker/gate/services/PermissionService.java @@ -29,6 +29,7 @@ import com.netflix.spinnaker.kork.core.RetrySupport; import com.netflix.spinnaker.kork.exceptions.SpinnakerException; import com.netflix.spinnaker.kork.exceptions.SystemException; +import com.netflix.spinnaker.kork.retrofit.Retrofit2SyncCall; import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException; import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException; import com.netflix.spinnaker.security.AuthenticatedRequest; @@ -78,9 +79,7 @@ public void login(final String userId) { try { AuthenticatedRequest.allowAnonymous( () -> { - // TODO(jvz): FiatService::loginUser should have only one parameter as Retrofit no - // longer requires this body parameter - getFiatServiceForLogin().loginUser(userId, ""); + Retrofit2SyncCall.execute(getFiatServiceForLogin().loginUser(userId)); permissionEvaluator.invalidatePermission(userId); return null; }); @@ -95,7 +94,7 @@ public void loginWithRoles(final String userId, final Collection roles) try { AuthenticatedRequest.allowAnonymous( () -> { - getFiatServiceForLogin().loginWithRoles(userId, roles); + Retrofit2SyncCall.execute(getFiatServiceForLogin().loginWithRoles(userId, roles)); permissionEvaluator.invalidatePermission(userId); return null; }); @@ -108,7 +107,7 @@ public void loginWithRoles(final String userId, final Collection roles) public void logout(String userId) { if (fiatStatus.isEnabled()) { try { - getFiatServiceForLogin().logoutUser(userId); + Retrofit2SyncCall.execute(getFiatServiceForLogin().logoutUser(userId)); permissionEvaluator.invalidatePermission(userId); } catch (SpinnakerServerException e) { throw UpstreamBadRequest.classifyError(e); @@ -119,7 +118,7 @@ public void logout(String userId) { public void sync() { if (fiatStatus.isEnabled()) { try { - getFiatServiceForLogin().sync(List.of()); + Retrofit2SyncCall.execute(getFiatServiceForLogin().sync(List.of())); } catch (SpinnakerServerException e) { throw UpstreamBadRequest.classifyError(e); }