ember_simple_auth-rails 0.2.1 → 0.3.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 +4 -4
- data/README.md +16 -1
- data/lib/ember_simple_auth/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ember-simple-auth-cookie-store.js +225 -0
- data/vendor/assets/javascripts/ember-simple-auth-devise.js +244 -0
- data/vendor/assets/javascripts/ember-simple-auth-oauth2.js +342 -0
- data/vendor/assets/javascripts/ember-simple-auth.js +308 -598
- metadata +5 -2
@@ -55,19 +55,21 @@ var define, requireModule;
|
|
55
55
|
})();
|
56
56
|
|
57
57
|
define("ember-simple-auth",
|
58
|
-
["./ember-simple-auth/core","./ember-simple-auth/session","./ember-simple-auth/authenticators","./ember-simple-auth/authorizers","./ember-simple-auth/stores","./ember-simple-auth/mixins/application_route_mixin","./ember-simple-auth/mixins/authenticated_route_mixin","./ember-simple-auth/mixins/authentication_controller_mixin","./ember-simple-auth/mixins/login_controller_mixin","exports"],
|
59
|
-
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __exports__) {
|
58
|
+
["./ember-simple-auth/core","./ember-simple-auth/session","./ember-simple-auth/authenticators","./ember-simple-auth/authorizers","./ember-simple-auth/stores","./ember-simple-auth/utils","./ember-simple-auth/mixins/application_route_mixin","./ember-simple-auth/mixins/authenticated_route_mixin","./ember-simple-auth/mixins/authentication_controller_mixin","./ember-simple-auth/mixins/login_controller_mixin","exports"],
|
59
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __exports__) {
|
60
60
|
"use strict";
|
61
61
|
var setup = __dependency1__.setup;
|
62
|
+
var initializeExtension = __dependency1__.initializeExtension;
|
62
63
|
var Configuration = __dependency1__.Configuration;
|
63
64
|
var Session = __dependency2__.Session;
|
64
65
|
var Authenticators = __dependency3__.Authenticators;
|
65
66
|
var Authorizers = __dependency4__.Authorizers;
|
66
67
|
var Stores = __dependency5__.Stores;
|
67
|
-
var
|
68
|
-
var
|
69
|
-
var
|
70
|
-
var
|
68
|
+
var Utils = __dependency6__.Utils;
|
69
|
+
var ApplicationRouteMixin = __dependency7__.ApplicationRouteMixin;
|
70
|
+
var AuthenticatedRouteMixin = __dependency8__.AuthenticatedRouteMixin;
|
71
|
+
var AuthenticationControllerMixin = __dependency9__.AuthenticationControllerMixin;
|
72
|
+
var LoginControllerMixin = __dependency10__.LoginControllerMixin;
|
71
73
|
|
72
74
|
/**
|
73
75
|
Ember.SimpleAuth's main module.
|
@@ -76,30 +78,27 @@ define("ember-simple-auth",
|
|
76
78
|
*/
|
77
79
|
|
78
80
|
__exports__.setup = setup;
|
81
|
+
__exports__.initializeExtension = initializeExtension;
|
79
82
|
__exports__.Configuration = Configuration;
|
80
83
|
__exports__.Session = Session;
|
81
84
|
__exports__.Authenticators = Authenticators;
|
82
85
|
__exports__.Authorizers = Authorizers;
|
83
86
|
__exports__.Stores = Stores;
|
87
|
+
__exports__.Utils = Utils;
|
84
88
|
__exports__.ApplicationRouteMixin = ApplicationRouteMixin;
|
85
89
|
__exports__.AuthenticatedRouteMixin = AuthenticatedRouteMixin;
|
86
90
|
__exports__.AuthenticationControllerMixin = AuthenticationControllerMixin;
|
87
91
|
__exports__.LoginControllerMixin = LoginControllerMixin;
|
88
92
|
});
|
89
93
|
define("ember-simple-auth/authenticators",
|
90
|
-
["./authenticators/base","
|
91
|
-
function(__dependency1__,
|
94
|
+
["./authenticators/base","exports"],
|
95
|
+
function(__dependency1__, __exports__) {
|
92
96
|
"use strict";
|
93
|
-
var global = (typeof window !== 'undefined') ? window : {},
|
94
|
-
Ember = global.Ember;
|
95
|
-
|
96
97
|
var Base = __dependency1__.Base;
|
97
|
-
var OAuth2 = __dependency2__.OAuth2;
|
98
98
|
|
99
|
-
var Authenticators =
|
100
|
-
Base:
|
101
|
-
|
102
|
-
});
|
99
|
+
var Authenticators = {
|
100
|
+
Base: Base
|
101
|
+
};
|
103
102
|
|
104
103
|
__exports__.Authenticators = Authenticators;
|
105
104
|
});
|
@@ -114,19 +113,26 @@ define("ember-simple-auth/authenticators/base",
|
|
114
113
|
The base for all authenticators. __This serves as a starting point for
|
115
114
|
implementing custom authenticators and must not be used directly.__
|
116
115
|
|
117
|
-
The authenticator
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
116
|
+
The authenticator authenticates the session. The actual mechanism used to do
|
117
|
+
this might e.g. be posting a set of credentials to a server and in exchange
|
118
|
+
retrieving an access token, initiating authentication against an external
|
119
|
+
provider like Facebook etc. and depends on the specific authenticator. Any
|
120
|
+
data that the authenticator receives upon successful authentication and
|
121
|
+
resolves with from the
|
123
122
|
[Ember.SimpleAuth.Authenticators.Base#authenticate](#Ember-SimpleAuth-Authenticators-Base-authenticate)
|
124
123
|
method is stored in the session and can then be used by the authorizer (see
|
125
124
|
[Ember.SimpleAuth.Authorizers.Base](#Ember-SimpleAuth-Authorizers-Base)).
|
126
125
|
|
127
|
-
|
128
|
-
|
129
|
-
|
126
|
+
The authenticator also decides whether a set of data that was restored from
|
127
|
+
the session store (see
|
128
|
+
[Ember.SimpleAuth.Stores.Base](#Ember-SimpleAuth-Stores-Base)) is sufficient
|
129
|
+
for the session to be authenticated or not.
|
130
|
+
|
131
|
+
Authenticators may trigger the `'updated'` and the `'invalidated'` events.
|
132
|
+
The `'updated'` event signals that the session data changed while the
|
133
|
+
`'ìnvalidated`' event signals that the authenticator decided that the
|
134
|
+
session became invalid. Both events are handled by the session automatically.
|
135
|
+
The `'updated'` event requires the complete session data as its argument.
|
130
136
|
|
131
137
|
__Custom authenticators have to be registered with Ember's dependency
|
132
138
|
injection container__ so that the session can retrieve an instance, e.g.:
|
@@ -138,10 +144,13 @@ define("ember-simple-auth/authenticators/base",
|
|
138
144
|
Ember.Application.initializer({
|
139
145
|
name: 'authentication',
|
140
146
|
initialize: function(container, application) {
|
141
|
-
container.register('
|
147
|
+
container.register('authenticator:custom', CustomAuthenticator);
|
142
148
|
Ember.SimpleAuth.setup(container, application);
|
143
149
|
}
|
144
150
|
});
|
151
|
+
App.AuthenticationController = Ember.Controller.extend(Ember.SimpleAuth.AuthenticationControllerMixin, {
|
152
|
+
authenticatorFactory: 'authenticator:custom'
|
153
|
+
});
|
145
154
|
```
|
146
155
|
|
147
156
|
@class Base
|
@@ -154,17 +163,18 @@ define("ember-simple-auth/authenticators/base",
|
|
154
163
|
Restores the session from a set of properties. __This method is invoked by
|
155
164
|
the session either after the application starts up and session data was
|
156
165
|
restored from the store__ or when properties in the store have changed due
|
157
|
-
to external events (e.g. in another tab)
|
166
|
+
to external events (e.g. in another tab) and the new set of properties
|
167
|
+
needs to be re-checked for whether it still constitutes an authenticated
|
168
|
+
session.
|
158
169
|
|
159
170
|
__This method returns a promise. A resolving promise will result in the
|
160
171
|
session being authenticated.__ Any properties the promise resolves with
|
161
|
-
will be saved
|
162
|
-
|
163
|
-
|
164
|
-
will remain unchanged.
|
172
|
+
will be saved in and accessible via the session. In most cases the `data`
|
173
|
+
argument will simply be forwarded through the promise. A rejecting promise
|
174
|
+
indicates that authentication failed and the session will remain unchanged.
|
165
175
|
|
166
|
-
`Ember.SimpleAuth.Authenticators.Base`'s always
|
167
|
-
|
176
|
+
`Ember.SimpleAuth.Authenticators.Base`'s implementation always returns a
|
177
|
+
rejecting promise.
|
168
178
|
|
169
179
|
@method restore
|
170
180
|
@param {Object} data The data to restore the session from
|
@@ -184,14 +194,11 @@ define("ember-simple-auth/authenticators/base",
|
|
184
194
|
|
185
195
|
__This method returns a promise. A resolving promise will result in the
|
186
196
|
session being authenticated.__ Any properties the promise resolves with
|
187
|
-
will be saved
|
197
|
+
will be saved in and accessible via the session. A rejecting promise
|
188
198
|
indicates that authentication failed and the session will remain unchanged.
|
189
199
|
|
190
200
|
`Ember.SimpleAuth.Authenticators.Base`'s implementation always returns a
|
191
|
-
rejecting promise and thus never authenticates the session
|
192
|
-
reasonable default behavior (for Ember.SimpleAuth's default authenticator
|
193
|
-
see
|
194
|
-
[Ember.SimpleAuth.Authenticators.OAuth2](#Ember-SimpleAuth-Authenticators-OAuth2)).
|
201
|
+
rejecting promise and thus never authenticates the session.
|
195
202
|
|
196
203
|
@method authenticate
|
197
204
|
@param {Object} options The options to authenticate the session with
|
@@ -202,11 +209,11 @@ define("ember-simple-auth/authenticators/base",
|
|
202
209
|
},
|
203
210
|
|
204
211
|
/**
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
212
|
+
This callback is invoked when the session is invalidated. While the session
|
213
|
+
will invalidate itself and clear all session properties, it might be
|
214
|
+
necessary for some authenticators to perform additional tasks (e.g.
|
215
|
+
invalidating an access token on the server), which should be done in this
|
216
|
+
method.
|
210
217
|
|
211
218
|
__This method returns a promise. A resolving promise will result in the
|
212
219
|
session being invalidated.__ A rejecting promise will result in the session
|
@@ -225,225 +232,15 @@ define("ember-simple-auth/authenticators/base",
|
|
225
232
|
|
226
233
|
__exports__.Base = Base;
|
227
234
|
});
|
228
|
-
define("ember-simple-auth/authenticators/oauth2",
|
229
|
-
["./base","../utils/is_secure_url","exports"],
|
230
|
-
function(__dependency1__, __dependency2__, __exports__) {
|
231
|
-
"use strict";
|
232
|
-
var global = (typeof window !== 'undefined') ? window : {},
|
233
|
-
Ember = global.Ember;
|
234
|
-
|
235
|
-
var Base = __dependency1__.Base;
|
236
|
-
var isSecureUrl = __dependency2__.isSecureUrl;
|
237
|
-
|
238
|
-
/**
|
239
|
-
Authenticator that conforms to OAuth 2
|
240
|
-
([RFC 6749](http://tools.ietf.org/html/rfc6749)), specifically the _"Resource
|
241
|
-
Owner Password Credentials Grant Type"_.
|
242
|
-
|
243
|
-
This authenticator supports refreshing the access token automatically and
|
244
|
-
will trigger the `'ember-simple-auth:session-updated'` event each time the
|
245
|
-
token was refreshed.
|
246
|
-
|
247
|
-
@class OAuth2
|
248
|
-
@namespace Authenticators
|
249
|
-
@extends Authenticators.Base
|
250
|
-
*/
|
251
|
-
var OAuth2 = Base.extend({
|
252
|
-
/**
|
253
|
-
The endpoint on the server the authenticator acquires the access token
|
254
|
-
from.
|
255
|
-
|
256
|
-
@property serverTokenEndpoint
|
257
|
-
@type String
|
258
|
-
@default '/token'
|
259
|
-
*/
|
260
|
-
serverTokenEndpoint: '/token',
|
261
|
-
/**
|
262
|
-
Sets whether the authenticator automatically refreshes access tokens.
|
263
|
-
|
264
|
-
@property refreshAccessTokens
|
265
|
-
@type Boolean
|
266
|
-
@default true
|
267
|
-
*/
|
268
|
-
refreshAccessTokens: true,
|
269
|
-
/**
|
270
|
-
@property _refreshTokenTimeout
|
271
|
-
@private
|
272
|
-
*/
|
273
|
-
_refreshTokenTimeout: null,
|
274
|
-
|
275
|
-
/**
|
276
|
-
Restores the session from a set of session properties; __will return a
|
277
|
-
resolving promise when there's a non-empty `access_token` in the `data`__
|
278
|
-
and a rejecting promise otherwise.
|
279
|
-
|
280
|
-
This method also schedules automatic token refreshing when there are values
|
281
|
-
for `refresh_token` and `expires_in` in the `data` and automatic token
|
282
|
-
refreshing is not disabled (see
|
283
|
-
[Ember.SimpleAuth.Authenticators.OAuth2#refreshAccessTokens](#Ember-SimpleAuth-Authenticators-OAuth2-refreshAccessTokens)).
|
284
|
-
|
285
|
-
@method restore
|
286
|
-
@param {Object} data The data to restore the session from
|
287
|
-
@return {Ember.RSVP.Promise} A promise that when it resolves results in the session being authenticated
|
288
|
-
*/
|
289
|
-
restore: function(data) {
|
290
|
-
var _this = this;
|
291
|
-
return new Ember.RSVP.Promise(function(resolve, reject) {
|
292
|
-
if (!Ember.isEmpty(data.access_token)) {
|
293
|
-
var now = (new Date()).getTime();
|
294
|
-
if (!Ember.isEmpty(data.expires_at) && data.expires_at < now) {
|
295
|
-
reject();
|
296
|
-
} else {
|
297
|
-
_this.scheduleAccessTokenRefresh(data.expires_in, data.expires_at, data.refresh_token);
|
298
|
-
resolve(data);
|
299
|
-
}
|
300
|
-
} else {
|
301
|
-
reject();
|
302
|
-
}
|
303
|
-
});
|
304
|
-
},
|
305
|
-
|
306
|
-
/**
|
307
|
-
Authenticates the session with the specified `credentials`; the credentials
|
308
|
-
are `POST`ed to the `serverTokenEndpoint` and if they are valid the server
|
309
|
-
returns an access token in response (see
|
310
|
-
http://tools.ietf.org/html/rfc6749#section-4.3). __If the credentials are
|
311
|
-
valid and authentication succeeds, a promise that resolves with the
|
312
|
-
server's response is returned__, otherwise a promise that rejects with the
|
313
|
-
error is returned.
|
314
|
-
|
315
|
-
This method also schedules automatic token refreshing when there are values
|
316
|
-
for `refresh_token` and `expires_in` in the server response and automatic
|
317
|
-
token refreshing is not disabled (see
|
318
|
-
[Ember.SimpleAuth.Authenticators.OAuth2#refreshAccessTokens](#Ember-SimpleAuth-Authenticators-OAuth2-refreshAccessTokens)).
|
319
|
-
|
320
|
-
@method authenticate
|
321
|
-
@param {Object} credentials The credentials to authenticate the session with
|
322
|
-
@return {Ember.RSVP.Promise} A promise that resolves when an access token is successfully acquired from the server and rejects otherwise
|
323
|
-
*/
|
324
|
-
authenticate: function(credentials) {
|
325
|
-
var _this = this;
|
326
|
-
return new Ember.RSVP.Promise(function(resolve, reject) {
|
327
|
-
var data = { grant_type: 'password', username: credentials.identification, password: credentials.password };
|
328
|
-
_this.makeRequest(data).then(function(response) {
|
329
|
-
Ember.run(function() {
|
330
|
-
var expiresAt = _this.absolutizeExpirationTime(response.expires_in);
|
331
|
-
_this.scheduleAccessTokenRefresh(response.expires_in, expiresAt, response.refresh_token);
|
332
|
-
resolve(Ember.$.extend(response, { expires_at: expiresAt }));
|
333
|
-
});
|
334
|
-
}, function(xhr, status, error) {
|
335
|
-
Ember.run(function() {
|
336
|
-
reject(xhr.responseJSON || xhr.responseText);
|
337
|
-
});
|
338
|
-
});
|
339
|
-
});
|
340
|
-
},
|
341
|
-
|
342
|
-
/**
|
343
|
-
Cancels any outstanding automatic token refreshes.
|
344
|
-
|
345
|
-
@method invalidate
|
346
|
-
@return {Ember.RSVP.Promise} A resolving promise
|
347
|
-
*/
|
348
|
-
invalidate: function() {
|
349
|
-
Ember.run.cancel(this._refreshTokenTimeout);
|
350
|
-
delete this._refreshTokenTimeout;
|
351
|
-
return new Ember.RSVP.resolve();
|
352
|
-
},
|
353
|
-
|
354
|
-
/**
|
355
|
-
Sends an `AJAX` request to the `serverTokenEndpoint`. This will always be a
|
356
|
-
_"POST_" request with content type _"application/x-www-form-urlencoded"_ as
|
357
|
-
specified in [RFC 6749](http://tools.ietf.org/html/rfc6749).
|
358
|
-
|
359
|
-
This method is not meant to be used directly but serves as an extension
|
360
|
-
point to e.g. add _"Client Credentials"_ (see
|
361
|
-
[RFC 6749, section 2.3](http://tools.ietf.org/html/rfc6749#section-2.3)).
|
362
|
-
|
363
|
-
@method makeRequest
|
364
|
-
@param {Object} data The data to send with the request, e.g. username and password or the refresh token
|
365
|
-
@return {Deferred object} A Deferred object (see [the jQuery docs](http://api.jquery.com/category/deferred-object/)) that is compatible to Ember.RSVP.Promise; will resolve if the request succeeds, reject otherwise
|
366
|
-
@protected
|
367
|
-
*/
|
368
|
-
makeRequest: function(data) {
|
369
|
-
if (!isSecureUrl(this.serverTokenEndpoint)) {
|
370
|
-
Ember.Logger.warn('Credentials are transmitted via an insecure connection - use HTTPS to keep them secure.');
|
371
|
-
}
|
372
|
-
return Ember.$.ajax({
|
373
|
-
url: this.serverTokenEndpoint,
|
374
|
-
type: 'POST',
|
375
|
-
data: data,
|
376
|
-
dataType: 'json',
|
377
|
-
contentType: 'application/x-www-form-urlencoded'
|
378
|
-
});
|
379
|
-
},
|
380
|
-
|
381
|
-
/**
|
382
|
-
@method scheduleAccessTokenRefresh
|
383
|
-
@private
|
384
|
-
*/
|
385
|
-
scheduleAccessTokenRefresh: function(expiresIn, expiresAt, refreshToken) {
|
386
|
-
var _this = this;
|
387
|
-
if (this.refreshAccessTokens) {
|
388
|
-
var now = (new Date()).getTime();
|
389
|
-
if (Ember.isEmpty(expiresAt) && !Ember.isEmpty(expiresIn)) {
|
390
|
-
expiresAt = new Date(now + (expiresIn - 5) * 1000).getTime();
|
391
|
-
}
|
392
|
-
if (!Ember.isEmpty(refreshToken) && !Ember.isEmpty(expiresAt) && expiresAt > now) {
|
393
|
-
Ember.run.cancel(this._refreshTokenTimeout);
|
394
|
-
delete this._refreshTokenTimeout;
|
395
|
-
this._refreshTokenTimeout = Ember.run.later(this, this.refreshAccessToken, expiresIn, refreshToken, expiresAt - now);
|
396
|
-
}
|
397
|
-
}
|
398
|
-
},
|
399
|
-
|
400
|
-
/**
|
401
|
-
@method refreshAccessToken
|
402
|
-
@private
|
403
|
-
*/
|
404
|
-
refreshAccessToken: function(expiresIn, refreshToken) {
|
405
|
-
var _this = this;
|
406
|
-
var data = { grant_type: 'refresh_token', refresh_token: refreshToken };
|
407
|
-
this.makeRequest(data).then(function(response) {
|
408
|
-
Ember.run(function() {
|
409
|
-
expiresIn = response.expires_in || expiresIn;
|
410
|
-
refreshToken = response.refresh_token || refreshToken;
|
411
|
-
var expiresAt = _this.absolutizeExpirationTime(expiresIn);
|
412
|
-
_this.scheduleAccessTokenRefresh(expiresIn, null, refreshToken);
|
413
|
-
_this.trigger('ember-simple-auth:session-updated', Ember.$.extend(response, { expires_in: expiresIn, expires_at: expiresAt, refresh_token: refreshToken }));
|
414
|
-
});
|
415
|
-
}, function(xhr, status, error) {
|
416
|
-
Ember.Logger.warn('Access token could not be refreshed - server responded with ' + error + '.');
|
417
|
-
});
|
418
|
-
},
|
419
|
-
|
420
|
-
/**
|
421
|
-
@method absolutizeExpirationTime
|
422
|
-
@private
|
423
|
-
*/
|
424
|
-
absolutizeExpirationTime: function(expiresIn) {
|
425
|
-
if (!Ember.isEmpty(expiresIn)) {
|
426
|
-
return new Date((new Date().getTime()) + (expiresIn - 5) * 1000).getTime();
|
427
|
-
}
|
428
|
-
}
|
429
|
-
});
|
430
|
-
|
431
|
-
__exports__.OAuth2 = OAuth2;
|
432
|
-
});
|
433
235
|
define("ember-simple-auth/authorizers",
|
434
|
-
["./authorizers/base","
|
435
|
-
function(__dependency1__,
|
236
|
+
["./authorizers/base","exports"],
|
237
|
+
function(__dependency1__, __exports__) {
|
436
238
|
"use strict";
|
437
|
-
var global = (typeof window !== 'undefined') ? window : {},
|
438
|
-
Ember = global.Ember;
|
439
|
-
|
440
239
|
var Base = __dependency1__.Base;
|
441
|
-
var OAuth2 = __dependency2__.OAuth2;
|
442
240
|
|
443
|
-
var Authorizers =
|
444
|
-
Base:
|
445
|
-
|
446
|
-
});
|
241
|
+
var Authorizers = {
|
242
|
+
Base: Base
|
243
|
+
};
|
447
244
|
|
448
245
|
__exports__.Authorizers = Authorizers;
|
449
246
|
});
|
@@ -465,8 +262,8 @@ define("ember-simple-auth/authorizers/base",
|
|
465
262
|
the query part of the URL, cookies etc. __The authorizer has to fit the
|
466
263
|
authenticator__ (see
|
467
264
|
[Ember.SimpleAuth.Authenticators.Base](#Ember-SimpleAuth-Authenticators-Base))
|
468
|
-
as it
|
469
|
-
|
265
|
+
as it relies on data that the authenticator retrieved during authentication
|
266
|
+
and that it makes available through the session.
|
470
267
|
|
471
268
|
@class Base
|
472
269
|
@namespace Authorizers
|
@@ -480,7 +277,7 @@ define("ember-simple-auth/authorizers/base",
|
|
480
277
|
@property session
|
481
278
|
@readOnly
|
482
279
|
@type Ember.SimpleAuth.Session
|
483
|
-
@default the session instance that is created during
|
280
|
+
@default the session instance that is created during Ember.SimpleAuth' setup (see [Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup))
|
484
281
|
*/
|
485
282
|
session: null,
|
486
283
|
|
@@ -489,10 +286,7 @@ define("ember-simple-auth/authorizers/base",
|
|
489
286
|
allows the server to identify the user making the request (e.g. a token in
|
490
287
|
the `Authorization` header or some other secret in the query string etc.).
|
491
288
|
|
492
|
-
`Ember.SimpleAuth.Authorizers.Base`'s implementation does nothing
|
493
|
-
there's no reasonable default behavior (for Ember.SimpleAuth's default
|
494
|
-
authorizer see
|
495
|
-
[Ember.SimpleAuth.Authorizers.OAuth2](#Ember-SimpleAuth-Authorizers-OAuth2)).
|
289
|
+
`Ember.SimpleAuth.Authorizers.Base`'s implementation does nothing.
|
496
290
|
|
497
291
|
@method authorize
|
498
292
|
@param {jqXHR} jqXHR The XHR request to authorize (see http://api.jquery.com/jQuery.ajax/#jqXHR)
|
@@ -504,59 +298,12 @@ define("ember-simple-auth/authorizers/base",
|
|
504
298
|
|
505
299
|
__exports__.Base = Base;
|
506
300
|
});
|
507
|
-
define("ember-simple-auth/authorizers/oauth2",
|
508
|
-
["./base","../utils/is_secure_url","exports"],
|
509
|
-
function(__dependency1__, __dependency2__, __exports__) {
|
510
|
-
"use strict";
|
511
|
-
var global = (typeof window !== 'undefined') ? window : {},
|
512
|
-
Ember = global.Ember;
|
513
|
-
|
514
|
-
var Base = __dependency1__.Base;
|
515
|
-
var isSecureUrl = __dependency2__.isSecureUrl;
|
516
|
-
|
517
|
-
/**
|
518
|
-
Authorizer that conforms to OAuth 2
|
519
|
-
([RFC 6749](http://tools.ietf.org/html/rfc6749)) by sending a bearer token
|
520
|
-
([RFC 6749](http://tools.ietf.org/html/rfc6750)) in the request's
|
521
|
-
`Authorization` header.
|
522
|
-
|
523
|
-
@class OAuth2
|
524
|
-
@namespace Authorizers
|
525
|
-
@extends Authorizers.Base
|
526
|
-
*/
|
527
|
-
var OAuth2 = Base.extend({
|
528
|
-
/**
|
529
|
-
Authorizes an XHR request by sending the `access_token` property from the
|
530
|
-
session as a bearer token in the `Authorization` header:
|
531
|
-
|
532
|
-
```
|
533
|
-
Authorization: Bearer <access_token>
|
534
|
-
```
|
535
|
-
|
536
|
-
@method authorize
|
537
|
-
@param {jqXHR} jqXHR The XHR request to authorize (see http://api.jquery.com/jQuery.ajax/#jqXHR)
|
538
|
-
@param {Object} requestOptions The options as provided to the `$.ajax` method (see http://api.jquery.com/jQuery.ajaxPrefilter/)
|
539
|
-
*/
|
540
|
-
authorize: function(jqXHR, requestOptions) {
|
541
|
-
if (this.get('session.isAuthenticated') && !Ember.isEmpty(this.get('session.access_token'))) {
|
542
|
-
if (!isSecureUrl(requestOptions.url)) {
|
543
|
-
Ember.Logger.warn('Credentials are transmitted via an insecure connection - use HTTPS to keep them secure.');
|
544
|
-
}
|
545
|
-
jqXHR.setRequestHeader('Authorization', 'Bearer ' + this.get('session.access_token'));
|
546
|
-
}
|
547
|
-
}
|
548
|
-
});
|
549
|
-
|
550
|
-
__exports__.OAuth2 = OAuth2;
|
551
|
-
});
|
552
301
|
define("ember-simple-auth/core",
|
553
|
-
["./session","./
|
554
|
-
function(__dependency1__, __dependency2__,
|
302
|
+
["./session","./stores","exports"],
|
303
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
555
304
|
"use strict";
|
556
305
|
var Session = __dependency1__.Session;
|
557
|
-
var
|
558
|
-
var Authorizers = __dependency3__.Authorizers;
|
559
|
-
var Stores = __dependency4__.Stores;
|
306
|
+
var registerStores = __dependency2__.registerStores;
|
560
307
|
|
561
308
|
function extractLocationOrigin(location) {
|
562
309
|
if (Ember.typeOf(location) === 'string') {
|
@@ -584,13 +331,31 @@ define("ember-simple-auth/core",
|
|
584
331
|
return crossOriginWhitelist.indexOf(urlOrigin) > -1 || urlOrigin === documentOrigin;
|
585
332
|
}
|
586
333
|
|
334
|
+
function setupSession(store, container) {
|
335
|
+
var session = Session.create({ store: store, container: container });
|
336
|
+
var router = container.lookup('router:main');
|
337
|
+
Ember.A([
|
338
|
+
'sessionAuthenticationSucceeded',
|
339
|
+
'sessionAuthenticationFailed',
|
340
|
+
'sessionInvalidationSucceeded',
|
341
|
+
'sessionInvalidationFailed'
|
342
|
+
]).forEach(function(event) {
|
343
|
+
session.on(event, function() {
|
344
|
+
router.send(event);
|
345
|
+
});
|
346
|
+
});
|
347
|
+
return session;
|
348
|
+
}
|
349
|
+
|
350
|
+
var extensionInitializers = [];
|
351
|
+
|
587
352
|
/**
|
588
353
|
Ember.SimpleAuth's configuration object.
|
589
354
|
|
590
355
|
@class Configuration
|
591
356
|
@namespace $mainModule
|
592
357
|
*/
|
593
|
-
var Configuration =
|
358
|
+
var Configuration = {
|
594
359
|
/**
|
595
360
|
The route to transition to for authentication; should be set through
|
596
361
|
[Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup).
|
@@ -622,7 +387,7 @@ define("ember-simple-auth/core",
|
|
622
387
|
@type String
|
623
388
|
*/
|
624
389
|
applicationRootUrl: null,
|
625
|
-
}
|
390
|
+
};
|
626
391
|
|
627
392
|
/**
|
628
393
|
Sets up Ember.SimpleAuth for the application; this method __should be invoked
|
@@ -642,14 +407,20 @@ define("ember-simple-auth/core",
|
|
642
407
|
@static
|
643
408
|
@param {Container} container The Ember.js application's dependency injection container
|
644
409
|
@param {Ember.Application} application The Ember.js application instance
|
645
|
-
@param {Object}
|
410
|
+
@param {Object} options
|
411
|
+
@param {String} [options.authorizerFactory] The authorizer factory to use as it is registered with Ember's container, see [Ember's API docs](http://emberjs.com/api/classes/Ember.Application.html#method_register); when the application does not interact with a server that requires authorized requests, no auzthorizer is needed
|
412
|
+
@param {Object} [options.storeFactory] The store factory to use as it is registered with Ember's container, see [Ember's API docs](http://emberjs.com/api/classes/Ember.Application.html#method_register) - defaults to `session-stores:local-storage`
|
646
413
|
@param {String} [options.authenticationRoute] route to transition to for authentication - defaults to `'login'`
|
647
414
|
@param {String} [options.routeAfterAuthentication] route to transition to after successful authentication - defaults to `'index'`
|
648
415
|
@param {Array[String]} [options.crossOriginWhitelist] Ember.SimpleAuth will never authorize requests going to a different origin than the one the Ember.js application was loaded from; to explicitely enable authorization for additional origins, whitelist those origins - defaults to `[]` _(beware that origins consist of protocol, host and port (port can be left out when it is 80 for HTTP or 443 for HTTPS))_
|
649
|
-
@param {Object} [options.authorizer] The authorizer _class_ to use; must extend `Ember.SimpleAuth.Authorizers.Base` - defaults to `Ember.SimpleAuth.Authorizers.OAuth2`
|
650
|
-
@param {Object} [options.store] The store _class_ to use; must extend `Ember.SimpleAuth.Stores.Base` - defaults to `Ember.SimpleAuth.Stores.LocalStorage`
|
651
416
|
**/
|
652
417
|
var setup = function(container, application, options) {
|
418
|
+
application.deferReadiness();
|
419
|
+
registerStores(container);
|
420
|
+
extensionInitializers.forEach(function(initializer) {
|
421
|
+
initializer(container, application, options);
|
422
|
+
});
|
423
|
+
|
653
424
|
options = options || {};
|
654
425
|
Configuration.routeAfterAuthentication = options.routeAfterAuthentication || Configuration.routeAfterAuthentication;
|
655
426
|
Configuration.authenticationRoute = options.authenticationRoute || Configuration.authenticationRoute;
|
@@ -658,25 +429,52 @@ define("ember-simple-auth/core",
|
|
658
429
|
return extractLocationOrigin(origin);
|
659
430
|
});
|
660
431
|
|
661
|
-
|
432
|
+
options.storeFactory = options.storeFactory || 'session-store:local-storage';
|
433
|
+
var store = container.lookup(options.storeFactory);
|
434
|
+
var session = setupSession(store, container);
|
662
435
|
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
container.register('ember-simple-auth:session:current', session, { instantiate: false });
|
668
|
-
Ember.A(['model', 'controller', 'view', 'route']).forEach(function(component) {
|
669
|
-
container.injection(component, 'session', 'ember-simple-auth:session:current');
|
436
|
+
container.register('session:main', session, { instantiate: false });
|
437
|
+
Ember.A(['controller', 'route']).forEach(function(component) {
|
438
|
+
container.injection(component, 'session', 'session:main');
|
670
439
|
});
|
671
440
|
|
672
|
-
Ember
|
673
|
-
|
674
|
-
|
441
|
+
if (!Ember.isEmpty(options.authorizerFactory)) {
|
442
|
+
var authorizer = container.lookup(options.authorizerFactory);
|
443
|
+
if (!!authorizer) {
|
444
|
+
authorizer.set('session', session);
|
445
|
+
Ember.$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
|
446
|
+
if (shouldAuthorizeRequest(options.url)) {
|
447
|
+
authorizer.authorize(jqXHR, options);
|
448
|
+
}
|
449
|
+
});
|
675
450
|
}
|
676
|
-
}
|
451
|
+
} else {
|
452
|
+
Ember.Logger.debug('No authorizer factory was specified for Ember.SimpleAuth - specify one if backend requests need to be authorized.');
|
453
|
+
}
|
454
|
+
|
455
|
+
var advanceReadiness = function() {
|
456
|
+
application.advanceReadiness();
|
457
|
+
};
|
458
|
+
session.restore().then(advanceReadiness, advanceReadiness);
|
459
|
+
};
|
460
|
+
|
461
|
+
/**
|
462
|
+
Registers an extension initializer to be invoked when
|
463
|
+
[Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup) is invoked. __This is used
|
464
|
+
by extensions__ to the base Ember.SimpleAuth library that can e.g. register
|
465
|
+
factories with the Ember.js dependency injection container here etc.
|
466
|
+
|
467
|
+
@method initializeExtension
|
468
|
+
@namespace $mainModule
|
469
|
+
@static
|
470
|
+
@param {Function} initializer The initializer to be invoked when [Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup) is invoked; this will receive the same arguments as [Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup).
|
471
|
+
*/
|
472
|
+
var initializeExtension = function(initializer) {
|
473
|
+
extensionInitializers.push(initializer);
|
677
474
|
};
|
678
475
|
|
679
476
|
__exports__.setup = setup;
|
477
|
+
__exports__.initializeExtension = initializeExtension;
|
680
478
|
__exports__.Configuration = Configuration;
|
681
479
|
});
|
682
480
|
define("ember-simple-auth/mixins/application_route_mixin",
|
@@ -715,7 +513,8 @@ define("ember-simple-auth/mixins/application_route_mixin",
|
|
715
513
|
|
716
514
|
This mixin also defines actions that are triggered whenever the session is
|
717
515
|
successfully authenticated or invalidated and whenever authentication or
|
718
|
-
invalidation fails.
|
516
|
+
invalidation fails. These actions provide a good starting point for adding
|
517
|
+
custom behavior to these events.
|
719
518
|
|
720
519
|
@class ApplicationRouteMixin
|
721
520
|
@namespace $mainModule
|
@@ -723,23 +522,6 @@ define("ember-simple-auth/mixins/application_route_mixin",
|
|
723
522
|
@static
|
724
523
|
*/
|
725
524
|
var ApplicationRouteMixin = Ember.Mixin.create({
|
726
|
-
activate: function() {
|
727
|
-
var _this = this;
|
728
|
-
this._super();
|
729
|
-
this.get('session').on('ember-simple-auth:session-authentication-succeeded', function() {
|
730
|
-
_this.send('sessionAuthenticationSucceeded');
|
731
|
-
});
|
732
|
-
this.get('session').on('ember-simple-auth:session-authentication-failed', function(error) {
|
733
|
-
_this.send('sessionAuthenticationFailed', error);
|
734
|
-
});
|
735
|
-
this.get('session').on('ember-simple-auth:session-invalidation-succeeded', function() {
|
736
|
-
_this.send('sessionInvalidationSucceeded');
|
737
|
-
});
|
738
|
-
this.get('session').on('ember-simple-auth:session-invalidation-failed', function(error) {
|
739
|
-
_this.send('sessionInvalidationFailed', error);
|
740
|
-
});
|
741
|
-
},
|
742
|
-
|
743
525
|
actions: {
|
744
526
|
/**
|
745
527
|
This action triggers transition to the `authenticationRoute` specified in
|
@@ -757,7 +539,7 @@ define("ember-simple-auth/mixins/application_route_mixin",
|
|
757
539
|
App.ApplicationRoute = Ember.Route.extend(Ember.SimpleAuth.ApplicationRouteMixin, {
|
758
540
|
actions: {
|
759
541
|
authenticateSession: function() {
|
760
|
-
this.get('session').authenticate('
|
542
|
+
this.get('session').authenticate('authenticator:custom', {});
|
761
543
|
}
|
762
544
|
}
|
763
545
|
});
|
@@ -818,7 +600,7 @@ define("ember-simple-auth/mixins/application_route_mixin",
|
|
818
600
|
This action invalidates the session (see
|
819
601
|
[Ember.SimpleAuth.Session#invalidate](#Ember-SimpleAuth-Session-invalidate)).
|
820
602
|
If invalidation succeeds, it reloads the application (see
|
821
|
-
[Ember.SimpleAuth.ApplicationRouteMixin
|
603
|
+
[Ember.SimpleAuth.ApplicationRouteMixin#sessionInvalidationSucceeded](#Ember-SimpleAuth-ApplicationRouteMixin-sessionInvalidationSucceeded)).
|
822
604
|
|
823
605
|
@method actions.invalidateSession
|
824
606
|
*/
|
@@ -830,8 +612,8 @@ define("ember-simple-auth/mixins/application_route_mixin",
|
|
830
612
|
This action is invoked whenever the session is successfully invalidated.
|
831
613
|
It reloads the Ember.js application by redirecting the browser to the
|
832
614
|
application's root URL so that all in-memory data (such as Ember Data
|
833
|
-
stores etc.)
|
834
|
-
Ember.js application's router (see
|
615
|
+
stores etc.) gets cleared. The root URL is automatically retrieved from
|
616
|
+
the Ember.js application's router (see
|
835
617
|
http://emberjs.com/guides/routing/#toc_specifying-a-root-url).
|
836
618
|
|
837
619
|
@method actions.sessionInvalidationSucceeded
|
@@ -846,15 +628,16 @@ define("ember-simple-auth/mixins/application_route_mixin",
|
|
846
628
|
default.
|
847
629
|
|
848
630
|
@method actions.sessionInvalidationFailed
|
631
|
+
@param {any} error The error the promise returned by the authenticator rejects with, see [Ember.SimpleAuth.Authenticators.Base#invalidate](#Ember-SimpleAuth-Authenticators-Base-invalidate)
|
849
632
|
*/
|
850
633
|
sessionInvalidationFailed: function(error) {
|
851
634
|
},
|
852
635
|
|
853
636
|
/**
|
854
637
|
This action is invoked when an authorization error occurs (which is
|
855
|
-
|
856
|
-
the session and reloads the application (see
|
857
|
-
[Ember.SimpleAuth.ApplicationRouteMixin
|
638
|
+
the case __when the server responds with HTTP status 401__). It
|
639
|
+
invalidates the session and reloads the application (see
|
640
|
+
[Ember.SimpleAuth.ApplicationRouteMixin#sessionInvalidationSucceeded](#Ember-SimpleAuth-ApplicationRouteMixin-sessionInvalidationSucceeded)).
|
858
641
|
|
859
642
|
@method actions.authorizationFailed
|
860
643
|
*/
|
@@ -886,11 +669,15 @@ define("ember-simple-auth/mixins/authenticated_route_mixin",
|
|
886
669
|
|
887
670
|
/**
|
888
671
|
The mixin for routes that require the session to be authenticated in order to
|
889
|
-
be accessible. Including this mixin in a route automatically adds
|
890
|
-
|
672
|
+
be accessible. Including this mixin in a route automatically adds a hook that
|
673
|
+
enforces the session to be authenticated and redirect to the
|
891
674
|
`authenticationRoute` specified in
|
892
675
|
[Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup) if it is not.
|
893
676
|
|
677
|
+
```javascript
|
678
|
+
App.ProtectedRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin);
|
679
|
+
```
|
680
|
+
|
894
681
|
`Ember.SimpleAuth.AuthenticatedRouteMixin` performs the redirect in the
|
895
682
|
`beforeModel` method so that in all methods executed after that the session
|
896
683
|
is guaranteed to be authenticated. __If `beforeModel` is overridden, ensure
|
@@ -936,15 +723,15 @@ define("ember-simple-auth/mixins/authentication_controller_mixin",
|
|
936
723
|
The mixin for the controller that handles the `authenticationRoute` specified
|
937
724
|
in [Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup)). It provides the
|
938
725
|
`authenticate` action that will authenticate the session with the configured
|
939
|
-
|
940
|
-
|
726
|
+
authenticator (see
|
727
|
+
[Ember.SimpleAuth.AuthenticationControllerMixin#authenticatorFactory](#Ember-SimpleAuth-AuthenticationControllerMixin-authenticatorFactory)).
|
941
728
|
|
942
729
|
@class AuthenticationControllerMixin
|
943
730
|
@extends Ember.Mixin
|
944
731
|
*/
|
945
732
|
var AuthenticationControllerMixin = Ember.Mixin.create({
|
946
733
|
/**
|
947
|
-
The authenticator
|
734
|
+
The authenticator used to authenticate the session.
|
948
735
|
|
949
736
|
@property authenticatorFactory
|
950
737
|
@type String
|
@@ -955,22 +742,14 @@ define("ember-simple-auth/mixins/authentication_controller_mixin",
|
|
955
742
|
actions: {
|
956
743
|
/**
|
957
744
|
This action will authenticate the session with the configured
|
958
|
-
|
959
|
-
(
|
745
|
+
authenticator (see
|
746
|
+
[Ember.SimpleAuth.AuthenticationControllerMixin#authenticatorFactory](#Ember-SimpleAuth-AuthenticationControllerMixin-authenticatorFactory),
|
960
747
|
[Ember.SimpleAuth.Session#authenticate](#Ember-SimpleAuth-Session-authenticate)).
|
961
748
|
|
962
|
-
If authentication succeeds, this method triggers the
|
963
|
-
`sessionAuthenticationSucceeded` action (see
|
964
|
-
[Ember.SimpleAuth.ApplicationRouteMixin#sessionAuthenticationSucceeded](#Ember-SimpleAuth-ApplicationRouteMixin-sessionAuthenticationSucceeded)).
|
965
|
-
If authentication fails it triggers the `sessionAuthenticationFailed`
|
966
|
-
action (see
|
967
|
-
[Ember.SimpleAuth.ApplicationRouteMixin#sessionAuthenticationFailed](#Ember-SimpleAuth-ApplicationRouteMixin-sessionAuthenticationFailed)).
|
968
|
-
|
969
749
|
@method actions.authenticate
|
970
750
|
@param {Object} options Any options the auhtenticator needs to authenticate the session
|
971
751
|
*/
|
972
752
|
authenticate: function(options) {
|
973
|
-
var _this = this;
|
974
753
|
this.get('session').authenticate(this.get('authenticatorFactory'), options);
|
975
754
|
}
|
976
755
|
}
|
@@ -979,23 +758,21 @@ define("ember-simple-auth/mixins/authentication_controller_mixin",
|
|
979
758
|
__exports__.AuthenticationControllerMixin = AuthenticationControllerMixin;
|
980
759
|
});
|
981
760
|
define("ember-simple-auth/mixins/login_controller_mixin",
|
982
|
-
["./authentication_controller_mixin","
|
983
|
-
function(__dependency1__,
|
761
|
+
["./authentication_controller_mixin","exports"],
|
762
|
+
function(__dependency1__, __exports__) {
|
984
763
|
"use strict";
|
985
764
|
var global = (typeof window !== 'undefined') ? window : {},
|
986
765
|
Ember = global.Ember;
|
987
766
|
|
988
767
|
var AuthenticationControllerMixin = __dependency1__.AuthenticationControllerMixin;
|
989
|
-
var OAuth2 = __dependency2__.OAuth2;
|
990
768
|
|
991
769
|
/**
|
992
|
-
|
770
|
+
The mixin to use with the controller that handles the `authenticationRoute`
|
993
771
|
specified in
|
994
772
|
[Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup) if the used authentication
|
995
773
|
mechanism works with a login form that asks for user credentials. It provides
|
996
774
|
the `authenticate` action that will authenticate the session with the
|
997
|
-
configured authenticator
|
998
|
-
specialization of
|
775
|
+
configured authenticator when invoked. __This is a specialization of
|
999
776
|
[Ember.SimpleAuth.AuthenticationControllerMixin](#Ember-SimpleAuth-AuthenticationControllerMixin).__
|
1000
777
|
|
1001
778
|
Accompanying the controller that this mixin is mixed in the application needs
|
@@ -1017,24 +794,16 @@ define("ember-simple-auth/mixins/login_controller_mixin",
|
|
1017
794
|
@extends Ember.SimpleAuth.AuthenticationControllerMixin
|
1018
795
|
*/
|
1019
796
|
var LoginControllerMixin = Ember.Mixin.create(AuthenticationControllerMixin, {
|
1020
|
-
/**
|
1021
|
-
The authenticator factory used to authenticate the session.
|
1022
|
-
|
1023
|
-
@property authenticatorFactory
|
1024
|
-
@type String
|
1025
|
-
@default 'ember-simple-auth:authenticators:oauth2'
|
1026
|
-
*/
|
1027
|
-
authenticatorFactory: 'ember-simple-auth:authenticators:oauth2',
|
1028
|
-
|
1029
797
|
actions: {
|
1030
798
|
/**
|
1031
799
|
This action will authenticate the session with the configured
|
1032
|
-
|
800
|
+
authenticator (see
|
801
|
+
[Ember.SimpleAuth.LoginControllerMixin#authenticatorFactory](#Ember-SimpleAuth-LoginControllerMixin-authenticatorFactory))
|
1033
802
|
if both `identification` and `password` are non-empty. It passes both
|
1034
803
|
values to the authenticator.
|
1035
804
|
|
1036
|
-
|
1037
|
-
stay in memory for longer than necessary.
|
805
|
+
__The action also resets the `password` property so sensitive data does
|
806
|
+
not stay in memory for longer than necessary.__
|
1038
807
|
|
1039
808
|
@method actions.authenticate
|
1040
809
|
*/
|
@@ -1049,30 +818,51 @@ define("ember-simple-auth/mixins/login_controller_mixin",
|
|
1049
818
|
__exports__.LoginControllerMixin = LoginControllerMixin;
|
1050
819
|
});
|
1051
820
|
define("ember-simple-auth/session",
|
1052
|
-
["
|
1053
|
-
function(
|
821
|
+
["exports"],
|
822
|
+
function(__exports__) {
|
1054
823
|
"use strict";
|
1055
824
|
var global = (typeof window !== 'undefined') ? window : {},
|
1056
825
|
Ember = global.Ember;
|
1057
826
|
|
1058
|
-
var flatObjectsAreEqual = __dependency1__.flatObjectsAreEqual;
|
1059
|
-
|
1060
827
|
/**
|
1061
828
|
__The session provides access to the current authentication state as well as
|
1062
|
-
any data
|
829
|
+
any data the authenticator resolved with__ (see
|
1063
830
|
[Ember.SimpleAuth.Authenticators.Base#authenticate](#Ember-SimpleAuth-Authenticators-Base-authenticate)).
|
1064
831
|
It is created when Ember.SimpleAuth is set up (see
|
1065
832
|
[Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup)) and __injected into all
|
1066
833
|
models, controllers, routes and views so that all parts of the application
|
1067
834
|
can always access the current authentication state and other data__,
|
1068
|
-
depending on the used authenticator
|
835
|
+
depending on the used authenticator and whether the session is actually
|
836
|
+
authenticated (see
|
1069
837
|
[Ember.SimpleAuth.Authenticators.Base](#Ember-SimpleAuth-Authenticators-Base))).
|
1070
838
|
|
1071
|
-
The session also provides methods to authenticate
|
1072
|
-
|
839
|
+
The session also provides methods to authenticate it and to invalidate itself
|
840
|
+
(see
|
1073
841
|
[Ember.SimpleAuth.Session#authenticate](#Ember-SimpleAuth-Session-authenticate),
|
1074
|
-
[Ember.SimpleAuth.Session#invaldiate](#Ember-SimpleAuth-Session-invaldiate)
|
842
|
+
[Ember.SimpleAuth.Session#invaldiate](#Ember-SimpleAuth-Session-invaldiate)).
|
1075
843
|
These methods are usually invoked through actions from routes or controllers.
|
844
|
+
To authenticate the session manually, simple call the
|
845
|
+
[Ember.SimpleAuth.Session#authenticate](#Ember-SimpleAuth-Session-authenticate)
|
846
|
+
method with the authenticator factory to use as well as any options the
|
847
|
+
authenticator needs to authenticate the session:
|
848
|
+
|
849
|
+
```javascript
|
850
|
+
this.get('session').authenticate('authenticatorFactory', { some: 'option' }).then(function() {
|
851
|
+
// authentication was successful
|
852
|
+
}, function() {
|
853
|
+
// authentication failed
|
854
|
+
});
|
855
|
+
```
|
856
|
+
|
857
|
+
When the session's authentication state changes or an attempt to change it
|
858
|
+
fails, it will trigger the `'sessionAuthenticationSucceeded'`,
|
859
|
+
`'sessionAuthenticationFailed'`, `'sessionInvalidationSucceeded'` or
|
860
|
+
`'sessionInvalidationFailed'` events.
|
861
|
+
|
862
|
+
The session also observes the store and - if it is authenticated - the
|
863
|
+
authenticator for changes (see
|
864
|
+
[Ember.SimpleAuth.Authenticators.Base](#Ember-SimpleAuth-Authenticators-Base)
|
865
|
+
end [Ember.SimpleAuth.Stores.Base](#Ember-SimpleAuth-Stores-Base)).
|
1076
866
|
|
1077
867
|
@class Session
|
1078
868
|
@extends Ember.ObjectProxy
|
@@ -1091,7 +881,7 @@ define("ember-simple-auth/session",
|
|
1091
881
|
authenticatorFactory: null,
|
1092
882
|
/**
|
1093
883
|
The store used to persist session properties. This is assigned during
|
1094
|
-
Ember.SimpleAuth's setup and can be
|
884
|
+
Ember.SimpleAuth's setup and can be configured there
|
1095
885
|
(see [Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup)).
|
1096
886
|
|
1097
887
|
@property store
|
@@ -1125,20 +915,7 @@ define("ember-simple-auth/session",
|
|
1125
915
|
@private
|
1126
916
|
*/
|
1127
917
|
init: function() {
|
1128
|
-
var _this = this;
|
1129
918
|
this.bindToStoreEvents();
|
1130
|
-
var restoredContent = this.store.restore();
|
1131
|
-
var authenticatorFactory = restoredContent.authenticatorFactory;
|
1132
|
-
if (!!authenticatorFactory) {
|
1133
|
-
delete restoredContent.authenticatorFactory;
|
1134
|
-
this.container.lookup(authenticatorFactory).restore(restoredContent).then(function(content) {
|
1135
|
-
_this.setup(authenticatorFactory, content);
|
1136
|
-
}, function() {
|
1137
|
-
_this.store.clear();
|
1138
|
-
});
|
1139
|
-
} else {
|
1140
|
-
this.store.clear();
|
1141
|
-
}
|
1142
919
|
},
|
1143
920
|
|
1144
921
|
/**
|
@@ -1146,6 +923,7 @@ define("ember-simple-auth/session",
|
|
1146
923
|
__This delegates the actual authentication work to the `authenticator`__
|
1147
924
|
and handles the returned promise accordingly (see
|
1148
925
|
[Ember.SimpleAuth.Authenticators.Base#authenticate](#Ember-SimpleAuth-Authenticators-Base-authenticate)).
|
926
|
+
All data the authenticator resolves with will be saved in the session.
|
1149
927
|
|
1150
928
|
__This method returns a promise itself. A resolving promise indicates that
|
1151
929
|
the session was successfully authenticated__ while a rejecting promise
|
@@ -1165,7 +943,7 @@ define("ember-simple-auth/session",
|
|
1165
943
|
resolve();
|
1166
944
|
}, function(error) {
|
1167
945
|
_this.clear();
|
1168
|
-
_this.trigger('
|
946
|
+
_this.trigger('sessionAuthenticationFailed', error);
|
1169
947
|
reject(error);
|
1170
948
|
});
|
1171
949
|
});
|
@@ -1183,7 +961,8 @@ define("ember-simple-auth/session",
|
|
1183
961
|
the session was successfully invalidated__ while a rejecting promise
|
1184
962
|
indicates that the promise returned by the `authenticator` rejected and
|
1185
963
|
thus invalidation was cancelled. In that case the session remains
|
1186
|
-
authenticated.
|
964
|
+
authenticated. Once the session is successfully invalidated it clears all
|
965
|
+
of its data.
|
1187
966
|
|
1188
967
|
@method invalidate
|
1189
968
|
@return {Ember.RSVP.Promise} A promise that resolves when the session was invalidated successfully
|
@@ -1193,16 +972,41 @@ define("ember-simple-auth/session",
|
|
1193
972
|
return new Ember.RSVP.Promise(function(resolve, reject) {
|
1194
973
|
var authenticator = _this.container.lookup(_this.authenticatorFactory);
|
1195
974
|
authenticator.invalidate(_this.content).then(function() {
|
1196
|
-
authenticator.off('
|
975
|
+
authenticator.off('updated');
|
1197
976
|
_this.clear(true);
|
1198
977
|
resolve();
|
1199
978
|
}, function(error) {
|
1200
|
-
_this.trigger('
|
979
|
+
_this.trigger('sessionInvalidationFailed', error);
|
1201
980
|
reject(error);
|
1202
981
|
});
|
1203
982
|
});
|
1204
983
|
},
|
1205
984
|
|
985
|
+
/**
|
986
|
+
@method restore
|
987
|
+
@private
|
988
|
+
*/
|
989
|
+
restore: function() {
|
990
|
+
var _this = this;
|
991
|
+
return new Ember.RSVP.Promise(function(resolve, reject) {
|
992
|
+
var restoredContent = _this.store.restore();
|
993
|
+
var authenticatorFactory = restoredContent.authenticatorFactory;
|
994
|
+
if (!!authenticatorFactory) {
|
995
|
+
delete restoredContent.authenticatorFactory;
|
996
|
+
_this.container.lookup(authenticatorFactory).restore(restoredContent).then(function(content) {
|
997
|
+
_this.setup(authenticatorFactory, content);
|
998
|
+
resolve();
|
999
|
+
}, function() {
|
1000
|
+
_this.store.clear();
|
1001
|
+
reject();
|
1002
|
+
});
|
1003
|
+
} else {
|
1004
|
+
_this.store.clear();
|
1005
|
+
reject();
|
1006
|
+
}
|
1007
|
+
});
|
1008
|
+
},
|
1009
|
+
|
1206
1010
|
/**
|
1207
1011
|
@method setup
|
1208
1012
|
@private
|
@@ -1216,12 +1020,9 @@ define("ember-simple-auth/session",
|
|
1216
1020
|
});
|
1217
1021
|
this.bindToAuthenticatorEvents();
|
1218
1022
|
var data = Ember.$.extend({ authenticatorFactory: authenticatorFactory }, this.content);
|
1219
|
-
|
1220
|
-
this.store.clear();
|
1221
|
-
this.store.persist(data);
|
1222
|
-
}
|
1023
|
+
this.store.replace(data);
|
1223
1024
|
if (trigger) {
|
1224
|
-
this.trigger('
|
1025
|
+
this.trigger('sessionAuthenticationSucceeded');
|
1225
1026
|
}
|
1226
1027
|
},
|
1227
1028
|
|
@@ -1238,7 +1039,7 @@ define("ember-simple-auth/session",
|
|
1238
1039
|
});
|
1239
1040
|
this.store.clear();
|
1240
1041
|
if (trigger) {
|
1241
|
-
this.trigger('
|
1042
|
+
this.trigger('sessionInvalidationSucceeded');
|
1242
1043
|
}
|
1243
1044
|
},
|
1244
1045
|
|
@@ -1249,10 +1050,14 @@ define("ember-simple-auth/session",
|
|
1249
1050
|
bindToAuthenticatorEvents: function() {
|
1250
1051
|
var _this = this;
|
1251
1052
|
var authenticator = this.container.lookup(this.authenticatorFactory);
|
1252
|
-
authenticator.off('
|
1253
|
-
authenticator.
|
1053
|
+
authenticator.off('updated');
|
1054
|
+
authenticator.off('invalidated');
|
1055
|
+
authenticator.on('updated', function(content) {
|
1254
1056
|
_this.setup(_this.authenticatorFactory, content);
|
1255
1057
|
});
|
1058
|
+
authenticator.on('invalidated', function(content) {
|
1059
|
+
_this.clear(true);
|
1060
|
+
});
|
1256
1061
|
},
|
1257
1062
|
|
1258
1063
|
/**
|
@@ -1261,7 +1066,7 @@ define("ember-simple-auth/session",
|
|
1261
1066
|
*/
|
1262
1067
|
bindToStoreEvents: function() {
|
1263
1068
|
var _this = this;
|
1264
|
-
this.store.on('
|
1069
|
+
this.store.on('updated', function(content) {
|
1265
1070
|
var authenticatorFactory = content.authenticatorFactory;
|
1266
1071
|
if (!!authenticatorFactory) {
|
1267
1072
|
delete content.authenticatorFactory;
|
@@ -1280,43 +1085,51 @@ define("ember-simple-auth/session",
|
|
1280
1085
|
__exports__.Session = Session;
|
1281
1086
|
});
|
1282
1087
|
define("ember-simple-auth/stores",
|
1283
|
-
["./stores/base","./stores/
|
1284
|
-
function(__dependency1__, __dependency2__, __dependency3__,
|
1088
|
+
["./stores/base","./stores/local_storage","./stores/ephemeral","exports"],
|
1089
|
+
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
1285
1090
|
"use strict";
|
1286
|
-
var global = (typeof window !== 'undefined') ? window : {},
|
1287
|
-
Ember = global.Ember;
|
1288
|
-
|
1289
1091
|
var Base = __dependency1__.Base;
|
1290
|
-
var
|
1291
|
-
var
|
1292
|
-
var Ephemeral = __dependency4__.Ephemeral;
|
1092
|
+
var LocalStorage = __dependency2__.LocalStorage;
|
1093
|
+
var Ephemeral = __dependency3__.Ephemeral;
|
1293
1094
|
|
1294
|
-
var Stores =
|
1095
|
+
var Stores = {
|
1295
1096
|
Base: Base,
|
1296
|
-
Cookie: Cookie,
|
1297
1097
|
LocalStorage: LocalStorage,
|
1298
1098
|
Ephemeral: Ephemeral
|
1299
|
-
}
|
1099
|
+
};
|
1300
1100
|
|
1101
|
+
var registerStores = function(container) {
|
1102
|
+
container.register('session-store:local-storage', LocalStorage);
|
1103
|
+
container.register('session-store:ephemeral', Ephemeral);
|
1104
|
+
};
|
1105
|
+
|
1106
|
+
__exports__.registerStores = registerStores;
|
1301
1107
|
__exports__.Stores = Stores;
|
1302
1108
|
});
|
1303
1109
|
define("ember-simple-auth/stores/base",
|
1304
|
-
["exports"],
|
1305
|
-
function(__exports__) {
|
1110
|
+
["../utils/flat_objects_are_equal","exports"],
|
1111
|
+
function(__dependency1__, __exports__) {
|
1306
1112
|
"use strict";
|
1307
1113
|
var global = (typeof window !== 'undefined') ? window : {},
|
1308
1114
|
Ember = global.Ember;
|
1309
1115
|
|
1116
|
+
var flatObjectsAreEqual = __dependency1__.flatObjectsAreEqual;
|
1117
|
+
|
1310
1118
|
/**
|
1311
1119
|
The base for all store types. __This serves as a starting point for
|
1312
1120
|
implementing custom stores and must not be used directly.__
|
1313
1121
|
|
1314
|
-
Stores
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1122
|
+
Stores are used to persist the session's state so it survives a page reload
|
1123
|
+
and is synchronized across multiple tabs or windows of the same application.
|
1124
|
+
The store to be used with the application can be configured during
|
1125
|
+
Ember.SimpleAuth's setup
|
1126
|
+
(see [Ember.SimpleAuth.setup](#Ember-SimpleAuth-setup)).
|
1127
|
+
|
1128
|
+
Stores may trigger the `'updated'` event when their data changed due to
|
1129
|
+
external actions (e.g. from another tab). The session listens to that event
|
1130
|
+
and will handle the changes accordingly. Whenever the event is triggered by
|
1131
|
+
the store, the session will forward the data to its authenticator which
|
1132
|
+
decides whether the session is still valid (see
|
1320
1133
|
[Ember.SimpleAuth.Authenticators.Base#restore](#Ember-SimpleAuth-Authenticators-Base-restore)).
|
1321
1134
|
|
1322
1135
|
@class Base
|
@@ -1337,7 +1150,7 @@ define("ember-simple-auth/stores/base",
|
|
1337
1150
|
},
|
1338
1151
|
|
1339
1152
|
/**
|
1340
|
-
Restores all data currently saved in the store as
|
1153
|
+
Restores all data currently saved in the store as a plain object.
|
1341
1154
|
|
1342
1155
|
`Ember.SimpleAuth.Stores.Base`'s implementation always returns an empty
|
1343
1156
|
plain Object.
|
@@ -1350,168 +1163,34 @@ define("ember-simple-auth/stores/base",
|
|
1350
1163
|
},
|
1351
1164
|
|
1352
1165
|
/**
|
1353
|
-
|
1166
|
+
Replaces all data currently saved in the store with the specified `data`.
|
1354
1167
|
|
1355
|
-
`Ember.SimpleAuth.Stores.Base`'s implementation
|
1168
|
+
`Ember.SimpleAuth.Stores.Base`'s implementation clears the store, then
|
1169
|
+
persists the specified `data`. If the store's current content is equal to
|
1170
|
+
the specified `data`, nothing is done.
|
1356
1171
|
|
1357
|
-
@method
|
1172
|
+
@method replace
|
1173
|
+
@param {Object} data The data to replace the store's content with
|
1358
1174
|
*/
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
__exports__.Base = Base;
|
1364
|
-
});
|
1365
|
-
define("ember-simple-auth/stores/cookie",
|
1366
|
-
["./base","../utils/flat_objects_are_equal","exports"],
|
1367
|
-
function(__dependency1__, __dependency2__, __exports__) {
|
1368
|
-
"use strict";
|
1369
|
-
var global = (typeof window !== 'undefined') ? window : {},
|
1370
|
-
Ember = global.Ember;
|
1371
|
-
|
1372
|
-
var Base = __dependency1__.Base;
|
1373
|
-
var flatObjectsAreEqual = __dependency2__.flatObjectsAreEqual;
|
1374
|
-
|
1375
|
-
/**
|
1376
|
-
Store that saves its data in session cookies.
|
1377
|
-
|
1378
|
-
__In order to keep multiple tabs/windows of your application in sync, this
|
1379
|
-
store has to periodically (every 500ms) check the cookies__ for changes as
|
1380
|
-
there are no events that notify of changes in cookies. The recommended
|
1381
|
-
alternative is
|
1382
|
-
[Ember.SimpleAuth.Stores.LocalStorage](#Ember-SimpleAuth-Stores-LocalStorage)
|
1383
|
-
that also persistently stores data but instead of cookies relies on the
|
1384
|
-
`localStorage` API and does not need to poll for external changes.
|
1385
|
-
|
1386
|
-
This store will trigger the `'ember-simple-auth:session-updated'` event when
|
1387
|
-
any of its cookies is changed from another tab or window.
|
1388
|
-
|
1389
|
-
@class Cookie
|
1390
|
-
@namespace Stores
|
1391
|
-
@extends Stores.Base
|
1392
|
-
*/
|
1393
|
-
var Cookie = Base.extend({
|
1394
|
-
/**
|
1395
|
-
The prefix to use for the store's cookie names so they can be distinguished
|
1396
|
-
from other cookies.
|
1397
|
-
|
1398
|
-
@property cookieNamePrefix
|
1399
|
-
@type String
|
1400
|
-
@default 'ember_simple_auth:'
|
1401
|
-
*/
|
1402
|
-
cookieNamePrefix: 'ember_simple_auth:',
|
1403
|
-
/**
|
1404
|
-
@property _secureCookies
|
1405
|
-
@private
|
1406
|
-
*/
|
1407
|
-
_secureCookies: window.location.protocol === 'https:',
|
1408
|
-
/**
|
1409
|
-
@property _syncDataTimeout
|
1410
|
-
@private
|
1411
|
-
*/
|
1412
|
-
_syncDataTimeout: null,
|
1413
|
-
|
1414
|
-
/**
|
1415
|
-
@method init
|
1416
|
-
@private
|
1417
|
-
*/
|
1418
|
-
init: function() {
|
1419
|
-
this.syncData();
|
1420
|
-
},
|
1421
|
-
|
1422
|
-
/**
|
1423
|
-
Persists the `data` in session cookies.
|
1424
|
-
|
1425
|
-
@method persist
|
1426
|
-
@param {Object} data The data to persist
|
1427
|
-
*/
|
1428
|
-
persist: function(data) {
|
1429
|
-
for (var property in data) {
|
1430
|
-
this.write(property, data[property], null);
|
1175
|
+
replace: function(data) {
|
1176
|
+
if (!flatObjectsAreEqual(data, this.restore())) {
|
1177
|
+
this.clear();
|
1178
|
+
this.persist(data);
|
1431
1179
|
}
|
1432
|
-
this._lastData = this.restore();
|
1433
1180
|
},
|
1434
1181
|
|
1435
1182
|
/**
|
1436
|
-
|
1437
|
-
`cookieNamePrefix` as one plain object.
|
1438
|
-
|
1439
|
-
@method restore
|
1440
|
-
@return {Object} All data currently persisted in the session cookies
|
1441
|
-
*/
|
1442
|
-
restore: function() {
|
1443
|
-
var _this = this;
|
1444
|
-
var data = {};
|
1445
|
-
this.knownCookies().forEach(function(cookie) {
|
1446
|
-
data[cookie] = _this.read(cookie);
|
1447
|
-
});
|
1448
|
-
return data;
|
1449
|
-
},
|
1183
|
+
Clears the store.
|
1450
1184
|
|
1451
|
-
|
1452
|
-
Clears the store by deleting all session cookies prefixed with the
|
1453
|
-
`cookieNamePrefix`.
|
1185
|
+
`Ember.SimpleAuth.Stores.Base`'s implementation does nothing.
|
1454
1186
|
|
1455
1187
|
@method clear
|
1456
1188
|
*/
|
1457
1189
|
clear: function() {
|
1458
|
-
var _this = this;
|
1459
|
-
this.knownCookies().forEach(function(cookie) {
|
1460
|
-
_this.write(cookie, null, (new Date(0)).toGMTString());
|
1461
|
-
});
|
1462
|
-
this._lastData = null;
|
1463
|
-
},
|
1464
|
-
|
1465
|
-
/**
|
1466
|
-
@method read
|
1467
|
-
@private
|
1468
|
-
*/
|
1469
|
-
read: function(name) {
|
1470
|
-
var value = document.cookie.match(new RegExp(this.cookieNamePrefix + name + '=([^;]+)')) || [];
|
1471
|
-
return decodeURIComponent(value[1] || '');
|
1472
|
-
},
|
1473
|
-
|
1474
|
-
/**
|
1475
|
-
@method write
|
1476
|
-
@private
|
1477
|
-
*/
|
1478
|
-
write: function(name, value, expiration) {
|
1479
|
-
var expires = Ember.isEmpty(expiration) ? '' : '; expires=' + expiration;
|
1480
|
-
var secure = !!this._secureCookies ? ';secure' : '';
|
1481
|
-
document.cookie = this.cookieNamePrefix + name + '=' + encodeURIComponent(value) + expires + secure;
|
1482
|
-
},
|
1483
|
-
|
1484
|
-
/**
|
1485
|
-
@method knownCookies
|
1486
|
-
@private
|
1487
|
-
*/
|
1488
|
-
knownCookies: function() {
|
1489
|
-
var _this = this;
|
1490
|
-
return Ember.A(document.cookie.split(/[=;\s]+/)).filter(function(element) {
|
1491
|
-
return new RegExp('^' + _this.cookieNamePrefix).test(element);
|
1492
|
-
}).map(function(cookie) {
|
1493
|
-
return cookie.replace(_this.cookieNamePrefix, '');
|
1494
|
-
});
|
1495
|
-
},
|
1496
|
-
|
1497
|
-
/**
|
1498
|
-
@method syncData
|
1499
|
-
@private
|
1500
|
-
*/
|
1501
|
-
syncData: function() {
|
1502
|
-
var data = this.restore();
|
1503
|
-
if (!flatObjectsAreEqual(data, this._lastData)) {
|
1504
|
-
this._lastData = data;
|
1505
|
-
this.trigger('ember-simple-auth:session-updated', data);
|
1506
|
-
}
|
1507
|
-
if (!Ember.testing) {
|
1508
|
-
Ember.run.cancel(this._syncDataTimeout);
|
1509
|
-
this._syncDataTimeout = Ember.run.later(this, this.syncData, 500);
|
1510
|
-
}
|
1511
1190
|
}
|
1512
1191
|
});
|
1513
1192
|
|
1514
|
-
__exports__.
|
1193
|
+
__exports__.Base = Base;
|
1515
1194
|
});
|
1516
1195
|
define("ember-simple-auth/stores/ephemeral",
|
1517
1196
|
["./base","exports"],
|
@@ -1524,7 +1203,13 @@ define("ember-simple-auth/stores/ephemeral",
|
|
1524
1203
|
|
1525
1204
|
/**
|
1526
1205
|
Store that saves its data in memory and thus __is not actually persistent__.
|
1527
|
-
|
1206
|
+
It does also not synchronize the session's state across multiple tabs or
|
1207
|
+
windows as those cannot share memory.
|
1208
|
+
|
1209
|
+
__This store is mainly useful for testing.__
|
1210
|
+
|
1211
|
+
_The factory for this store is registered as `'session-store:ephemeral'` in
|
1212
|
+
Ember's container._
|
1528
1213
|
|
1529
1214
|
@class Ephemeral
|
1530
1215
|
@namespace Stores
|
@@ -1550,7 +1235,7 @@ define("ember-simple-auth/stores/ephemeral",
|
|
1550
1235
|
},
|
1551
1236
|
|
1552
1237
|
/**
|
1553
|
-
Restores all data currently saved as
|
1238
|
+
Restores all data currently saved as a plain object.
|
1554
1239
|
|
1555
1240
|
@method restore
|
1556
1241
|
@return {Object} All data currently persisted
|
@@ -1585,8 +1270,11 @@ define("ember-simple-auth/stores/local_storage",
|
|
1585
1270
|
/**
|
1586
1271
|
Store that saves its data in the browser's `localStorage`.
|
1587
1272
|
|
1588
|
-
This store will trigger the `'
|
1589
|
-
|
1273
|
+
This store will trigger the `'updated'` event when any of the keys it manages
|
1274
|
+
is changed from another tab or window.
|
1275
|
+
|
1276
|
+
_The factory for this store is registered as `'session-store:local-storage'`
|
1277
|
+
in Ember's container._
|
1590
1278
|
|
1591
1279
|
@class LocalStorage
|
1592
1280
|
@namespace Stores
|
@@ -1696,7 +1384,7 @@ define("ember-simple-auth/stores/local_storage",
|
|
1696
1384
|
_this._lastData = data;
|
1697
1385
|
Ember.run.cancel(_this._triggerChangeEventTimeout);
|
1698
1386
|
_this._triggerChangeEventTimeout = Ember.run.next(_this, function() {
|
1699
|
-
this.trigger('
|
1387
|
+
this.trigger('updated', data);
|
1700
1388
|
});
|
1701
1389
|
}
|
1702
1390
|
});
|
@@ -1705,10 +1393,28 @@ define("ember-simple-auth/stores/local_storage",
|
|
1705
1393
|
|
1706
1394
|
__exports__.LocalStorage = LocalStorage;
|
1707
1395
|
});
|
1396
|
+
define("ember-simple-auth/utils",
|
1397
|
+
["./utils/is_secure_url","./utils/flat_objects_are_equal","exports"],
|
1398
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
1399
|
+
"use strict";
|
1400
|
+
var isSecureUrl = __dependency1__.isSecureUrl;
|
1401
|
+
var flatObjectsAreEqual = __dependency2__.flatObjectsAreEqual;
|
1402
|
+
|
1403
|
+
var Utils = {
|
1404
|
+
isSecureUrl: isSecureUrl,
|
1405
|
+
flatObjectsAreEqual: flatObjectsAreEqual
|
1406
|
+
};
|
1407
|
+
|
1408
|
+
__exports__.Utils = Utils;
|
1409
|
+
});
|
1708
1410
|
define("ember-simple-auth/utils/flat_objects_are_equal",
|
1709
1411
|
["exports"],
|
1710
1412
|
function(__exports__) {
|
1711
1413
|
"use strict";
|
1414
|
+
/**
|
1415
|
+
@method flatObjectsAreEqual
|
1416
|
+
@private
|
1417
|
+
*/
|
1712
1418
|
var flatObjectsAreEqual = function(a, b) {
|
1713
1419
|
function sortObject(object) {
|
1714
1420
|
var array = [];
|
@@ -1734,6 +1440,10 @@ define("ember-simple-auth/utils/is_secure_url",
|
|
1734
1440
|
["exports"],
|
1735
1441
|
function(__exports__) {
|
1736
1442
|
"use strict";
|
1443
|
+
/**
|
1444
|
+
@method isSecureUrl
|
1445
|
+
@private
|
1446
|
+
*/
|
1737
1447
|
var isSecureUrl = function(url) {
|
1738
1448
|
var link = document.createElement('a');
|
1739
1449
|
link.href = location;
|