padrino-warden 0.20.0 → 0.20.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 +4 -4
- data/README.md +18 -3
- data/lib/padrino/warden.rb +6 -4
- data/lib/padrino/warden/controller.rb +1 -1
- data/lib/padrino/warden/helpers.rb +6 -0
- data/lib/padrino/warden/version.rb +1 -1
- data/padrino-warden.gemspec +2 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee593e6a245f5c03c36bb809d7f3189a88821fc4
|
4
|
+
data.tar.gz: 583fe62715c0ba71194dc6c42ac0fc6b923fc1ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5729ac8622e272740ce8e26c1155ffc83dffec42c03ec6bf402eee878bf281e9c288ae93e8d2e1016423f806ae8c2f12d56a3184b3e651ddf64a423f6d264eb
|
7
|
+
data.tar.gz: 047e444a3011ac5e76384b393198e7beb73ab1ea104acdcfc5c6a401156db53fb50bfc099b92d8eb1f83e979e1865e0f8e079520380ae530c6362fa6864ebd16
|
data/README.md
CHANGED
@@ -4,6 +4,9 @@ A [Padrino](http://github.com/padrino/padrino-framework) module that provides au
|
|
4
4
|
|
5
5
|
Most of the code was adapted from [sinatra\_warden](http://github.com/jsmestad/sinatra_warden).
|
6
6
|
|
7
|
+
[](http://badge.fury.io/rb/padrino-warden)
|
9
|
+
|
7
10
|
## Usage
|
8
11
|
|
9
12
|
Currently padrino-warden uses +password+ as default authentication strategy. If you wish to change that consult
|
@@ -55,7 +58,9 @@ After login you can fiddle with *current\_user* for anything you need.
|
|
55
58
|
|
56
59
|
## Multi Sub-Apps
|
57
60
|
|
58
|
-
You UserApp
|
61
|
+
padrino-warden can be used across multiple apps in one project. You need to have one UserApp which handles logins and logouts.
|
62
|
+
|
63
|
+
Add this to your UserApp(/user):
|
59
64
|
|
60
65
|
```ruby
|
61
66
|
register Padrino::Warden
|
@@ -71,7 +76,17 @@ You OtherApps:
|
|
71
76
|
register Padrino::Warden::Helpers
|
72
77
|
```
|
73
78
|
|
74
|
-
|
79
|
+
Configure warden globally within config/apps.rb. Don't forget to tell warden about the UserApp:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
Padrino.configure_apps do
|
83
|
+
...
|
84
|
+
set :warden_failure_app, UserApp
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
Your UserApp needs to be mounted first in Padrino! Cascading routes from the UserApp can cause exceptions, so don't use an app mounted to the root path ('/') as UserApp.
|
89
|
+
|
75
90
|
|
76
91
|
## Overriding warden manager defaults
|
77
92
|
|
@@ -96,7 +111,7 @@ end
|
|
96
111
|
```
|
97
112
|
|
98
113
|
## Note on Patches/Pull Requests
|
99
|
-
|
114
|
+
|
100
115
|
* Fork the project.
|
101
116
|
* Make your feature addition or bug fix.
|
102
117
|
* Add tests for it. This is important so I don't break it in a
|
data/lib/padrino/warden.rb
CHANGED
@@ -8,9 +8,9 @@ require 'padrino/warden/helpers'
|
|
8
8
|
|
9
9
|
module Padrino
|
10
10
|
module Warden
|
11
|
-
def self.registered(app)
|
11
|
+
def self.registered(app, register_controller = true)
|
12
12
|
# Enable Sessions
|
13
|
-
app.set :sessions, true
|
13
|
+
app.set :sessions, true unless app.sessions
|
14
14
|
app.set :auth_failure_path, '/'
|
15
15
|
app.set :auth_success_path, '/'
|
16
16
|
|
@@ -31,7 +31,7 @@ module Padrino
|
|
31
31
|
app.set :auth_use_oauth, false
|
32
32
|
app.set :default_strategies, [:password] unless app.respond_to?(:default_strategies)
|
33
33
|
|
34
|
-
app.set :warden_failure_app, app
|
34
|
+
app.set :warden_failure_app, app unless app.respond_to?(:warden_failure_app)
|
35
35
|
app.set :warden_default_scope, :session
|
36
36
|
app.set(:warden_config) { |manager| nil }
|
37
37
|
app.use ::Warden::Manager do |manager|
|
@@ -41,7 +41,9 @@ module Padrino
|
|
41
41
|
app.warden_config manager
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
if register_controller
|
45
|
+
Controller.registered app
|
46
|
+
end
|
45
47
|
app.helpers Helpers
|
46
48
|
end
|
47
49
|
end
|
@@ -25,7 +25,7 @@ module Padrino
|
|
25
25
|
post :login , map: app.auth_login_path do
|
26
26
|
authenticate
|
27
27
|
flash[:success] = settings.auth_success_message if flash
|
28
|
-
redirect settings.auth_use_referrer && session[:return_to] ? session.delete(:return_to) :
|
28
|
+
redirect settings.auth_use_referrer && session[:return_to] ? session.delete(:return_to) :
|
29
29
|
settings.auth_success_path
|
30
30
|
end
|
31
31
|
|
@@ -29,6 +29,7 @@ module Padrino
|
|
29
29
|
#
|
30
30
|
# @param [Symbol] the session scope to terminate
|
31
31
|
def logout(scopes=nil)
|
32
|
+
authenticated?
|
32
33
|
scopes ? warden.logout(scopes) : warden.logout
|
33
34
|
end
|
34
35
|
|
@@ -50,6 +51,11 @@ module Padrino
|
|
50
51
|
warden.set_user(new_user, opts)
|
51
52
|
end
|
52
53
|
alias_method :current_user=, :user=
|
54
|
+
|
55
|
+
# Register the helpers directly without the controller (useful for MultiApp environments)
|
56
|
+
def self.registered(app)
|
57
|
+
Padrino::Warden.registered(app, false)
|
58
|
+
end
|
53
59
|
end # helpers
|
54
60
|
end # Warden
|
55
61
|
end # Padrino
|
data/padrino-warden.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'padrino/warden/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "padrino-warden"
|
8
8
|
spec.version = Padrino::Warden::VERSION
|
9
|
-
spec.authors = ["Dotan Nahum"]
|
10
|
-
spec.email = ["dotan@paracode.com"]
|
9
|
+
spec.authors = ["Dotan Nahum", "Michał Zając"]
|
10
|
+
spec.email = ["dotan@paracode.com", "padrino-warden@quintasan.pl"]
|
11
11
|
spec.description = %q{basic helpers and authentication methods for using warden with padrino also providing some hooks into Rack::Flash}
|
12
12
|
spec.summary = %q{authentication system for using warden with Padrino, adopted from sinatra_warden}
|
13
13
|
spec.homepage = "https://github.com/jondot/padrino-warden"
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-warden
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dotan Nahum
|
8
|
+
- Michał Zając
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: warden
|
@@ -56,6 +57,7 @@ description: basic helpers and authentication methods for using warden with padr
|
|
56
57
|
also providing some hooks into Rack::Flash
|
57
58
|
email:
|
58
59
|
- dotan@paracode.com
|
60
|
+
- padrino-warden@quintasan.pl
|
59
61
|
executables: []
|
60
62
|
extensions: []
|
61
63
|
extra_rdoc_files: []
|
@@ -91,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
93
|
version: '0'
|
92
94
|
requirements: []
|
93
95
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.4.4
|
95
97
|
signing_key:
|
96
98
|
specification_version: 4
|
97
99
|
summary: authentication system for using warden with Padrino, adopted from sinatra_warden
|