ember_simple_auth-rails 0.6.4 → 0.6.6

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: 719d3390d677fc68f07d4c9b56d6997a22af2730
4
- data.tar.gz: a414a5634f5252c0dd3d33ced15a4d4c140db9d4
3
+ metadata.gz: 0a573203d0d366acbb574f5e2ffd9165ab3ee866
4
+ data.tar.gz: cc55804dcf7971eee623a9fb6fff2cc8734d5d6c
5
5
  SHA512:
6
- metadata.gz: e06686f14ed887bbcd5b028d9a6c6ca74436cac09f04feda5316bf597939b779fc5f6c6a270a6c81d2521490c93af8fc267d647962b9901ce5025828f202f9a3
7
- data.tar.gz: b372da27a81fbb7bf92ccacd3733cbe538a111de9e57dfa5e20b0df3a2b5e048367718a3291203fdb3f566b335096c913af955545da030de9fde8b2e838edc5a
6
+ metadata.gz: 6ac14445cf2128de3b56e5731268d7ce02ede54c87b305681d32e1663c12c388f0008a5696b41021bf7353a599371b9d813d29e5d57c9427561cf2effbaf5278
7
+ data.tar.gz: ec30ebc92a9604814ff74987a66304b48a984d5f9781d10efe7fec71e67f1441becf05ad6198dbef29b20b6267b54a70fc80eef1becb0a6bced79a320a2927ff
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # EmberSimpleAuth::Rails
2
2
 
3
- TODO: Write a gem description
3
+ ember-simple-auth for the assets pipeline
4
+
5
+ # IF YOU WANT A NEW VERSION RUN
6
+ ```bash
7
+ $ rake update
8
+ ```
9
+ # AND SUBMIT A PULL REQUEST
4
10
 
5
11
  ## Installation
6
12
 
@@ -1,5 +1,5 @@
1
1
  module EmberSimpleAuth
2
2
  module Rails
