WiKID 3.0.2 → 3.2.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.
@@ -0,0 +1,5 @@
1
+ module WiKID
2
+ class Auth
3
+ VERSION = "3.2.3"
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIG4jCCBMqgAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBpTEiMCAGCSqGSIb3DQEJ
3
+ ARYTY2FAd2lraWRzeXN0ZW1zLmNvbTELMAkGA1UEBhMCVVMxEDAOBgNVBAgMB0dl
4
+ b3JnaWExEDAOBgNVBAcMB0F0bGFudGExGjAYBgNVBAoMEVdpS0lEIFN5c3RlbXMg
5
+ SW5jMRQwEgYDVQQLDAtDQSBTZXJ2aWNlczEcMBoGA1UEAwwTY2Eud2lraWRzeXN0
6
+ ZW1zLmNvbTAeFw0xMzA0MTcxMTQzMzhaFw0yMzA0MTcxMTQzMzhaMIGlMSIwIAYJ
7
+ KoZIhvcNAQkBFhNjYUB3aWtpZHN5c3RlbXMuY29tMQswCQYDVQQGEwJVUzEQMA4G
8
+ A1UECAwHR2VvcmdpYTEQMA4GA1UEBwwHQXRsYW50YTEaMBgGA1UECgwRV2lLSUQg
9
+ U3lzdGVtcyBJbmMxFDASBgNVBAsMC0NBIFNlcnZpY2VzMRwwGgYDVQQDDBNjYS53
10
+ aWtpZHN5c3RlbXMuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
11
+ qFrO3TUybKfA38FH7rXhQEMnpy+59vwZJns6j8NcYyyUbeEZXY8vQ7VSCLjro7bF
12
+ wBbAAvt3z+XWPWwqS7njtmm4H8b1xnwp2waBooXawCY0GWKsD6sRUmA42E3y++li
13
+ +J/mz2BrdZ/srWxh5wyrn/TkgzBlRUgwbF6qKPb14l9NhPi8MtWfrrqkdBYsBZFd
14
+ MW6vTj/pDusQwWxxQKf4tIWM2mOoB51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GiZd1G8EupfEU4
30
+ 4JTAY2LlANToITmOTslzVwCJ5znGlPEjLF2xYF3xMAH8zqkhfFeZi+xDPcdgpUmk
31
+ lT2YUn3FZMxXMV6h8ANw72iCMON82uifBMsVQ3G/MG0qFCyeiYqj9gYMDO8yXqTM
32
+ ftuy4UBOOBWHJWpTy7JXlaYyLcEVJXeq92KH/MwHaG6xpyT8CyPGZpv4yyaNE9YO
33
+ f9g3XbEWUa5eHWo0qVVmf4tF3wfyG/gQ/TdFVJHcqGTpPtLmumM49+Bbbd/Ohoea
34
+ 3Jc1ZwPIxu/W76bs0ZK530me8vzq0Wzo2cKc77gi2zByasdMh6hwY4Q7oYeh6kqh
35
+ fLq3dc3Hv5jgzU2ivbkOnyFs6wxLjub+Gklkg65IKyYMLIG/OVDuns3kUnJnXO+i
36
+ Kkol7KbkxI3oZypsOqXMUFZ+4TYUMs+xWSD2kmi3Vp/XaiUiaiZ3ZTIbHpnqK6HC
37
+ sFcMy5yGnNYJqudi5ZfbYuvVLJcqj1q6xY8+b/4bgbingKH2v97uBSePp+Mb6Sol
38
+ qoln8zxXi9eQMDI+rfAZtpztGXcwlyjpuyivCFnYm+jftz3gEwk=
39
+ -----END CERTIFICATE-----
@@ -0,0 +1,10 @@
1
+ ## rename to test-options.rb and set the parameter per your environment
2
+
3
+ DOMAIN_CODE = "127000000001"
4
+ SERVER_HOST = "127.0.0.1"
5
+ SERVER_PORT = 8388
6
+
7
+ CLIENT_KEY_FILE = File.join(File.dirname(__FILE__), 'network-client.pem')
8
+ CLIENT_KEY_PASS = 'changeme'
9
+
10
+ JCMD_REGISTER = "java -cp lib/wikidtoken-3.1.23.jar:lib/wikid-tokentest.jar com.wikidsystems.test.JavaSETokenTester register"
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+
5
+ class TestLoadWiKID < Test::Unit::TestCase
6
+
7
+ def test_load_module
8
+
9
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
10
+
11
+ begin
12
+ require 'WiKID'
13
+ loaded = 1
14
+ rescue
15
+ loaded = 0
16
+ end
17
+ assert(loaded == 1, "Unable to load WiKID module!")
18
+
19
+ end
20
+
21
+ end
@@ -1,52 +1,206 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'test/unit'
4
- # $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+ require 'WiKID'
6
+ require 'SecureRandom'
7
+ require 'rexml/document'
8
+ include REXML
9
+
10
+ TEST_OPTIONS_FILE = File.join(File.dirname(__FILE__), "..", "test-options.rb")
11
+ config_file_exists = FileTest.exists?(TEST_OPTIONS_FILE)
12
+ if config_file_exists
13
+ require TEST_OPTIONS_FILE
14
+ end
15
+
16
+ SERVER_HOST = "127.0.0.1" if !defined?(SERVER_HOST)
17
+ DOMAIN_CODE = "127000000001" if !defined?(DOMAIN_CODE)
18
+ SERVER_PORT = 8388 if !defined?(SERVER_PORT)
19
+ CLIENT_KEY_FILE = '' if !defined?(CLIENT_KEY_FILE)
20
+ CLIENT_KEY_PASS = '' if !defined?(CLIENT_KEY_PASS)
21
+
22
+ puts "* Running with server: #{SERVER_HOST}:#{SERVER_PORT}"
5
23
 
