omniauth-expressov3 1.0.6 → 1.0.7
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 +8 -8
- data/Gemfile +1 -0
- data/Gemfile.lock +1 -1
- data/lib/omniauth/strategies/expressov3.rb +2 -3
- data/lib/omniauth-expressov3/expressov3_auth_client.rb +4 -3
- data/lib/omniauth-expressov3/jsonrpc_tine_connection.rb +17 -2
- data/lib/omniauth-expressov3/version.rb +1 -1
- data/spec/omniauth-expressov3/expressov3_auth_client_2_spec.rb +20 -0
- data/spec/spec_helper.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjA2ODkyOTJjYTZkZjIyZTlkYTc3NzA3NzhhYjM5MjhmZDE5NTQ4Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Mzg2ZTA1MDI1NWNjODdiNmY1YjdlZDU3ZDhlYWM0OGQ0YWMwNTljYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDZjNzIwODEzYzdlOGVhYWUwYTdjZDYxM2NiZWI2ZDM0ZjhlZTJkYjQxMzRh
|
10
|
+
YzgwOTBmM2M2ZTI3NTA2Y2NlNDY3ZGM0Zjk4OTQ2MmFiNDI1ZjA2NmY0NDA5
|
11
|
+
ZWY1YjZiMzNkMWNkNTg3ZmZmMmRhOWU4ODAzYzdhMmZmNjgxNWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjdmMWQxYzc4NDdiYTQ4YTM0ZjdhZjNhYWE0NzA4NDY0MWE1MTA5YjZiNzA1
|
14
|
+
YWJhNmNlYmQzZDk2Yjk0NTYyZjA2NTAzODIwZmE4ZWNhMTNiOTg4NzQ4ZDg1
|
15
|
+
ZTY1YzQ4ZTM0MzBjN2Y5OGI3ZmNjN2I5Mjc3MWZlNTE4ZDE3NTE=
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -18,7 +18,8 @@ module OmniAuth
|
|
18
18
|
:telephone => 'userContact::tel_work',
|
19
19
|
:organization_unit => 'userContact::org_unit',
|
20
20
|
:tine_key => 'keys::tine_key',
|
21
|
-
:json_key => 'keys::json_key'
|
21
|
+
:json_key => 'keys::json_key',
|
22
|
+
:cookies => 'keys::cookies'
|
22
23
|
}
|
23
24
|
|
24
25
|
option :title, "Autenticação Expresso V3" #default title for authentication form
|
@@ -43,7 +44,6 @@ module OmniAuth
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def callback_phase
|
46
|
-
|
47
47
|
@auth_client = OmniAuth::ExpressoV3::AuthClient.new @options
|
48
48
|
|
49
49
|
return fail!(:missing_credentials) if missing_credentials?
|
@@ -58,7 +58,6 @@ module OmniAuth
|
|
58
58
|
|
59
59
|
super
|
60
60
|
rescue Exception => e
|
61
|
-
puts "#{e.message} -\n\t#{e.backtrace}"
|
62
61
|
return fail!(:expressov3_error, e)
|
63
62
|
end
|
64
63
|
end
|
@@ -34,14 +34,15 @@ module OmniAuth
|
|
34
34
|
build_struct @json_tine.result
|
35
35
|
end
|
36
36
|
|
37
|
-
def send method, args=
|
37
|
+
def send method, args={}
|
38
38
|
@json_tine.send method, args
|
39
39
|
build_struct @json_tine.result
|
40
40
|
end
|
41
41
|
|
42
|
-
def get_user_data
|
42
|
+
def get_user_data args={}
|
43
43
|
#request to get user data
|
44
|
-
@json_tine.send 'Tinebase.getAllRegistryData'
|
44
|
+
@json_tine.send 'Tinebase.getAllRegistryData', args
|
45
|
+
|
45
46
|
# hash with user data
|
46
47
|
build_struct :keys => @json_tine.result['keys'],
|
47
48
|
:currentAccount => @json_tine.result['Tinebase']['currentAccount'],
|
@@ -39,7 +39,12 @@ module OmniAuth
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def send(tine_method, args=nil)
|
42
|
+
@json_key = args.delete(:json_key) if args.has_key? :json_key
|
43
|
+
@tine_key = args.delete(:tine_key) if args.has_key? :tine_key
|
44
|
+
@cookies = args.delete(:cookies) if args.has_key? :cookies
|
45
|
+
|
42
46
|
response = execute_http_call(tine_method, args)
|
47
|
+
|
43
48
|
hash_response = parse_response(response)
|
44
49
|
@json_return = hash_response[:json_object]
|
45
50
|
@cookies = hash_response[:cookies]
|
@@ -71,7 +76,11 @@ module OmniAuth
|
|
71
76
|
|
72
77
|
def keys
|
73
78
|
{
|
74
|
-
'keys' => {
|
79
|
+
'keys' => {
|
80
|
+
'tine_key' => @tine_key,
|
81
|
+
'json_key' => @json_key,
|
82
|
+
'cookies' => @cookies
|
83
|
+
}
|
75
84
|
}
|
76
85
|
end
|
77
86
|
|
@@ -87,9 +96,14 @@ module OmniAuth
|
|
87
96
|
private
|
88
97
|
|
89
98
|
def execute_http_call(tine_method, args=nil)
|
99
|
+
|
90
100
|
@req = Net::HTTP::Post.new(@uri.request_uri, initheader = {'Content-Type'=>'application/json'})
|
91
101
|
json_body = {:jsonrpc => '2.0', :method => tine_method, :id => next_cont}
|
92
|
-
|
102
|
+
|
103
|
+
unless args.nil? or args.empty?
|
104
|
+
#raise tine_method unless 'Tinebase.login'.eql? tine_method
|
105
|
+
json_body.merge!({:params => args})
|
106
|
+
end
|
93
107
|
|
94
108
|
#puts "REQUEST BODY: #{json_body.to_json}" if @debug
|
95
109
|
|
@@ -154,6 +168,7 @@ protected
|
|
154
168
|
#header e cookie enviados pelo usuario logado
|
155
169
|
@req.add_field 'X-Tine20-JsonKey', @json_key if @json_key
|
156
170
|
#@req.add_field 'Cookie', 'TINE20SESSID='+@tine_key if @tine_key
|
171
|
+
#puts @cookies.inspect
|
157
172
|
@req.add_field 'Cookie', @cookies if @cookies
|
158
173
|
end
|
159
174
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
|
2
3
|
describe "OmniAuth::ExpressoV3::AuthClient" do
|
3
4
|
|
4
5
|
before :all do
|
@@ -23,6 +24,25 @@ describe "OmniAuth::ExpressoV3::AuthClient" do
|
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
27
|
+
context 'reuse tine key, json key and cookies' do
|
28
|
+
let(:client) do
|
29
|
+
auth = OmniAuth::ExpressoV3::AuthClient.new :debug => false
|
30
|
+
auth
|
31
|
+
end
|
32
|
+
|
33
|
+
let(:auth_data) do
|
34
|
+
auth_data = client.authenticate(ENV['EXPRESSO_USERNAME'], ENV['EXPRESSO_PASSWORD'])
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:new_client) { OmniAuth::ExpressoV3::AuthClient.new :debug => false }
|
38
|
+
|
39
|
+
describe 'new client' do
|
40
|
+
it 'should connect using auth data of a previous authentication' do
|
41
|
+
user_data = new_client.get_user_data(auth_data.keys.to_h)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
26
46
|
context 'explore tine api' do
|
27
47
|
|
28
48
|
before :all do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-expressov3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abner Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|