3
- VERSION = "0.6.4"
3
+ VERSION = "0.6.6"
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.4');
3
+ Ember.libraries.register('Ember Simple Auth Cookie Store', '0.6.6');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -243,9 +243,10 @@ define("simple-auth-cookie-store/stores/cookie",
243
243
  @private
244
244
  */
245
245
  write: function(value, expiration) {
246
+ var path = '; path=/';
246
247
  var expires = Ember.isEmpty(expiration) ? '' : '; expires=' + new Date(expiration).toUTCString();
247
248
  var secure = !!this._secureCookies ? ';secure' : '';
248
- document.cookie = this.cookieName + '=' + encodeURIComponent(value) + expires + secure;
249
+ document.cookie = this.cookieName + '=' + encodeURIComponent(value) + path + expires + secure;
249
250
  },
250
251
 
251
252
  /**
@@ -275,8 +276,8 @@ define('simple-auth/utils/get-global-config', ['exports'], function(__exports__
275
276
  __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
276
277
  });
277
278
 
278
- var initializer = requireModule('simple-auth-cookie-store/initializer').default;
279
- var Cookie = requireModule('simple-auth-cookie-store/stores/cookie').default;
279
+ var initializer = requireModule('simple-auth-cookie-store/initializer')['default'];
280
+ var Cookie = requireModule('simple-auth-cookie-store/stores/cookie')['default'];
280
281
 
281
282
  global.SimpleAuth.Stores.Cookie = Cookie;
282
283
 
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth Devise', '0.6.4');
3
+ Ember.libraries.register('Ember Simple Auth Devise', '0.6.6');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -301,9 +301,9 @@ define('simple-auth/utils/get-global-config', ['exports'], function(__exports__
301
301
  __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
302
302
  });
303
303
 
304
- var initializer = requireModule('simple-auth-devise/initializer').default;
305
- var Authenticator = requireModule('simple-auth-devise/authenticators/devise').default;
306
- var Authorizer = requireModule('simple-auth-devise/authorizers/devise').default;
304
+ var initializer = requireModule('simple-auth-devise/initializer')['default'];
305
+ var Authenticator = requireModule('simple-auth-devise/authenticators/devise')['default'];
306
+ var Authorizer = requireModule('simple-auth-devise/authorizers/devise')['default'];
307
307
 
308
308
  global.SimpleAuth.Authenticators.Devise = Authenticator;
309
309
  global.SimpleAuth.Authorizers.Devise = Authorizer;
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth OAuth 2.0', '0.6.4');
3
+ Ember.libraries.register('Ember Simple Auth OAuth 2.0', '0.6.6');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -118,15 +118,15 @@ define("simple-auth-oauth2/authenticators/oauth2",
118
118
  ```js
119
119
  window.ENV = window.ENV || {};
120
120
  window.ENV['simple-auth-oauth2'] = {
121
- serverTokenRevokationEndpoint: '/some/custom/endpoint'
121
+ serverTokenRevocationEndpoint: '/some/custom/endpoint'
122
122
  }
123
123
  ```
124
124
 
125
- @property serverTokenRevokationEndpoint
125
+ @property serverTokenRevocationEndpoint
126
126
  @type String
127
127
  @default null
128
128
  */
129
- serverTokenRevokationEndpoint: null,
129
+ serverTokenRevocationEndpoint: null,
130
130
 
131
131
  /**
132
132
  Sets whether the authenticator automatically refreshes access tokens.
@@ -159,7 +159,7 @@ define("simple-auth-oauth2/authenticators/oauth2",
159
159
  init: function() {
160
160
  var globalConfig = getGlobalConfig('simple-auth-oauth2');
161
161
  this.serverTokenEndpoint = globalConfig.serverTokenEndpoint || this.serverTokenEndpoint;
162
- this.serverTokenRevokationEndpoint = globalConfig.serverTokenRevokationEndpoint || this.serverTokenRevokationEndpoint;
162
+ this.serverTokenRevocationEndpoint = globalConfig.serverTokenRevocationEndpoint || this.serverTokenRevocationEndpoint;
163
163
  this.refreshAccessTokens = globalConfig.refreshAccessTokens || this.refreshAccessTokens;
164
164
  },
165
165
 
@@ -256,11 +256,11 @@ define("simple-auth-oauth2/authenticators/oauth2",
256
256
  resolve();
257
257
  }
258
258
  return new Ember.RSVP.Promise(function(resolve, reject) {
259
- if (!Ember.isEmpty(_this.serverTokenRevokationEndpoint)) {
259
+ if (!Ember.isEmpty(_this.serverTokenRevocationEndpoint)) {
260
260
  var requests = [];
261
261
  Ember.A(['access_token', 'refresh_token']).forEach(function(tokenType) {
262
262
  if (!Ember.isEmpty(data[tokenType])) {
263
- requests.push(_this.makeRequest(_this.serverTokenRevokationEndpoint, {
263
+ requests.push(_this.makeRequest(_this.serverTokenRevocationEndpoint, {
264
264
  token_type_hint: tokenType, token: data[tokenType]
265
265
  }));
266
266
  }
@@ -444,9 +444,9 @@ define('simple-auth/utils/get-global-config', ['exports'], function(__exports__
444
444
  __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
445
445
  });
446
446
 
447
- var initializer = requireModule('simple-auth-oauth2/initializer').default;
448
- var Authenticator = requireModule('simple-auth-oauth2/authenticators/oauth2').default;
449
- var Authorizer = requireModule('simple-auth-oauth2/authorizers/oauth2').default;
447
+ var initializer = requireModule('simple-auth-oauth2/initializer')['default'];
448
+ var Authenticator = requireModule('simple-auth-oauth2/authenticators/oauth2')['default'];
449
+ var Authorizer = requireModule('simple-auth-oauth2/authorizers/oauth2')['default'];
450
450
 
451
451
  global.SimpleAuth.Authenticators.OAuth2 = Authenticator;
452
452
  global.SimpleAuth.Authorizers.OAuth2 = Authorizer;
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth Testing', '0.6.4');
3
+ Ember.libraries.register('Ember Simple Auth Testing', '0.6.6');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -127,11 +127,10 @@ define("simple-auth-testing/test-helpers",
127
127
  define('simple-auth/authenticators/base', ['exports'], function(__exports__) {
128
128
  __exports__['default'] = global.SimpleAuth.Authenticators.Base;
129
129
  });
130
+ define('simple-auth/configuration', ['exports'], function(__exports__) {
131
+ __exports__['default'] = global.SimpleAuth.Configuration;
132
+ });
130
133
 
131
134
  requireModule('simple-auth-testing/ember');
132
-
133
- if (global.Ember.testing) {
134
- requireModule('simple-auth/test-helpers/authenticate-session');
135
- requireModule('simple-auth/test-helpers/invalidate-session');
136
- }
135
+ requireModule('simple-auth-testing/test-helpers');
137
136
  })((typeof global !== 'undefined') ? global : window);
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth Torii', '0.6.4');
3
+ Ember.libraries.register('Ember Simple Auth Torii', '0.6.6');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -191,7 +191,7 @@ define('simple-auth/authenticators/base', ['exports'], function(__exports__) {
191
191
  __exports__['default'] = global.SimpleAuth.Authenticators.Base;
192
192
  });
193
193
 
194
- var Authenticator = requireModule('simple-auth-torii/authenticators/torii').default;
194
+ var Authenticator = requireModule('simple-auth-torii/authenticators/torii')['default'];
195
195
 
196
196
  global.SimpleAuth.Authenticators.Torii = Authenticator;
197
197
 
@@ -1,6 +1,6 @@
1
1
  (function(global) {
2
2
 
3
- Ember.libraries.register('Ember Simple Auth', '0.6.4');
3
+ Ember.libraries.register('Ember Simple Auth', '0.6.6');
4
4
 
5
5
  var define, requireModule;
6
6
 
@@ -303,6 +303,19 @@ define("simple-auth/configuration",
303
303
  */
304
304
  routeAfterAuthentication: 'index',
305
305
 
306
+ /**
307
+ The route to transition to if a route that implements
308
+ [`UnauthenticatedRouteMixin`](#SimpleAuth-UnauthenticatedRouteMixin) is
309
+ accessed when the session is authenticated.
310
+
311
+ @property routeIfAlreadyAuthenticated
312
+ @readOnly
313
+ @static
314
+ @type String
315
+ @default 'index'
316
+ */
317
+ routeIfAlreadyAuthenticated: 'index',
318
+
306
319
  /**
307
320
  The name of the property that the session is injected with into routes and
308
321
  controllers.
@@ -384,6 +397,7 @@ define("simple-auth/configuration",
384
397
  var globalConfig = getGlobalConfig('simple-auth');
385
398
  this.authenticationRoute = globalConfig.authenticationRoute || this.authenticationRoute;
386
399
  this.routeAfterAuthentication = globalConfig.routeAfterAuthentication || this.routeAfterAuthentication;
400
+ this.routeIfAlreadyAuthenticated = globalConfig.routeIfAlreadyAuthenticated || this.routeIfAlreadyAuthenticated;
387
401
  this.sessionPropertyName = globalConfig.sessionPropertyName || this.sessionPropertyName;
388
402
  this.authorizer = globalConfig.authorizer || this.authorizer;
389
403
  this.session = globalConfig.session || this.session;
@@ -681,6 +695,7 @@ define("simple-auth/mixins/authenticated-route-mixin",
681
695
  if (!this.get(Configuration.sessionPropertyName).get('isAuthenticated')) {
682
696
  transition.abort();
683
697
  this.get(Configuration.sessionPropertyName).set('attemptedTransition', transition);
698
+ Ember.assert('The route configured as Configuration.authenticationRoute cannot implement the AuthenticatedRouteMixin mixin as that leads to an infinite transitioning loop.', this.get('routeName') !== Configuration.authenticationRoute);
684
699
  transition.send('authenticateSession');
685
700
  }
686
701
  }
@@ -758,9 +773,9 @@ define("simple-auth/mixins/login-controller-mixin",
758
773
  ```handlebars
759
774
  <form {{action 'authenticate' on='submit'}}>
760
775
  <label for="identification">Login</label>
761
- {{input id='identification' placeholder='Enter Login' value=identification}}
776
+ {{input value=identification placeholder='Enter Login'}}
762
777
  <label for="password">Password</label>
763
- {{input id='password' placeholder='Enter Password' type='password' value=password}}
778
+ {{input value=password placeholder='Enter Password' type='password'}}
764
779
  <button type="submit">Login</button>
765
780
  </form>
766
781
  ```
@@ -792,6 +807,56 @@ define("simple-auth/mixins/login-controller-mixin",
792
807
  }
793
808
  });
794
809
  });
810
+ define("simple-auth/mixins/unauthenticated-route-mixin",
811
+ ["./../configuration","exports"],
812
+ function(__dependency1__, __exports__) {
813
+ "use strict";
814
+ var Configuration = __dependency1__["default"];
815
+
816
+ /**
817
+ This mixin is for routes that should only be accessible if the session is
818
+ not authenticated. This is e.g. the case for the login route that should not
819
+ be accessible when the session is already authenticated. Including this mixin
820
+ in a route automatically adds a hook that redirects to the
821
+ [`Configuration.routeIfAlreadyAuthenticated`](#SimpleAuth-Configuration-routeIfAlreadyAuthenticated),
822
+ which defaults to `'index'`.
823
+
824
+ ```javascript
825
+ // app/routes/login.js
826
+ import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin';
827
+
828
+ export default Ember.Route.extend(UnauthenticatedRouteMixin);
829
+ ```
830
+
831
+ `UnauthenticatedRouteMixin` performs the redirect in the `beforeModel`
832
+ method. __If `beforeModel` is overridden, ensure that the custom
833
+ implementation calls `this._super(transition)`__.
834
+
835
+ @class UnauthenticatedRouteMixin
836
+ @namespace SimpleAuth
837
+ @module simple-auth/mixins/unauthenticated-route-mixin
838
+ @extends Ember.Mixin
839
+ @static
840
+ */
841
+ __exports__["default"] = Ember.Mixin.create({
842
+ /**
843
+ This method implements the enforcement of the session not being
844
+ authenticated. If the session is authenticated, the current transition will
845
+ be aborted and a redirect will be triggered to the
846
+ [`Configuration.routeIfAlreadyAuthenticated`](#SimpleAuth-Configuration-routeIfAlreadyAuthenticated).
847
+
848
+ @method beforeModel
849
+ @param {Transition} transition The transition that lead to this route
850
+ */
851
+ beforeModel: function(transition) {
852
+ if (this.get(Configuration.sessionPropertyName).get('isAuthenticated')) {
853
+ transition.abort();
854
+ Ember.assert('The route configured as Configuration.routeIfAlreadyAuthenticated cannot implement the UnauthenticatedRouteMixin mixin as that leads to an infinite transitioning loop.', this.get('routeName') !== Configuration.routeIfAlreadyAuthenticated);
855
+ this.transitionTo(Configuration.routeIfAlreadyAuthenticated);
856
+ }
857
+ }
858
+ });
859
+ });
795
860
  define("simple-auth/session",
796
861
  ["exports"],
797
862
  function(__exports__) {
@@ -1198,17 +1263,18 @@ define("simple-auth/setup",
1198
1263
  authorizer.set('session', session);
1199
1264
  Ember.$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
1200
1265
  if (!authorizer.isDestroyed && shouldAuthorizeRequest(options)) {
1266
+ jqXHR.__simple_auth_authorized__ = true;
1201
1267
  authorizer.authorize(jqXHR, options);
1202
1268
  }
1203
1269
  });
1204
1270
  Ember.$(document).ajaxError(function(event, jqXHR, setting, exception) {
1205
- if (jqXHR.status === 401) {
1271
+ if (!!jqXHR.__simple_auth_authorized__ && jqXHR.status === 401) {
1206
1272
  session.trigger('authorizationFailed');
1207
1273
  }
1208
1274
  });
1209
1275
  }
1210
1276
  } else {
1211
- Ember.Logger.debug('No authorizer factory was configured for Ember Simple Auth - specify one if backend requests need to be authorized.');
1277
+ Ember.Logger.info('No authorizer was configured for Ember Simple Auth - specify one if backend requests need to be authorized.');
1212
1278
  }
