internal static string CalculateParameterExpectation( string key, string httpMethod, string apiPath, long timestamp) { string unsignedResult = String.Format("{0}&{1}&{2}", httpMethod, apiPath, timestamp); string signedResult = D2LSigner.GetBase64HashString(key, unsignedResult); return(signedResult); }
public void AppContext_CreateUrlForAuth_ReturnsUri_AndQueryParam_x_b_MatchesLandingUriSignedWithAppKey() { string expectedSignedUri = D2LSigner.GetBase64HashString( TestConstants.APP_KEY, TestConstants.API_URL); Uri uri = m_appContext.CreateUrlForAuthentication(m_testHostSpec, m_landingUri); string parameter = GetUriQueryParameter(uri, "x_b"); Assert.AreEqual(expectedSignedUri, parameter); }
public void D2LSigner_GetBase64HashString_RemovesTrailingEqualSigns() { string hash = D2LSigner.GetBase64HashString(TEST_KEY, TEST_DATA); Assert.AreEqual(TEST_HASH, hash); }
public void D2LSigner_GetBase64HashString_ReplacesSlashesWithUnderscores() { string hash = D2LSigner.GetBase64HashString(TEST_KEY, TEST_DATA_3); Assert.AreEqual(TEST_HASH_3, hash); }
public void D2LSigner_GetBase64HashString_ReplacesPlusesWithDashes() { string hash = D2LSigner.GetBase64HashString(TEST_KEY, TEST_DATA_2); Assert.AreEqual(TEST_HASH_2, hash); }