Sha256: 840651d5fb17777d30aab06569da3b21b03b16f595791b0be0384ca91dcc72f6
Contents?: true
Size: 1.91 KB
Versions: 1
Compression:
Stored size: 1.91 KB
Contents
== Welcome to Hadley Hadley is rack middleware built on top of the excellent security authentication middleware warden. Hadley enables Rack-based web applications to easily become AFID protected resource servers. == Getting Started Rails: 1. Add <tt>gem 'hadley'</tt> to your Gemfile 2. Run <tt>bundle</tt> from your project root 3. Run <tt>touch config/initializers/hadley.rb</tt> from your project root 4. Add warden and hadley to your middleware stack by opening <tt>config/initializers/hadlery.rb</tt> in your favorite text editor and adding the following: token_store = Hadley::TokenStore.new(Rails.cache) MyApp::Application.config.middleware.insert_after ActionDispatch::Session::CookieStore, Warden::Manager do |manager| # setup authentication for the afid server to provision and revoke access tokens manager.basic(:server) do |basic| basic.hash_credentials true basic.lookup do |id, secret| [ id, secret ] == [ 'my_hashed_id', 'my_hashed_secret' ] ? id : nil end end # setup authentication for afid clients to authenticate in anonymous mode (client_credentials grant type in OAuth2 # parlance) manager.bearer(:client) do |bearer| bearer.token_store token_store bearer.anonymous_allowed true end # setup authentication for afid clients to access apis on behalf of a particular user (authorization_grant grant # type in OAuth2 parlance) manager.bearer(:user) do |bearer| bearer.token_store token_store bearer.anonymous_allowed false end end MyApp::Application.config.middleware.insert_after Warden::Manager, Hadley::Middleware, token_store: token_store 5. Run <tt>rake middleware</tt> from your project root and verify that <tt>Warden::Manager</tt> appears after <tt>ActionDispatch::Session::CookieStore</tt> and <tt>Hadley::Middleware</tt> appears after <tt>Warden::Manager</tt>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hadley-0.0.3 | README.rdoc |