Alexander Wels has uploaded a new change for review.

Change subject: userportal,webadmin: clear token on error
......................................................................

userportal,webadmin: clear token on error

- Added code to clear the token on the client and
  reacquire it when retrying the attempt that errored out. This
  is to support scenarios where the token might have changed
  without the client knowing.

Change-Id: I66c08d021788ebee561d39907f06de22cfe77b22
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1112404
Signed-off-by: Alexander Wels <[email protected]>
---
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/communication/GWTRPCCommunicationProvider.java
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/04/29904/1

diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/communication/GWTRPCCommunicationProvider.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/communication/GWTRPCCommunicationProvider.java
index b3c2927..9610eb0 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/communication/GWTRPCCommunicationProvider.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/communication/GWTRPCCommunicationProvider.java
@@ -154,6 +154,8 @@
                         (VdcQueryParametersBase) operation.getParameter(), new 
AsyncCallback<VdcQueryReturnValue>() {
                     @Override
                     public void onFailure(final Throwable exception) {
+                        //Clear out the token, and let the retry mechanism try 
again.
+                        xsrfRequestBuilder.setXsrfToken(null);
                         operation.getCallback().onFailure(operation, 
exception);
                     }
 
@@ -183,6 +185,8 @@
                         (VdcActionParametersBase) operation.getParameter(), 
new AsyncCallback<VdcReturnValueBase>() {
                     @Override
                     public void onFailure(final Throwable exception) {
+                        //Clear out the token, and let the retry mechanism try 
again.
+                        xsrfRequestBuilder.setXsrfToken(null);
                         operation.getCallback().onFailure(operation, 
exception);
                     }
 
@@ -260,6 +264,8 @@
                             new 
AsyncCallback<ArrayList<VdcQueryReturnValue>>() {
                         @Override
                         public void onFailure(final Throwable exception) {
+                            //Clear out the token, and let the retry mechanism 
try again.
+                            xsrfRequestBuilder.setXsrfToken(null);
                             handleMultipleQueriesFailure(queriesList, 
exception);
                         }
 
@@ -301,6 +307,8 @@
      */
     private void handleMultipleQueriesFailure(final List<VdcOperation<?, ?>> 
queriesList,
             final Throwable exception) {
+        //Clear out the token, and let the retry mechanism try again.
+        xsrfRequestBuilder.setXsrfToken(null);
         Map<VdcOperationCallback<?, ?>, List<VdcOperation<?, ?>>> callbackMap 
= getCallbackMap(queriesList);
         for (Map.Entry<VdcOperationCallback<?, ?>, List<VdcOperation<?, ?>>> 
callbackEntry: callbackMap.entrySet()) {
             if (callbackEntry.getKey() instanceof VdcOperationCallbackList) {
@@ -368,6 +376,8 @@
 
                     @Override
                     public void onFailure(final Throwable exception) {
+                        //Clear out the token, and let the retry mechanism try 
again.
+                        xsrfRequestBuilder.setXsrfToken(null);
                         handleRunMultipleActionFailure(operations, exception);
                     }
 
@@ -400,6 +410,8 @@
 
     private void handleRunMultipleActionFailure(final List<VdcOperation<?, ?>> 
operations,
             final Throwable exception) {
+        //Clear out the token, and let the retry mechanism try again.
+        xsrfRequestBuilder.setXsrfToken(null);
         Map<VdcOperationCallback<?, ?>, List<VdcOperation<?, ?>>> callbackMap =
                 getCallbackMap(operations);
         for (Map.Entry<VdcOperationCallback<?, ?>, List<VdcOperation<?, ?>>> 
callbackEntry: callbackMap.entrySet()) {
@@ -480,6 +492,8 @@
 
                     @Override
                     public void onFailure(final Throwable caught) {
+                        //Clear out the token, and let the retry mechanism try 
again.
+                        xsrfRequestBuilder.setXsrfToken(null);
                         loginOperation.getCallback().onFailure(loginOperation, 
caught);
                     }
                 });
@@ -541,6 +555,8 @@
 
                     @Override
                     public void onFailure(final Throwable caught) {
+                        //Clear out the token, and let the retry mechanism try 
again.
+                        xsrfRequestBuilder.setXsrfToken(null);
                         callback.onFailure(caught);
                     }
                 });
@@ -569,6 +585,8 @@
 
                     @Override
                     public void onFailure(final Throwable caught) {
+                        //Clear out the token, and let the retry mechanism try 
again.
+                        xsrfRequestBuilder.setXsrfToken(null);
                         callback.onFailure(caught);
                     }
                 });


-- 
To view, visit http://gerrit.ovirt.org/29904
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66c08d021788ebee561d39907f06de22cfe77b22
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Alexander Wels <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to