KristinJJ / MovieMeetUp

MovieMeetUp: A group movie recommender built during CodeDay Labs 2021
https://www.moviemeetup.com
GNU General Public License v3.0
4 stars 1 forks source link

Mg 121 authguard #128

Closed ZenSorcere closed 3 years ago

ZenSorcere commented 3 years ago

Resolves Issue #121 (Add AuthGuard to redirect non-logged in uses who attempt to access /home or /event to the /intro page).

As an admin, I only want logged in users to have access to the Home and Event pages, and to have non-logged in users redirected to the Intro page. If a user attempts to access the Home or Event page directly, I want to ensure they are logged in before accessing user-specific pages. This feature is addressed by introducing an auth.guard.ts and an auth.service.ts. Auth guard verifies if the page can be activated by checking that the user is logged in before displaying the page details. It makes use of the Auth Service which sets up determining if the user is logged in. Previously, the home page had code that would parse the returned query string from the Cognito Hosted UI for the id_token, decode it and derive the "HostID" name, then save that information to sessionStorage to be used for determining what should be displayed on the Home Page. That code has been moved into the AuthService's login function (since the home page cannot be accessed at all until that info is saved).

Tested on Win10 laptop, Chrome v92.

To Verify: