ember_simple_auth-rails 0.6.0 → 0.6.1

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: e3490369b67f03b10b7ce3350102b9bb902d28af
4
- data.tar.gz: f64475c9fa708f8fe9e5da17a22dea0bd78aa671
3
+ metadata.gz: 498b715ab90033753bdf77832bb83bd477b626b3
4
+ data.tar.gz: bc8c1ff0e6e118dc9769930ed512f6495525b0cc
5
5
  SHA512:
6
- metadata.gz: c27d60cc65d468d48134ea73c0ed3c7b16b5802ed0e60519bc425b2501dc0aaa14418f455b07e63322ec79300926efeef1e421d4134441a677884618ed9ec04b
7
- data.tar.gz: 80a037ea6926c3262181c98a779a40213db7c0d6ed12c2d91731696f14cfebe4c31859a0c430c32a8cd797c73bf3a5f963aa4e748eead72543ec564b22bad645
6
+ metadata.gz: 5973918142232a714a0a9314d074e746d6de635467f4f0266d7dc8d1e8da994f5cb9043de202ea2875de741448c53b551e5b81761872ab29c73047ec3ccae18b
7
+ data.tar.gz: 22e3d4bc12c54181f52350240f2a9e73810da4ea078adcc2cba509083ac22132f1f5682ea8a228699f8bf4cf04ea7d9af7d119ade9adb41402132fba21d1b0ed
@@ -1,5 +1,5 @@
1
1
  module EmberSimpleAuth
2
2
  module Rails
3
- VERSION = "0.6.0"
3
+ VERSION = "0.6.1"
4
4
  end
5
5
  end
