2014-06-30 16:58:10 +04:00
|
|
|
var AuthenticationInitializer = {
|
|
|
|
|
|
|
|
name: 'authentication',
|
|
|
|
after: 'registerTrailingLocationHistory',
|
|
|
|
|
|
|
|
initialize: function (container, application) {
|
2014-07-01 19:58:26 +04:00
|
|
|
Ember.SimpleAuth.Session.reopen({
|
|
|
|
user: function () {
|
|
|
|
return container.lookup('store:main').find('user', 'me');
|
|
|
|
}.property()
|
|
|
|
});
|
2014-06-30 16:58:10 +04:00
|
|
|
Ember.SimpleAuth.Authenticators.OAuth2.reopen({
|
|
|
|
serverTokenEndpoint: '/ghost/api/v0.1/authentication/token',
|
|
|
|
refreshAccessTokens: true,
|
|
|
|
makeRequest: function (data) {
|
|
|
|
data.client_id = 'ghost-admin';
|
|
|
|
return this._super(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
Ember.SimpleAuth.setup(container, application, {
|
|
|
|
authenticationRoute: 'signin',
|
|
|
|
routeAfterAuthentication: 'content',
|
|
|
|
authorizerFactory: 'ember-simple-auth-authorizer:oauth2-bearer'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-07-01 19:58:26 +04:00
|
|
|
export default AuthenticationInitializer;
|