Skip to content

Feature: Shared Tokens #241

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

Merged
merged 6 commits into from
Aug 24, 2024
Merged

Feature: Shared Tokens #241

merged 6 commits into from
Aug 24, 2024

Conversation

benloh
Copy link
Collaborator

@benloh benloh commented Aug 10, 2024

For the September 2024 pilot, we expect students to be working with multiple graphs over the duration of the pilot.

Removing the dataset field when defining tokens should make it possible to create tokens that are defined by two parameters:

  • class name -- This will be the first part of the token and can be any string
  • project name (group name) -- This will be the second part of the token and can be any string

There is a new script ncMakeSharedTokens(classid, projid, numTokens) that works the same as ncMakeTokens. (ncMakeTokens still works, but the datatset field is now ignored).

See #233


To Test

Test Net.Create

  1. Start Net.Create with a graph, e.g. npm run dev if you already have a project defined, or ./nc.js --dataset=rome.
  2. Open a browser and the developer console
  3. Type ncMakeSharedTokens('history1a', 'tacitus', 30), where history1a is the name of the class and tacitus is the name of the group.
  4. The system should make 30 tokens that can be used for any graph.
  5. Make note of the token, e.g. HISTORY1A-TACITUS-NWE
  6. Stop the current server
  7. Start another graph, e.g. ./nc.js --dataset=demo
  8. Log in with one of the tokens. It should work.

Test nc-multiplex

Make sure nc-multiplex can still be used to create tokens.

  1. cd to nc-multiplex
  2. cd to nc-multiplex/netcreate-itest
  3. git fetch
  4. git checkout dev-bl/shared-tokens`
  5. nvm use npm ci
  6. npm run package
  7. cd ..
  8. node nc-multiplex.js
  9. Go to http://localhost/manage
  10. Generate some tokens and make sure they work -- you should be able to ignore the "graph" name popup menu. Only the class id and project id fields will be used to generate the tokens. The token should match the tokens in the Net.Create test above.
  11. Open a graph and use the token to sign in.

Once the user authentication system is added (post-September) this should no longer be necessary.

@benloh
Copy link
Collaborator Author

benloh commented Apr 14, 2025

NOTE: This implementation essentially removes dataset from the salt for the hash. This is a problem because this essentially means that ncMakeTokens and ncMakeSharedTokens are equivalent even though that is probably not the intended behavior.

See #389 to restore ncMakeTokens

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