omniauth-naranya_id 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c6cf87ecd4cfbc16285bc461405172991bcb343
4
- data.tar.gz: cfc67136830bdf7e2cd7f6218828b333a4895df3
3
+ metadata.gz: a149dcf33862e6c9b242b23f4ad8c5ff4f9711d5
4
+ data.tar.gz: 9a67a8ca0db6ca616ac12f13baf9eb123e555032
5
5
  SHA512:
6
- metadata.gz: 3dbf9a155d795624b9e5934c4e8ec58a1d288d23b6d8c17e2d92bb510f111a897895db49fbd545a3f403bf16bb106dc199ec3c085851791b2e7c3748fb0d80e3
7
- data.tar.gz: 9376eeee039cd19281b74f974c1b628b60a42fd5fae99bc67541d03d7020f1f1bc36dec70c5aa919d3bfd959a9a6599eb9bbf84cc8a1e3f78286cba0cc676bb7
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))
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module NaranyaId
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-naranya_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla