在使用 ember-cli-simple-auth 之前,我有这个初始化程序:
Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
container.register('authenticator:api', Oauth2Authenticator);
Ember.SimpleAuth.setup(container, application, {
authorizerFactory: 'ember-simple-auth-authorizer:oauth2-bearer',
routeAfterAuthentication: 'dashboard',
routeAfterInvalidation: 'login',
storeFactory: 'ember-simple-auth-session-store:local-storage'
});
}
});
现在如何做到这一点,在使用导入时,我已经成功地做到了这一点:
import Oauth2Authenticator from '../services/authenticator';
export default {
name: 'authentication',
initialize: function(container, app) {
container.register('authenticator:api', Oauth2Authenticator);
// THIS PART IS NOT CLEAR, HOW TO SETUP IN AMD?
Ember.SimpleAuth.setup(container, application, {
authorizerFactory: 'ember-simple-auth-authorizer:oauth2-bearer',
routeAfterAuthentication: 'dashboard',
routeAfterInvalidation: 'login',
storeFactory: 'ember-simple-auth-session-store:local-storage'
});
// END OF CONFUSING PART
}
};
谢谢!