Skip to content

Commit

Permalink
NIFI-13602 Corrected Logout Supported Status for Clustered User (#9127)
Browse files Browse the repository at this point in the history
- Set CurrentUserEntity.logoutSupported based on local authentication instead of replicated and merged responses

This closes #9127
  • Loading branch information
exceptionfactory authored Jul 31, 2024
1 parent b7faf8c commit 5a6bee2
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
Expand Down Expand Up @@ -341,20 +340,19 @@ public Response getCurrentUser() {

authorizeFlow();

final CurrentUserEntity entity;
if (isReplicateRequest()) {
return replicate(HttpMethod.GET);
}

// note that the cluster manager will handle this request directly
final NiFiUser user = NiFiUserUtils.getNiFiUser();
if (user == null) {
throw new WebApplicationException(new Throwable("Unable to access details for current user."));
try (Response replicatedResponse = replicate(HttpMethod.GET)) {
final CurrentUserEntity replicatedCurrentUserEntity = (CurrentUserEntity) replicatedResponse.getEntity();
final CurrentUserEntity currentUserEntity = serviceFacade.getCurrentUser();
// Set Logout Supported based on local client information instead of replicated and merged responses
replicatedCurrentUserEntity.setLogoutSupported(currentUserEntity.isLogoutSupported());
entity = replicatedCurrentUserEntity;
}
} else {
entity = serviceFacade.getCurrentUser();
}

// create the response entity
final CurrentUserEntity entity = serviceFacade.getCurrentUser();

// generate the response
return generateOkResponse(entity).build();
}

Expand Down

0 comments on commit 5a6bee2

Please sign in to comment.