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

Backwards compat changes to ensure that all tokens start with the study name #858

Merged
merged 3 commits into from
Jul 11, 2022

Conversation

shankari
Copy link
Contributor

Related server changes:
e-mission/e-mission-server@b73d671
e-mission/e-mission-server@0870760
e-mission/e-mission-server@6e9f4d2

Related PR comments:
e-mission/e-mission-docs#732 (comment)

Basically, we:

  • infer the study name from the connect URL
  • ensure that any new autogenerated tokens have the study prefix
  • fix up old style tokens to start with the study prefix

Once all the old style tokens are converted over, we can remove the final change.
Once we change the study config to include the name, and support config updates, we can remove the first change.

shankari added 3 commits July 10, 2022 22:17
Until we actually go through and add a name to the survey spec
We fill this in both on download and on load from disk
If we have a token that does not start with the study prefix,
add it and re-save.

This ensures that as the app is upgraded, all the tokens will be upgraded, and
we can fix the server side tokens later.

Testing done:

- Logged in with an old-style token

Initial login was as expected

```
2022-07-10 21:25:09,655:DEBUG:123145355665408:Using the skip method to verify id token user-0 of length 6
2022-07-10 21:25:09,657:DEBUG:123145355665408:retUUID = 802667b6-371f-45b2-9c7a-bb051244836a
```

Then went to the control screen, which reset the token to nrelop_dev_user-0

```
user email = user-0
index.html:154 DEBUG:Found old style token, after prepending nrelop_dev new token is nrelop_dev_user-0
```

And we logged in after stripping the value

```
2022-07-10 21:49:42,398:DEBUG:123145437908992:retUUID = None
2022-07-10 21:49:42,398:DEBUG:123145437908992:token nrelop_dev_user-0 is valid, but no account found. stripping out study name and retrying...
2022-07-10 21:49:42,398:DEBUG:123145437908992:study prefix is nrelop_dev
2022-07-10 21:49:42,398:DEBUG:123145437908992:After stripping out nrelop_dev, token is user-0
```

Then updated the server token

```
2022-07-10 21:52:58,581:DEBUG:123145422143488:Using the skip method to verify id token nrelop_dev_user-0 of length 17
2022-07-10 21:52:58,583:DEBUG:123145422143488:retUUID = ....
```

Login with a new token works as always

```
2022-07-10 22:08:17,604:DEBUG:123145406377984:Using the skip method to verify id token nrelop_dev_bkR1arZm6mKw6Fym of length 27
2022-07-10 22:08:17,609:DEBUG:123145406377984:retUUID = 93ca26ce-8d8a-4d45-a41d-c6615ab791ab
```
@shankari
Copy link
Contributor Author

Should we also ensure that any new tokens follow the correct format?
Let's do that next week, once we have a chance for the tokens to change over.

@shankari shankari merged commit 13472f9 into master_for_platform Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant