ember_simple_auth-rails 0.6.6 → 0.6.7

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: 0a573203d0d366acbb574f5e2ffd9165ab3ee866
4
- data.tar.gz: cc55804dcf7971eee623a9fb6fff2cc8734d5d6c
3
+ metadata.gz: 98cff789967e0d6a024fe6392feba562b75a7835
4
+ data.tar.gz: 088ae5371911e80a050e3f44a325713f2eabe0a4
5
5
  SHA512:
6
- metadata.gz: 6ac14445cf2128de3b56e5731268d7ce02ede54c87b305681d32e1663c12c388f0008a5696b41021bf7353a599371b9d813d29e5d57c9427561cf2effbaf5278
7
- data.tar.gz: ec30ebc92a9604814ff74987a66304b48a984d5f9781d10efe7fec71e67f1441becf05ad6198dbef29b20b6267b54a70fc80eef1becb0a6bced79a320a2927ff
6
+ metadata.gz: 9f2925db8e28803450ca3404d1b400e1bf52024d215267d281cb20409317fc37f2eb03ffdbd681d83d54dadf84c32c1a0a2fb1190fd2e808c98fa0742ab50daf
7
+ data.tar.gz: 51f710029060693fbe3c78d632c72b6c1d8820623589113c777cd9553b66abf6056d497ba4fd1b5a41cb185ec2bc6f7f3da032d17641b22ee5dd623d2562b29c
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ember-simple-auth for the assets pipeline
4
4
 
5
- # IF YOU WANT A NEW VERSION RUN
5
+ # IF YOU WANT A NEW VERSION RUN
6
6
  ```bash
7
7
  $ rake update
8
8
  ```
@@ -31,28 +31,28 @@ require the assets as you always do.
31
31
  require the base library:
32
32
 
33
33
  ```
34
- # require "ember-simple-auth"
34
+ //= require "ember-simple-auth"
35
35
  ```
36
36
 
37
37
  plus any extension libraries you might need:
38
38
 
39
39
  ```
40
- # require "ember-simple-auth-cookie-store"
41
- # require "ember-simple-auth-devise"
42
- # require "ember-simple-auth-oauth2"
40
+ //= require "ember-simple-auth-cookie-store"
41
+ //= require "ember-simple-auth-devise"
42
+ //= require "ember-simple-auth-oauth2"
43
43
  ```
44
44
 
45
45
  #### < 0.3.0
46
46
 
47
47
  require the library:
48
48
 
49
- ```
50
- # require "ember-simple-auth"
49
+ ```
50
+ //= require "ember-simple-auth"
51
51
  ```
52
52
 
53
53
  ## Contributing
54
54
 
55
- 1. Fork it ( http://github.com/<my-github-username>/ember_simple_auth-rails/fork )
55
+ 1. Fork it ( http://github.com/doodzik/ember_simple_auth-rails/fork )
56
56
  2. Create your feature branch (`git checkout -b my-new-feature`)
57
57
  3. Commit your changes (`git commit -am 'Add some feature'`)
58
58
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,5 +1,5 @@
1
1
  module EmberSimpleAuth
2
2
  module Rails
3
- VERSION = "0.6.6"
3
+ VERSION = "0.6.7"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth Cookie Store', '0.6.6');
3
+ Ember.libraries.register('Ember Simple Auth Cookie Store', '0.6.7');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -56,6 +56,66 @@ var define, requireModule;
56
56
  requireModule.registry = registry;
57
57
  })();
58
58
 
59
+ define("simple-auth-cookie-store/configuration",
60
+ ["simple-auth/utils/load-config","exports"],
61
+ function(__dependency1__, __exports__) {
62
+ "use strict";
63
+ var loadConfig = __dependency1__["default"];
64
+
65
+ var defaults = {
66
+ cookieName: 'ember_simple_auth:session',
67
+ cookieExpirationTime: null
68
+ };
69
+
70
+ /**
71
+ Ember Simple Auth Cookie Store's configuration object.
72
+
73
+ To change any of these values, define a global environment object for Ember
74
+ Simple Auth and define the values there:
75
+
76
+ ```js
77
+ window.ENV = window.ENV || {};
78
+ window.ENV['simple-auth-cookie-store'] = {
79
+ cookieName: 'my_app_auth_session'
80
+ }
81
+ ```
82
+
83
+ @class CookieStore
84
+ @namespace SimpleAuth.Configuration
85
+ @module simple-auth/configuration
86
+ */
87
+ __exports__["default"] = {
88
+ /**
89
+ The name of the cookie the store stores its data in.
90
+
91
+ @property cookieName
92
+ @readOnly
93
+ @static
94
+ @type String
95
+ @default 'ember_simple_auth:'
96
+ */
97
+ cookieName: defaults.cookieName,
98
+
99
+ /**
100
+ The expiration time in seconds to use for the cookie. A value of `null`
101
+ will make the cookie a session cookie that expires when the browser is
102
+ closed.
103
+
104
+ @property cookieExpirationTime
105
+ @readOnly
106
+ @static
107
+ @type Integer
108
+ @default null
109
+ */
110
+ cookieExpirationTime: defaults.cookieExpirationTime,
111
+
112
+ /**
113
+ @method load
114
+ @private
115
+ */
116
+ load: loadConfig(defaults)
117
+ };
118
+ });
59
119
  define("simple-auth-cookie-store/ember",
60
120
  ["./initializer"],
61
121
  function(__dependency1__) {
@@ -67,26 +127,30 @@ define("simple-auth-cookie-store/ember",
67
127
  });
68
128
  });
69
129
  define("simple-auth-cookie-store/initializer",
70
- ["simple-auth-cookie-store/stores/cookie","exports"],
71
- function(__dependency1__, __exports__) {
130
+ ["./configuration","simple-auth/utils/get-global-config","simple-auth-cookie-store/stores/cookie","exports"],
131
+ function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
72
132
  "use strict";
73
- var Store = __dependency1__["default"];
133
+ var Configuration = __dependency1__["default"];
134
+ var getGlobalConfig = __dependency2__["default"];
135
+ var Store = __dependency3__["default"];
74
136
 
75
137
  __exports__["default"] = {
76
138
  name: 'simple-auth-cookie-store',
77
139
  before: 'simple-auth',
78
140
  initialize: function(container, application) {
141
+ var config = getGlobalConfig('simple-auth-cookie-store');
142
+ Configuration.load(container, config);
79
143
  container.register('simple-auth-session-store:cookie', Store);
80
144
  }
81
145
  };
82
146
  });
83
147
  define("simple-auth-cookie-store/stores/cookie",
84
- ["simple-auth/stores/base","simple-auth/utils/flat-objects-are-equal","simple-auth/utils/get-global-config","exports"],
148
+ ["simple-auth/stores/base","simple-auth/utils/flat-objects-are-equal","./../configuration","exports"],
85
149
  function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
86
150
  "use strict";
87
151
  var Base = __dependency1__["default"];
88
152
  var flatObjectsAreEqual = __dependency2__["default"];
89
- var getGlobalConfig = __dependency3__["default"];
153
+ var Configuration = __dependency3__["default"];
90
154
 
91
155
  /**
92
156
  Store that saves its data in a cookie.
@@ -131,18 +195,12 @@ define("simple-auth-cookie-store/stores/cookie",
131
195
  /**
132
196
  The name of the cookie the store stores its data in.
133
197
 
134
- This value can be configured via the global environment object:
135
-
136
- ```js
137
- window.ENV = window.ENV || {};
138
- window.ENV['simple-auth-cookie-store'] = {
139
- cookieName: 'my_app_auth_session'
140
- }
141
- ```
198
+ This value can be configured via
199
+ [`SimpleAuth.Configuration.CookieStore#cookieName`](#SimpleAuth-Configuration-CookieStore-cookieName).
142
200
 
