Package com.google.gwt.user.client.rpc

Examples of com.google.gwt.user.client.rpc.XsrfToken


            service.validateXsrfToken(token);
            fail("Expected RpcTokenException");
        } catch (RpcTokenException e) { }

        try {
            XsrfToken token = mock(XsrfToken.class);
            when(token.getToken()).thenReturn("blech");
            service.validateXsrfToken((RpcToken) token);
            fail("Expected RpcTokenException");
        } catch (RpcTokenException e) { }

        XsrfToken token = mock(XsrfToken.class);
        when(token.getToken()).thenReturn(GwtCookieXsrfTokenService.generateTokenFromCookie("value"));
        service.validateXsrfToken((RpcToken) token);
    }
View Full Code Here


            service.validateXsrfToken((XsrfToken) null);
            fail("Expected RpcTokenException");
        } catch (RpcTokenException e) { }

        try {
            XsrfToken token = mock(XsrfToken.class);
            when(token.getToken()).thenReturn("blech");
            service.validateXsrfToken(token);
            fail("Expected RpcTokenException");
        } catch (RpcTokenException e) { }

        XsrfToken token = mock(XsrfToken.class);
        when(token.getToken()).thenReturn(GwtCookieXsrfTokenService.generateTokenFromCookie("value"));
        service.validateXsrfToken(token);
    }
View Full Code Here

            this.callback.onFailure(caught);
        }

        @Override
        public void onSuccess(String token) {
            XsrfToken xsrfToken = new XsrfToken(token);
            setRpcToken(xsrfToken);
            this.invokeRpcMethod();
        }
View Full Code Here

          "Unable to verify XSRF cookie");
    }

    String expectedToken = Utility.toHexString(
        Utility.getMd5Digest(sessionCookie.getValue().getBytes()));
    XsrfToken xsrfToken = (XsrfToken) token;

    if (!expectedToken.equals(xsrfToken.getToken())) {
      throw new RpcTokenException("Invalid XSRF token");
    }
  }
View Full Code Here

  /**
   * Generates and returns new XSRF token.
   */
  public XsrfToken getNewXsrfToken() {
    return new XsrfToken(generateTokenValue());
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.rpc.XsrfToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.