# File 'oa-core/lib/omniauth/test/strategy_macros.rb', line 7
+
+defsets_an_auth_hash
+ it'should set an auth hash'do
+ last_request.env['omniauth.auth'].shouldbe_kind_of(Hash)
+ end
+end
+
+
+
+
+
+
+
+
+
+ - (Object) sets_provider_to(provider)
+
+
+
+
+
+
+
+
+
+13
+14
+15
+16
+17
+
+
+
# File 'oa-core/lib/omniauth/test/strategy_macros.rb', line 13
+
+defsets_provider_to(provider)
+ it"should set the provider to #{provider}"do
+ (last_request.env['omniauth.auth']||{})['provider'].should==provider
+ end
+end
+
+
+
+
+
+
+
+
+
+ - (Object) sets_uid_to(uid)
+
+
+
+
+
+
+
+
+
+19
+20
+21
+22
+23
+
+
+
# File 'oa-core/lib/omniauth/test/strategy_macros.rb', line 19
+
+defsets_uid_to(uid)
+ it"should set the UID to #{uid}"do
+ (last_request.env['omniauth.auth']||{})['uid'].should==uid
+ end
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OmniAuth/Test/StrategyTestCase.html b/OmniAuth/Test/StrategyTestCase.html
new file mode 100644
index 000000000..d75fd3b76
--- /dev/null
+++ b/OmniAuth/Test/StrategyTestCase.html
@@ -0,0 +1,302 @@
+
+
+
+
+Module: OmniAuth::Test::StrategyTestCase
+
+
+
+
+
+
+
+
+
+
+
+
+Support for testing OmniAuth strategies. Usage:
+
+
+ classMyStrategyTest<Test::Unit::TestCase
+ includeOmniAuth::Test::StrategyTestCase
+ defstrategy
+ # return the parameters to a Rack::Builder map call:
+ [MyStrategy.new,:some,:configuration,:options=>'here']
+ end
+ setupdo
+ post'/auth/my_strategy/callback',:user=>{'name'=>'Dylan','id'=>'445'}
+ end
+ end
+
+Because gapps_openid changes the discovery order (looking first for Google
+Apps, then anything else), we need to monkeypatch it to make it play nicely
+with others.
+
+Because gapps_openid changes the discovery order (looking first for Google
+Apps, then anything else), we need to monkeypatch it to make it play nicely
+with others.
+
OmniAuth is a new Rack-based authentication system for multi-provider external authentcation. OmniAuth is built from the ground up on the philosophy that authentication is not the same as identity, and is based on two observations:
+
+
+
The traditional ‘sign up using a login and password’ model is becoming the exception, not the rule. Modern web applications offer external authentication via OpenID, Facebook, and/or OAuth.
+
+
The interconnectable web is no longer a dream, it is a necessity. It is not unreasonable to expect that one application may need to be able to connect to one, three, or twelve other services. Modern authentication systems should allow a user’s identity to be associated with many authentications.
+
+
+
Installation
+
+
To install OmniAuth, simply install the gem:
+
+
geminstallomniauth
+
+
+
Providers
+
+
OmniAuth currently supports the following external providers:
Now to initiate authentication you merely need to redirect the user to /auth/twitter via a link or other means. Once the user has authenticated to Twitter, they will be redirected to /auth/twitter/callback. You should build an endpoint that handles this URL, at which point you will will have access to the authentication information through the omniauth.auth parameter of the Rack environment. For example, in Sinatra you would do something like this:
The user_info hash will automatically be populated with as much information about the user as OmniAuth was able to pull from the given API or authentication provider.
+
+
Resources
+
+
The best place to find more information is the OmniAuth Wiki. Some specific information you might be interested in:
OmniAuth is a new Rack-based authentication system for multi-provider external authentcation. OmniAuth is built from the ground up on the philosophy that authentication is not the same as identity, and is based on two observations:
+
+
+
The traditional ‘sign up using a login and password’ model is becoming the exception, not the rule. Modern web applications offer external authentication via OpenID, Facebook, and/or OAuth.
+
+
The interconnectable web is no longer a dream, it is a necessity. It is not unreasonable to expect that one application may need to be able to connect to one, three, or twelve other services. Modern authentication systems should allow a user’s identity to be associated with many authentications.
+
+
+
Installation
+
+
To install OmniAuth, simply install the gem:
+
+
geminstallomniauth
+
+
+
Providers
+
+
OmniAuth currently supports the following external providers:
Now to initiate authentication you merely need to redirect the user to /auth/twitter via a link or other means. Once the user has authenticated to Twitter, they will be redirected to /auth/twitter/callback. You should build an endpoint that handles this URL, at which point you will will have access to the authentication information through the omniauth.auth parameter of the Rack environment. For example, in Sinatra you would do something like this:
The user_info hash will automatically be populated with as much information about the user as OmniAuth was able to pull from the given API or authentication provider.
+
+
Resources
+
+
The best place to find more information is the OmniAuth Wiki. Some specific information you might be interested in: