rails_warden 0.5.8 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +2 -2
- data/README.md +41 -0
- data/lib/rails_warden.rb +21 -6
- metadata +18 -17
- data/README.textile +0 -42
- data/TODO +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 350d12501ae6763cb927d33aeeb522ec31275b3c10c23e591aa0517964ec72c2
|
4
|
+
data.tar.gz: fb0aaf21f734dfb8b0d877df045004e5e797588a001c59d396ea9ff6c51dc60c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bdb6ea4cebb61007118596441c47c918fd51ea85838fa89a5fed50b2799b38bb9f91f08a1eb51e8fffdaf80725880114029700b6d6690734c5909228f64577f
|
7
|
+
data.tar.gz: 61898c226690c8b24f09325e0727717bc3142a503efb3133ee35e8938fec0b2c502658d2d92bdfe1e61b0996066f5f3d2bf4d20f9334a72d135bb874d9e7b620
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2009 Daniel Neighman
|
1
|
+
Copyright (c) 2009-2017 Daniel Neighman
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Rails Warden
|
2
|
+
|
3
|
+
|
4
|
+
This application adds some nice helpers on-top of the base [Warden](https://github.com/hassox/warden) Rack layer. It aims to make Warden easier to use in Rails-based environments without something as heavy-weight as devise.
|
5
|
+
|
6
|
+
Require the gem:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'rails_warden'
|
10
|
+
```
|
11
|
+
|
12
|
+
Setup an initializer:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
# config/initializers/warden.rb
|
16
|
+
|
17
|
+
Rails.configuration.middleware.use RailsWarden::Manager do |manager|
|
18
|
+
manager.default_strategies :my_strategy
|
19
|
+
manager.failure_app = LoginController
|
20
|
+
end
|
21
|
+
|
22
|
+
# Setup Session Serialization
|
23
|
+
class Warden::SessionSerializer
|
24
|
+
def serialize(record)
|
25
|
+
[record.class.name, record.id]
|
26
|
+
end
|
27
|
+
|
28
|
+
def deserialize(keys)
|
29
|
+
klass, id = keys
|
30
|
+
klass.find(:first, :conditions => { :id => id })
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Declare your strategies here, or require a file that defines one.
|
35
|
+
#Warden::Strategies.add(:my_strategy) do
|
36
|
+
# def authenticate!
|
37
|
+
# # do stuff
|
38
|
+
# end
|
39
|
+
#end
|
40
|
+
|
41
|
+
```
|
data/lib/rails_warden.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'warden'
|
3
3
|
require 'active_support'
|
4
4
|
|
5
|
-
|
6
5
|
$:.unshift File.expand_path(File.dirname(__FILE__))
|
7
6
|
require "rails_warden/manager"
|
8
7
|
require "rails_warden/rails_settings"
|
@@ -89,13 +88,29 @@ if !defined?(Rails::Railtie)
|
|
89
88
|
else
|
90
89
|
class RailsWarden::Railtie < Rails::Railtie
|
91
90
|
include_block = Proc.new {
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
|
92
|
+
ActiveSupport.on_load(:action_controller) do
|
93
|
+
::ActionController::Base.class_eval do
|
94
|
+
include RailsWarden::Mixins::HelperMethods
|
95
|
+
include RailsWarden::Mixins::ControllerOnlyMethods
|
96
|
+
end
|
97
|
+
if defined? ::ActionController::API
|
98
|
+
::ActionController::API.class_eval do
|
99
|
+
include RailsWarden::Mixins::HelperMethods
|
100
|
+
|
101
|
+
if defined? helper
|
102
|
+
helper RailsWarden::Mixins::ControllerOnlyMethods
|
103
|
+
else
|
104
|
+
include RailsWarden::Mixins::ControllerOnlyMethods
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
95
108
|
end
|
96
109
|
|
97
|
-
|
98
|
-
|
110
|
+
ActiveSupport.on_load(:action_view) do
|
111
|
+
::ActionView::Base.class_eval do
|
112
|
+
include RailsWarden::Mixins::HelperMethods
|
113
|
+
end
|
99
114
|
end
|
100
115
|
}
|
101
116
|
|
metadata
CHANGED
@@ -1,45 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_warden
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Neighman
|
8
|
+
- Justin Smestad
|
9
|
+
- Whitney Smestad
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: warden
|
15
17
|
requirement: !ruby/object:Gem::Requirement
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ">="
|
18
20
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
21
|
+
version: 1.2.0
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
|
-
- -
|
26
|
+
- - ">="
|
25
27
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
27
|
-
description: A gem that provides
|
28
|
+
version: 1.2.0
|
29
|
+
description: A gem that provides authentication Rails helpers when using Warden for
|
30
|
+
authentication
|
28
31
|
email: has.sox@gmail.com
|
29
32
|
executables: []
|
30
33
|
extensions: []
|
31
34
|
extra_rdoc_files:
|
32
35
|
- LICENSE
|
33
|
-
- README.
|
34
|
-
- TODO
|
36
|
+
- README.md
|
35
37
|
files:
|
38
|
+
- LICENSE
|
39
|
+
- README.md
|
40
|
+
- lib/rails_warden.rb
|
36
41
|
- lib/rails_warden/controller_mixin.rb
|
37
42
|
- lib/rails_warden/manager.rb
|
38
43
|
- lib/rails_warden/rails_settings.rb
|
39
|
-
- lib/rails_warden.rb
|
40
|
-
- LICENSE
|
41
|
-
- README.textile
|
42
|
-
- TODO
|
43
44
|
homepage: https://github.com/hassox/rails_warden
|
44
45
|
licenses: []
|
45
46
|
metadata: {}
|
@@ -49,18 +50,18 @@ require_paths:
|
|
49
50
|
- lib
|
50
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
52
|
requirements:
|
52
|
-
- -
|
53
|
+
- - ">="
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '0'
|
55
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
57
|
requirements:
|
57
|
-
- -
|
58
|
+
- - ">="
|
58
59
|
- !ruby/object:Gem::Version
|
59
60
|
version: '0'
|
60
61
|
requirements: []
|
61
62
|
rubyforge_project:
|
62
|
-
rubygems_version: 2.
|
63
|
+
rubygems_version: 2.7.6
|
63
64
|
signing_key:
|
64
65
|
specification_version: 4
|
65
|
-
summary: A gem that provides
|
66
|
+
summary: A gem that provides authentication Rails helpers when using Warden for authentication
|
66
67
|
test_files: []
|
data/README.textile
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
h1. Rails Warden
|
2
|
-
|
3
|
-
Provides authentication for Rails applications via the "Warden":http://github.com/hassox/warden Rack authentication framework.
|
4
|
-
|
5
|
-
Require the gem:
|
6
|
-
|
7
|
-
config/environment.rb
|
8
|
-
|
9
|
-
<pre><code>
|
10
|
-
config.gem "rails_warden"
|
11
|
-
</code></pre>
|
12
|
-
|
13
|
-
Setup an initializer:
|
14
|
-
|
15
|
-
config/initializers/warden.rb
|
16
|
-
|
17
|
-
<pre><code>
|
18
|
-
Rails.configuration.middleware.use RailsWarden::Manager do |manager|
|
19
|
-
manager.default_strategies :my_strategy
|
20
|
-
manager.failure_app = LoginController
|
21
|
-
end
|
22
|
-
|
23
|
-
# Setup Session Serialization
|
24
|
-
class Warden::SessionSerializer
|
25
|
-
def serialize(record)
|
26
|
-
[record.class.name, record.id]
|
27
|
-
end
|
28
|
-
|
29
|
-
def deserialize(keys)
|
30
|
-
klass, id = keys
|
31
|
-
klass.find(:first, :conditions => { :id => id })
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Declare your strategies here
|
36
|
-
#Warden::Strategies.add(:my_strategy) do
|
37
|
-
# def authenticate!
|
38
|
-
# # do stuff
|
39
|
-
# end
|
40
|
-
#end
|
41
|
-
|
42
|
-
</code></pre>
|