Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

auth #7

Open
grounded042 opened this issue Nov 21, 2015 · 1 comment
Open

auth #7

grounded042 opened this issue Nov 21, 2015 · 1 comment

Comments

@grounded042
Copy link
Owner

For the admin panel, we need authentication. This will be handled via JWT. To incorporate this, we will need several endpoints with corresponding logic and SQL tables.

  • endpoints
    • GET /auth/token - refresh a current token. Hit this endpoint with a valid token and you will receive a new, valid token.
    • POST /auth/token - login. User credentials are sent here and a valid JWT is returned to be used in all requests that need authentication.
    • DELETE /auth/token - logout. Hit this endpoint with a valid token, and your token will be marked as invalid.
  • SQL - we will need tables to hold user information
    • users
      • user_id
      • email
      • first_name
      • last_name
      • created_at
      • updated_at
    • user_logins
      • user_login_id
      • fk_user_id
      • salt
      • password
      • created_at
      • updated_at
  • routes - we will need to add an attribute to routing so that routes can opt into user auth. Note that if a route opts out of auth, the controller could reject a call because there is no user obj on it
  • controllers - the coordination controller will take of getting user objects from the db and passing those objects down to methods that need them to make business logic decisions
grounded042 pushed a commit that referenced this issue Nov 28, 2015
moving into production mode here where SQL changes need to be non-breaking moving forward. From now on you should NEVER need to drop the public schema to apply new DB changes.

The new tables are for #7
grounded042 pushed a commit that referenced this issue Nov 28, 2015
@grounded042
Copy link
Owner Author

to "opt into" auth, a handler will have to handle this. The middleware for auth will check for a token and if a token is present, validate it. If the token is valid, the user id will be added to the context as UserId. The handler/controller will then have to check for the existence of UserId and can act accordingly.

grounded042 pushed a commit that referenced this issue Nov 28, 2015
handlers will need to opt into this by checking for `UserId` from context.

For #7
grounded042 pushed a commit that referenced this issue Nov 28, 2015
@grounded042 grounded042 mentioned this issue Nov 28, 2015
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant