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

Torii restore generic data #1310

Merged
merged 1 commit into from
Oct 4, 2017

Conversation

elidupuis
Copy link
Contributor

I think I've found a small bug in authenticator:torii. It seems that on restore, session data (possibly resolved by extra functionality in authenticate) is being clobbered by the data returned from this.get('torii').fetch().

I've updated a test with some generic data to demonstrate a failing result and including a fix that simply merges the sessionData passed into restore with the data returned from the .fetch() call.

Let me know if I'm missing something here, or if you'd like anything changed/updated.

@elidupuis elidupuis force-pushed the torii-restore-generic-data branch from b5ec121 to 74e1ccf Compare May 2, 2017 17:48
@elidupuis
Copy link
Contributor Author

Looks like there's some tests failing on master. I can rebase after #1308 is merged if you're interested in this patch.

Copy link
Member

@marcoow marcoow left a comment

Choose a reason for hiding this comment

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

I'm not sure I understand the use case for this. The authenticated object in the session data is managed by ESA and supposed to ever be written by the app.

return authenticator.restore({ some: 'data', provider: 'provider' }).then((data) => {
expect(data).to.eql({ some: 'other data', provider: 'provider' });
return authenticator.restore({ some: 'data', provider: 'provider', other: 'unrelated data' }).then((data) => {
expect(data).to.eql({ some: 'other data', provider: 'provider', other: 'unrelated data' });
Copy link
Member

Choose a reason for hiding this comment

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

How would other end up in the authenticated session data in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, other is part of the data resolved by a custom authenticator.authenticate() method.

I'll put an example together shortly.

Previously, generic `sessionData` was being clobbered be the data returned by Torii.fetch.
Now, generic sessionData is preserved and the result of Torii.fetch is merged into it.
Copy link
Member

@marcoow marcoow left a comment

Choose a reason for hiding this comment

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

OK, I got what this solves now and fixed the test 👍

@marcoow marcoow added the bug label Oct 4, 2017
@marcoow marcoow merged commit e84ebdd into mainmatter:master Oct 4, 2017
@elidupuis elidupuis deleted the torii-restore-generic-data branch October 4, 2017 17:16
@elidupuis
Copy link
Contributor Author

Great! Sorry I never got around to providing a better example!

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

Successfully merging this pull request may close these issues.

None yet

2 participants