omniauth-naranya_id 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth/strategies/naranya_id.rb +36 -11
- data/lib/omniauth-naranya_id/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a149dcf33862e6c9b242b23f4ad8c5ff4f9711d5
|
4
|
+
data.tar.gz: 9a67a8ca0db6ca616ac12f13baf9eb123e555032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4d2f8f8d38302e88407638ea02e62913a035e30d110edddd6f0a69a8398a63884dc7f97f00ffe8262fb5a7f64cd3b88b9c5b3cc810637d6eb383ce3a19dd842
|
7
|
+
data.tar.gz: 868bcc197e17512a5fde37b6879b6e7f0d79b9cb21756f545904c7d758b557e9ec732d0e55ac6bd060844c48387aece0af57adb399b8fd27e45dcf39c91d90e0
|
@@ -13,6 +13,42 @@ module OmniAuth
|
|
13
13
|
# initializing your consumer from the OAuth gem.
|
14
14
|
option :client_options, ::NaranyaId::CONSUMER_DEFAULTS
|
15
15
|
|
16
|
+
# Override para habilitar/deshabilitar el output de debuggeo de HTTP:
|
17
|
+
def consumer
|
18
|
+
consumer = ::OAuth::Consumer.new(options.consumer_key, options.consumer_secret, options.client_options)
|
19
|
+
consumer.http.open_timeout = options.open_timeout if options.open_timeout
|
20
|
+
consumer.http.read_timeout = options.read_timeout if options.read_timeout
|
21
|
+
|
22
|
+
# Se habilita el output sólo si en las opciones debug_oauth es true:
|
23
|
+
consumer.http.set_debug_output($stderr) if options.debug_oauth
|
24
|
+
consumer
|
25
|
+
end
|
26
|
+
|
27
|
+
# Override de método `request_phase` para enviar el parámetro de lang/locale:
|
28
|
+
def request_phase
|
29
|
+
request_token = consumer.get_request_token({:oauth_callback => callback_url}, options.request_params)
|
30
|
+
session['oauth'] ||= {}
|
31
|
+
session['oauth'][name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
|
32
|
+
|
33
|
+
# Setup de parametros de lang/locale:
|
34
|
+
locale_params = if defined?(I18n) && I18n.respond_to?(:locale) && I18n.locale.present?
|
35
|
+
{ lang: I18n.locale.to_s.split('-').first, locale: I18n.locale.to_s }
|
36
|
+
else
|
37
|
+
{}
|
38
|
+
end
|
39
|
+
|
40
|
+
if request_token.callback_confirmed?
|
41
|
+
redirect request_token.authorize_url(options[:authorize_params].merge(locale_params))
|
42
|
+
else
|
43
|
+
redirect request_token.authorize_url(options[:authorize_params].merge(:oauth_callback => callback_url).merge(locale_params))
|
44
|
+
end
|
45
|
+
|
46
|
+
rescue ::Timeout::Error => e
|
47
|
+
fail!(:timeout, e)
|
48
|
+
rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
|
49
|
+
fail!(:service_unavailable, e)
|
50
|
+
end
|
51
|
+
|
16
52
|
# These are called after authentication has succeeded. If
|
17
53
|
# possible, you should try to set the UID without making
|
18
54
|
# additional calls (if the user id is returned with the token
|
@@ -48,17 +84,6 @@ module OmniAuth
|
|
48
84
|
end
|
49
85
|
end
|
50
86
|
|
51
|
-
# Override para habilitar/deshabilitar el output de debuggeo de HTTP:
|
52
|
-
def consumer
|
53
|
-
consumer = ::OAuth::Consumer.new(options.consumer_key, options.consumer_secret, options.client_options)
|
54
|
-
consumer.http.open_timeout = options.open_timeout if options.open_timeout
|
55
|
-
consumer.http.read_timeout = options.read_timeout if options.read_timeout
|
56
|
-
|
57
|
-
# Se habilita el output sólo si en las opciones debug_oauth es true:
|
58
|
-
consumer.http.set_debug_output($stderr) if options.debug_oauth
|
59
|
-
consumer
|
60
|
-
end
|
61
|
-
|
62
87
|
# Indicates if the SDK's api key + secret are missing
|
63
88
|
def sdk_key_or_secret_missing?
|
64
89
|
!(::NaranyaId.config.has_key?(:api_key) && ::NaranyaId.config.has_key?(:api_secret))
|