我已經升級了一個用於simple-auth的自定義身份驗證器和授權程序的ember-cli應用程序,從0.0.40和ember-cli-simple-auth 0.6.3到版本0.0 .46和0.6.7。授權()方法不會觸發CustomAuthorizer
身份驗證可以正常工作,但authorize()方法不會觸發,所以安全令牌不會添加到頭並返回http 401錯誤。
我在其他地方看,這可能是一個缺乏crossOriginWhitelist問題的,但我有這個在我的index.html:
<script>
window.EmberENV = {{EMBER_ENV}};
<!-- Ember Simple Auth relies on window.ENV to read its configuration -->
window.ENV = window.EmberENV;
window.ENV['simple-auth'] = {
authorizer: 'authorizer:custom',
crossOriginWhitelist: window.EmberENV.APP.crossOriginWhitelist
};
</script>
這似乎沒什麼問題。
我可以在我的beforeModel()授權檢查添加這Ajax調用消除401錯誤:
beforeSend: function (request)
{
request.setRequestHeader('Authorization', 'Bearer ' + self.get('session.token'));
},
但這是不正確的,當然,它只是一個創可貼。
任何人有任何想法?
感謝,
BillyB
灰燼簡單驗證不讀window.ENV的煨了,但使用灰燼CLI時使用你的應用程序的糖漬從配置/ environment.js。 – marcoow 2014-10-20 06:27:44