Git Product home page Git Product logo

user-api's Introduction

user-api's People

Contributors

amargherio avatar cheddar avatar jh-bate avatar kentquirk avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

user-api's Issues

Separate sessions out of the user-api and into a session service

The user API has a weak notion of sessions.

Ben has adapted a session management system that can probably work for us. It uses a redis backing store for fast session lookup, and he's done some work on making the adaptations needed to run under our server structure. Ben, please add a reference to it as I can't seem to find it right now.

Write a mock mongodb so that unit tests don't need mongo

Our current set of tests require an instance of mongodb; either a local test or one on an accessible server. Proper tests shouldn't require a networked system. Build a mock mongodb that has the minimum set of appropriate functionality to run the tests (we don't need a full mongo simulation, just enough to run the tests).

This will also include modifying the setup code and its callers so that the calling process passes in the mongo (or mock) object to the db_mongo setup.

should be able to run on localhost on checkout

It would help collaboration if it was super easy to get this running, at least for demonstration purposes, on localhost after first checking out the repo. I need to run this on localhost to integrate my pull request on jellyfish, but I don't know how to provide API_SECRET and some other required variables.

Support regeneration of private hashes

The user API has an unchanging user ID, and allows the end user to edit the email addresses and username associated with the account. There should also be a function to regenerate the private hashes.

(This would allow us to recover from a leaked private hash, for example).

Hook user-api up to apiary so that apiary can be a proxy

The apiary service has the ability to transparently proxy an api so that apiary can act as a debugger. Now that user-api is deployed, we could permit this to work. It should be quite simple to make it try, but it may be a bit more work to clean up the documentation and make each of the examples actually run.

Create a password recovery mechanism

If a user forgets a password, we should be able to generate and email a temporary password. We need an API to say "generate a temp password on the account with this email address, and if it's subsequently used to log in, replace the password and set a 'requires new password' flag.

Create an API throttling model so that we can limit the damage created by runaway API users

Currently our API is not throttled. This will hurt us someday.

Immediate problem is that user-creation is not rate-limited. That should simply be throttled to limit the rate at which is can be called by anyone.

But the API should rate-limit calls to individual tokens to some reasonable number -- X calls a minute, for example. This rate limit should probably be visible in a header, so when you make a call, you can tell how many more calls you have before you get rejected.

Make user delete function move the data to a temporary holding area

"Delete everything" is a feature we should support -- but it's also a feature that users often regret using. We should provide a short period of permissible regret -- deleting a user account should move it to a holding area for a few days (7 days is probably about right, but it should be configurable). We can then run periodic purges to actually clean out these accounts.

This task requires not only implementing the move feature, but also providing a purge script.

/logout never needs to return a 401

This is a bit of a nit and a point of style, but right now /logout returns a 401 if the token didn't exist, etc.

Semantically speaking, if the token isn't provided, then the session no longer exists. If the token has expired, the session no longer exists. If /logout just means "session no longer useable", then I think that the endpoint can pretty much just return 201 for everything.

Add support for versioning this API

Currently we have no version support in the API, but restify supports a versioning model. We should define and support multiple versions of the API in a request.

Write more unit tests

The current set of tests is broad rather than deep. Each API call is tested in basic form and again with total garbage, but there are a lot of untested edge cases. Write more unit tests to more fully exercise the API.

Add Owned Accounts

There was a TODO in lib/userapi.js on the createUser() function.

It read

// TODO: add owned accounts

I have deleted it, I do not know what it means, so I am filing this issue so that someone does it at some point.

Support 2-factor authentication

It would be nice to support 2-factor authentication for the user API someday. This will require planning and signing up with an SMS service to send text messages, plus no small amount of code to manage the authentication state.

Write some integration tests

The current set of tests is slightly split between integration and unit tests. We could use integration tests that check that the API is functional from the point of view of an external client. Write some integration tests that can exercise the API from an external endpoint to make sure that it's functioning as intended in the deployed form. This is most likely making a copy of the test_user_api_unit tests and removing the stuff that is intended to run behind the firewall.

Need method of verifying token for backend services

I need an endpoint to verify that a token is valid and who it is. I can imagine this as something like

GET /token/:token

And a response like

404 Not Found

If the token is invalid, or

200
{ userId: abcd, otherPropertiesIfAny: '', ... }

This endpoint should probably be protected by requiring a server-side token

Create a way to generate and assign API keys

Right now any client can talk to us, and we have no way of distinguishing between clients, which means that a badly-behaved client can't be cut off. We need a system for generating and assigning API keys that are used to establish the initial session.

Initially, client developers can apply to us for keys. Eventually we will want a self-service model.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.