OAuthAuthenticationHandler.verifyBodyHash(req, hash);
}
@Test
public void testFailBodySigning() throws Exception {
FakeHttpServletRequest req = new FakeHttpServletRequest();
req.setContentType("text/plain");
String body = "BODY";
req.setPostData(CharsetUtil.getUtf8Bytes(body));
String hash = new String(Base64.encodeBase64(DigestUtils.sha(CharsetUtil
.getUtf8Bytes("NOTBODY"))), "UTF-8");
req.setParameter(OAuthConstants.OAUTH_BODY_HASH, hash);
try {
OAuthAuthenticationHandler.verifyBodyHash(req, hash);
fail("Body verification should fail");
} catch (AuthenticationHandler.InvalidAuthenticationException iae) {
// Pass