public void TestSignatureCheck_OptionsEmptySuccess() { var connectionContext = new WebPubSubConnectionContext( WebPubSubEventType.System, null, null, "0f9c97a2f0bf4706afe87a14e0797b11", signature: "sha256=7767effcb3946f3e1de039df4b986ef02c110b1469d02c0a06f41b3b727ab561", origin: TestUri.Host); var result = connectionContext.IsValidSignature(null); Assert.True(result); }
public void TestSignatureCheck_SignatureNullFail() { var connectionContext = new WebPubSubConnectionContext( WebPubSubEventType.System, null, null, "0f9c97a2f0bf4706afe87a14e0797b11", origin: TestUri.Host); var options = new WebPubSubValidationOptions($"Endpoint={TestUri};AccessKey=7aab239577fd4f24bc919802fb629f5f;Version=1.0;"); var result = connectionContext.IsValidSignature(options); Assert.False(result); }
public void TestSignatureCheck(string accessKey, bool valid) { var connectionContext = new WebPubSubConnectionContext( WebPubSubEventType.System, null, null, "0f9c97a2f0bf4706afe87a14e0797b11", signature: "sha256=7767effcb3946f3e1de039df4b986ef02c110b1469d02c0a06f41b3b727ab561", origin: TestUri.Host); var options = new WebPubSubValidationOptions($"Endpoint={TestUri};AccessKey={accessKey};Version=1.0;"); var result = connectionContext.IsValidSignature(options); Assert.AreEqual(valid, result); }