143
201
  @property cookieName
202
+ @readOnly
144
203
  @type String
145
- @default 'ember_simple_auth:'
146
204
  */
147
205
  cookieName: 'ember_simple_auth:session',
148
206
 
@@ -151,18 +209,12 @@ define("simple-auth-cookie-store/stores/cookie",
151
209
  will make the cookie a session cookie that expires when the browser is
152
210
  closed.
153
211
 
154
- This value can be configured via the global environment object:
155
-
156
- ```js
157
- window.ENV = window.ENV || {};
158
- window.ENV['simple-auth-cookie-store'] = {
159
- cookieExpirationTime: 24 * 60 * 60
160
- }
161
- ```
212
+ This value can be configured via
213
+ [`SimpleAuth.Configuration.CookieStore#cookieExpirationTime`](#SimpleAuth-Configuration-CookieStore-cookieExpirationTime).
162
214
 
163
215
  @property cookieExpirationTime
216
+ @readOnly
164
217
  @type Integer
165
- @default null
166
218
  */
167
219
  cookieExpirationTime: null,
168
220
 
@@ -183,9 +235,8 @@ define("simple-auth-cookie-store/stores/cookie",
183
235
  @private
184
236
  */
185
237
  init: function() {
186
- var globalConfig = getGlobalConfig('simple-auth-cookie-store');
187
- this.cookieName = globalConfig.cookieName || this.cookieName;
188
- this.cookieExpirationTime = globalConfig.cookieExpirationTime || this.cookieExpirationTime;
238
+ this.cookieName = Configuration.cookieName;
239
+ this.cookieExpirationTime = Configuration.cookieExpirationTime;
189
240
  this.syncData();
190
241
  },
191
242
 
@@ -209,6 +260,7 @@ define("simple-auth-cookie-store/stores/cookie",
209
260
  @return {Object} All data currently persisted in the cookie
210
261
  */
211
262
  restore: function() {
263
+
212
264
  var data = this.read();
213
265
  if (Ember.isEmpty(data)) {
214
266
  return {};
@@ -275,11 +327,16 @@ define('simple-auth/utils/flat-objects-are-equal', ['exports'], function(__expo
275
327
  define('simple-auth/utils/get-global-config', ['exports'], function(__exports__) {
276
328
  __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
277
329
  });
330
+ define('simple-auth/utils/load-config', ['exports'], function(__exports__) {
331
+ __exports__['default'] = global.SimpleAuth.Utils.loadConfig;
332
+ });
278
333
 
279
- var initializer = requireModule('simple-auth-cookie-store/initializer')['default'];
280
- var Cookie = requireModule('simple-auth-cookie-store/stores/cookie')['default'];
334
+ var initializer = requireModule('simple-auth-cookie-store/initializer')['default'];
335
+ var Configuration = requireModule('simple-auth-cookie-store/configuration')['default'];
336
+ var Cookie = requireModule('simple-auth-cookie-store/stores/cookie')['default'];
281
337
 
282
- global.SimpleAuth.Stores.Cookie = Cookie;
338
+ global.SimpleAuth.Configuration.CookieStore = Configuration;
339
+ global.SimpleAuth.Stores.Cookie = Cookie;
283
340
 
284
341
  requireModule('simple-auth-cookie-store/ember');
285
342
  })((typeof global !== 'undefined') ? global : window);
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth Devise', '0.6.6');
3
+ Ember.libraries.register('Ember Simple Auth Devise', '0.6.7');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -57,12 +57,12 @@ var define, requireModule;
57
57
  })();
58
58
 
59
59
  define("simple-auth-devise/authenticators/devise",
60
- ["simple-auth/authenticators/base","simple-auth/utils/is-secure-url","simple-auth/utils/get-global-config","exports"],
60
+ ["simple-auth/authenticators/base","simple-auth/utils/is-secure-url","./../configuration","exports"],
61
61
  function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
62
62
  "use strict";
63
63
  var Base = __dependency1__["default"];
64
64
  var isSecureUrl = __dependency2__["default"];
65
- var getGlobalConfig = __dependency3__["default"];
65
+ var Configuration = __dependency3__["default"];
66
66
 
67
67
  /**
68
68
  Authenticator that works with the Ruby gem
@@ -86,14 +86,8 @@ define("simple-auth-devise/authenticators/devise",
86
86
  The endpoint on the server the authenticator acquires the auth token
87
87
  and email from.
88
88
 
89
- This value can be configured via the global environment object:
90
-
91
- ```js
92
- window.ENV = window.ENV || {};
93
- window.ENV['simple-auth-devise'] = {
94
- serverTokenEndpoint: '/some/other/endpoint'
95
- }
96
- ```
89
+ This value can be configured via
90
+ [`SimpleAuth.Configuration.Devise#serverTokenEndpoint`](#SimpleAuth-Configuration-Devise-serverTokenEndpoint).
97
91
 
98
92
  @property serverTokenEndpoint
99
93
  @type String
@@ -104,14 +98,8 @@ define("simple-auth-devise/authenticators/devise",
104
98
  /**
105
99
  The devise resource name
106
100
 
107
- This value can be configured via the global environment object:
108
-
109
- ```js
110
- window.ENV = window.ENV || {};
111
- window.ENV['simple-auth-devise'] = {
112
- resourceName: 'account'
113
- }
114
- ```
101
+ This value can be configured via
102
+ [`SimpleAuth.Configuration.Devise#resourceName`](#SimpleAuth-Configuration-Devise-resourceName).
115
103
 
116
104
  @property resourceName
117
105
  @type String
@@ -124,9 +112,8 @@ define("simple-auth-devise/authenticators/devise",
124
112
  @private
125
113
  */
126
114
  init: function() {
127
- var globalConfig = getGlobalConfig('simple-auth-devise');
128
- this.serverTokenEndpoint = globalConfig.serverTokenEndpoint || this.serverTokenEndpoint;
129
- this.resourceName = globalConfig.resourceName || this.resourceName;
115
+ this.serverTokenEndpoint = Configuration.serverTokenEndpoint;
116
+ this.resourceName = Configuration.resourceName;
130
117
  },
131
118
 
132
119
  /**
@@ -262,6 +249,65 @@ define("simple-auth-devise/authorizers/devise",
262
249
  }
263
250
  });
264
251
  });
252
+ define("simple-auth-devise/configuration",
253
+ ["simple-auth/utils/load-config","exports"],
254
+ function(__dependency1__, __exports__) {
255
+ "use strict";
256
+ var loadConfig = __dependency1__["default"];
257
+
258
+ var defaults = {
259
+ serverTokenEndpoint: '/users/sign_in',
260
+ resourceName: 'user'
261
+ };
262
+
263
+ /**
264
+ Ember Simple Auth Device's configuration object.
265
+
266
+ To change any of these values, define a global environment object for Ember
267
+ Simple Auth and define the values there:
268
+
269
+ ```js
270
+ window.ENV = window.ENV || {};
271
+ window.ENV['simple-auth-devise'] = {
272
+ serverTokenEndpoint: '/some/other/endpoint'
273
+ }
274
+ ```
275
+
276
+ @class Devise
277
+ @namespace SimpleAuth.Configuration
278
+ @module simple-auth/configuration
279
+ */
280
+ __exports__["default"] = {
281
+ /**
282
+ The endpoint on the server the authenticator acquires the auth token
283
+ and email from.
284
+
285
+ @property serverTokenEndpoint
286
+ @readOnly
287
+ @static
288
+ @type String
289
+ @default '/users/sign_in'
290
+ */
291
+ serverTokenEndpoint: defaults.serverTokenEndpoint,
292
+
293
+ /**
294
+ The devise resource name.
295
+
296
+ @property resourceName
297
+ @readOnly
298
+ @static
299
+ @type String
300
+ @default 'user'
301
+ */
302
+ resourceName: defaults.resourceName,
303
+
304
+ /**
305
+ @method load
306
+ @private
307
+ */
308
+ load: loadConfig(defaults)
309
+ };
310
+ });
265
311
  define("simple-auth-devise/ember",
266
312
  ["./initializer"],
267
313
  function(__dependency1__) {
@@ -273,16 +319,20 @@ define("simple-auth-devise/ember",
273
319
  });
274
320
  });
275
321
  define("simple-auth-devise/initializer",
276
- ["simple-auth-devise/authenticators/devise","simple-auth-devise/authorizers/devise","exports"],
277
- function(__dependency1__, __dependency2__, __exports__) {
322
+ ["./configuration","simple-auth/utils/get-global-config","simple-auth-devise/authenticators/devise","simple-auth-devise/authorizers/devise","exports"],
323
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
278
324
  "use strict";
279
- var Authenticator = __dependency1__["default"];
280
- var Authorizer = __dependency2__["default"];
325
+ var Configuration = __dependency1__["default"];
326
+ var getGlobalConfig = __dependency2__["default"];
327
+ var Authenticator = __dependency3__["default"];
328
+ var Authorizer = __dependency4__["default"];
281
329
 
282
330
  __exports__["default"] = {
283
331
  name: 'simple-auth-devise',
284
332
  before: 'simple-auth',
285
333
  initialize: function(container, application) {
334
+ var config = getGlobalConfig('simple-auth-devise');
335
+ Configuration.load(container, config);
286
336
  container.register('simple-auth-authorizer:devise', Authorizer);
287
337
  container.register('simple-auth-authenticator:devise', Authenticator);
288
338
  }
@@ -300,11 +350,16 @@ define('simple-auth/utils/is-secure-url', ['exports'], function(__exports__) {
300
350
  define('simple-auth/utils/get-global-config', ['exports'], function(__exports__) {
301
351
  __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
302
352
  });
353
+ define('simple-auth/utils/load-config', ['exports'], function(__exports__) {
354
+ __exports__['default'] = global.SimpleAuth.Utils.loadConfig;
355
+ });
303
356
 
304
357
  var initializer = requireModule('simple-auth-devise/initializer')['default'];
358
+ var Configuration = requireModule('simple-auth-devise/configuration')['default'];
305
359
  var Authenticator = requireModule('simple-auth-devise/authenticators/devise')['default'];
306
360
  var Authorizer = requireModule('simple-auth-devise/authorizers/devise')['default'];
307
361
 
362
+ global.SimpleAuth.Configuration.Devise = Configuration;
308
363
  global.SimpleAuth.Authenticators.Devise = Authenticator;
309
364
  global.SimpleAuth.Authorizers.Devise = Authorizer;
310
365
 
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth OAuth 2.0', '0.6.6');
3
+ Ember.libraries.register('Ember Simple Auth OAuth 2.0', '0.6.7');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -57,12 +57,12 @@ var define, requireModule;
57
57
  })();
58
58
 
59
59
  define("simple-auth-oauth2/authenticators/oauth2",
60
- ["simple-auth/authenticators/base","simple-auth/utils/is-secure-url","simple-auth/utils/get-global-config","exports"],
60
+ ["simple-auth/authenticators/base","simple-auth/utils/is-secure-url","./../configuration","exports"],
61
61
  function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
62
62
  "use strict";
63
63
  var Base = __dependency1__["default"];
64
64
  var isSecureUrl = __dependency2__["default"];
65
- var getGlobalConfig = __dependency3__["default"];
65
+ var Configuration = __dependency3__["default"];
66
66
 
67
67
  /**
68
68
  Authenticator that conforms to OAuth 2
@@ -94,14 +94,8 @@ define("simple-auth-oauth2/authenticators/oauth2",
94
94
  The endpoint on the server the authenticator acquires the access token
95
95
  from.
96
96
 
97
- This value can be configured via the global environment object:
98
-
99
- ```js
100
- window.ENV = window.ENV || {};
101
- window.ENV['simple-auth-oauth2'] = {
102
- serverTokenEndpoint: '/some/custom/endpoint'
103
- }
104
- ```
97
+ This value can be configured via
98
+ [`SimpleAuth.Configuration.OAuth2#serverTokenEndpoint`](#SimpleAuth-Configuration-OAuth2-serverTokenEndpoint).
105
99
 
106
100
  @property serverTokenEndpoint
107
101
  @type String
@@ -113,14 +107,8 @@ define("simple-auth-oauth2/authenticators/oauth2",
113
107
  The endpoint on the server the authenticator uses to revoke tokens. Only
114
108
  set this if the server actually supports token revokation.
115
109
 
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
- serverTokenRevocationEndpoint: '/some/custom/endpoint'
122
- }
123
- ```
110
+ This value can be configured via
111
+ [`SimpleAuth.Configuration.OAuth2#serverTokenRevocationEndpoint`](#SimpleAuth-Configuration-OAuth2-serverTokenRevocationEndpoint).
124
112
 
125
113
  @property serverTokenRevocationEndpoint
126
114
  @type String
@@ -131,14 +119,8 @@ define("simple-auth-oauth2/authenticators/oauth2",
131
119
  /**
132
120
  Sets whether the authenticator automatically refreshes access tokens.
133
121
 
134
- This value can be configured via the global environment object:
135
-
136
- ```js
137
- window.ENV = window.ENV || {};
138
- window.ENV['simple-auth-oauth2'] = {
139
- refreshAccessTokens: false
140
- }
141
- ```
122
+ This value can be configured via
123
+ [`SimpleAuth.Configuration.OAuth2#refreshAccessTokens`](#SimpleAuth-Configuration-OAuth2-refreshAccessTokens).
142
124
 
143
125
  @property refreshAccessTokens
144
126
  @type Boolean
@@ -157,10 +139,9 @@ define("simple-auth-oauth2/authenticators/oauth2",
157
139
  @private
158
140
  */
159
141
  init: function() {
160
- var globalConfig = getGlobalConfig('simple-auth-oauth2');
161
- this.serverTokenEndpoint = globalConfig.serverTokenEndpoint || this.serverTokenEndpoint;
162
- this.serverTokenRevocationEndpoint = globalConfig.serverTokenRevocationEndpoint || this.serverTokenRevocationEndpoint;
163
- this.refreshAccessTokens = globalConfig.refreshAccessTokens || this.refreshAccessTokens;
142
+ this.serverTokenEndpoint = Configuration.serverTokenEndpoint;
143
+ this.serverTokenRevocationEndpoint = Configuration.serverTokenRevocationEndpoint;
144
+ this.refreshAccessTokens = Configuration.refreshAccessTokens;
164
145
  },
165
146
 
166
147
  /**
@@ -378,7 +359,7 @@ define("simple-auth-oauth2/authorizers/oauth2",
378
359
 
379
360
  @class OAuth2
380
361
  @namespace SimpleAuth.Authorizers
381
- @module simple-auth-devise/authorizers/oauth2
362
+ @module simple-auth-oauth2/authorizers/oauth2
382
363
  @extends Base
383
364
  */
384
365
  __exports__["default"] = Base.extend({
@@ -405,6 +386,78 @@ define("simple-auth-oauth2/authorizers/oauth2",
405
386
  }
406
387
  });
407
388
  });
389
+ define("simple-auth-oauth2/configuration",
390
+ ["simple-auth/utils/load-config","exports"],
391
+ function(__dependency1__, __exports__) {
392
+ "use strict";
393
+ var loadConfig = __dependency1__["default"];
394
+
395
+ var defaults = {
396
+ serverTokenEndpoint: '/token',
397
+ serverTokenRevocationEndpoint: null,
398
+ refreshAccessTokens: true
399
+ };
400
+
401
+ /**
402
+ Ember Simple Auth OAuth2's configuration object.
403
+
404
+ To change any of these values, define a global environment object for Ember
405
+ Simple Auth and define the values there:
406
+
407
+ ```js
408
+ window.ENV = window.ENV || {};
409
+ window.ENV['simple-auth-oauth2'] = {
410
+ serverTokenEndpoint: '/some/custom/endpoint'
411
+ }
412
+ ```
413
+
414
+ @class OAuth2
415
+ @namespace SimpleAuth.Configuration
416
+ @module simple-auth/configuration
417
+ */
418
+ __exports__["default"] = {
419
+ /**
420
+ The endpoint on the server the authenticator acquires the access token
421
+ from.
422
+
423
+ @property serverTokenEndpoint
424
+ @readOnly
425
+ @static
426
+ @type String
427
+ @default '/token'
428
+ */
429
+ serverTokenEndpoint: defaults.serverTokenEndpoint,
430
+
431
+ /**
432
+ The endpoint on the server the authenticator uses to revoke tokens. Only
433
+ set this if the server actually supports token revokation.
434
+
435
+ @property serverTokenRevocationEndpoint
436
+ @readOnly
437
+ @static
438
+ @type String
439
+ @default null
440
+ */
441
+ serverTokenRevocationEndpoint: defaults.serverTokenRevocationEndpoint,
442
+
443
+ /**
444
+ Sets whether the authenticator automatically refreshes access tokens.
445
+
446
+ @property refreshAccessTokens
447
+ @readOnly
448
+ @static
449
+ @type Boolean
450
+ @default true
451
+ */
452
+ refreshAccessTokens: defaults.refreshAccessTokens,
453
+
454
+ /**
455
+ @method load
456
+ @private
457
+ */
458
+ load: loadConfig(defaults)
459
+ };
460
+ });
408
461
  define("simple-auth-oauth2/ember",
409
462
  ["./initializer"],
410
463
  function(__dependency1__) {
@@ -416,16 +469,20 @@ define("simple-auth-oauth2/ember",
416
469
  });
417
470
  });
418
471
  define("simple-auth-oauth2/initializer",
419
- ["simple-auth-oauth2/authenticators/oauth2","simple-auth-oauth2/authorizers/oauth2","exports"],
420
- function(__dependency1__, __dependency2__, __exports__) {
472
+ ["./configuration","simple-auth/utils/get-global-config","simple-auth-oauth2/authenticators/oauth2","simple-auth-oauth2/authorizers/oauth2","exports"],
473
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
421
474
  "use strict";
422
- var Authenticator = __dependency1__["default"];
423
- var Authorizer = __dependency2__["default"];
475
+ var Configuration = __dependency1__["default"];
476
+ var getGlobalConfig = __dependency2__["default"];
477
+ var Authenticator = __dependency3__["default"];
478
+ var Authorizer = __dependency4__["default"];
424
479
 
425
480
  __exports__["default"] = {
426
481
  name: 'simple-auth-oauth2',
427
482
  before: 'simple-auth',
428
483
  initialize: function(container, application) {
484
+ var config = getGlobalConfig('simple-auth-oauth2');
485
+ Configuration.load(container, config);
429
486
  container.register('simple-auth-authorizer:oauth2-bearer', Authorizer);
430
487
  container.register('simple-auth-authenticator:oauth2-password-grant', Authenticator);
431
488
  }
@@ -443,11 +500,16 @@ define('simple-auth/utils/is-secure-url', ['exports'], function(__exports__) {
443
500
  define('simple-auth/utils/get-global-config', ['exports'], function(__exports__) {
444
501
  __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
445
502
  });
503
+ define('simple-auth/utils/load-config', ['exports'], function(__exports__) {
504
+ __exports__['default'] = global.SimpleAuth.Utils.loadConfig;
505
+ });
446
506
 
447
507
  var initializer = requireModule('simple-auth-oauth2/initializer')['default'];
508
+ var Configuration = requireModule('simple-auth-oauth2/configuration')['default'];
448
509
  var Authenticator = requireModule('simple-auth-oauth2/authenticators/oauth2')['default'];
449
510
  var Authorizer = requireModule('simple-auth-oauth2/authorizers/oauth2')['default'];
450
511
 
512
+ global.SimpleAuth.Configuration.OAuth2 = Configuration;
451
513
  global.SimpleAuth.Authenticators.OAuth2 = Authenticator;
452
514
  global.SimpleAuth.Authorizers.OAuth2 = Authorizer;
453
515
 
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth Testing', '0.6.6');
3
+ Ember.libraries.register('Ember Simple Auth Testing', '0.6.7');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth Torii', '0.6.6');
3
+ Ember.libraries.register('Ember Simple Auth Torii', '0.6.7');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth', '0.6.6');
3
+ Ember.libraries.register('Ember Simple Auth', '0.6.7');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -82,7 +82,7 @@ define("simple-auth/authenticators/base",
82
82
  __Custom authenticators have to be registered with Ember's dependency
83
83
  injection container__ so that the session can retrieve an instance, e.g.:
84
84
 
85
- ```javascript
85
+ ```js
86
86
  import Base from 'simple-auth/authenticators/base';
87
87
 
88
88
  var CustomAuthenticator = Base.extend({
@@ -97,7 +97,7 @@ define("simple-auth/authenticators/base",
97
97
  });
98
98
  ```
99
99
 
100
- ```javascript
100
+ ```js
101
101
  // app/controllers/login.js
102
102
  import AuthenticationControllerMixin from 'simple-auth/mixins/authentication-controller-mixin';
103
103
 
@@ -258,10 +258,22 @@ define("simple-auth/authorizers/base",
258
258
  });
259
259
  });
260
260
  define("simple-auth/configuration",
261
- ["./utils/get-global-config","exports"],
261
+ ["simple-auth/utils/load-config","exports"],
262
262
  function(__dependency1__, __exports__) {
263
263
  "use strict";
264
- var getGlobalConfig = __dependency1__["default"];
264
+ var loadConfig = __dependency1__["default"];
265
+
266
+ var defaults = {
267
+ authenticationRoute: 'login',
268
+ routeAfterAuthentication: 'index',
269
+ routeIfAlreadyAuthenticated: 'index',
270
+ sessionPropertyName: 'session',
271
+ authorizer: null,
272
+ session: 'simple-auth-session:main',
273
+ store: 'simple-auth-session-store:local-storage',
274
+ crossOriginWhitelist: [],
275
+ applicationRootUrl: null
276
+ };
265
277
 
266
278
  /**
267
279
  Ember Simple Auth's configuration object.
@@ -269,7 +281,7 @@ define("simple-auth/configuration",
269
281
  To change any of these values, define a global environment object for Ember
270
282
  Simple Auth and define the values there:
271
283
 
272
- ```javascript
284
+ ```js
273
285
  window.ENV = window.ENV || {};
274
286
  window.ENV['simple-auth'] = {
275
287
  authenticationRoute: 'sign-in'
@@ -290,7 +302,7 @@ define("simple-auth/configuration",
290
302
  @type String
291
303
  @default 'login'
292
304
  */
293
- authenticationRoute: 'login',
305
+ authenticationRoute: defaults.authenticationRoute,
294
306
 
295
307
  /**
296
308
  The route to transition to after successful authentication.
@@ -301,7 +313,7 @@ define("simple-auth/configuration",
301
313
  @type String
302
314
  @default 'index'
303
315
  */
304
- routeAfterAuthentication: 'index',
316
+ routeAfterAuthentication: defaults.routeAfterAuthentication,
305
317
 
306
318
  /**
307
319
  The route to transition to if a route that implements
@@ -314,7 +326,7 @@ define("simple-auth/configuration",
314
326
  @type String
315
327
  @default 'index'
316
328
  */
317
- routeIfAlreadyAuthenticated: 'index',
329
+ routeIfAlreadyAuthenticated: defaults.routeIfAlreadyAuthenticated,
318
330
 
319
331
  /**
320
332
  The name of the property that the session is injected with into routes and
@@ -326,7 +338,7 @@ define("simple-auth/configuration",
326
338
  @type String
327
339
  @default 'session'
328
340
  */
329
- sessionPropertyName: 'session',
341
+ sessionPropertyName: defaults.sessionPropertyName,
330
342
 
331
343
  /**
332
344
  The authorizer factory to use as it is registered with Ember's container,
@@ -341,7 +353,7 @@ define("simple-auth/configuration",
341
353
  @type String
342
354
  @default null
343
355
  */
344
- authorizer: null,
356
+ authorizer: defaults.authorizer,
345
357
 
346
358
  /**
347
359
  The session factory to use as it is registered with Ember's container,
@@ -354,7 +366,7 @@ define("simple-auth/configuration",
354
366
  @type String
355
367
  @default 'simple-auth-session:main'
356
368
  */
357
- session: 'simple-auth-session:main',
369
+ session: defaults.session,
358
370
 
359
371
  /**
360
372
  The store factory to use as it is registered with Ember's container, see
@@ -366,7 +378,7 @@ define("simple-auth/configuration",
366
378
  @type String
367
379
  @default simple-auth-session-store:local-storage
368
380
  */
369
- store: 'simple-auth-session-store:local-storage',
381
+ store: defaults.store,
370
382
 
371
383
  /**
372
384
  Ember Simple Auth will never authorize requests going to a different origin
@@ -381,30 +393,21 @@ define("simple-auth/configuration",
381
393
  @type Array
382
394
  @default []
383
395
  */
384
- crossOriginWhitelist: [],
396
+ crossOriginWhitelist: defaults.crossOriginWhitelist,
385
397
 
386
398
  /**
387
399
  @property applicationRootUrl
388
400
  @private
389
401
  */
390
- applicationRootUrl: null,
402
+ applicationRootUrl: defaults.applicationRootUrl,
391
403
 
392
404
  /**
393
405
  @method load
394
406
  @private
395
407
  */
396
- load: function(container) {
397
- var globalConfig = getGlobalConfig('simple-auth');
398
- this.authenticationRoute = globalConfig.authenticationRoute || this.authenticationRoute;
399
- this.routeAfterAuthentication = globalConfig.routeAfterAuthentication || this.routeAfterAuthentication;
400
- this.routeIfAlreadyAuthenticated = globalConfig.routeIfAlreadyAuthenticated || this.routeIfAlreadyAuthenticated;
401
- this.sessionPropertyName = globalConfig.sessionPropertyName || this.sessionPropertyName;
402
- this.authorizer = globalConfig.authorizer || this.authorizer;
403
- this.session = globalConfig.session || this.session;
404
- this.store = globalConfig.store || this.store;
405
- this.crossOriginWhitelist = globalConfig.crossOriginWhitelist || this.crossOriginWhitelist;
406
- this.applicationRootUrl = container.lookup('router:main').get('rootURL') || '/';
407
- }
408
+ load: loadConfig(defaults, function(container, config) {
409
+ this.applicationRootUrl = container.lookup('router:main').get('rootURL') || '/';
410
+ })
408
411
  };
409
412
  });
410
413
  define("simple-auth/ember",
@@ -418,14 +421,18 @@ define("simple-auth/ember",
418
421
  });
419
422
  });
420
423
  define("simple-auth/initializer",
421
- ["./setup","exports"],
422
- function(__dependency1__, __exports__) {
424
+ ["./configuration","./utils/get-global-config","./setup","exports"],
425
+ function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
423
426
  "use strict";
424
- var setup = __dependency1__["default"];
427
+ var Configuration = __dependency1__["default"];
428
+ var getGlobalConfig = __dependency2__["default"];
429
+ var setup = __dependency3__["default"];
425
430
 
426
431
  __exports__["default"] = {
427
432
  name: 'simple-auth',
428
433
  initialize: function(container, application) {
434
+ var config = getGlobalConfig('simple-auth');
435
+ Configuration.load(container, config);
429
436
  setup(container, application);
430
437
  }
431
438
  };
@@ -471,7 +478,7 @@ define("simple-auth/mixins/application-route-mixin",
471
478
  be automatically translated into route actions but would have to be handled
472
479
  inidivially, e.g. in an initializer:
473
480
 
474
- ```javascript
481
+ ```js
475
482
  Ember.Application.initializer({
476
483
  name: 'authentication',
477
484
  after: 'simple-auth',
@@ -531,7 +538,7 @@ define("simple-auth/mixins/application-route-mixin",
531
538
  because it opens a new window to handle authentication there), this is
532
539
  the action to override, e.g.:__
533
540
 
534
- ```javascript
541
+ ```js
535
542
  App.ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, {
536
543
  actions: {
537
544
  authenticateSession: function() {
@@ -576,7 +583,7 @@ define("simple-auth/mixins/application-route-mixin",
576
583
 
577
584
  It can be overridden to display error messages etc.:
578
585
 
579
- ```javascript
586
+ ```js
580
587
  App.ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, {
581
588
  actions: {
582
589
  sessionAuthenticationFailed: function(error) {
@@ -658,7 +665,7 @@ define("simple-auth/mixins/authenticated-route-mixin",
658
665
  [`Configuration.authenticationRoute`](#SimpleAuth-Configuration-authenticationRoute)
659
666
  if it is not.
660
667
 
661
- ```javascript
668
+ ```js
662
669
  // app/routes/protected.js
663
670
  import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
664
671
 
@@ -821,7 +828,7 @@ define("simple-auth/mixins/unauthenticated-route-mixin",
821
828
  [`Configuration.routeIfAlreadyAuthenticated`](#SimpleAuth-Configuration-routeIfAlreadyAuthenticated),
822
829
  which defaults to `'index'`.
823
830
 
824
- ```javascript
831
+ ```js
825
832
  // app/routes/login.js
826
833
  import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin';
827
834
 
@@ -881,7 +888,7 @@ define("simple-auth/session",
881
888
  method with the authenticator factory to use as well as any options the
882
889
  authenticator needs to authenticate the session:
883
890
 
884
- ```javascript
891
+ ```js
885
892
  this.get('session').authenticate('authenticator:custom', { some: 'option' }).then(function() {
886
893
  // authentication was successful
887
894
  }, function() {
@@ -1242,7 +1249,6 @@ define("simple-auth/setup",
1242
1249
  @private
1243
1250
  **/
1244
1251
  __exports__["default"] = function(container, application) {
1245
- Configuration.load(container);
1246
1252
  application.deferReadiness();
1247
1253
  registerFactories(container);
1248
1254
 
@@ -1547,7 +1553,7 @@ define("simple-auth/utils/get-global-config",
1547
1553
  var global = (typeof window !== 'undefined') ? window : {};
1548
1554
 
1549
1555
  __exports__["default"] = function(scope) {
1550
- return(global.ENV || {})[scope] || {};
1556
+ return Ember.get(global, 'ENV.' + scope) || {};
1551
1557
  }
1552
1558
  });
1553
1559
  define("simple-auth/utils/is-secure-url",
@@ -1565,6 +1571,24 @@ define("simple-auth/utils/is-secure-url",
1565
1571
  return link.protocol == 'https:';
1566
1572
  }
1567
1573
  });
1574
+ define("simple-auth/utils/load-config",
1575
+ ["exports"],
1576
+ function(__exports__) {
1577
+ "use strict";
1578
+ __exports__["default"] = function(defaults, callback) {
1579
+ return function(container, config) {
1580
+ var wrappedConfig = Ember.Object.create(config);
1581
+ for (var property in this) {
1582
+ if (this.hasOwnProperty(property) && Ember.typeOf(this[property]) !== 'function') {
1583
+ this[property] = wrappedConfig.getWithDefault(property, defaults[property]);
1584
+ }
1585
+ }
1586
+ if (callback) {
1587
+ callback.apply(this, [container, config]);
1588
+ }
1589
+ };
1590
+ }
1591
+ });
1568
1592
  var initializer = requireModule('simple-auth/initializer')['default'];
1569
1593
  var Configuration = requireModule('simple-auth/configuration')['default'];
1570
1594
  var Session = requireModule('simple-auth/session')['default'];
@@ -1576,6 +1600,7 @@ var EphemeralStore = requireModule('simple-auth/stores/ephemeral'
1576
1600
  var flatObjectsAreEqual = requireModule('simple-auth/utils/flat-objects-are-equal')['default'];
1577
1601
  var isSecureUrl = requireModule('simple-auth/utils/is-secure-url')['default'];
1578
1602
  var getGlobalConfig = requireModule('simple-auth/utils/get-global-config')['default'];
1603
+ var loadConfig = requireModule('simple-auth/utils/load-config')['default'];
1579
1604
  var ApplicationRouteMixin = requireModule('simple-auth/mixins/application-route-mixin')['default'];
1580
1605
  var AuthenticatedRouteMixin = requireModule('simple-auth/mixins/authenticated-route-mixin')['default'];
1581
1606
  var AuthenticationControllerMixin = requireModule('simple-auth/mixins/authentication-controller-mixin')['default'];
@@ -1604,7 +1629,8 @@ global.SimpleAuth = {
1604
1629
  Utils: {
1605
1630
  flatObjectsAreEqual: flatObjectsAreEqual,
1606
1631
  isSecureUrl: isSecureUrl,
1607
- getGlobalConfig: getGlobalConfig
1632
+ getGlobalConfig: getGlobalConfig,
1633
+ loadConfig: loadConfig
1608
1634
  },
1609
1635
 
1610
1636
  ApplicationRouteMixin: ApplicationRouteMixin,
@@ -1616,5 +1642,5 @@ global.SimpleAuth = {
1616
1642
 
1617
1643
  requireModule('simple-auth/ember');
1618
1644
 
1619
- Ember.libraries.register('Ember Simple Auth', '0.6.6');
1645
+ Ember.libraries.register('Ember Simple Auth', '0.6.7');
1620
1646
  })((typeof global !== 'undefined') ? global : window);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember_simple_auth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - frederik dudzik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-27 00:00:00.000000000 Z
11
+ date: 2014-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler