Sha256: e967025fd5408bf6e2b9d28b9a038bbb994ac8179d9fb99f90e813e703319ef6
Contents?: true
Size: 2 KB
Versions: 1
Compression:
Stored size: 2 KB
Contents
# encoding: utf-8 module OmniAuth module Strategies # # Authenticate to PassaporteWeb via OAuth and retrieve an access token for API usage # # Usage: # # use OmniAuth::Strategies::PassaporteWeb, 'consumerkey', 'consumersecret', :client_options => {:site => 'http://sandbox.app.passaporteweb.com.br'} # class PassaporteWeb < OmniAuth::Strategies::OAuth # Give your strategy a name. option :name, "passaporte_web" # This is where you pass the options you would pass when # initializing your consumer from the OAuth gem. option :client_options, { :site => "http://sandbox.app.passaporteweb.com.br", :request_token_path => "/sso/initiate", :authorize_path => "/sso/authorize", :access_token_path => "/sso/token", :signature_method => "PLAINTEXT", :include_expired_service_accounts => false } # These are called after authentication has succeeded. If # possible, you should try to set the UID without making # additional calls (if the user id is returned with the token # or as a URI parameter). This may not be possible with all # providers. # uid{ request.params['uuid'] } uid{ user_data['uuid'] } info do { 'uuid' => user_data['uuid'], 'nickname' => user_data['nickname'], 'email' => user_data['email'], 'first_name' => user_data['first_name'], 'last_name' => user_data['last_name'], 'name' => [user_data['first_name'], user_data['last_name']].join(' ').strip, } end extra do { 'user_hash' => user_data } end def user_data @result ||= access_token.post('/sso/fetchuserdata', fetch_user_data_post_body) @user_data ||= MultiJson.decode(@result.body) end def fetch_user_data_post_body options['client_options']['include_expired_service_accounts'] ? {:include_expired => true} : nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omni_auth_passaporte_web-3.0.1 | lib/omni_auth_passaporte_web/passaporte_web.rb |