Put into your Gemfile:
gem "crowd_authentication", :git => "git://github.com/dpisarewski/crowd_authentication.git"
-
Add your host to remote hosts list in crowd applications http://www.arvatosystems-us.com/crowd/console/secure/application/browse.action
-
Copy config/crowd_authentication.yml file into the rails config directory and set up the credentials for your application.
-
If you are using Rails 2 you have to
include CrowdAuthentication::Controller
in your ApplicationController.
Use
authenticate_with_crowd_id(crowd_id, password)
in your controllers for authentication. This method returns a hash with response code and response body in JSON format.
{:success => true, :code => 200, :body => body_hash}
crowd_user_data(crowd_id)
returns a Hash with user data.
For example:
{"expand"=>"attributes",
"link"=>
{"href"=>
"",
"rel"=>"self"},
"name"=>"[email protected]",
"first-name"=>"Dieter",
"last-name"=>"Pisarewski",
"display-name"=>"Dieter Pisarewski",
"email"=>"[email protected]",
"password"=>
{"link"=>
{"href"=>
"",
"rel"=>"edit"}},
"active"=>true,
"attributes"=>
{"attributes"=>[],
"link"=>
{"href"=>
"",
"rel"=>"self"}}}