1213
1279
 
1214
1280
  var advanceReadiness = function() {
@@ -1355,11 +1421,12 @@ define("simple-auth/stores/ephemeral",
1355
1421
  });
1356
1422
  });
1357
1423
  define("simple-auth/stores/local-storage",
1358
- ["./base","../utils/flat-objects-are-equal","exports"],
1359
- function(__dependency1__, __dependency2__, __exports__) {
1424
+ ["./base","../utils/flat-objects-are-equal","simple-auth/utils/get-global-config","exports"],
1425
+ function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
1360
1426
  "use strict";
1361
1427
  var Base = __dependency1__["default"];
1362
1428
  var flatObjectsAreEqual = __dependency2__["default"];
1429
+ var getGlobalConfig = __dependency3__["default"];
1363
1430
 
1364
1431
  /**
1365
1432
  Store that saves its data in the browser's `localStorage`.
@@ -1389,6 +1456,9 @@ define("simple-auth/stores/local-storage",
1389
1456
  @private
1390
1457
  */
1391
1458
  init: function() {
1459
+ var globalConfig = getGlobalConfig('simple-auth');
1460
+ this.key = globalConfig.localStorageKey || this.key;
1461
+
1392
1462
  this.bindToStorageEvents();
1393
1463
  },
1394
1464
 
@@ -1495,21 +1565,22 @@ define("simple-auth/utils/is-secure-url",
1495
1565
  return link.protocol == 'https:';
1496
1566
  }
1497
1567
  });
