From 941984ed7bc6c3039689c2b620d348b2a5087d4c Mon Sep 17 00:00:00 2001 From: Ricardo Pereira Date: Tue, 22 Mar 2016 22:15:28 +0000 Subject: [PATCH 1/2] RSA8f2 --- Spec/Auth.swift | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Spec/Auth.swift b/Spec/Auth.swift index 39290b30f..1a8f74c07 100644 --- a/Spec/Auth.swift +++ b/Spec/Auth.swift @@ -867,6 +867,26 @@ class Auth : QuickSpec { } + // RSA8f2 + it("ensure that the message is rejected") { + let token = getTestToken() + let options = ARTClientOptions(token: token) + options.environment = "sandbox" + options.clientId = "john" + + let rest = ARTRest(options: options) + rest.httpExecutor = mockExecutor + let channel = rest.channels.get("test") + + waitUntil(timeout: testTimeout) { done in + channel.publish([ARTMessage(name: nil, data: "no client", clientId: "john")]) { error in + expect(error!.message).to(contain("mismatched clientId")) + done() + } + } + expect(rest.auth.clientId).to(beNil()) + } + // RSA8f4 it("ensure the message published with a wildcard '*' has the provided clientId") { let options = AblyTests.commonAppSetup() From 642491863cc413d3d52c643b7cb28f2da8985194 Mon Sep 17 00:00:00 2001 From: Ricardo Pereira Date: Wed, 6 Apr 2016 15:34:20 +0100 Subject: [PATCH 2/2] Fix RSA8f2 --- Spec/Auth.swift | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Spec/Auth.swift b/Spec/Auth.swift index 1a8f74c07..318095a3c 100644 --- a/Spec/Auth.swift +++ b/Spec/Auth.swift @@ -869,17 +869,14 @@ class Auth : QuickSpec { // RSA8f2 it("ensure that the message is rejected") { - let token = getTestToken() - let options = ARTClientOptions(token: token) - options.environment = "sandbox" - options.clientId = "john" - + let options = AblyTests.commonAppSetup() + options.token = getTestToken(clientId: nil) let rest = ARTRest(options: options) - rest.httpExecutor = mockExecutor let channel = rest.channels.get("test") waitUntil(timeout: testTimeout) { done in - channel.publish([ARTMessage(name: nil, data: "no client", clientId: "john")]) { error in + let message = ARTMessage(name: nil, data: "message with an explicit clientId", clientId: "john") + channel.publish([message]) { error in expect(error!.message).to(contain("mismatched clientId")) done() }