Skip to content

Commit

Permalink
Replace X-Ably-DeviceIdentityToken header with X-Ably-DeviceToken
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardopereira committed Jul 3, 2019
1 parent 7f112d3 commit 256c1e5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Source/ARTNSMutableRequest+ARTPush.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (void)setDeviceAuthentication:(ARTDeviceId *)deviceId localDevice:(ARTLocalDev
if ([localDevice.id isEqualToString:deviceId]) {
if (localDevice.identityTokenDetails.token) {
[logger debug:__FILE__ line:__LINE__ message:@"adding device authentication using local device identity token"];
[self setValue:[localDevice.identityTokenDetails.token base64Encoded] forHTTPHeaderField:@"X-Ably-DeviceIdentityToken"];
[self setValue:[localDevice.identityTokenDetails.token base64Encoded] forHTTPHeaderField:@"X-Ably-DeviceToken"];
}
else if (localDevice.secret) {
[logger debug:__FILE__ line:__LINE__ message:@"adding device authentication using local device secret"];
Expand Down
12 changes: 6 additions & 6 deletions Spec/PushActivationStateMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ class PushActivationStateMachine : QuickSpec {
expect(url.query).to(contain(rest.device.id))
expect(rest.device.identityTokenDetails).to(beNil())
expect(request.allHTTPHeaderFields?["Authorization"]).toNot(beNil())
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(deviceAuthorization).to(equal(testIdentityTokenDetails.token.base64Encoded()))
}

Expand Down Expand Up @@ -878,7 +878,7 @@ class PushActivationStateMachine : QuickSpec {
expect(body.value(forKey: "formFactor")).to(beNil())
expect(body.value(forKey: "platform")).to(beNil())
expect(request.allHTTPHeaderFields?["Authorization"]).toNot(beNil())
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(deviceAuthorization).to(equal(deviceIdentityToken))
}

Expand Down Expand Up @@ -937,7 +937,7 @@ class PushActivationStateMachine : QuickSpec {
expect(body.value(forKey: "formFactor")).to(beNil())
expect(body.value(forKey: "platform")).to(beNil())
expect(request.allHTTPHeaderFields?["Authorization"]).toNot(beNil())
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecret"]).to(beNil())
expect(deviceAuthorization).to(equal(deviceIdentityToken))
}
Expand Down Expand Up @@ -1079,7 +1079,7 @@ class PushActivationStateMachine : QuickSpec {
expect(body.value(forKey: "formFactor")).to(beNil())
expect(body.value(forKey: "platform")).to(beNil())
expect(request.allHTTPHeaderFields?["Authorization"]).toNot(beNil())
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(deviceAuthorization).to(equal(deviceIdentityToken))
}

Expand Down Expand Up @@ -1141,7 +1141,7 @@ class PushActivationStateMachine : QuickSpec {
expect(body.value(forKey: "formFactor")).to(beNil())
expect(body.value(forKey: "platform")).to(beNil())
expect(request.allHTTPHeaderFields?["Authorization"]).toNot(beNil())
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(deviceAuthorization).to(equal(deviceIdentityToken.base64Encoded()))
}

Expand Down Expand Up @@ -1310,7 +1310,7 @@ class PushActivationStateMachine : QuickSpec {
expect(url.query).to(contain(rest.device.id))
expect(rest.device.identityTokenDetails).to(beNil())
expect(request.allHTTPHeaderFields?["Authorization"]).toNot(beNil())
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let deviceAuthorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(deviceAuthorization).to(equal(testIdentityTokenDetails.token.base64Encoded()))
}

Expand Down
18 changes: 9 additions & 9 deletions Spec/PushAdmin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class PushAdmin : QuickSpec {
return
}

let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(authorization).to(equal(testIdentityTokenDetails.token.base64Encoded()))
}

Expand Down Expand Up @@ -504,7 +504,7 @@ class PushAdmin : QuickSpec {
}

expect(request.httpMethod) == "DELETE"
expect(request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecret"]).to(beNil())
}
}
Expand All @@ -529,7 +529,7 @@ class PushAdmin : QuickSpec {
}

expect(request.httpMethod) == "PUT"
expect(request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecret"]).to(beNil())
}

Expand Down Expand Up @@ -565,7 +565,7 @@ class PushAdmin : QuickSpec {
}
expect(request.httpMethod).to(equal("PUT"))

let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(authorization).to(equal(testIdentityTokenDetails.token.base64Encoded()))
}

Expand Down Expand Up @@ -633,7 +633,7 @@ class PushAdmin : QuickSpec {
}

expect(request.httpMethod) == "DELETE"
expect(request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecret"]).to(beNil())

waitUntil(timeout: testTimeout) { done in
Expand Down Expand Up @@ -700,7 +700,7 @@ class PushAdmin : QuickSpec {
}

expect(request.httpMethod).to(equal("POST"))
expect(request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecret"]).to(beNil())
}

Expand Down Expand Up @@ -761,7 +761,7 @@ class PushAdmin : QuickSpec {
return
}

let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(authorization).to(equal(testIdentityTokenDetails.token.base64Encoded()))
}

Expand Down Expand Up @@ -847,7 +847,7 @@ class PushAdmin : QuickSpec {
}

expect(request.httpMethod).to(equal("DELETE"))
expect(request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecret"]).to(beNil())

waitUntil(timeout: testTimeout) { done in
Expand Down Expand Up @@ -893,7 +893,7 @@ class PushAdmin : QuickSpec {
return
}

let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(authorization).to(equal(testIdentityTokenDetails.token.base64Encoded()))
}

Expand Down
8 changes: 4 additions & 4 deletions Spec/PushChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class PushChannel : QuickSpec {
expect(body.value(forKey: "deviceId") as? String).to(equal(rest.device.id))
expect(body.value(forKey: "channel") as? String).to(equal(channel.name))

let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(authorization).to(equal(testIdentityTokenDetails.token.base64Encoded()))
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecrect"]).to(beNil())
}
Expand Down Expand Up @@ -147,7 +147,7 @@ class PushChannel : QuickSpec {
expect(body.value(forKey: "clientId") as? String).to(equal(rest.device.clientId))
expect(body.value(forKey: "channel") as? String).to(equal(channel.name))

expect(request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecrect"]).to(beNil())
}
}
Expand Down Expand Up @@ -195,7 +195,7 @@ class PushChannel : QuickSpec {
expect(query).to(haveParam("deviceId", withValue: rest.device.id))
expect(query).to(haveParam("channel", withValue: channel.name))

let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]
let authorization = request.allHTTPHeaderFields?["X-Ably-DeviceToken"]
expect(authorization).to(equal(testIdentityTokenDetails.token.base64Encoded()))
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecrect"]).to(beNil())
}
Expand Down Expand Up @@ -252,7 +252,7 @@ class PushChannel : QuickSpec {
expect(query).to(haveParam("clientId", withValue: rest.device.clientId!))
expect(query).to(haveParam("channel", withValue: channel.name))

expect(request.allHTTPHeaderFields?["X-Ably-DeviceIdentityToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceToken"]).to(beNil())
expect(request.allHTTPHeaderFields?["X-Ably-DeviceSecrect"]).to(beNil())
}
}
Expand Down

0 comments on commit 256c1e5

Please sign in to comment.