-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
AuthenticationAny task tagged with this will add or modify authentication practicesAny task tagged with this will add or modify authentication practicesUser AccountAny task tagged with this will add or modify user account functionalityAny task tagged with this will add or modify user account functionality
Milestone
Description
With users being saved to the database, ought be not allow them to log in?
- First, learning hashing ... we MAY throw it out afterward for Oauth but there is value in going through it
- Use SHA something or other: https://github.com/grondilu/libdigest-perl6/blob/master/lib/Digest/SHA.pm (md5 is too breakable to be useful)
- Take the submitted password and hash it and store in the database on account creation
- Second, provide a login form / welcome page
- Build out a session/cookie detection clause
- If cookie/session is found, say 'welcome $username'
- If not, provide a login form
- Ask for Username and Password
- Build out a session/cookie detection clause
- Third, provide an authentication endpoint
- Accept Username and Password
- Encrypt the password given
- So a lookup against the table for a user that has the username and encrypted password
- Create a session and/or cookie if there's a result
- Return a 'failure to log in' if not (and don't tell them that the username doesn't match; this protects the site from being scanned for usernames)
- Accept Username and Password
- BONUS; Add a field or new table that shows the last datetime any given username logged in
- Could be done a few ways; not required at this time, up to you
- BONUS/LATER; At the same time, investigate Oauth2 as an option
- NOTE: Implementing this may force us to go back and edit stuff you've just done, but we should learn about it anyways
- SEE: https://modules.perl6.org/dist/OAuth2::Client::Google:cpan:BDUGGAN
- SEE: https://github.com/ohmycloud/fanfou-p6
- SEE: https://oauth.net/ (I myself am trying to get my head around it and that's why this task is starting out vague)
- SEE: https://youtu.be/PfvSD6MmEmQ
- Research how to implement the concept of Oauth and whether either of these are sufficient to our task
- First, provide an 'authentication' endpoint
- Make sure it accepts a username and accepts a password
- TASK: provide a link/api-endpoint that logs a person out
- review https://softwareengineering.stackexchange.com/questions/196871/what-http-verb-should-the-route-to-log-out-of-your-web-app-be ... it SEEMS like folk want you to POST the token back to a /logout endpoint saying 'take this and kill it.'
- So... make a logout enpoint, accept post (and nothing else)
- Delete the cookie
- Return the homepage (either via call homepage code or via redirect to / )
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
AuthenticationAny task tagged with this will add or modify authentication practicesAny task tagged with this will add or modify authentication practicesUser AccountAny task tagged with this will add or modify user account functionalityAny task tagged with this will add or modify user account functionality