ember_simple_auth-rails 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73f2d4ad8f745292a30ac576c6db894f387c276d
4
- data.tar.gz: 38b0fe4355b5d8ccd9b3801512800bdaf331131f
3
+ metadata.gz: e3490369b67f03b10b7ce3350102b9bb902d28af
4
+ data.tar.gz: f64475c9fa708f8fe9e5da17a22dea0bd78aa671
5
5
  SHA512:
6
- metadata.gz: c35fb4d3f62dbaa128ff332f38260def9215f99db29e1d636ee689c438c56c05abc5862501d229c41041ba0d6b1ab74c22bdf381b08de02f6f3a030750f570ba
7
- data.tar.gz: bf9eff7b02ccc43b52a701fbaed86fa2c9e63e07d3ecc1dc2b13098b85e096c4778442fa421ee9c5a7e9d02b0b8057d30641ecdde0374adc288c5753b95fb692
6
+ metadata.gz: c27d60cc65d468d48134ea73c0ed3c7b16b5802ed0e60519bc425b2501dc0aaa14418f455b07e63322ec79300926efeef1e421d4134441a677884618ed9ec04b
7
+ data.tar.gz: 80a037ea6926c3262181c98a779a40213db7c0d6ed12c2d91731696f14cfebe4c31859a0c430c32a8cd797c73bf3a5f963aa4e748eead72543ec564b22bad645
@@ -1,5 +1,5 @@
1
1
  module EmberSimpleAuth
2
2
  module Rails
3
- VERSION = "0.5.3"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
@@ -54,31 +54,84 @@ var define, requireModule;
54
54
  requireModule.registry = registry;
55
55
  })();
56
56
 
