1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00
omniauth--omniauth/oa-identity
2011-06-03 09:49:32 -07:00
..
lib check whether identity model is persisted with ActiveModel's #persisted? method 2011-06-03 09:49:32 -07:00
spec check whether identity model is persisted with ActiveModel's #persisted? method 2011-06-03 09:49:32 -07:00
.rspec Added skeleton for oa-identity as well as the basics for the model mixin. 2011-05-02 11:47:13 -05:00
oa-identity.gemspec Adding simplecov 2011-05-16 15:56:29 -05:00
Rakefile Added skeleton for oa-identity as well as the basics for the model mixin. 2011-05-02 11:47:13 -05:00
README.markdown Update the README a bit. 2011-05-02 15:17:43 -05:00

OmniAuth Identity

The OmniAuth Identity gem provides a way for applications to utilize a traditional login/password based authentication system without the need to give up the simple authentication flow provided by OmniAuth. Identity is designed on purpose to be as featureless as possible: it provides the basic construct for user management and then gets out of the way.

Usage

You use oa-identity just like you would any other OmniAuth provider: as a Rack middleware. The basic setup would look something like this:

use OmniAuth::Builder do
  provider :identity
end

Next, you need to create a model (called Identity by default) that will be able to persist the information provided by the user. Luckily for you, there are pre-built models for popular ORMs that make this dead simple. You just need to subclass the relevant class:

class Identity < OmniAuth::Identity::Models::ActiveRecord
  # Add whatever you like!
end

Adapters are provided for ActiveRecord and MongoMapper and are autoloaded on request (but not loaded by default so no dependencies are injected).

Once you've got an Identity persistence model and the strategy up and running, you can point users to /auth/identity and it will request that they log in or give them the opportunity to sign up for an account. Once they have authenticated with their identity, OmniAuth will call through to /auth/identity/callback with the same kinds of information it would had the user authenticated through an external provider. Simple!