Skip to content
Browse files

Cleanup EOL whitespace

  • Loading branch information...
1 parent 9c1e5ce commit 0fefb9c8d7053598d7b643796e5ad9a17a689b61 @sferik sferik committed
View
8 oa-core/lib/omniauth/strategy.rb
@@ -3,7 +3,7 @@
module OmniAuth
class NoSessionError < StandardError; end
# The Strategy is the base unit of OmniAuth's ability to
- # wrangle multiple providers. Each strategy provided by
+ # wrangle multiple providers. Each strategy provided by
# OmniAuth includes this mixin to gain the default functionality
# necessary to be compatible with the OmniAuth library.
module Strategy
@@ -41,9 +41,9 @@ def call!(env)
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
- @app.call(env)
+ @app.call(env)
end
-
+
# Performs the steps necessary to run the request phase of a strategy.
def request_call
setup_phase
@@ -81,7 +81,7 @@ def on_callback_path?
end
def mock_call!(env)
- return mock_request_call if on_request_path?
+ return mock_request_call if on_request_path?
return mock_callback_call if on_callback_path?
call_app!
end
View
4 oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb
@@ -39,14 +39,14 @@ def user_info
def parse_user_info(node)
return nil if node.nil?
hash = {}
- node.children.each do |e|
+ node.children.each do |e|
unless e.kind_of?(Nokogiri::XML::Text) ||
e.name == 'cas:proxies' ||
e.name == 'proxies'
# There are no child elements
if e.element_children.count == 0
hash[e.name.sub(/^cas:/, '')] = e.content
- elsif e.element_children.count
+ elsif e.element_children.count
hash[e.name.sub(/^cas:/, '')] = [] if hash[e.name.sub(/^cas:/, '')].nil?
hash[e.name.sub(/^cas:/, '')].push parse_user_info e
end
View
16 oa-more/lib/omniauth/strategies/draugiem.rb
@@ -9,10 +9,10 @@ module Strategies
# Authenticate to draugiem.lv and frype.com and others.
#
# @example Basic Rails Usage
- #
+ #
# Add this to config/initializers/omniauth.rb
- #
- # Rails.application.config.middleware.use OmniAuth::Builder do
+ #
+ # Rails.application.config.middleware.use OmniAuth::Builder do
# provider :draugiem, 'App id', 'API Key'
# end
#
@@ -32,7 +32,7 @@ def initialize(app, app_id, api_key)
end
protected
-
+
def request_phase
params = {
:app => @app_id,
@@ -42,7 +42,7 @@ def request_phase
query_string = params.collect{ |key,value| "#{key}=#{Rack::Utils.escape(value)}" }.join('&')
redirect "http://api.draugiem.lv/authorize/?#{query_string}"
end
-
+
def callback_phase
if request.params['dr_auth_status'] == 'ok' && request.params['dr_auth_code']
response = RestClient.get('http://api.draugiem.lv/json/', { :params => draugiem_authorize_params(request.params['dr_auth_code']) })
@@ -59,7 +59,7 @@ def callback_phase
rescue Exception => e
fail!(:invalid_response, e)
end
-
+
def auth_hash
OmniAuth::Utils.deep_merge(super, {
'uid' => @auth_data['uid'],
@@ -70,8 +70,8 @@ def auth_hash
'extra' => { 'user_hash' => @auth_data }
})
end
-
- private
+
+ private
def get_user_info
if @auth_data['users'] && @auth_data['users'][@auth_data['uid']]
View
24 oa-more/lib/omniauth/strategies/ign.rb
@@ -6,7 +6,7 @@ module Strategies
class Ign
include OmniAuth::Strategy
IDENTIFIER_URL_PARAMETER = ""
-
+
class CallbackError < StandardError
attr_accessor :error, :error_reason
def initialize(error, error_reason)
@@ -14,32 +14,32 @@ def initialize(error, error_reason)
self.error_reason = error_reason
end
end
-
+
def initialize(app, api_key, hostname=nil, options = {})
options[:name] ||= "ign"
super(app, :ign)
@api_key = api_key
@hostname = hostname
end
-
+
protected
-
+
def request_phase
OmniAuth::Form.build(:title => 'IGN Authentication', :header_info=>js) do
label_field('Identifying you with the IGN server', IDENTIFIER_URL_PARAMETER)
end.to_response
end
-
+
def callback_phase
signature = OpenSSL::HMAC.hexdigest('sha1', @api_key, ("#{request.params["username"]}::#{request.params["timestamp"]}"))
-
+
raise CallbackError.new("Invalid Signature","The supplied and calculated signature did not match, user not approved.") if signature != request.params["signature"]
-
+
super
rescue CallbackError => e
fail!(:invalid_response, e)
end
-
+
def auth_hash
OmniAuth::Utils.deep_merge(super, {
'uid' => "ign-" + request.params["username"],
@@ -48,13 +48,13 @@ def auth_hash
'extra' => { 'user_hash' => request.params }
})
end
-
+
def user_info
{
'nickname' => request.params["username"],
}
end
-
+
def js
@js = <<-JS
$(document).ready(function() {
@@ -87,7 +87,7 @@ def js
"\n<script type='text/javascript'>#{@js}</script>" +
"\n<style type='text/css'>button {visibility:hidden;}</style>"
end
-
+
end
end
-end
+end
View
16 oa-more/lib/omniauth/strategies/yupoo.rb
@@ -8,7 +8,7 @@ module Strategies
class Yupoo
include OmniAuth::Strategy
attr_accessor :api_key, :secret_key, :options
-
+
class CallbackError < StandardError
attr_accessor :error, :error_reason
@@ -26,30 +26,30 @@ def initialize(app, api_key, secret_key, options = {})
end
protected
-
+
def request_phase
params = { :api_key => api_key, :perms => options[:scope] }
params[:api_sig] = yupoo_sign(params)
query_string = params.collect{ |key,value| "#{key}=#{Rack::Utils.escape(value)}" }.join('&')
redirect "http://www.yupoo.com/services/auth/?#{query_string}"
end
-
+
def callback_phase
params = { :api_key => api_key, :method => 'yupoo.auth.getToken', :frob => request.params['frob'], :format => 'json', :nojsoncallback => '1' }
params[:api_sig] = yupoo_sign(params)
-
+
response = RestClient.get('http://www.yupoo.com/api/rest/', { :params => params })
auth = MultiJson.decode(response.to_s)
raise CallbackError.new(auth['code'],auth['message']) if auth['stat'] == 'fail'
-
+
@user = auth['auth']['user']
@access_token = auth['auth']['token']['_content']
-
+
super
rescue CallbackError => e
fail!(:invalid_response, e)
end
-
+
def auth_hash
OmniAuth::Utils.deep_merge(super, {
'uid' => @user['nsid'],
@@ -58,7 +58,7 @@ def auth_hash
'extra' => { 'user_hash' => @user }
})
end
-
+
def yupoo_sign(params)
Digest::MD5.hexdigest(secret_key + params.sort{|a,b| a[0].to_s <=> b[0].to_s }.flatten.join)
end
View
24 oa-more/spec/omniauth/strategies/draugiem_spec.rb
@@ -15,7 +15,7 @@ def strategy
describe '/auth/draugiem' do
it 'should redirect to api.draugiem.lv' do
- get '/auth/draugiem'
+ get '/auth/draugiem'
last_response.should be_redirect
last_response.headers['Location'].should == "http://api.draugiem.lv/authorize/?app=123&redirect=http%3A%2F%2Fexample.org%2Fauth%2Fdraugiem%2Fcallback&hash=2d5698ba02ddd42c441998a5a2c2946b"
end
@@ -23,19 +23,19 @@ def strategy
it 'should gather user data after success authorization' do
stub_request(:get, "http://api.draugiem.lv/json/?action=authorize&app=abc&code=123456").
to_return(:body => MultiJson.encode({
- 'apikey'=>"123456789",
- 'uid'=>"100",
- 'language'=>"lv",
+ 'apikey'=>"123456789",
+ 'uid'=>"100",
+ 'language'=>"lv",
'users'=>{
'100'=>{
- 'uid'=>"100",
- 'name'=>"John",
- 'surname'=>"Lenon",
- 'nick'=>"johnybravo",
- 'place'=>"Durbe",
- 'age'=>"false",
- 'adult'=>"1",
- 'img'=>"http://4.bp.blogspot.com/_ZmXOoYjxXog/Sg2jby1RFSI/AAAAAAAAE_Q/1LpfjimAz50/s400/JohnnyBravo3.gif",
+ 'uid'=>"100",
+ 'name'=>"John",
+ 'surname'=>"Lenon",
+ 'nick'=>"johnybravo",
+ 'place'=>"Durbe",
+ 'age'=>"false",
+ 'adult'=>"1",
+ 'img'=>"http://4.bp.blogspot.com/_ZmXOoYjxXog/Sg2jby1RFSI/AAAAAAAAE_Q/1LpfjimAz50/s400/JohnnyBravo3.gif",
'sex'=>"M"
}
}
View
2 oa-oauth/lib/omniauth/oauth.rb
@@ -51,6 +51,6 @@ module Strategies
autoload :Yahoo, 'omniauth/strategies/yahoo'
autoload :Yammer, 'omniauth/strategies/yammer'
autoload :YouTube, 'omniauth/strategies/you_tube'
- autoload :Mailru, 'omniauth/strategies/mailru'
+ autoload :Mailru, 'omniauth/strategies/mailru'
end
end
View
4 oa-oauth/lib/omniauth/strategies/linked_in.rb
@@ -40,13 +40,13 @@ def user_hash(access_token)
'description' => person['headline'],
'public_profile_url' => person['public_profile_url']
}
- hash['urls']={}
+ hash['urls']={}
member_urls = person['member_url_resources']['member_url']
if (!member_urls.nil?) and (!member_urls.empty?)
[member_urls].flatten.each do |url|
hash['urls']["#{url['name']}"]=url['url']
end
- end
+ end
hash['urls']['LinkedIn'] = person['public_profile_url']
hash['name'] = "#{hash['first_name']} #{hash['last_name']}"
hash
View
24 oa-oauth/lib/omniauth/strategies/mailru.rb
@@ -14,30 +14,30 @@ module Strategies
class Mailru < OAuth2
# @param [Rack Application] app standard middleware application parameter
# @param [String] api_key the application id as [registered in Mailru]
- # @param [String] secret_key the application secret as [registered in Mailru]
+ # @param [String] secret_key the application secret as [registered in Mailru]
def initialize(app, api_key = nil, secret_key = nil, options = {}, &block)
client_options = {
:site => 'https://connect.mail.ru',
:authorize_path => '/oauth/authorize',
:access_token_path => '/oauth/token'
}
-
- @private_key = options[:private_key]
+
+ @private_key = options[:private_key]
super(app, :mailru, api_key, secret_key, client_options, options, &block)
end
protected
-
+
def request_phase
options[:response_type] ||= 'code'
super
- end
-
+ end
+
def calculate_signature(params)
str = params['uids'] + (params.sort.collect { |c| "#{c[0]}=#{c[1]}" }).join('') + @private_key
Digest::MD5.hexdigest(str)
- end
+ end
def user_data
request_params = {
@@ -46,7 +46,7 @@ def user_data
'session_key' => @access_token.token,
'uids' => @access_token['x_mailru_vid']
}
-
+
request_params.merge!('sig' => calculate_signature(request_params))
@data ||= MultiJson.decode(client.request(:get, 'http://www.appsmail.ru/platform/api', request_params))[0]
end
@@ -82,7 +82,7 @@ def user_data
#}
def user_info
- {
+ {
'nickname' => user_data['nick'],
'email' => user_data['email'],
'first_name' => user_data["first_name"],
@@ -91,8 +91,8 @@ def user_info
'image' => @data['pic'],
'urls' => {
'Mailru' => user_data["link"]
- }
- }
+ }
+ }
end
def auth_hash
@@ -102,6 +102,6 @@ def auth_hash
'extra' => {'user_hash' => user_data}
})
end
- end
+ end
end
end
View
4 oa-oauth/lib/omniauth/strategies/plurk.rb
@@ -6,7 +6,7 @@ module Strategies
#
# Authenticate to Plurk via OAuth and retrieve basic user info.
#
- # Please note that this strategy relies on Plurk API 2.0,
+ # Please note that this strategy relies on Plurk API 2.0,
# which is still in Beta.
#
# Usage:
@@ -45,7 +45,7 @@ def user_info
else
"http://www.plurk.com/static/default_medium.gif"
end,
- 'urls' => { 'Plurk' => 'http://plurk.com/' + user['nick_name']}
+ 'urls' => { 'Plurk' => 'http://plurk.com/' + user['nick_name']}
}
end
View
4 oa-oauth/lib/omniauth/strategies/taobao.rb
@@ -12,9 +12,9 @@ module Strategies
# use OmniAuth::Strategies::TB, 'client_id', 'client_secret'
class TB < OAuth2
# @param [Rack Application] app standard middleware application parameter
- # @param [String] client_id the app key at taobao open platform
+ # @param [String] client_id the app key at taobao open platform
# @param [String] client_secret the app secret at taobao open platform
- # @option options [String]
+ # @option options [String]
def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
client_options = {
View
6 oa-openid/lib/omniauth/strategies/steam.rb
@@ -5,10 +5,10 @@ class Steam < OmniAuth::Strategies::OpenID
def initialize(app, store = nil, api_key = nil, options = {}, &block)
options[:identifier] ||= "http://steamcommunity.com/openid"
options[:name] ||= 'steam'
- @api_key = api_key
+ @api_key = api_key
super(app, store, options, &block)
end
-
+
def user_info(response=nil)
player = user_hash['response']['players']['player'].first
nickname = player["personaname"]
@@ -25,7 +25,7 @@ def user_info(response=nil)
'location' => "#{city}, #{state}, #{country}"
}
end
-
+
def user_hash
# Steam provides no information back on a openid response other than a 64bit user id
# Need to use this information and make a API call to get user information from steam.

0 comments on commit 0fefb9c

Please sign in to comment.
Something went wrong with that request. Please try again.