User's authentication is checked on page load

Description

When the OpenLMIS page is loaded, but before the angular application processes the current page's route information, the user's browser is checked for the existence of an authentication-token. If the user's has an authentication token, the OpenLMIS application will attempt to process the page state. Otherwise the user will be redirected to the login page.

The current login controller has code that should be an angular service mixed into it, and there isn't any support for OpenlmisServerURL in the codebase, which would allow for an easier dev experience...

To fix this, I'm going to:
AuthURLFactory
Which will create URLs specifically for the authURL, this service will have two variables that could be replaced at build time, OpenlmisServerURL and OpenlmisAuthServiceURL — allowing for customization of the URL endpoint...

AuthService
Seperate calls to the OpenLMIS service from the controller level code. Which is a recommended practice in Angular applications. This service will be responsible for determining if a user is logged in, and then logging in the user.

Auth Init Function
There will also be a runtime function for the OpenLMIS UI, which will run at page load and determine if a user is logged in — if the user isn't logged in, the requested page state will be cached, and the user will be directed towards a login screen.

Assignee

Nick Reid

Reporter

Nick Reid

Labels

None

Epic Link

Sprint

None

Fix versions

Priority

Major
Configure