mirror of https://github.com/apache/nifi.git
NIFI-13602 Corrected Logout Supported Status for Clustered User (#9127)
- Set CurrentUserEntity.logoutSupported based on local authentication instead of replicated and merged responses This closes #9127
This commit is contained in:
parent
b7faf8c84a
commit
5a6bee2154
|
@ -144,7 +144,6 @@ import jakarta.ws.rs.Path;
|
|||
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;
|
||||
|
@ -341,20 +340,19 @@ public class FlowResource extends ApplicationResource {
|
|||
|
||||
authorizeFlow();
|
||||
|
||||
final CurrentUserEntity entity;
|
||||
if (isReplicateRequest()) {
|
||||
return replicate(HttpMethod.GET);
|
||||
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();
|
||||
}
|
||||
|
||||
// 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."));
|
||||
}
|
||||
|
||||
// create the response entity
|
||||
final CurrentUserEntity entity = serviceFacade.getCurrentUser();
|
||||
|
||||
// generate the response
|
||||
return generateOkResponse(entity).build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue