monban 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acd6663ce53c6af5ad43f138da55020b087cea3e
4
- data.tar.gz: 048b50dc5d4f0fc2bec708a5d25c50123cb865e6
3
+ metadata.gz: 608af56fdd4c89a460ac08545532bc6a39d47cd6
4
+ data.tar.gz: 8e41b690802c8cbec996c27937db68b351eaa2a5
5
5
  SHA512:
6
- metadata.gz: 9c9a8140dfa2b6c5c04aa3d4513885d8b319b30edc2852d5ca68b3d87c8d5c6d580b422650ba2b3ae1508280690ecc5100eb7f767c3316386bb118a399b844f8
7
- data.tar.gz: 75e929873ffa7175559ffc0779a5366f992d157353d1ce735f3db32a6b9f03802707951ed1c0203e56ce6f50b4885d87659fd07ba42fbd9eaaadaa362be0a0ca
6
+ metadata.gz: 8245fdd7c1bf279332dec0314ade04e10f2ef9e7ff27d7d194c7d651c4608a5157ef4a26bc1e19dcaf83e3cafc49eb2e93e8631e4a2a394431ad74b25b308184
7
+ data.tar.gz: e582bf6d7de38f0d25f0f0a0d583439706707685e18bf79433a2157604d16d32756b177d3ef120d5991cf0677b68807aa064387335c65de6103a141fd2399324
data/NEWS.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.3.0
2
+ * Warden serialization is now configurable
3
+
1
4
  == 0.2.1
2
5
  * Updated documentation for test helpers
3
6
  * Updated documentation for using monban in console
@@ -11,6 +11,7 @@ module Monban
11
11
  attr_accessor :creation_method, :find_method
12
12
  attr_accessor :no_login_handler, :no_login_redirect
13
13
  attr_accessor :authentication_strategy
14
+ attr_accessor :warden_serialize_into_session, :warden_serialize_from_session
14
15
 
15
16
  attr_writer :user_class
16
17
 
@@ -19,7 +20,7 @@ module Monban
19
20
  setup_token_hashing
20
21
  setup_notices
21
22
  setup_services
22
- setup_warden_requirements
23
+ setup_warden
23
24
  end
24
25
 
25
26
  # Default creation method. Can be overriden via {Monban.configure}
@@ -108,9 +109,19 @@ module Monban
108
109
  @password_reset_service = Monban::Services::PasswordReset
109
110
  end
110
111
 
112
+ def setup_warden
113
+ setup_warden_requirements
114
+ setup_warden_serialization
115
+ end
116
+
111
117
  def setup_warden_requirements
112
118
  @failure_app = Monban::FailureApp
113
119
  @authentication_strategy = Monban::Strategies::PasswordStrategy
114
120
  end
121
+
122
+ def setup_warden_serialization
123
+ @warden_serialize_into_session = -> (user) { user.id }
124
+ @warden_serialize_from_session = -> (id) { Monban.config.user_class.find_by(id: id) }
125
+ end
115
126
  end
116
127
  end
@@ -1,4 +1,4 @@
1
1
  module Monban
2
- # 0.2.1
3
- VERSION = "0.2.1"
2
+ # 0.3.0
3
+ VERSION = "0.3.0"
4
4
  end
@@ -22,13 +22,8 @@ module Monban
22
22
  attr_reader :warden_config
23
23
 
24
24
  def setup_warden_manager
25
- Warden::Manager.serialize_into_session do |user|
26
- user.id
27
- end
28
-
29
- Warden::Manager.serialize_from_session do |id|
30
- Monban.config.user_class.find_by(id: id)
31
- end
25
+ Warden::Manager.serialize_into_session(&serialize_into_session_method)
26
+ Warden::Manager.serialize_from_session(&serialize_from_session_method)
32
27
  end
33
28
 
34
29
  def setup_warden_strategies
@@ -40,5 +35,13 @@ module Monban
40
35
  config.failure_app = Monban.config.failure_app
41
36
  end
42
37
  end
38
+
39
+ def serialize_into_session_method
40
+ Monban.config.warden_serialize_into_session
41
+ end
42
+
43
+ def serialize_from_session_method
44
+ Monban.config.warden_serialize_from_session
45
+ end
43
46
  end
44
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monban
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - halogenandtoast
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-19 00:00:00.000000000 Z
12
+ date: 2016-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -254,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  version: '0'
255
255
  requirements: []
256
256
  rubyforge_project:
257
- rubygems_version: 2.4.5
257
+ rubygems_version: 2.4.5.1
258
258
  signing_key:
259
259
  specification_version: 4
260
260
  summary: Making rails authentication as simple as possible