Sha256: 6a5a99b3da930820611ef5550bc9534c921b5f9cd31ccbf17005ae03d04f1882
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require 'omniauth/oauth' require 'multi_json' module OmniAuth module Strategies # # Authenticate to Myfcid via OAuth and retrieve an access token for API usage # # Usage: # # use OmniAuth::Strategies::Myfcid, 'consumerkey', 'consumersecret', {:site=> 'http://stage.id.myfreecomm.com.br'} # class PassaporteWeb < OmniAuth::Strategies::OAuth def initialize(app, consumer_key, consumer_secret, options = {}) @site = options.delete(:site) || 'https://sandbox.app.passaporteweb.com.br' super(app, :myfcid, consumer_key, consumer_secret, options.merge({:site => @site , :request_token_path => "/sso/initiate", :authorize_path => "/sso/authorize", :access_token_path => "/sso/token", :signature_method => "PLAINTEXT" })) end def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => user_data['uuid'], 'user_info' => user_info, 'extra' => { 'user_hash' => user_data } }) end protected def user_data @result ||= @access_token.post('/sso/fetchuserdata', nil) @data ||= MultiJson.decode(@result.body) end def user_info { '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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omni_auth_passaporte_web-0.0.1.pre | lib/omni_auth_passaporte_web/passaporte_web.rb |