6
24
  class TestWiKID < Test::Unit::TestCase
7
25
 
8
- def test_001_rubygems
26
+ def test_init_module
27
+
28
+ wc = WiKID::Auth.new(SERVER_HOST, SERVER_PORT, CLIENT_KEY_FILE, CLIENT_KEY_PASS)
29
+
30
+ assert_not_nil(wc, "WiKID module successfully loaded!")
31
+
32
+ end
33
+
34
+ def test_check_keys
35
+
36
+ wc = WiKID::Auth.new(SERVER_HOST, SERVER_PORT, CLIENT_KEY_FILE, CLIENT_KEY_PASS)
37
+ assert_nothing_raised do
38
+
39
+ wc.checkKeys()
40
+ end
41
+ end
42
+
43
+ def test_invalid_user_registration
44
+
45
+ username = 'test'
46
+ domaincode = DOMAIN_CODE
47
+
48
+ wc = WiKID::Auth.new(SERVER_HOST, SERVER_PORT, CLIENT_KEY_FILE, CLIENT_KEY_PASS)
49
+
50
+ regcode = ""
51
+ result = wc.registerUsername(username, regcode, domaincode)
52
+ assert_not_equal(0, result, "Properly failed to register user")
53
+
54
+ end
55
+
56
+ def test_valid_user_registration
57
+
58
+ username = 'test-' + SecureRandom.uuid
59
+ domaincode = DOMAIN_CODE
60
+
61
+ wc = WiKID::Auth.new(SERVER_HOST, SERVER_PORT, CLIENT_KEY_FILE, CLIENT_KEY_PASS)
62
+
63
+ output=`#{JCMD_REGISTER} #{DOMAIN_CODE}`
64
+ matches = /code=(\w+)/.match(output)
65
+ regcode = matches[1] || ''
66
+ result = wc.registerUsername(username, regcode, DOMAIN_CODE)
67
+
68
+ assert_equal(0, result, "Failed to register user")
69
+
70
+ # cleanup
71
+ wc.deleteUser(username, domaincode)
72
+
73
+ end
74
+
75
+ def test_invalid_pin
76
+
77
+ end
78
+
79
+ def test_valid_pin
80
+
81
+ end
82
+
83
+ def test_find_user
84
+
85
+ username = 'test-' + SecureRandom.uuid
86
+ domaincode = DOMAIN_CODE
87
+
88
+ wc = WiKID::Auth.new(SERVER_HOST, SERVER_PORT, CLIENT_KEY_FILE, CLIENT_KEY_PASS)
89
+
90
+ output=`#{JCMD_REGISTER} #{DOMAIN_CODE}`
91
+ matches = /code=(\w+)/.match(output)
92
+ regcode = matches[1] || ''
93
+ result = wc.registerUsername(username, regcode, DOMAIN_CODE)
94
+
95
+ user_xml = wc.findUser(username, domaincode)
96
+
97
+ user_id = XPath.first(user_xml, '//user-id/text()')
98
+
99
+ assert_equal(user_id, username, "Failed to lookup user")
100
+
101
+ # cleanup
102
+ wc.deleteUser(username, domaincode)
103
+
104
+ end
105
+
106
+
107
+ def test_update_user
108
+
109
+ username = 'test-' + SecureRandom.uuid
110
+ domaincode = DOMAIN_CODE
111
+
112
+ wc = WiKID::Auth.new(SERVER_HOST, SERVER_PORT, CLIENT_KEY_FILE, CLIENT_KEY_PASS)
113
+
114
+ output=`#{JCMD_REGISTER} #{DOMAIN_CODE}`
115
+ matches = /code=(\w+)/.match(output)
116
+ regcode = matches[1] || ''
117
+ wc.registerUsername(username, regcode, DOMAIN_CODE)
118
+
119
+ ## get the XML string to modify with
120
+ user_xml = wc.findUser(username, domaincode)
121
+
122
+ ## 1. modify the number of bad attempts
123
+ attempts = XPath.first(user_xml, '//bad-passcode-attempts/text()')
124
+ assert_equal(0, attempts, "Number of bad attempts is aleady non-zero!")
125
+
126
+ user_xml.elements['bad-passcode-attempts'].text = 2
127
+
128
+ result = wc.updateUser(username, domaincode, user_xml)
129
+ assert_equal(true, result, "Failed to modify the number of bad attempts!")
130
+
131
+ user_xml = wc.findUser(username, domaincode)
132
+ attempts = XPath.first(user_xml, '//bad-passcode-attempts/text()')
133
+ assert_equal(2, attempts, "Failed to correctly set the the number of bad attempts!")
134
+
135
+ ## 2. modify the user status
136
+ status = XPath.first(user_xml, '//status/text()')
137
+ assert_equal(1, status, "Status is already disabled!")
138
+
139
+ user_xml.elements['status'].text = 0
140
+
141
+ result = wc.updateUser(username, domaincode, user_xml)
142
+ assert_equal(true, result, "Failed to modify the status!")
143
+
144
+ user_xml = wc.findUser(username, domaincode)
145
+ status = XPath.first(user_xml, '//status/text()')
146
+ assert_equal(0, status, "Failed to modify the status value!")
147
+
148
+ ## 3. modify the user note
149
+ note = XPath.first(user_xml, '//note/text()')
150
+ assert_equal('', note.to_s, "Note is already non-empty!")
151
+
152
+ new_note_text = "This is a test note"
153
+ user_xml.elements['note'].text = new_note_text
154
+
155
+ result = wc.updateUser(username, domaincode, user_xml)
156
+ assert_equal(true, result, "Failed to modify the note!")
157
+
158
+ user_xml = wc.findUser(username, domaincode)
159
+ note = XPath.first(user_xml, '//note/text()')
160
+ assert_equal(new_note_text, note.to_s, "Failed to modity the note value!")
161
+
162
+ # cleanup
163
+ wc.deleteUser(username, domaincode)
164
+
165
+ end
166
+
167
+ def test_delete_unknown_user
168
+
169
+ username = 'junk-test-' + SecureRandom.uuid
170
+ domaincode = DOMAIN_CODE
171
+
172
+ wc = WiKID::Auth.new(SERVER_HOST, SERVER_PORT, CLIENT_KEY_FILE, CLIENT_KEY_PASS)
173
+
174
+ result = wc.deleteUser(username, domaincode)
175
+
176
+ assert_equal(false, result, "Unable to delete unknown user")
177
+
178
+ # cleanup
179
+ wc.deleteUser(username, domaincode)
9
180
 