@@ -103,7 +103,7 @@ define("simple-auth/authenticators/base",
103
103
  import AuthenticationControllerMixin from 'simple-auth/mixins/authentication-controller-mixin';
104
104
 
105
105
  export default Ember.Controller.extend(AuthenticationControllerMixin, {
106
- authenticatorFactory: 'authenticator:custom'
106
+ authenticator: 'authenticator:custom'
107
107
  });
108
108
  ```
109
109
 
@@ -325,25 +325,25 @@ define("simple-auth/configuration",
325
325
  when the application does not interact with a server that requires
326
326
  authorized requests, no auzthorizer is needed.
327
327
 
328
- @property sessionPropertyName
328
+ @property authorizer
329
329
  @readOnly
330
330
  @static
331
331
  @type String
332
332
  @default null
333
333
  */
334
- authorizerFactory: null,
334
+ authorizer: null,
335
335
 
336
336
  /**
337
337
  The store factory to use as it is registered with Ember's container, see
338
338
  [Ember's API docs](http://emberjs.com/api/classes/Ember.Application.html#method_register).
339
339
 
340
- @property storeFactory
340
+ @property store
341
341
  @readOnly
342
342
  @static
343
343
  @type String
344
344
  @default simple-auth-session-store:local-storage
345
345
  */
346
- storeFactory: 'simple-auth-session-store:local-storage',
346
+ store: 'simple-auth-session-store:local-storage',
347
347
 
348
348
  /**
349
349
  Ember Simple Auth will never authorize requests going to a different origin
@@ -375,8 +375,8 @@ define("simple-auth/configuration",
375
375
  this.authenticationRoute = globalConfig.authenticationRoute || this.authenticationRoute;
376
376
  this.routeAfterAuthentication = globalConfig.routeAfterAuthentication || this.routeAfterAuthentication;
377
377
  this.sessionPropertyName = globalConfig.sessionPropertyName || this.sessionPropertyName;
378
- this.authorizerFactory = globalConfig.authorizerFactory || this.authorizerFactory;
379
- this.storeFactory = globalConfig.storeFactory || this.storeFactory;
378
+ this.authorizer = globalConfig.authorizer || this.authorizer;
379
+ this.store = globalConfig.store || this.store;
380
380
  this.applicationRootUrl = container.lookup('router:main').get('rootURL') || '/';
381
381
  }
382
382
  };
@@ -696,7 +696,7 @@ define("simple-auth/mixins/authentication-controller-mixin",
696
696
  [`Configuration.authenticationRoute`](#SimpleAuth-Configuration-authenticationRoute).
697
697
  It provides the `authenticate` action that will authenticate the session with
698
698
  the configured authenticator (see
699
- [`AuthenticationControllerMixin#authenticatorFactory`](#SimpleAuth-AuthenticationControllerMixin-authenticatorFactory)).
699
+ [`AuthenticationControllerMixin#authenticator`](#SimpleAuth-AuthenticationControllerMixin-authenticator)).
700
700
 
701
701
  @class AuthenticationControllerMixin
702
702
  @namespace SimpleAuth
@@ -705,28 +705,30 @@ define("simple-auth/mixins/authentication-controller-mixin",
705
705
  */
706
706
  __exports__["default"] = Ember.Mixin.create({
707
707
  /**
708
- The authenticator used to authenticate the session.
708
+ The authenticator factory to use as it is registered with Ember's
709
+ container, see
710
+ [Ember's API docs](http://emberjs.com/api/classes/Ember.Application.html#method_register).
709
711
 
710
- @property authenticatorFactory
712
+ @property authenticator
711
713
  @type String
712
714
  @default null
713
715
  */
714
- authenticatorFactory: null,
716
+ authenticator: null,
715
717
 
716
718
  actions: {
717
719
  /**
718
720
  This action will authenticate the session with the configured
719
721
  authenticator (see
720
- [`AuthenticationControllerMixin#authenticatorFactory`](#SimpleAuth-AuthenticationControllerMixin-authenticatorFactory),
722
+ [`AuthenticationControllerMixin#authenticator`](#SimpleAuth-AuthenticationControllerMixin-authenticator),
721
723
  [`Session#authenticate`](#SimpleAuth-Session-authenticate)).
722
724
 
723
725
  @method actions.authenticate
724
726
  @param {Object} options Any options the authenticator needs to authenticate the session
725
727
  */
726
728
  authenticate: function(options) {
727
- var authenticatorFactory = this.get('authenticatorFactory');
728
- Ember.assert('AuthenticationControllerMixin/LoginControllerMixin require the authenticatorFactory property to be set on the controller', !Ember.isEmpty(authenticatorFactory));
729
- return this.get(Configuration.sessionPropertyName).authenticate(this.get('authenticatorFactory'), options);
729
+ var authenticator = this.get('authenticator');
730
+ Ember.assert('AuthenticationControllerMixin/LoginControllerMixin require the authenticator property to be set on the controller', !Ember.isEmpty(authenticator));
731
+ return this.get(Configuration.sessionPropertyName).authenticate(this.get('authenticator'), options);
730
732
  }
731
733
  }
732
734
  });
@@ -775,7 +777,7 @@ define("simple-auth/mixins/login-controller-mixin",
775
777
  /**
776
778
  This action will authenticate the session with the configured
777
779
  authenticator (see
778
- [AuthenticationControllerMixin#authenticatorFactory](#SimpleAuth-Authentication-authenticatorFactory))
780
+ [AuthenticationControllerMixin#authenticator](#SimpleAuth-Authentication-authenticator))
779
781
  if both `identification` and `password` are non-empty. It passes both
780
782
  values to the authenticator.
781
783
 
@@ -820,7 +822,7 @@ define("simple-auth/session",
820
822
  authenticator needs to authenticate the session:
821
823
 
822
824
  ```javascript
823
- this.get('session').authenticate('authenticatorFactory', { some: 'option' }).then(function() {
825
+ this.get('session').authenticate('authenticator:custom', { some: 'option' }).then(function() {
824
826
  // authentication was successful
825
827
  }, function() {
826
828
  // authentication failed
@@ -889,15 +891,17 @@ define("simple-auth/session",
889
891
  */
890
892
 
891
893
  /**
892
- The authenticator factory used to authenticate the session. This is only
893
- set when the session is currently authenticated.
894
+ The authenticator factory to use as it is registered with Ember's
895
+ container, see
896
+ [Ember's API docs](http://emberjs.com/api/classes/Ember.Application.html#method_register).
897
+ This is only set when the session is currently authenticated.
894
898
 
895
- @property authenticatorFactory
899
+ @property authenticator
896
900
  @type String
897
901
  @readOnly
898
902
  @default null
899
903
  */
900
- authenticatorFactory: null,
904
+ authenticator: null,
901
905
  /**
902
906
  The store used to persist session properties.
903
907
 
@@ -948,16 +952,16 @@ define("simple-auth/session",
948
952
  unauthenticated.
949
953
 
950
954
  @method authenticate
951
- @param {String} authenticatorFactory The authenticator 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)
955
+ @param {String} authenticator The authenticator 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)
952
956
  @param {Object} options The options to pass to the authenticator; depending on the type of authenticator these might be a set of credentials, a Facebook OAuth Token, etc.
953
957
  @return {Ember.RSVP.Promise} A promise that resolves when the session was authenticated successfully
954
958
  */
955
- authenticate: function(authenticatorFactory, options) {
956
- Ember.assert('Session#authenticate requires the authenticator factory to be specified, was ' + authenticatorFactory, !Ember.isEmpty(authenticatorFactory));
959
+ authenticate: function(authenticator, options) {
960
+ Ember.assert('Session#authenticate requires the authenticator factory to be specified, was ' + authenticator, !Ember.isEmpty(authenticator));
957
961
  var _this = this;
958
962
  return new Ember.RSVP.Promise(function(resolve, reject) {
959
- _this.container.lookup(authenticatorFactory).authenticate(options).then(function(content) {
960
- _this.setup(authenticatorFactory, content, true);
963
+ _this.container.lookup(authenticator).authenticate(options).then(function(content) {
964
+ _this.setup(authenticator, content, true);
961
965
  resolve();
962
966
  }, function(error) {
963
967
  _this.clear();
@@ -970,9 +974,9 @@ define("simple-auth/session",
970
974
  /**
971
975
  Invalidates the session with the authenticator it is currently
972
976
  authenticated with (see
973
- [`Session#authenticatorFactory`](#SimpleAuth-Session-authenticatorFactory)).
974
- __This invokes the authenticator's `invalidate` method and handles the
975
- returned promise accordingly__ (see
977
+ [`Session#authenticator`](#SimpleAuth-Session-authenticator)). __This
978
+ invokes the authenticator's `invalidate` method and handles the returned
979
+ promise accordingly__ (see
976
980
  [`Authenticators.Base#invalidate`](#SimpleAuth-Authenticators-Base-invalidate)).
977
981
 
978
982
  __This method returns a promise itself. A resolving promise indicates that
@@ -988,7 +992,7 @@ define("simple-auth/session",
988
992
  invalidate: function() {
989
993
  var _this = this;
990
994
  return new Ember.RSVP.Promise(function(resolve, reject) {
991
- var authenticator = _this.container.lookup(_this.authenticatorFactory);
995
+ var authenticator = _this.container.lookup(_this.authenticator);
992
996
  authenticator.invalidate(_this.content).then(function() {
993
997
  authenticator.off('sessionDataUpdated');
994
998
  _this.clear(true);
@@ -1007,12 +1011,12 @@ define("simple-auth/session",
1007
1011
  restore: function() {
1008
1012
  var _this = this;
1009
1013
  return new Ember.RSVP.Promise(function(resolve, reject) {
1010
- var restoredContent = _this.store.restore();
1011
- var authenticatorFactory = restoredContent.authenticatorFactory;
1012
- if (!!authenticatorFactory) {
1013
- delete restoredContent.authenticatorFactory;
1014
- _this.container.lookup(authenticatorFactory).restore(restoredContent).then(function(content) {
1015
- _this.setup(authenticatorFactory, content);
1014
+ var restoredContent = _this.store.restore();
1015
+ var authenticator = restoredContent.authenticator;
1016
+ if (!!authenticator) {
1017
+ delete restoredContent.authenticator;
1018
+ _this.container.lookup(authenticator).restore(restoredContent).then(function(content) {
1019
+ _this.setup(authenticator, content);
1016
1020
  resolve();
1017
1021
  }, function() {
1018
1022
  _this.store.clear();
@@ -1029,16 +1033,16 @@ define("simple-auth/session",
1029
1033
  @method setup
1030
1034
  @private
1031
1035
  */
1032
- setup: function(authenticatorFactory, content, trigger) {
1036
+ setup: function(authenticator, content, trigger) {
1033
1037
  trigger = !!trigger && !this.get('isAuthenticated');
1034
1038
  this.beginPropertyChanges();
1035
1039
  this.setProperties({
1036
- isAuthenticated: true,
1037
- authenticatorFactory: authenticatorFactory,
1038
- content: content
1040
+ isAuthenticated: true,
1041
+ authenticator: authenticator,
1042
+ content: content
1039
1043
  });
1040
1044
  this.bindToAuthenticatorEvents();
1041
- var data = Ember.$.extend({ authenticatorFactory: authenticatorFactory }, this.content);
1045
+ var data = Ember.$.extend({ authenticator: authenticator }, this.content);
1042
1046
  this.store.replace(data);
1043
1047
  this.endPropertyChanges();
1044
1048
  if (trigger) {
@@ -1054,9 +1058,9 @@ define("simple-auth/session",
1054
1058
  trigger = !!trigger && this.get('isAuthenticated');
1055
1059
  this.beginPropertyChanges();
1056
1060
  this.setProperties({
1057
- isAuthenticated: false,
1058
- authenticatorFactory: null,
1059
- content: {}
1061
+ isAuthenticated: false,
1062
+ authenticator: null,
1063
+ content: {}
1060
1064
  });
1061
1065
  this.store.clear();
1062
1066
  this.endPropertyChanges();
@@ -1071,11 +1075,11 @@ define("simple-auth/session",
1071
1075
  */
1072
1076
  bindToAuthenticatorEvents: function() {
1073
1077
  var _this = this;
1074
- var authenticator = this.container.lookup(this.authenticatorFactory);
1078
+ var authenticator = this.container.lookup(this.authenticator);
1075
1079
  authenticator.off('sessionDataUpdated');
1076
1080
  authenticator.off('sessionDataInvalidated');
1077
1081
  authenticator.on('sessionDataUpdated', function(content) {
1078
- _this.setup(_this.authenticatorFactory, content);
1082
+ _this.setup(_this.authenticator, content);
1079
1083
  });
1080
1084
  authenticator.on('sessionDataInvalidated', function(content) {
1081
1085
  _this.clear(true);
@@ -1089,11 +1093,11 @@ define("simple-auth/session",
1089
1093
  bindToStoreEvents: function() {
1090
1094
  var _this = this;
1091
1095
  this.store.on('sessionDataUpdated', function(content) {
1092
- var authenticatorFactory = content.authenticatorFactory;
1093
- if (!!authenticatorFactory) {
1094
- delete content.authenticatorFactory;
1095
- _this.container.lookup(authenticatorFactory).restore(content).then(function(content) {
1096
- _this.setup(authenticatorFactory, content, true);
1096
+ var authenticator = content.authenticator;
1097
+ if (!!authenticator) {
1098
+ delete content.authenticator;
1099
+ _this.container.lookup(authenticator).restore(content).then(function(content) {
1100
+ _this.setup(authenticator, content, true);
1097
1101
  }, function() {
1098
1102
  _this.clear(true);
1099
1103
  });
@@ -1155,7 +1159,7 @@ define("simple-auth/setup",
1155
1159
  application.deferReadiness();
1156
1160
  registerStores(container);
1157
1161
 
1158
- var store = container.lookup(Configuration.storeFactory);
1162
+ var store = container.lookup(Configuration.store);
1159
1163
  var session = Session.create({ store: store, container: container });
1160
1164
  crossOriginWhitelist = Ember.A(Configuration.crossOriginWhitelist).map(function(origin) {
1161
1165
  return extractLocationOrigin(origin);
@@ -1166,8 +1170,8 @@ define("simple-auth/setup",
1166
1170
  container.injection(component, Configuration.sessionPropertyName, 'simple-auth-session:main');
1167
1171
  });
1168
1172
 
1169
- if (!Ember.isEmpty(Configuration.authorizerFactory)) {
1170
- var authorizer = container.lookup(Configuration.authorizerFactory);
1173
+ if (!Ember.isEmpty(Configuration.authorizer)) {
1174
+ var authorizer = container.lookup(Configuration.authorizer);
1171
1175
  if (!!authorizer) {
1172
1176
  authorizer.set('session', session);
1173
1177
  Ember.$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
@@ -1212,7 +1216,7 @@ define("simple-auth/stores/base",
1212
1216
  ```js
1213
1217
  window.ENV = window.ENV || {};
1214
1218
  window.ENV['simple-auth'] = {
1215
- storeFactory: 'simple-auth-session-store:local-storage'
1219
+ store: 'simple-auth-session-store:local-storage'
1216
1220
  }
1217
1221
  ```
1218
1222
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember_simple_auth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - frederik dudzik