57
- define("ember-simple-auth-cookie-store/stores/cookie",
58
- ["ember-simple-auth/stores/base","ember-simple-auth/utils/flat_objects_are_equal","exports"],
59
- function(__dependency1__, __dependency2__, __exports__) {
57
+ define("simple-auth-cookie-store/ember",
58
+ ["./initializer"],
59
+ function(__dependency1__) {
60
+ "use strict";
61
+ var global = (typeof window !== 'undefined') ? window : {},
62
+ Ember = global.Ember;
63
+
64
+ var initializer = __dependency1__["default"];
65
+
66
+ Ember.onLoad('Ember.Application', function(Application) {
67
+ Application.initializer(initializer);
68
+ });
69
+ });
70
+ define("simple-auth-cookie-store/initializer",
71
+ ["simple-auth-cookie-store/stores/cookie","exports"],
72
+ function(__dependency1__, __exports__) {
73
+ "use strict";
74
+ var global = (typeof window !== 'undefined') ? window : {},
75
+ Ember = global.Ember;
76
+
77
+ var Store = __dependency1__["default"];
78
+
79
+ __exports__["default"] = {
80
+ name: 'simple-auth-cookie-store',
81
+ before: 'simple-auth',
82
+ initialize: function(container, application) {
83
+ container.register('simple-auth-session-store:cookie', Store);
84
+ }
85
+ };
86
+ });
87
+ define("simple-auth-cookie-store/stores/cookie",
88
+ ["simple-auth/stores/base","simple-auth/utils/flat-objects-are-equal","simple-auth/utils/get-global-config","exports"],
89
+ function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
60
90
  "use strict";
61
91
  var Base = __dependency1__["default"];
62
92
  var flatObjectsAreEqual = __dependency2__["default"];
93
+ var getGlobalConfig = __dependency3__["default"];
63
94
 
64
95
  var global = (typeof window !== 'undefined') ? window : {},
65
96
  Ember = global.Ember;
66
97
 
67
98
  /**
68
- Store that saves its data in session cookies.
99
+ Store that saves its data in cookies.
69
100
 
70
101
  __In order to keep multiple tabs/windows of an application in sync, this
71
102
  store has to periodically (every 500ms) check the cookies__ for changes as
72
103
  there are no events that notify of changes in cookies. The recommended
73
- alternative is `Ember.SimpleAuth.Stores.LocalStorage` that also persistently
74
- stores data but instead of cookies relies on the `localStorage` API and does
75
- not need to poll for external changes.
104
+ alternative is `Stores.LocalStorage` that also persistently stores data but
105
+ instead of cookies relies on the `localStorage` API and does not need to poll
106
+ for external changes.
107
+
108
+ By default the cookie store will use session cookies that expire and are
109
+ deleted when the browser is closed. The cookie expiration period can be
110
+ configured via setting
111
+ [`Stores.Cooke#cookieExpirationTime`](#SimpleAuth-Stores-Cookie-cookieExpirationTime)
112
+ though. This can also be used to implement "remember me" functionality that
113
+ will either store the session persistently or in a session cookie depending
114
+ whether the user opted in or not:
115
+
116
+ ```js
117
+ // app/controllers/login.js
118
+ import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';
119
+
120
+ export default Ember.Controller.extend(LoginControllerMixin, {
121
+ rememberMe: false,
122
+
123
+ rememberMeChanged: function() {
124
+ this.get('session.store').cookieExpirationTime = this.get('rememberMe') ? (14 * 24 * 60 * 60) : null;
125
+ }.observes('rememberMe')
126
+ });
127
+ ```
76
128
 
77
129
  _The factory for this store is registered as
78
- `'ember-simple-auth-session-store:cookie'` in Ember's container._
130
+ `'simple-auth-session-store:cookie'` in Ember's container._
79
131
 
80
132
  @class Cookie
81
- @namespace Stores
133
+ @namespace SimpleAuth.Stores
134
+ @module simple-auth-cookie-store/stores/cookie
82
135
  @extends Stores.Base
83
136
  */
84
137
  __exports__["default"] = Base.extend({
@@ -86,12 +139,41 @@ define("ember-simple-auth-cookie-store/stores/cookie",
86
139
  The prefix to use for the store's cookie names so they can be distinguished
87
140
  from other cookies.
88
141
 
142
+ This value can be configured via the global environment object:
143
+
144
+ ```js
145
+ window.ENV = window.ENV || {};
146
+ window.ENV['simple-auth-cookie-store'] = {
147
+ cookieNamePrefix: 'my_app_auth_'
148
+ }
149
+ ```
150
+
89
151
  @property cookieNamePrefix
90
152
  @type String
91
153
  @default 'ember_simple_auth:'
92
154
  */
93
155
  cookieNamePrefix: 'ember_simple_auth:',
94
156
 
157
+ /**
158
+ The expiration time in seconds to use for the cookies. A value of `null`
159
+ will make the cookies session cookies that expire when the browser is
160
+ closed.
161
+
162
+ This value can be configured via the global environment object:
163
+
164
+ ```js
165
+ window.ENV = window.ENV || {};
166
+ window.ENV['simple-auth-cookie-store'] = {
167
+ cookieExpirationTime: 24 * 60 * 60
168
+ }
169
+ ```
170
+
171
+ @property cookieExpirationTime
172
+ @type Integer
173
+ @default null
174
+ */
175
+ cookieExpirationTime: null,
176
+
95
177
  /**
96
178
  @property _secureCookies
97
179
  @private
@@ -109,6 +191,9 @@ define("ember-simple-auth-cookie-store/stores/cookie",
109
191
  @private
110
192
  */
111
193
  init: function() {
194
+ var globalConfig = getGlobalConfig('simple-auth-cookie-store');
195
+ this.cookieNamePrefix = globalConfig.cookieNamePrefix || this.cookieNamePrefix;
196
+ this.cookieExpirationTime = globalConfig.cookieExpirationTime || this.cookieExpirationTime;
112
197
  this.syncData();
113
198
  },
114
199
 
@@ -120,7 +205,7 @@ define("ember-simple-auth-cookie-store/stores/cookie",
120
205
  */
121
206
  persist: function(data) {
122
207
  for (var property in data) {
123
- this.write(property, data[property], null);
208
+ this.write(property, data[property], !!this.cookieExpirationTime ? new Date().getTime() + this.cookieExpirationTime * 1000 : null);
124
209
  }
125
210
  this._lastData = this.restore();
126
211
  },
@@ -128,7 +213,7 @@ define("ember-simple-auth-cookie-store/stores/cookie",
128
213
  /**
129
214
  Restores all data currently saved in the session cookies identified by the
130
215
  `cookieNamePrefix` (see
131
- [Ember.SimpleAuth.Stores.Cookie#cookieNamePrefix](Ember-SimpleAuth-Stores-Cookie-cookieNamePrefix))
216
+ [`Stores.Cookie#cookieNamePrefix`](#SimpleAuth-Stores-Cookie-cookieNamePrefix))
132
217
  as a plain object.
133
218
 
134
219
  @method restore
@@ -146,14 +231,14 @@ define("ember-simple-auth-cookie-store/stores/cookie",
146
231
  /**
147
232
  Clears the store by deleting all session cookies prefixed with the
148
233
  `cookieNamePrefix` (see
149
- [Ember.SimpleAuth.Stores.Cookie#cookieNamePrefix](Ember-SimpleAuth-Stores-Cookie-cookieNamePrefix)).
234
+ [`SimpleAuth.Stores.Cookie#cookieNamePrefix`](#SimpleAuth-Stores-Cookie-cookieNamePrefix)).
150
235
 
151
236
  @method clear
152
237
  */
153
238
  clear: function() {
154
239
  var _this = this;
155
240
  this.knownCookies().forEach(function(cookie) {
156
- _this.write(cookie, null, (new Date(0)).toGMTString());
241
+ _this.write(cookie, null, 0);
157
242
  });
158
243
  this._lastData = null;
159
244
  },
@@ -172,7 +257,7 @@ define("ember-simple-auth-cookie-store/stores/cookie",
172
257
  @private
173
258
  */
174
259
  write: function(name, value, expiration) {
175
- var expires = Ember.isEmpty(expiration) ? '' : '; expires=' + expiration;
260
+ var expires = Ember.isEmpty(expiration) ? '' : '; expires=' + new Date(expiration).toUTCString();
176
261
  var secure = !!this._secureCookies ? ';secure' : '';
177
262
  document.cookie = this.cookieNamePrefix + name + '=' + encodeURIComponent(value) + expires + secure;
178
263
  },
@@ -207,17 +292,20 @@ define("ember-simple-auth-cookie-store/stores/cookie",
207
292
  }
208
293
  });
209
294
  });
210
- define('ember-simple-auth/stores/base', ['exports'], function(__exports__) {
211
- __exports__['default'] = global.Ember.SimpleAuth.Stores.Base;
295
+ define('simple-auth/stores/base', ['exports'], function(__exports__) {
296
+ __exports__['default'] = global.SimpleAuth.Stores.Base;
212
297
  });
213
- define('ember-simple-auth/utils/flat_objects_are_equal', ['exports'], function(__exports__) {
214
- __exports__['default'] = global.Ember.SimpleAuth.Utils.flatObjectsAreEqual;
298
+ define('simple-auth/utils/flat-objects-are-equal', ['exports'], function(__exports__) {
299
+ __exports__['default'] = global.SimpleAuth.Utils.flatObjectsAreEqual;
300
+ });
301
+ define('simple-auth/utils/get-global-config', ['exports'], function(__exports__) {
302
+ __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
215
303
  });
216
304
 
217
- var Cookie = requireModule('ember-simple-auth-cookie-store/stores/cookie').default;
218
- global.Ember.SimpleAuth.Stores.Cookie = Cookie;
305
+ var initializer = requireModule('simple-auth-cookie-store/initializer').default;
306
+ var Cookie = requireModule('simple-auth-cookie-store/stores/cookie').default;
219
307
 
220
- global.Ember.SimpleAuth.initializeExtension(function(container, application, options) {
221
- container.register('ember-simple-auth-session-store:cookie', global.Ember.SimpleAuth.Stores.Cookie);
222
- });
308
+ global.SimpleAuth.Stores.Cookie = Cookie;
309
+
310
+ requireModule('simple-auth-cookie-store/ember');
223
311
  })((typeof global !== 'undefined') ? global : window);
@@ -54,12 +54,13 @@ var define, requireModule;
54
54
  requireModule.registry = registry;
55
55
  })();
56
56
 
57
- define("ember-simple-auth-devise/authenticators/devise",
58
- ["ember-simple-auth/authenticators/base","ember-simple-auth/utils/is_secure_url","exports"],
59
- function(__dependency1__, __dependency2__, __exports__) {
57
+ define("simple-auth-devise/authenticators/devise",
58
+ ["simple-auth/authenticators/base","simple-auth/utils/is-secure-url","simple-auth/utils/get-global-config","exports"],
59
+ function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
60
60
  "use strict";
61
61
  var Base = __dependency1__["default"];
62
62
  var isSecureUrl = __dependency2__["default"];
63
+ var getGlobalConfig = __dependency3__["default"];
63
64
 
64
65
  var global = (typeof window !== 'undefined') ? window : {},
65
66
  Ember = global.Ember;
@@ -74,10 +75,11 @@ define("ember-simple-auth-devise/authenticators/devise",
74
75
  [discussion here](https://gist.github.com/josevalim/fb706b1e933ef01e4fb6).
75
76
 
76
77
  _The factory for this authenticator is registered as
77
- `'ember-simple-auth-authenticator:devise'` in Ember's container._
78
+ `'simple-auth-authenticator:devise'` in Ember's container._
78
79
 
79
80
  @class Devise
80
- @namespace Authenticators
81
+ @namespace SimpleAuth.Authenticators
82
+ @module simple-auth-devise/authenticators/devise
81
83
  @extends Base
82
84
  */
83
85
  __exports__["default"] = Base.extend({
@@ -85,6 +87,15 @@ define("ember-simple-auth-devise/authenticators/devise",
85
87
  The endpoint on the server the authenticator acquires the auth token
86
88
  and email from.
87
89
 
90
+ This value can be configured via the global environment object:
91
+
92
+ ```js
93
+ window.ENV = window.ENV || {};
94
+ window.ENV['simple-auth-devise'] = {
95
+ serverTokenEndpoint: '/some/other/endpoint'
96
+ }
97
+ ```
98
+
88
99
  @property serverTokenEndpoint
89
100
  @type String
90
101
  @default '/users/sign_in'
@@ -94,12 +105,31 @@ define("ember-simple-auth-devise/authenticators/devise",
94
105
  /**
95
106
  The devise resource name
96
107
 
108
+ This value can be configured via the global environment object:
109
+
110
+ ```js
111
+ window.ENV = window.ENV || {};
112
+ window.ENV['simple-auth-devise'] = {
113
+ resourceName: 'account'
114
+ }
115
+ ```
116
+
97
117
  @property resourceName
98
118
  @type String
99
119
  @default 'user'
100
120
  */
101
121
  resourceName: 'user',
102
122
 
123
+ /**
124
+ @method init
125
+ @private
126
+ */
127
+ init: function() {
128
+ var globalConfig = getGlobalConfig('simple-auth-devise');
129
+ this.serverTokenEndpoint = globalConfig.serverTokenEndpoint || this.serverTokenEndpoint;
130
+ this.resourceName = globalConfig.resourceName || this.resourceName;
131
+ },
132
+
103
133
  /**
104
134
  Restores the session from a set of session properties; __will return a
105
135
  resolving promise when there's a non-empty `user_token` and a non-empty
@@ -121,11 +151,12 @@ define("ember-simple-auth-devise/authenticators/devise",
121
151
 
122
152
  /**
123
153
  Authenticates the session with the specified `credentials`; the credentials
124
- are `POST`ed to the `serverTokenEndpoint` and if they are valid the server
125
- returns an auth token and email in response . __If the credentials are
126
- valid and authentication succeeds, a promise that resolves with the
127
- server's response is returned__, otherwise a promise that rejects with the
128
- error is returned.
154
+ are `POST`ed to the
155
+ [`Authenticators.Devise#serverTokenEndpoint`](#SimpleAuth-Authenticators-Devise-serverTokenEndpoint)
156
+ and if they are valid the server returns an auth token and email in
157
+ response. __If the credentials are valid and authentication succeeds, a
158
+ promise that resolves with the server's response is returned__, otherwise a
159
+ promise that rejects with the server error is returned.
129
160
 
130
161
  @method authenticate
131
162
  @param {Object} options The credentials to authenticate the session with
@@ -181,8 +212,8 @@ define("ember-simple-auth-devise/authenticators/devise",
181
212
  }
182
213
  });
183
214
  });
184
- define("ember-simple-auth-devise/authorizers/devise",
185
- ["ember-simple-auth/authorizers/base","ember-simple-auth/utils/is_secure_url","exports"],
215
+ define("simple-auth-devise/authorizers/devise",
216
+ ["simple-auth/authorizers/base","simple-auth/utils/is-secure-url","exports"],
186
217
  function(__dependency1__, __dependency2__, __exports__) {
187
218
  "use strict";
188
219
  var Base = __dependency1__["default"];
@@ -201,10 +232,11 @@ define("ember-simple-auth-devise/authorizers/devise",
201
232
  see the README for more information.
202
233
 
203
234
  _The factory for this authorizer is registered as
204
- `'ember-simple-auth-authorizer:devise'` in Ember's container._
235
+ `'simple-auth-authorizer:devise'` in Ember's container._
205
236
 
206
237
  @class Devise
207
- @namespace Authorizers
238
+ @namespace SimpleAuth.Authorizers
239
+ @module simple-auth-devise/authorizers/devise
208
240
  @extends Base
209
241
  */
210
242
  __exports__["default"] = Base.extend({
@@ -234,24 +266,57 @@ define("ember-simple-auth-devise/authorizers/devise",
234
266
  }
235
267
  });
236
268
  });
237
- define('ember-simple-auth/authenticators/base', ['exports'], function(__exports__) {
238
- __exports__['default'] = global.Ember.SimpleAuth.Authenticators.Base;
269
+ define("simple-auth-devise/ember",
270
+ ["./initializer"],
271
+ function(__dependency1__) {
272
+ "use strict";
273
+ var global = (typeof window !== 'undefined') ? window : {},
274
+ Ember = global.Ember;
275
+
276
+ var initializer = __dependency1__["default"];
277
+
278
+ Ember.onLoad('Ember.Application', function(Application) {
279
+ Application.initializer(initializer);
280
+ });
281
+ });
282
+ define("simple-auth-devise/initializer",
283
+ ["simple-auth-devise/authenticators/devise","simple-auth-devise/authorizers/devise","exports"],
284
+ function(__dependency1__, __dependency2__, __exports__) {
285
+ "use strict";
286
+ var global = (typeof window !== 'undefined') ? window : {},
287
+ Ember = global.Ember;
288
+
289
+ var Authenticator = __dependency1__["default"];
290
+ var Authorizer = __dependency2__["default"];
291
+
292
+ __exports__["default"] = {
293
+ name: 'simple-auth-devise',
294
+ before: 'simple-auth',
295
+ initialize: function(container, application) {
296
+ container.register('simple-auth-authorizer:devise', Authorizer);
297
+ container.register('simple-auth-authenticator:devise', Authenticator);
298
+ }
299
+ };
300
+ });
301
+ define('simple-auth/authenticators/base', ['exports'], function(__exports__) {
302
+ __exports__['default'] = global.SimpleAuth.Authenticators.Base;
303
+ });
304
+ define('simple-auth/authorizers/base', ['exports'], function(__exports__) {
305
+ __exports__['default'] = global.SimpleAuth.Authorizers.Base;
239
306
  });
240
- define('ember-simple-auth/authorizers/base', ['exports'], function(__exports__) {
241
- __exports__['default'] = global.Ember.SimpleAuth.Authorizers.Base;
307
+ define('simple-auth/utils/is-secure-url', ['exports'], function(__exports__) {
308
+ __exports__['default'] = global.SimpleAuth.Utils.isSecureUrl;
242
309
  });
243
- define('ember-simple-auth/utils/is_secure_url', ['exports'], function(__exports__) {
244
- __exports__['default'] = global.Ember.SimpleAuth.Utils.isSecureUrl;
310
+ define('simple-auth/utils/get-global-config', ['exports'], function(__exports__) {
311
+ __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
245
312
  });
246
313
 
247
- var Authenticator = requireModule('ember-simple-auth-devise/authenticators/devise').default;
248
- var Authorizer = requireModule('ember-simple-auth-devise/authorizers/devise').default;
314
+ var initializer = requireModule('simple-auth-devise/initializer').default;
315
+ var Authenticator = requireModule('simple-auth-devise/authenticators/devise').default;
316
+ var Authorizer = requireModule('simple-auth-devise/authorizers/devise').default;
249
317
 
250
- global.Ember.SimpleAuth.Authenticators.Devise = Authenticator;
251
- global.Ember.SimpleAuth.Authorizers.Devise = Authorizer;
318
+ global.SimpleAuth.Authenticators.Devise = Authenticator;
319
+ global.SimpleAuth.Authorizers.Devise = Authorizer;
252
320
 
253
- global.Ember.SimpleAuth.initializeExtension(function(container, application, options) {
254
- container.register('ember-simple-auth-authorizer:devise', global.Ember.SimpleAuth.Authorizers.Devise);
255
- container.register('ember-simple-auth-authenticator:devise', global.Ember.SimpleAuth.Authenticators.Devise);
256
- });
321
+ requireModule('simple-auth-devise/ember');
257
322
  })((typeof global !== 'undefined') ? global : window);
@@ -54,12 +54,13 @@ var define, requireModule;
54
54
  requireModule.registry = registry;
55
55
  })();
56
56
 
57
- define("ember-simple-auth-oauth2/authenticators/oauth2",
58
- ["ember-simple-auth/authenticators/base","ember-simple-auth/utils/is_secure_url","exports"],
59
- function(__dependency1__, __dependency2__, __exports__) {
57
+ define("simple-auth-oauth2/authenticators/oauth2",
58
+ ["simple-auth/authenticators/base","simple-auth/utils/is-secure-url","simple-auth/utils/get-global-config","exports"],
59
+ function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
60
60
  "use strict";
61
61
  var Base = __dependency1__["default"];
62
62
  var isSecureUrl = __dependency2__["default"];
63
+ var getGlobalConfig = __dependency3__["default"];
63
64
 
64
65
  var global = (typeof window !== 'undefined') ? window : {},
65
66
  Ember = global.Ember;
@@ -73,11 +74,12 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
73
74
  [RFC 6740, section 6](http://tools.ietf.org/html/rfc6749#section-6)).
74
75
 
75
76
  _The factory for this authenticator is registered as
76
- `'ember-simple-auth-authenticator:oauth2-password-grant'` in Ember's
77
+ `'simple-auth-authenticator:oauth2-password-grant'` in Ember's
77
78
  container._
78
79
 
79
80
  @class OAuth2
80
- @namespace Authenticators
81
+ @namespace SimpleAuth.Authenticators
82
+ @module simple-auth-oauth2/authenticators/oauth2
81
83
  @extends Base
82
84
  */
83
85
  __exports__["default"] = Base.extend({
@@ -93,6 +95,15 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
93
95
  The endpoint on the server the authenticator acquires the access token
94
96
  from.
95
97
 
98
+ This value can be configured via the global environment object:
99
+
100
+ ```js
101
+ window.ENV = window.ENV || {};
102
+ window.ENV['simple-auth-oauth2'] = {
103
+ serverTokenEndpoint: '/some/custom/endpoint'
104
+ }
105
+ ```
106
+
96
107
  @property serverTokenEndpoint
97
108
  @type String
98
109
  @default '/token'
@@ -102,6 +113,15 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
102
113
  /**
103
114
  Sets whether the authenticator automatically refreshes access tokens.
104
115
 
116
+ This value can be configured via the global environment object:
117
+
118
+ ```js
119
+ window.ENV = window.ENV || {};
120
+ window.ENV['simple-auth-oauth2'] = {
121
+ refreshAccessTokens: false
122
+ }
123
+ ```
124
+
105
125
  @property refreshAccessTokens
106
126
  @type Boolean
107
127
  @default true
@@ -114,6 +134,16 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
114
134
  */
115
135
  _refreshTokenTimeout: null,
116
136
 
137
+ /**
138
+ @method init
139
+ @private
140
+ */
141
+ init: function() {
142
+ var globalConfig = getGlobalConfig('simple-auth-oauth2');
143
+ this.serverTokenEndpoint = globalConfig.serverTokenEndpoint || this.serverTokenEndpoint;
144
+ this.refreshAccessTokens = globalConfig.refreshAccessTokens || this.refreshAccessTokens;
145
+ },
146
+
117
147
  /**
118
148
  Restores the session from a set of session properties; __will return a
119
149
  resolving promise when there's a non-empty `access_token` in the `data`__
@@ -122,7 +152,7 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
122
152
  This method also schedules automatic token refreshing when there are values
123
153
  for `refresh_token` and `expires_in` in the `data` and automatic token
124
154
  refreshing is not disabled (see
125
- [Ember.SimpleAuth.Authenticators.OAuth2#refreshAccessTokens](#Ember-SimpleAuth-Authenticators-OAuth2-refreshAccessTokens)).
155
+ [`Authenticators.OAuth2#refreshAccessTokens`](#SimpleAuth-Authenticators-OAuth2-refreshAccessTokens)).
126
156
 
127
157
  @method restore
128
158
  @param {Object} data The data to restore the session from
@@ -153,8 +183,8 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
153
183
 
154
184
  /**
155
185
  Authenticates the session with the specified `credentials`; the credentials
156
- are `POST`ed to the `serverTokenEndpoint` (see
157
- [Ember.SimpleAuth.Authenticators.OAuth2#serverTokenEndpoint](#Ember-SimpleAuth-Authenticators-OAuth2-serverTokenEndpoint))
186
+ are send via a _"POST"_ request to the
187
+ [`Authenticators.OAuth2#serverTokenEndpoint`](#SimpleAuth-Authenticators-OAuth2-serverTokenEndpoint)
158
188
  and if they are valid the server returns an access token in response (see
159
189
  http://tools.ietf.org/html/rfc6749#section-4.3). __If the credentials are
160
190
  valid and authentication succeeds, a promise that resolves with the
@@ -164,7 +194,7 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
164
194
  This method also schedules automatic token refreshing when there are values
165
195
  for `refresh_token` and `expires_in` in the server response and automatic
166
196
  token refreshing is not disabled (see
167
- [Ember.SimpleAuth.Authenticators.OAuth2#refreshAccessTokens](#Ember-SimpleAuth-Authenticators-OAuth2-refreshAccessTokens)).
197
+ [`Authenticators.OAuth2#refreshAccessTokens`](#SimpleAuth-Authenticators-OAuth2-refreshAccessTokens)).
168
198
 
169
199
  @method authenticate
170
200
  @param {Object} credentials The credentials to authenticate the session with
@@ -203,7 +233,7 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
203
233
 
204
234
  /**
205
235
  Sends an `AJAX` request to the `serverTokenEndpoint`. This will always be a
206
- _"POST_" request with content type _"application/x-www-form-urlencoded"_ as
236
+ _"POST"_ request with content type _"application/x-www-form-urlencoded"_ as
207
237
  specified in [RFC 6749](http://tools.ietf.org/html/rfc6749).
208
238
 
209
239
  This method is not meant to be used directly but serves as an extension
@@ -286,8 +316,8 @@ define("ember-simple-auth-oauth2/authenticators/oauth2",
286
316
  }
287
317
  });
288
318
  });
289
- define("ember-simple-auth-oauth2/authorizers/oauth2",
290
- ["ember-simple-auth/authorizers/base","ember-simple-auth/utils/is_secure_url","exports"],
319
+ define("simple-auth-oauth2/authorizers/oauth2",
320
+ ["simple-auth/authorizers/base","simple-auth/utils/is-secure-url","exports"],
291
321
  function(__dependency1__, __dependency2__, __exports__) {
292
322
  "use strict";
293
323
  var Base = __dependency1__["default"];
@@ -303,10 +333,11 @@ define("ember-simple-auth-oauth2/authorizers/oauth2",
303
333
  `Authorization` header.
304
334
 
305
335
  _The factory for this authorizer is registered as
306
- `'ember-simple-auth-authorizer:oauth2-bearer'` in Ember's container._
336
+ `'simple-auth-authorizer:oauth2-bearer'` in Ember's container._
307
337
 
308
338
  @class OAuth2
309
- @namespace Authorizers
339
+ @namespace SimpleAuth.Authorizers
340
+ @module simple-auth-devise/authorizers/oauth2
310
341
  @extends Base
311
342
  */
312
343
  __exports__["default"] = Base.extend({
@@ -333,24 +364,57 @@ define("ember-simple-auth-oauth2/authorizers/oauth2",
333
364
  }
334
365
  });
335
366
  });
336
- define('ember-simple-auth/authenticators/base', ['exports'], function(__exports__) {
337
- __exports__['default'] = global.Ember.SimpleAuth.Authenticators.Base;
367
+ define("simple-auth-oauth2/ember",
368
+ ["./initializer"],
369
+ function(__dependency1__) {
370
+ "use strict";
371
+ var global = (typeof window !== 'undefined') ? window : {},
372
+ Ember = global.Ember;
373
+
374
+ var initializer = __dependency1__["default"];
375
+
376
+ Ember.onLoad('Ember.Application', function(Application) {
377
+ Application.initializer(initializer);
378
+ });
379
+ });
380
+ define("simple-auth-oauth2/initializer",
381
+ ["simple-auth-oauth2/authenticators/oauth2","simple-auth-oauth2/authorizers/oauth2","exports"],
382
+ function(__dependency1__, __dependency2__, __exports__) {
383
+ "use strict";
384
+ var global = (typeof window !== 'undefined') ? window : {},
385
+ Ember = global.Ember;
386
+
387
+ var Authenticator = __dependency1__["default"];
388
+ var Authorizer = __dependency2__["default"];
389
+
390
+ __exports__["default"] = {
391
+ name: 'simple-auth-oauth2',
392
+ before: 'simple-auth',
393
+ initialize: function(container, application) {
394
+ container.register('simple-auth-authorizer:oauth2-bearer', Authorizer);
395
+ container.register('simple-auth-authenticator:oauth2-password-grant', Authenticator);
396
+ }
397
+ };
398
+ });
399
+ define('simple-auth/authenticators/base', ['exports'], function(__exports__) {
400
+ __exports__['default'] = global.SimpleAuth.Authenticators.Base;
401
+ });
402
+ define('simple-auth/authorizers/base', ['exports'], function(__exports__) {
403
+ __exports__['default'] = global.SimpleAuth.Authorizers.Base;
338
404
  });
339
- define('ember-simple-auth/authorizers/base', ['exports'], function(__exports__) {
340
- __exports__['default'] = global.Ember.SimpleAuth.Authorizers.Base;
405
+ define('simple-auth/utils/is-secure-url', ['exports'], function(__exports__) {
406
+ __exports__['default'] = global.SimpleAuth.Utils.isSecureUrl;
341
407
  });
342
- define('ember-simple-auth/utils/is_secure_url', ['exports'], function(__exports__) {
343
- __exports__['default'] = global.Ember.SimpleAuth.Utils.isSecureUrl;
408
+ define('simple-auth/utils/get-global-config', ['exports'], function(__exports__) {
409
+ __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
344
410
  });
345
411
 
346
- var Authenticator = requireModule('ember-simple-auth-oauth2/authenticators/oauth2').default;
347
- var Authorizer = requireModule('ember-simple-auth-oauth2/authorizers/oauth2').default;
412
+ var initializer = requireModule('simple-auth-oauth2/initializer').default;
413
+ var Authenticator = requireModule('simple-auth-oauth2/authenticators/oauth2').default;
414
+ var Authorizer = requireModule('simple-auth-oauth2/authorizers/oauth2').default;
348
415
 
349
- global.Ember.SimpleAuth.Authenticators.OAuth2 = Authenticator;
350
- global.Ember.SimpleAuth.Authorizers.OAuth2 = Authorizer;
416
+ global.SimpleAuth.Authenticators.OAuth2 = Authenticator;
417
+ global.SimpleAuth.Authorizers.OAuth2 = Authorizer;
351
418
 
352
- global.Ember.SimpleAuth.initializeExtension(function(container, application, options) {
353
- container.register('ember-simple-auth-authorizer:oauth2-bearer', global.Ember.SimpleAuth.Authorizers.OAuth2);
354
- container.register('ember-simple-auth-authenticator:oauth2-password-grant', global.Ember.SimpleAuth.Authenticators.OAuth2);
355
- });
419
+ requireModule('simple-auth-oauth2/ember');
356
420
  })((typeof global !== 'undefined') ? global : window);