10
- begin
11
- require 'rubygems'
12
- loaded = 1
13
- rescue Exception
14
- # puts "WARNING: RubyGems not installed"
15
- loaded = 0
16
- end
17
- assert(loaded == 1, "Unable to load RubyGems!")
181
+ end
18
182
 
19
- require 'rubygems/rubygems_version.rb'
20
- # puts "Loaded RubyGems #{Gem::RubyGemsVersion} ..."
183
+ def test_delete_user
21
184
 
22
- if (Gem::RubyGemsVersion <= '0.8.11')
23
- # puts "WARNING: RubyGems may need patching for a mod_ruby environment. Please see doc/README for more details"
24
- end
185
+ username = 'test-' + SecureRandom.uuid
186
+ domaincode = DOMAIN_CODE
25
187
 
26
- end
188
+ wc = WiKID::Auth.new(SERVER_HOST, SERVER_PORT, CLIENT_KEY_FILE, CLIENT_KEY_PASS)
27
189
 
28
- def test_002_load_module
190
+ output=`#{JCMD_REGISTER} #{DOMAIN_CODE}`
191
+ matches = /code=(\w+)/.match(output)
192
+ regcode = matches[1] || ''
193
+ wc.registerUsername(username, regcode, DOMAIN_CODE)
29
194
 
