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

Feature/Maintain Session #29

Open
5 tasks
faraonc opened this issue May 26, 2019 · 0 comments
Open
5 tasks

Feature/Maintain Session #29

faraonc opened this issue May 26, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@faraonc
Copy link
Member

faraonc commented May 26, 2019

Description

As a user, I want to maintain my authenticated session using my browsers local storage and history.

This task includes the following:

  • login action
  • authentication guard
  • logout action
  • auto login

Reference: https://hwsc-org.github.io/wikis/app-gateway-svc/epics.html#getnewauthtoken

For this task, I would recommend the to do the following prior to starting this task.

  • history mode task
  • I recommend writing your own epic for this task.
  • Limit the pull request to 1 per definition of done, so it is easier to review and to find bugs right away.
  • I recommend doing the definition of done sequentially. We can comeback if we have to modify the previous implementation.
  • Draft components e.g. login, dashboard, or user pages.

Story Points

13

Definitions of Done

  • user login action that saves the current user's uuid, auth token, token expiration in browser's local storage.
  • Setup authentication guard in router
    The common pattern I have seen is something similar to the codes below:
const routes = [
  { path: '/', component: WelcomePage },
  { path: '/login', component: SigninPage },
  {
    path: '/dashboard',
    component: DashboardPage,
    beforeEnter (to, from, next) {
      if (store.state.token) {
        next()
      } else {
        next('/login')
      }
    }
  }
]
  • user logout action that clears the user's uuid, auth token, token expiration from the browser's local local storage, and routes to a login or signin page
  • auto-login action that attempts to login the user using the auth data stored in the browser's local storage during the created lifecycle hook of App.vue. If the authentication has expired, then route to the proper page. Hopefully, this covers keeping the session after restarting and refreshing the browser.
  • dispatch another action to automatically get a new auth token per epic requirement using possibly setInterval(func, interval). This action can be possibly be dispatched within login action.
@faraonc faraonc added the enhancement New feature or request label May 26, 2019
@faraonc faraonc changed the title Feature/Maintain authenticate session Feature/Maintain Session May 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants