omniauth-naranya_id 0.0.12 → 0.0.13
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 +4 -4
- data/README.md +7 -0
- data/lib/naranya_id.rb +16 -13
- data/lib/omniauth-naranya_id/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a2b7a28e3e24339ec05f6e7a2b3c03c4a27cb7a
|
4
|
+
data.tar.gz: 2bcf5f1a78c554e04e4e7b7529cf2a2d8209d561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb7eedfb2f252fbaf7f09ccd8e836d1a8202aa47efb42c636216e71fa71c2e03acbf6384d62ad8ac3ab6959efb8737b02e3ac879e6c9ff56b24abcecbe5a044
|
7
|
+
data.tar.gz: acd096813004fd0c7619a7c07c7127867994f85c32905c7410a9812896733c994f2570967e096ac8a29090818a95c7452bf068bdca045a68388294dd402293db
|
data/README.md
CHANGED
@@ -110,6 +110,13 @@ An example auth hash available in `request.env['omniauth.auth']`:
|
|
110
110
|
}
|
111
111
|
```
|
112
112
|
|
113
|
+
## Environment Variables
|
114
|
+
|
115
|
+
- NARANYA_ID_API_KEY
|
116
|
+
- NARANYA_ID_API_SECRET
|
117
|
+
- NARANYA_ID_WEB_PORT (default: 80)
|
118
|
+
- NARANYA_ID_API_PORT (default: 89)
|
119
|
+
|
113
120
|
## Note on Patches/Pull Requests
|
114
121
|
|
115
122
|
- Fork the project.
|
data/lib/naranya_id.rb
CHANGED
@@ -3,9 +3,9 @@ require 'active_support'
|
|
3
3
|
require 'active_support/core_ext/hash'
|
4
4
|
|
5
5
|
module NaranyaId
|
6
|
-
|
6
|
+
|
7
7
|
extend ActiveSupport::Autoload
|
8
|
-
|
8
|
+
|
9
9
|
autoload_under 'models' do
|
10
10
|
autoload :User
|
11
11
|
end
|
@@ -28,8 +28,8 @@ module NaranyaId
|
|
28
28
|
|
29
29
|
# Sitio de Naranya ID:
|
30
30
|
# TODO: Sustituir con el URL de producción (https)
|
31
|
-
|
32
|
-
|
31
|
+
site: ENV["NARANYA_ID_WEB_URL"] || "http://id.naranya.net",
|
32
|
+
api_site: ENV["NARANYA_ID_API_URL"] || "http://id.naranya.net:89",
|
33
33
|
scheme: :query_string,
|
34
34
|
http_method: :post,
|
35
35
|
request_token_path: "/oauthv1/request_token.php",
|
@@ -43,7 +43,7 @@ module NaranyaId
|
|
43
43
|
class << self
|
44
44
|
|
45
45
|
def consumer
|
46
|
-
|
46
|
+
|
47
47
|
unless config.consumer_key.present? && config.consumer_secret.present?
|
48
48
|
logger.warn "No Naranya ID consumer key or secret configured at SDK level... using environment variables."
|
49
49
|
logger.warn "Current Naranya ID config: #{config.inspect}"
|
@@ -51,13 +51,16 @@ module NaranyaId
|
|
51
51
|
|
52
52
|
consumer_key = config.consumer_key || ENV['NARANYA_ID_API_KEY']
|
53
53
|
consumer_secret = config.consumer_secret || ENV['NARANYA_ID_API_SECRET']
|
54
|
-
|
55
|
-
consumer = ::OAuth::Consumer.new(
|
56
|
-
|
54
|
+
|
55
|
+
consumer = ::OAuth::Consumer.new(
|
56
|
+
consumer_key,
|
57
|
+
consumer_secret,
|
58
|
+
config.client_options.merge(site: config.client_options[:api_site])
|
59
|
+
)
|
57
60
|
|
58
61
|
consumer.http.open_timeout = config.open_timeout if config.open_timeout
|
59
62
|
consumer.http.read_timeout = config.read_timeout if config.read_timeout
|
60
|
-
|
63
|
+
|
61
64
|
# Se habilita el output sólo si en las opciones debug_oauth es true:
|
62
65
|
consumer.http.set_debug_output($stderr) if config.debug_oauth
|
63
66
|
consumer
|
@@ -73,9 +76,9 @@ module NaranyaId
|
|
73
76
|
def load_config_from_hash!(given_hash)
|
74
77
|
configure do |config|
|
75
78
|
given_hash.each do |key, value|
|
76
|
-
|
79
|
+
|
77
80
|
existing_value = config.send(key.to_sym)
|
78
|
-
|
81
|
+
|
79
82
|
if existing_value.nil? || existing_value.is_a?(TrueClass) && value.is_a?(FalseClass) || existing_value.is_a?(FalseClass) && value.is_a?(TrueClass)
|
80
83
|
# Existing value was nil, or a boolean with a different value:
|
81
84
|
config.send "#{key}=".to_sym, value
|
@@ -159,11 +162,11 @@ module NaranyaId
|
|
159
162
|
end
|
160
163
|
|
161
164
|
end
|
162
|
-
|
165
|
+
|
163
166
|
end
|
164
167
|
|
165
168
|
# If we are using Rails then we will include the Mongoid railtie. This has all
|
166
169
|
# the nifty initializers that Mongoid needs.
|
167
170
|
if defined?(Rails)
|
168
171
|
require "naranya_id/railtie"
|
169
|
-
end
|
172
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-naranya_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Quintanilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|