30
- begin
31
- require_gem 'WiKID'
32
- loaded = 1
33
- rescue
34
- loaded = 0
35
- end
36
- assert(loaded == 1, "Unable to load WiKID module!")
195
+ result = wc.deleteUser(username, domaincode)
37
196
 
38
- end
197
+ assert_equal(true, result, "Failed to delete user")
39
198
 
40
- def test_003_init_module
199
+ user_xml = wc.findUser(username, domaincode)
41
200
 
42
- server_host = "127000000001"
43
- server_port = -1
44
- client_key_file = "/path/to/nowhere.pem"
45
- client_key_pass = "changeme"
201
+ assert_nil(user_xml, "User not deleted")
46
202
 
47
- wc = WiKID::Auth.new(server_host, server_port, client_key_file, client_key_pass)
48
- assert_not_nil(wc, "WiKID module successfully loaded!")
203
+ end
49
204
 
50
- end
51
205
 
52
206
  end
metadata CHANGED
@@ -1,60 +1,85 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: WiKID
3
- version: !ruby/object:Gem::Version
4
- version: 3.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.2.3
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Greg Haygood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2008-04-13 00:00:00 -04:00
13
- default_executable:
14
- dependencies: []
15
-
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
16
41
  description:
17
- email: ghaygood @nospam@ wikidsystems(dot)com
42
+ email:
43
+ - ghaygood@wikidsystems.com
18
44
  executables: []
19
-
20
45
  extensions: []
21
-
22
- extra_rdoc_files:
23
- - doc/README
24
- files:
25
- - lib/WiKID.rb
26
- - doc/example
27
- - doc/rubygems-0.8.11.security-patch.diff
46
+ extra_rdoc_files: []
47
+ files:
48
+ - doc/LICENSE.txt
28
49
  - doc/MANIFEST
29
50
  - doc/README
30
- - doc/LICENSE.txt
31
- - share/data
51
+ - doc/rubygems-0.8.11.security-patch.diff
52
+ - lib/WiKID.rb
53
+ - lib/WiKID_version.rb
54
+ - share/data/WiKID-ca.pem
55
+ - test-options-dist.rb
56
+ - test/ts_load_wikid.rb
32
57
  - test/ts_wikid.rb
33
- has_rdoc: true
34
- homepage: http://sourceforge.net/projects/wikid-twofactor
58
+ homepage: https://rubygems.org/gems/WiKID
59
+ licenses:
60
+ - LGPL
61
+ metadata: {}
35
62
  post_install_message:
36
63
  rdoc_options: []
37
-
38
- require_paths:
64
+ require_paths:
39
65
  - lib
40
- required_ruby_version: !ruby/object:Gem::Requirement
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
45
- version:
46
- required_rubygems_version: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: "0"
51
- version:
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: 1.9.3
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
52
76
  requirements: []
53
-
54
- rubyforge_project: wikid
55
- rubygems_version: 1.1.0
77
+ rubyforge_project:
78
+ rubygems_version: 2.4.1
56
79
  signing_key:
57
- specification_version: 2
80
+ specification_version: 4
58
81
  summary: A network client module for the WiKID Strong Authentication system
59
- test_files: []
60
-
82
+ test_files:
83
+ - test/ts_load_wikid.rb
84
+ - test/ts_wikid.rb
85
+ has_rdoc: