Skip to content
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

RSA10k #495

Merged
merged 7 commits into from
Oct 11, 2016
Merged

RSA10k #495

merged 7 commits into from
Oct 11, 2016

Conversation

EvgenyKarkan
Copy link
Contributor

No description provided.

@mattheworiordan
Copy link
Member

This PR addresses some of the points from the previous PRs about testing time which is good ,, thanks.

@EvgenyKarkan
Copy link
Contributor Author

Sorry, should I redo something here?

@mattheworiordan
Copy link
Member

Sorry, should I redo something here?

I should have been clearer, I think this PR is fine. However, given the equivalent Java one that I saw was not actually using the offset, can you think of any way to check that the offset is really being used on subsequent requests?

@EvgenyKarkan
Copy link
Contributor Author

EvgenyKarkan commented Sep 7, 2016

Ok, let me try to describe one case.

  • assume timeOffset is stored by Auth instance yet, and we are expecting subsequent request in future.
  • AuthOptions argument queryTime property set to false or missed as an argument (false by default)

I guess you want us also to check such case for subsequent requests, right?

@mattheworiordan
Copy link
Member

I guess you want us also to check such case for subsequent requests, right?

Well yes, some coverage that demonstrably shows that the offset is effecting the time. You could inject a fake offset and check it effects token, or if you can think of a better way then that would good too, I just want to be sure the offset is actually used as per the spec.

@EvgenyKarkan
Copy link
Contributor Author

Please review and merge if everything looks good

callback(nil, error);
} else {
NSDate *dateNow = [NSDate date];
long long nowMillis = [dateNow timeIntervalSince1970]*1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you convert the NSTimeIntervals to long long and then to NSNumber instead of just storing the time offset as a NSTimeInterval? And why do you multiply by 1000 instead of working with seconds with decimals, which is what NSTimeInterval is?

Copy link
Member

@mattheworiordan mattheworiordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few small comments but mostly good

XCTFail("tokenRequest is nil"); return
}
expect(rest.auth.timeOffset).toNot(beNil())
rest.auth.discardTimeOffset()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. It's saying the it's possible that the "Client" should be able to discard the local clock offset, not the user. Anyway, leave now, but this spec item was simply a statement to make it clear that the client library developer when writing the client could under certain circumstances choose to discard the offset internally.

@ricardopereira ricardopereira changed the base branch from RSA10g to master September 29, 2016 09:22
@ricardopereira
Copy link
Contributor

Will change the base to master.

@ricardopereira
Copy link
Contributor

Squashed.

@ricardopereira
Copy link
Contributor

Not passing. I think some pieces are missing.

@ricardopereira
Copy link
Contributor

A client MAY discard the cached local clock offset in situations in which it may have been invalidated, such as if there is a local change to the date, time, or timezone, of the client device

@mattheworiordan
Copy link
Member

Thanks @ricardopereira. TBH actually handling the changing timezones is not something we worried about hence why it's deliberately unspecified in the lib, but glad you've done it so worth merging in now.

Added offset test.

Test improvement, use of fake time offset.
@ricardopereira ricardopereira force-pushed the RSA10k branch 2 times, most recently from 7936ed5 to 7fbbec4 Compare October 5, 2016 12:03
@ricardopereira
Copy link
Contributor

@tcard PTAL

@mattheworiordan
Copy link
Member

@tcard are you happy for this to be merged?

}
}];
} else {
if (_timeOffset) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will prevent the server time to be queried even if queryTime is set to true, which is not what I would expect, although RSA10k makes it kind of ambiguous: "If the AuthOption argument’s queryTime attribute is true, it will obtain the server time once and persist the offset from the local clock" contradicts with "All future token requests generated directly or indirectly via a call to authorize will not obtain the server time" if authorize is called with queryTime true (triggering the first condition) a second time (triggering the second condition).

@mattheworiordan can you confirm this is expected?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 3588ff0.

@ricardopereira ricardopereira force-pushed the RSA10k branch 2 times, most recently from 3588ff0 to f8a395e Compare October 10, 2016 22:17
@ricardopereira
Copy link
Contributor

Can I squash and rebase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants