Skip to content

Feature: Graph-Specific Token Generator #98

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

Closed
benloh opened this issue Jul 25, 2020 · 15 comments
Closed

Feature: Graph-Specific Token Generator #98

benloh opened this issue Jul 25, 2020 · 15 comments
Labels
enhancement New feature or request
Milestone

Comments

@benloh
Copy link
Collaborator

benloh commented Jul 25, 2020

Request: Ideally, connect token creation to a specific database, so that students who have access to tacitus can’t edit indiana and vice versa Ideally they can’t even see it, but can’t edit is good enough for now

@benloh benloh added the enhancement New feature or request label Jul 25, 2020
@benloh
Copy link
Collaborator Author

benloh commented Jul 25, 2020

Features

  • Tokens are generated for a specific graph only. They cannot be used with other graphs.
  • Graphs are not viewable unless you are logged in.
  • Tokens are NOT represented in the URL so that graph URLs can be easily copied and shared.

Design Issues

  1. Individual Graph Management
    If tokens are generated separately for each graph, then each graph needs its own management page where tokens can be generated (and stored?)

  2. Main Page Design
    If you need to login before seeing a graph, we need to hide (or not render) the graph until the user is logged in.

  3. Public Access
    If you want to make a graph publicly visible, you need to be able to bypass the authentication.

  4. Integrate Single Sign-On? oauth? auth0?
    Probably not because we would need to store usernames and passwords?


Design Spec

ROUGH DRAFT

General

  • Update template file without restarting server
  • Document default template.

Public

  • Private graph viewable only on login
  • Private flag set via template

Admin

Login

  • Password defined via file
  • Single password for site
  • Password form for admin page

Permissions

  • Stop a database

  • Create new database -- Only admins can create a new database.

  • Handle new database request via direct URL -- Don't create a new database if the graph is not running.

  • Periodic ping to make sure server is still running -- Contact admin if disconnected.

  • home.html arbitrary page. Fallback to defaulthome.html?

@benloh
Copy link
Collaborator Author

benloh commented Jul 25, 2020

Addresses #72.

@benloh
Copy link
Collaborator Author

benloh commented Jul 26, 2020

@jdanish A few design questions about token management and graph management in general.

There are two competing design directions here: one is an open bottom-up design that encourages the easy creation and maintenance of graphs, and another is a more restricted top-down approach that limits access to graphs.

Given what you've described in your requirements, I think you'd like the more restricted version.

There are a few key questions:

  • Who can create graphs?
  • Who can start/stop graphs?
  • Who can add/edit templates?
  • Who can Generate Tokens?

The simple solution is to basically have three levels of users: an admin user, a general graph user, and a public user.

  1. The public user can view any graph designated as public.
  2. The general graph user can only access graphs for which they have a login token.
  3. The admin user is the only one who can create a new graph, start/stop graphs, add/edit templates, and generate tokens.

I imagine we're looking for some balance between being "secure-enough" and "easy to maintain". It'd be nice to keep things simple. I'd rather not have to implement a whole database for managing usernames and passwords as that seems like overkill.

Proposed Approach

So here's a proposed approach. Please let me know what you think.

  1. Public Access
    Since you want graphs to be hidden unless you are logged in, we can hide the graph until the user enters their token.
    If you want to be able to have public graphs, though, we probably need to be able to set a flag somewhere that allows users to view the graph without logging in. This is probably a future feature.

  2. General Graph User
    This would work essentially the same way it currently does. You enter a token to be able edit a graph. Tokens are specific to a graph, so you can't arbitrarily use your token to view/edit any graph.

  3. Admin User
    The admin user is the complex case. There are a few considerations:

URL

The main NetCreate Multiplex site will be accessible via a special URL, e.g. http://nc.com/manage or http://localhost/manage. We can use manage, or admin or whatever you prefer.

One question here is what should the root / page display? For now we'll just throw up the logo and contact info.

Password Entry

Assuming url obscurity is not enough, we can add a password. There are a few ways we could do it.

  • Password via Parameter -- One easy solution would be to use the MEME approach of adding a ?danishpowers parameter. This way you can cut and paste the URL and quickly log in. The problem is that it would expose the password if you are projecting on a screen. And practically speaking, it's really no different than using an obscure URL.

  • Password Field -- A password field is more difficult to implement and more annoying from a UI perspective. Every time you want to visit the Multiplex page, you'd have to enter the password. If we wanted to remember your logged in status, we'd have to implement a separate session manager. But this is a little more secure.

So right now I'm inclined to implement something like this:

  1. When you go to /admin you'll see nothing but a password field.
  2. You enter the password, e.g. kalanipowers
  3. The Multiplex page displays.
  4. You can add, stop, generate tokens, etc.
  5. If you navigate away and come back you have to enter a password again.

Your password is basically good as long as your window is open. This is simple and would not require a session manager and we won't have to worry about logging out, etc.

Password Setting

Finally there is the issue of how to set the password. You probably don't want a single password that is used across all of your installations.

One idea is to use a local file override. For example, when the app starts up, it looks for a file named SESAME in the root folder. If it's there, it uses the text in file as the password. If it doesn't file the file, it defaults to a common password, e.g. kalanipowers.

Alternatively, we could have you modify the code directly, but that seems a little less user-friendly. Adding/changing a SESAME file seems like something anyone with tech skills can do.

This is obviously only very low grade security though and anyone who's determined can get in. But perhaps this is good enough?

If we wanted to go all out, we could set up a database of usernames and passwords and grant different permissions to different users, but that would make the system much more difficult to use and maintain let alone cost a lot more to develop.

Thoughts?

@kalanicraig
Copy link
Collaborator

kalanicraig commented Jul 26, 2020 via email

@kalanicraig
Copy link
Collaborator

kalanicraig commented Jul 26, 2020 via email

@benloh
Copy link
Collaborator Author

benloh commented Jul 27, 2020

Thanks for the feedback! I hope to get this for you this week.

How about 'kpop` as a password then? :)

@kalanicraig
Copy link
Collaborator

kalanicraig commented Jul 27, 2020 via email

@jdanish
Copy link
Collaborator

jdanish commented Jul 27, 2020 via email

@benloh
Copy link
Collaborator Author

benloh commented Jul 27, 2020

We have about 20 hours left. If I do a bare bones version of this, I might still be able to do a simple filtering solution. But it's also possible filtering would need to be dropped. Is that OK?

I also want to make sure we reserve time to deal with bugs. I've run a 3-4 person test, but it'd be great if you could get your labs to bang on it together at the same time.

@jdanish
Copy link
Collaborator

jdanish commented Jul 27, 2020 via email

@benloh
Copy link
Collaborator Author

benloh commented Jul 27, 2020 via email

@jdanish
Copy link
Collaborator

jdanish commented Jul 27, 2020 via email

@benloh
Copy link
Collaborator Author

benloh commented Aug 6, 2020

Server Disconnect message set with e134f82

@benloh
Copy link
Collaborator Author

benloh commented Aug 7, 2020

Graphs can now be hidden until user is logged in. 79ea683

@benloh benloh added this to the Version 1.3.0 milestone Aug 17, 2020
@benloh
Copy link
Collaborator Author

benloh commented Aug 17, 2020

Implemented. Remaining feature of removing token from URL is #121.

@benloh benloh closed this as completed Aug 17, 2020
@benloh benloh mentioned this issue Aug 17, 2020
benloh added a commit that referenced this issue Jan 8, 2024
Site footer now sits on its own pane rather than floating and covering the bottom of editors and the legend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants