-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix RSA8c: check authUrl content expectations #474
Conversation
Not passing: the client is adding additional parameters in the |
cd8fb22
to
e271713
Compare
Wrong assumption
but |
5072c0a
to
25592e0
Compare
expect(tokenDetails?.capability) == testTokenDetails.capability | ||
expect(tokenDetails?.issued).toNot(beNil()) | ||
expect(tokenDetails?.expires).toNot(beNil()) | ||
if let issued = tokenDetails?.issued, let testIssued = testTokenDetails.issued { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending because tokenDetails.issued
is nil and tokenDetails.expires
is nil.
But jsonTokenDetails.toUTF8String
is "http://echo.ably.io?ttl=3600.000000&capability=%7B%22*%22:%5B%22*%22%5D%7D×tamp=1472479389.001963&type=json&body=%7B%22expires%22:%221472482988000%22,%22capability%22:%22%7B%5C%22*%5C%22:%5B%5C%22*%5C%22%5D%7D%22,%22token%22:%22WKZpMg.Dcg4-NM2v5eYV5v8bmkTRxv4oe3nmp7qmQ4DA-5lXij4tcizw7uIex0vMrOtNUqRcSZhGR9z9d5H60dZBayVTpcABAO80d4K9_F6I-IgpMryU7md31s9IbmPkrZvuU7Rs%22,%22issued%22:%221472479388000%22%7D&format=msgpack"
Both issued
and expires
have values and echo.ably.io
is working fine.
curl -X "GET" "http://echo.ably.io/?type=json&body=%7B%22expires%22:%221472482988000%22,%22capability%22:%22%7B%5C%22*%5C%22:%5B%5C%22*%5C%22%5D%7D%22,%22token%22:%22WKZpMg.Dcg4-NM2v5eYV5v8bmkTRxv4oe3nmp7qmQ4DA-5lXij4tcizw7uIex0vMrOtNUqRcSZhGR9z9d5H60dZBayVTpcABAO80d4K9_F6I-IgpMryU7md31s9IbmPkrZvuU7Rs%22,%22issued%22:%221472479388000%22%7D"
cURL returns:
{"expires":"1472482988000","capability":"{\"*\":[\"*\"]}","token":"WKZpMg.Dcg4-NM2v5eYV5v8bmkTRxv4oe3nmp7qmQ4DA-5lXij4tcizw7uIex0vMrOtNUqRcSZhGR9z9d5H60dZBayVTpcABAO80d4K9_F6I-IgpMryU7md31s9IbmPkrZvuU7Rs","issued":"1472479388000"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not pending anymore, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, fixed da08ea9
I can squash this after review. |
var tokenRequest: ARTTokenRequest? | ||
waitUntil(timeout: testTimeout) { done in | ||
// Sandbox and valid TokenRequest | ||
ARTRest(options: AblyTests.commonAppSetup()).auth.createTokenRequest(nil, options: nil, callback: { newTokenRequest, error in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we add something to the token request (capability, etc.) and then check in the retrieved TokenDetails
that it matches? As is, the library could be ignoring the token request from authUrl
and we wouldn't notice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 48025f0 👍
@ricardopereira PTAL |
@tcard Looks good 👍 |
Should I squash? |
@tcard I don't know if you notice but the ttl=3600.000000&capability ... ⬇️
|
@ricardopereira Isn't that expected? http://docs.ably.io/client-lib-development-guide/features/#RSA8c1a |
@tcard Yes, sorry. |
8bbebff
to
8d0e087
Compare
👍 |
- NSJSONSerialization does the correct number deserialization. No need to explicitly check the NSNumber type.
TokenRequest: it first should use the `authUrl` and then it should request a token as usual
#292