Skip to content

Commit

Permalink
Add a bit of doc to Developer strategy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed Oct 16, 2011
1 parent 250963a commit 78301c0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions lib/omniauth/strategies/developer.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/omniauth/strategies/developer_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 78301c0

Please sign in to comment.