From 78301c00bb5140aa43a7727da984becd355f5a80 Mon Sep 17 00:00:00 2001 From: Michael Bleigh Date: Sun, 16 Oct 2011 19:35:37 -0400 Subject: [PATCH] Add a bit of doc to Developer strategy. --- README.md | 7 ++++++- lib/omniauth/strategies/developer.rb | 23 ++++++++++++++++++++++ spec/omniauth/strategies/developer_spec.rb | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 43691146f..9f2cfb75f 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,12 @@ one or more strategies. These strategies are generally released individually as RubyGems, and you can see a [community maintained list](https://github.com/intridea/omniauth/wiki/List-of-Strategies) on the wiki for this project. -## Adding OmniAuth to Your Application +One strategy, called `Developer`, is included with OmniAuth and provides +a completely unsecure, non-production-usable strategy that directly +prompts a user for authentication information and then passes it +straight through. + +## Getting Started Each OmniAuth strategy is a Rack Middleware. That means that you can use it the same way that you use any other Rack middleware. For example, to diff --git a/lib/omniauth/strategies/developer.rb b/lib/omniauth/strategies/developer.rb index e32d7ab12..e98388c4d 100644 --- a/lib/omniauth/strategies/developer.rb +++ b/lib/omniauth/strategies/developer.rb @@ -2,6 +2,29 @@ module OmniAuth module Strategies + # The Developer strategy is a very simple strategy that can be used as a + # placeholder in your application until a different authentication strategy + # is swapped in. It has zero security and should *never* be used in a + # production setting. + # + # ## Usage + # + # To use the Developer strategy, all you need to do is put it in like any + # other strategy: + # + # @example Basic Usage + # + # use OmniAuth::Builder do + # provider :developer + # end + # + # This will create a strategy that, when the user visits `/auth/developer` + # they will be presented a form that prompts for (by default) their name + # and email address. The auth hash will be populated with these fields and + # the `uid` will simply be set to the provided email. + # + # @option options [Array] :fields An array of fields you would like to collect. + # @option options [Symbol] :uid_field The field you'd like to use for the uid. class Developer include OmniAuth::Strategy diff --git a/spec/omniauth/strategies/developer_spec.rb b/spec/omniauth/strategies/developer_spec.rb index 30e0d66f4..39e3393ff 100644 --- a/spec/omniauth/strategies/developer_spec.rb +++ b/spec/omniauth/strategies/developer_spec.rb @@ -4,7 +4,7 @@ let(:app){ Rack::Builder.new do |b| b.use Rack::Session::Cookie b.use OmniAuth::Strategies::Developer - b.run lambda{|env| [200, {:auth_hash => env['omniauth.auth']}, ['Not Found']]} + b.run lambda{|env| [200, {}, ['Not Found']]} end.to_app } context 'request phase' do