Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

padrino-warden

> 编程语言
Open source

A Padrino module that provides authentication for your Padrino application through Warden

99 stars0 likes0 views
WebsiteGitHub

About

A Padrino module that provides authentication for your Padrino application through Warden

padrino-warden

A Padrino module that provides authentication for your Padrino application through Warden.

Most of the code was adapted from sinatra_warden.

Usage

Currently padrino-warden uses +password+ as default authentication strategy. If you wish to change that consult Warden.

ruby
class SampleApp 

After login you can fiddle with *current\_user* for anything you need.

## Multi Sub-Apps

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

This will mount the sessions controller on it:

/user/sessions/...

You OtherApps:

ruby
register Padrino::Warden::Helpers

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.

Configuration

There are some options you can override to customize padrino-warden to your needs. Please consult the wiki page to see all of them.

Overriding warden manager defaults

ruby
class SampleApp < Padrino::Application
  register Padrino::Warden

  Warden::Strategies.add(:token) do
    def valid?
      params["token"]
    end

    def authenticate!
      ...
    end
  end

  set :warden_config do |manager|
    manager.scope_defaults :api, strategies: [:token], store: false
  end
end

Changelog

Changelog is available on the wiki.

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 future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Contributors

  • Dotan Nahum (http://github.com/jondot)
  • Michał Zając (http://github.com/Quintasan)

For sinatra_warden, thanks to: Justin Smestad, Daniel Neighman and Shane Hanna.

Copyright

Copyright (c) 2010 Dotan Nahum (jondot). See LICENSE for details. Copyright (c) 2015 Michał Zając (Quintasan). See LICENSE for details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言