Skip to content
Robby Ronk edited this page Aug 15, 2013 · 6 revisions

Factory: enforceAuth

Used in the resolve property of routes that require authentication.

  1. If there is no saved authentication, open a dialog with links to login to our authentication providers.
  2. If there is a saved authentication, resolve the factory promise which allows the view and controller to load.

Authentication happens by a user clicking on a link taking the browser to an API URL which handles the authentication and the provider interactions.

Save the attempted route change as a session cookie (intendedRoute) by listening to the $locationChangeStart event.

Route: #/auth/:token

  • No view
  • No controller
  • Only a single resolve, redirectToIntendedRoute.

redirectToIntendedRoute

  1. Saves the token from the route parameters to crsToken cookie, using $cookies.
  2. Redirects the user to the route in the intendedRoute cookie, using $location.

Interceptor: authorizationInterceptor

Sets the Authorization header to the token in the crsToken cookie.

References