1498
- var initializer = requireModule('simple-auth/initializer').default;
1499
- var Configuration = requireModule('simple-auth/configuration').default;
1500
- var Session = requireModule('simple-auth/session').default;
1501
- var BaseAuthenticator = requireModule('simple-auth/authenticators/base').default;
1502
- var BaseAuthorizer = requireModule('simple-auth/authorizers/base').default;
1503
- var BaseStore = requireModule('simple-auth/stores/base').default;
1504
- var LocalStorageStore = requireModule('simple-auth/stores/local-storage').default;
1505
- var EphemeralStore = requireModule('simple-auth/stores/ephemeral').default;
1506
- var flatObjectsAreEqual = requireModule('simple-auth/utils/flat-objects-are-equal').default;
1507
- var isSecureUrl = requireModule('simple-auth/utils/is-secure-url').default;
1508
- var getGlobalConfig = requireModule('simple-auth/utils/get-global-config').default;
1509
- var ApplicationRouteMixin = requireModule('simple-auth/mixins/application-route-mixin').default;
1510
- var AuthenticatedRouteMixin = requireModule('simple-auth/mixins/authenticated-route-mixin').default;
1511
- var AuthenticationControllerMixin = requireModule('simple-auth/mixins/authentication-controller-mixin').default;
1512
- var LoginControllerMixin = requireModule('simple-auth/mixins/login-controller-mixin').default;
1568
+ var initializer = requireModule('simple-auth/initializer')['default'];
1569
+ var Configuration = requireModule('simple-auth/configuration')['default'];
1570
+ var Session = requireModule('simple-auth/session')['default'];
1571
+ var BaseAuthenticator = requireModule('simple-auth/authenticators/base')['default'];
1572
+ var BaseAuthorizer = requireModule('simple-auth/authorizers/base')['default'];
1573
+ var BaseStore = requireModule('simple-auth/stores/base')['default'];
1574
+ var LocalStorageStore = requireModule('simple-auth/stores/local-storage')['default'];
1575
+ var EphemeralStore = requireModule('simple-auth/stores/ephemeral')['default'];
1576
+ var flatObjectsAreEqual = requireModule('simple-auth/utils/flat-objects-are-equal')['default'];
1577
+ var isSecureUrl = requireModule('simple-auth/utils/is-secure-url')['default'];
1578
+ var getGlobalConfig = requireModule('simple-auth/utils/get-global-config')['default'];
1579
+ var ApplicationRouteMixin = requireModule('simple-auth/mixins/application-route-mixin')['default'];
1580
+ var AuthenticatedRouteMixin = requireModule('simple-auth/mixins/authenticated-route-mixin')['default'];
1581
+ var AuthenticationControllerMixin = requireModule('simple-auth/mixins/authentication-controller-mixin')['default'];
1582
+ var LoginControllerMixin = requireModule('simple-auth/mixins/login-controller-mixin')['default'];
1583
+ var UnauthenticatedRouteMixin = requireModule('simple-auth/mixins/unauthenticated-route-mixin')['default'];
1513
1584
 
1514
1585
  global.SimpleAuth = {
1515
1586
  Configuration: Configuration,
@@ -1539,10 +1610,11 @@ global.SimpleAuth = {
1539
1610
  ApplicationRouteMixin: ApplicationRouteMixin,
1540
1611
  AuthenticatedRouteMixin: AuthenticatedRouteMixin,
1541
1612
  AuthenticationControllerMixin: AuthenticationControllerMixin,
1542
- LoginControllerMixin: LoginControllerMixin
1613
+ LoginControllerMixin: LoginControllerMixin,
1614
+ UnauthenticatedRouteMixin: UnauthenticatedRouteMixin
1543
1615
  };
1544
1616
 
1545
1617
  requireModule('simple-auth/ember');
1546
1618
 
1547
- Ember.libraries.register('Ember Simple Auth', '0.6.4');
1619
+ Ember.libraries.register('Ember Simple Auth', '0.6.6');
1548
1620
  })((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.4
4
+ version: 0.6.6
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-07-26 00:00:00.000000000 Z
11
+ date: 2014-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,3 +94,4 @@ signing_key:
94
94
  specification_version: 4
95
95
  summary: ember-simple-auth for the rails asset pipeline
96
96
  test_files: []
97
+ has_rdoc: