百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

padrino-warden

> 编程语言
开源

一个 Padrino 模块,可通过 Warden 为您的 Padrino 应用程序提供身份验证

99 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个 Padrino 模块,可通过 Warden 为您的 Padrino 应用程序提供身份验证

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

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