Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clarified the readme and fixed a configuration issue across apps
  • Loading branch information
FeeJai committed Feb 22, 2015
1 parent 9d15b87 commit bc19665
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions README.md
Expand Up @@ -58,7 +58,9 @@ After login you can fiddle with *current\_user* for anything you need.

## Multi Sub-Apps

You UserApp(/user):
padrino-warden can be used across multiple apps in one project. You need to have one UserApp which handles logins and logouts.

Add this to your UserApp(/user):

```ruby
register Padrino::Warden
Expand All @@ -74,7 +76,17 @@ You OtherApps:
register Padrino::Warden::Helpers
```

But you must apply the same options in your UserApp.
Configure warden globally within config/apps.rb. Don't forget to tell warden about the UserApp:

```ruby
Padrino.configure_apps do
...
set :warden_failure_app, UserApp
end
```

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.


## Overriding warden manager defaults

Expand All @@ -99,7 +111,7 @@ end
```

## Note on Patches/Pull Requests

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
Expand Down
2 changes: 1 addition & 1 deletion lib/padrino/warden.rb
Expand Up @@ -31,7 +31,7 @@ def self.registered(app, register_controller = true)
app.set :auth_use_oauth, false
app.set :default_strategies, [:password] unless app.respond_to?(:default_strategies)

app.set :warden_failure_app, app
app.set :warden_failure_app, app unless app.respond_to?(:warden_failure_app)
app.set :warden_default_scope, :session
app.set(:warden_config) { |manager| nil }
app.use ::Warden::Manager do |manager|
Expand Down

0 comments on commit bc19665

Please sign in to comment.