lundi 2 mai 2016

Using ember-simple-auth when the login page is on another system

The page to login to our application is a jsp hosted on another machine. I have managed to get requests firing to this machine by modifying authenticated-route-mixin by allowing window.location.replace to be called if the route start with http.

  beforeModel(transition) {
    if (!this.get('session.isAuthenticated')) {
      Ember.assert('The route configured as Configuration.authenticationRoute cannot implement the AuthenticatedRouteMixin mixin as that leads to an infinite transitioning loop!', this.get('routeName') !== Configuration.authenticationRoute);

      transition.abort();
      this.set('session.attemptedTransition', transition);
      debugger;
      if (Configuration.authenticationRoute.startsWith('http')) {
        window.location.replace(Configuration.authenticationRoute);
      } else {
        this.transitionTo(Configuration.authenticationRoute);
      }
    } else {
      return this._super(...arguments);
    }
  }

This is working but when I am redirected back to my application, ember-simple-auth thinks I am no longer logged in and redirects be back to the remote machine, which then sends me back to the application in an infinite loop.

Obviously I need to set something to let ember-simple-auth know that it it is actually logged in. Why is it not doing this automatically? What am I doing wrong?

I am pretty new to oAuth so I could be missing some basic setting here.

Here is the URL.

  ENV['ember-simple-auth'] = {
    authenticationRoute: 'http://ift.tt/1TF7uDJ'
  };




Aucun commentaire:

Enregistrer un commentaire