@Test public void testCreateAuthenticationSignature2() { DefaultAuthenticator authenticator = new DefaultAuthenticator( AuthorizationType.V1HMAC, "EC36A74A98D21", "6Kj5HT0MQKC6D8eb7W3lTg71kVKVDSt1"); String dataToSign = "GET\n" + "\n" + "Fri, 06 Jun 2014 13:39:43 GMT\n" + "/v1/9991/tokens/123456789\n"; String authenticationSignature = authenticator.createAuthenticationSignature(dataToSign); Assert.assertEquals("9ond5EIN05dBXJGCLRK5om9pxHsyrh/12pZJ7bvmwNM=", authenticationSignature); }
@Test public void testCreateAuthenticationSignature() { DefaultAuthenticator authenticator = new DefaultAuthenticator(AuthorizationType.V1HMAC, "apiKeyId", "secretApiKey"); String dataToSign = "DELETE\n" + "application/json\n" + "Fri, 06 Jun 2014 13:39:43 GMT\n" + "x-gcs-clientmetainfo:processed header value\n" + "x-gcs-customerheader:processed header value\n" + "x-gcs-servermetainfo:processed header value\n" + "/v1/9991/tokens/123456789\n"; String authenticationSignature = authenticator.createAuthenticationSignature(dataToSign); Assert.assertEquals("VfnXpPBQQoHZivTcAg0JvOWkhnzlPnaCPKpTQn/uMJM=", authenticationSignature); }