mardi 15 décembre 2015

Extending/modifying ember-simple-auth to check for auth cookies

I need to modify adaptive.js in ember-simple-auth for my app.

Ultimately I want the restore method to look for two particular cookie security tokens that is shared across our platforms and construct the simple auth localstorage object based on these cookies as a last resort if localStorage authentication data does not already exist in order to determine if the user is already authenticated.

I realise you can create a custom authenticator however the problem with extending Base is that when restore is called on your custom authorizer ember-simple-auth has already looked up localstorage for your auth data. If this isn't available restore never gets called. For this reason I believe I need to extend or modify the simple auth node module to my requirements.

Below is my simple attempt at trying to modify adaptive.js in ember-simple-auth within my app however when restore gets called it's never through the below:

import AdaptiveStore from 'ember-simple-auth/session-stores/adaptive';

AdaptiveStore.reopenClass({
    restore(){
        alert('do custom stuff here');
    }
});




Aucun commentaire:

Enregistrer un commentaire