pki_express 1.3.0 → 1.3.2
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/.gitattributes +2 -2
- data/.github/workflows/test.yml +22 -0
- data/.gitignore +27 -27
- data/.rspec +1 -0
- data/CHANGELOG.md +19 -12
- data/Gemfile +9 -4
- data/README.md +24 -24
- data/Rakefile +7 -1
- data/lib/pki_express/auth_complete_result.rb +21 -21
- data/lib/pki_express/auth_start_result.rb +76 -76
- data/lib/pki_express/authentication.rb +284 -284
- data/lib/pki_express/base_signer.rb +54 -54
- data/lib/pki_express/cades_signature.rb +89 -89
- data/lib/pki_express/cades_signature_starter.rb +242 -242
- data/lib/pki_express/check_service_result.rb +15 -15
- data/lib/pki_express/command_error.rb +13 -13
- data/lib/pki_express/commands.rb +24 -24
- data/lib/pki_express/digest_algorithm.rb +118 -118
- data/lib/pki_express/digest_algorithm_and_value.rb +30 -30
- data/lib/pki_express/discovery_service_result.rb +25 -25
- data/lib/pki_express/enum.rb +9 -9
- data/lib/pki_express/error_codes.rb +46 -46
- data/lib/pki_express/installation_not_found_error.rb +8 -8
- data/lib/pki_express/name.rb +47 -47
- data/lib/pki_express/oids.rb +30 -30
- data/lib/pki_express/pades_certification_level.rb +7 -7
- data/lib/pki_express/pades_horizontal_align.rb +9 -9
- data/lib/pki_express/pades_measurement_units.rb +8 -8
- data/lib/pki_express/pades_page_optimization.rb +50 -50
- data/lib/pki_express/pades_page_orientation.rb +9 -9
- data/lib/pki_express/pades_paper_size.rb +21 -21
- data/lib/pki_express/pades_signature.rb +16 -16
- data/lib/pki_express/pades_signature_explorer.rb +30 -30
- data/lib/pki_express/pades_signature_starter.rb +251 -251
- data/lib/pki_express/pades_signer.rb +274 -274
- data/lib/pki_express/pades_signer_info.rb +9 -9
- data/lib/pki_express/pades_size.rb +17 -17
- data/lib/pki_express/pades_text_horizontal_align.rb +8 -8
- data/lib/pki_express/pades_vertical_align.rb +9 -9
- data/lib/pki_express/pades_visual_auto_positioning.rb +21 -21
- data/lib/pki_express/pades_visual_image.rb +51 -51
- data/lib/pki_express/pades_visual_manual_positioning.rb +16 -16
- data/lib/pki_express/pades_visual_positioning.rb +27 -27
- data/lib/pki_express/pades_visual_rectangle.rb +74 -74
- data/lib/pki_express/pades_visual_representation.rb +22 -22
- data/lib/pki_express/pades_visual_text.rb +35 -35
- data/lib/pki_express/pk_algorithms.rb +157 -157
- data/lib/pki_express/pk_certificate.rb +61 -61
- data/lib/pki_express/pki_brazil_certificate_fields.rb +57 -57
- data/lib/pki_express/pki_brazil_certificate_types.rb +19 -19
- data/lib/pki_express/pki_express_config.rb +39 -26
- data/lib/pki_express/pki_express_operator.rb +240 -234
- data/lib/pki_express/pki_italy_certificate_fields.rb +15 -15
- data/lib/pki_express/pki_italy_certificate_types.rb +11 -11
- data/lib/pki_express/signature_algorithm_and_value.rb +34 -34
- data/lib/pki_express/signature_explorer.rb +74 -74
- data/lib/pki_express/signature_finisher.rb +314 -314
- data/lib/pki_express/signature_policy_identifier.rb +20 -20
- data/lib/pki_express/signature_start_result.rb +12 -12
- data/lib/pki_express/signature_starter.rb +116 -116
- data/lib/pki_express/signer.rb +151 -151
- data/lib/pki_express/standard_signature_policies.rb +58 -58
- data/lib/pki_express/timestamp_authority.rb +50 -50
- data/lib/pki_express/trust_service_auth_parameters.rb +20 -20
- data/lib/pki_express/trust_service_info.rb +37 -37
- data/lib/pki_express/trust_service_manager.rb +258 -258
- data/lib/pki_express/trust_service_session_result.rb +29 -29
- data/lib/pki_express/trust_service_session_types.rb +7 -7
- data/lib/pki_express/tsa_authentication_type.rb +14 -14
- data/lib/pki_express/validation_error.rb +8 -8
- data/lib/pki_express/validation_item.rb +43 -43
- data/lib/pki_express/validation_item_types.rb +103 -103
- data/lib/pki_express/validation_results.rb +120 -120
- data/lib/pki_express/version.rb +3 -3
- data/lib/pki_express/version_manager.rb +20 -20
- data/lib/pki_express.rb +69 -69
- data/pki_express.gemspec +26 -26
- data/spec/pki_express/pki_express_config_spec.rb +73 -0
- data/spec/pki_express/pki_express_operator_spec.rb +31 -0
- data/spec/spec_helper.rb +13 -0
- metadata +17 -9
@@ -1,259 +1,259 @@
|
|
1
|
-
module PkiExpress
|
2
|
-
class TrustServicesManager < PkiExpressOperator
|
3
|
-
def initialize(config=PkiExpressConfig.new)
|
4
|
-
super(config)
|
5
|
-
end
|
6
|
-
|
7
|
-
def check_by_cpf(service, cpf)
|
8
|
-
unless service
|
9
|
-
raise "The provided service is not valid"
|
10
|
-
end
|
11
|
-
|
12
|
-
unless cpf
|
13
|
-
raise "The provided CPF is not valid"
|
14
|
-
end
|
15
|
-
|
16
|
-
args = [
|
17
|
-
service,
|
18
|
-
'--cpf',
|
19
|
-
cpf,
|
20
|
-
]
|
21
|
-
|
22
|
-
# This operation can only be used on versions greater than 1.18 of
|
23
|
-
# the PKI Express.
|
24
|
-
@version_manager.require_version('1.18')
|
25
|
-
|
26
|
-
# Invoke command.
|
27
|
-
response = invoke(Commands::CHECK_SERVICE, args)
|
28
|
-
|
29
|
-
# Parse output and return result.
|
30
|
-
model = parse_output(response)
|
31
|
-
CheckServiceResult.new(model)
|
32
|
-
end
|
33
|
-
|
34
|
-
def check_by_cnpj(service, cnpj)
|
35
|
-
unless service
|
36
|
-
raise "The provided service is not valid"
|
37
|
-
end
|
38
|
-
|
39
|
-
unless cnpj
|
40
|
-
raise "The provided CNPJ is not valid"
|
41
|
-
end
|
42
|
-
|
43
|
-
args = [
|
44
|
-
service,
|
45
|
-
'--cnpj',
|
46
|
-
cnpj,
|
47
|
-
]
|
48
|
-
|
49
|
-
# This operation can only be used on versions greater than 1.18 of
|
50
|
-
# the PKI Express.
|
51
|
-
@version_manager.require_version('1.18')
|
52
|
-
|
53
|
-
# Invoke command.
|
54
|
-
response = invoke(Commands::CHECK_SERVICE, args)
|
55
|
-
|
56
|
-
# Parse output and return result.
|
57
|
-
model = parse_output(response)
|
58
|
-
CheckServiceResult.new(model)
|
59
|
-
end
|
60
|
-
|
61
|
-
def discover_by_cpf(cpf, throw_exceptions=false)
|
62
|
-
unless cpf
|
63
|
-
raise "The provided CPF is not valid"
|
64
|
-
end
|
65
|
-
|
66
|
-
args = [
|
67
|
-
'--cpf',
|
68
|
-
cpf
|
69
|
-
]
|
70
|
-
|
71
|
-
if throw_exceptions
|
72
|
-
args.append('--throw')
|
73
|
-
end
|
74
|
-
|
75
|
-
# This operation can only be used on versions greater than 1.18 of
|
76
|
-
# the PKI Express.
|
77
|
-
@version_manager.require_version('1.18')
|
78
|
-
|
79
|
-
# Invoke command.
|
80
|
-
response = invoke(Commands::DISCOVER_SERVICES, args)
|
81
|
-
|
82
|
-
# Parse output and return result.
|
83
|
-
model = parse_output(response)
|
84
|
-
DiscoverServicesResult.new(model).services
|
85
|
-
end
|
86
|
-
|
87
|
-
def discover_by_cnpj(cnpj, throw_exceptions=false)
|
88
|
-
unless cnpj
|
89
|
-
raise "The provided CNPJ is not valid"
|
90
|
-
end
|
91
|
-
|
92
|
-
args = [
|
93
|
-
'--cnpj',
|
94
|
-
cnpj
|
95
|
-
]
|
96
|
-
|
97
|
-
if throw_exceptions
|
98
|
-
args.append('--throw')
|
99
|
-
end
|
100
|
-
# This operation can only be used on versions greater than 1.18 of
|
101
|
-
# the PKI Express.
|
102
|
-
@version_manager.require_version('1.18')
|
103
|
-
|
104
|
-
# Invoke command.
|
105
|
-
response = invoke(Commands::DISCOVER_SERVICES, args)
|
106
|
-
|
107
|
-
# Parse output and return result.
|
108
|
-
model = parse_output(response)
|
109
|
-
DiscoverServicesResult.new(model).services
|
110
|
-
end
|
111
|
-
|
112
|
-
def discover_by_cpf_and_start_auth(cpf, redirect_url,
|
113
|
-
session_type=TrustServiceSessionTypes::SIGNATURE_SESSION,
|
114
|
-
custom_state=nil, throw_exceptions=false)
|
115
|
-
unless cpf
|
116
|
-
raise "The provided CPF is not valid"
|
117
|
-
end
|
118
|
-
unless redirect_url
|
119
|
-
raise "The provided redirectUrl is not valid"
|
120
|
-
end
|
121
|
-
unless session_type
|
122
|
-
raise "No session type was provided"
|
123
|
-
end
|
124
|
-
|
125
|
-
args = [
|
126
|
-
'--cpf',
|
127
|
-
cpf,
|
128
|
-
'--redirect-url',
|
129
|
-
redirect_url,
|
130
|
-
'--session-type',
|
131
|
-
session_type,
|
132
|
-
]
|
133
|
-
|
134
|
-
if custom_state
|
135
|
-
args.append('--custom-state')
|
136
|
-
args.append(custom_state)
|
137
|
-
end
|
138
|
-
|
139
|
-
if throw_exceptions
|
140
|
-
args.append('--throw')
|
141
|
-
end
|
142
|
-
|
143
|
-
# This operation can only be used on versions greater than 1.18 of
|
144
|
-
# the PKI Express.
|
145
|
-
@version_manager.require_version('1.18')
|
146
|
-
|
147
|
-
# Invoke command.
|
148
|
-
response = invoke(Commands::DISCOVER_SERVICES, args)
|
149
|
-
|
150
|
-
# Parse output and return result.
|
151
|
-
model = parse_output(response)
|
152
|
-
DiscoverServicesResult.new(model).auth_parameters
|
153
|
-
end
|
154
|
-
|
155
|
-
def discover_by_cnpj_and_start_auth(cnpj, redirect_url,
|
156
|
-
session_type=TrustServiceSessionTypes::SIGNATURE_SESSION,
|
157
|
-
custom_state=nil, throw_exceptions=false)
|
158
|
-
unless cnpj
|
159
|
-
raise "The provided CNPJ is not valid"
|
160
|
-
end
|
161
|
-
unless redirect_url
|
162
|
-
raise "The provided redirectUrl is not valid"
|
163
|
-
end
|
164
|
-
unless session_type
|
165
|
-
raise "No session type was provided"
|
166
|
-
end
|
167
|
-
|
168
|
-
args = [
|
169
|
-
'--cnpj',
|
170
|
-
cnpj,
|
171
|
-
'--redirect-url',
|
172
|
-
redirect_url,
|
173
|
-
'--session-type',
|
174
|
-
session_type
|
175
|
-
]
|
176
|
-
|
177
|
-
if custom_state
|
178
|
-
args.append('--custom-state')
|
179
|
-
args.append(custom_state)
|
180
|
-
end
|
181
|
-
|
182
|
-
if throw_exceptions
|
183
|
-
args.append('--throw')
|
184
|
-
end
|
185
|
-
|
186
|
-
# This operation can only be used on versions greater than 1.18 of
|
187
|
-
# the PKI Express.
|
188
|
-
@version_manager.require_version('1.18')
|
189
|
-
|
190
|
-
# Invoke command.
|
191
|
-
response = invoke(Commands::DISCOVER_SERVICES, args)
|
192
|
-
|
193
|
-
# Parse output and return result.
|
194
|
-
model = parse_output(response)
|
195
|
-
DiscoverServicesResult.new(model).auth_parameters
|
196
|
-
end
|
197
|
-
|
198
|
-
def password_authorize(service, username, password,
|
199
|
-
session_type=TrustServiceSessionTypes::SIGNATURE_SESSION)
|
200
|
-
unless service
|
201
|
-
raise "The provided service is not valid"
|
202
|
-
end
|
203
|
-
|
204
|
-
unless username
|
205
|
-
raise "The provided username is not valid"
|
206
|
-
end
|
207
|
-
|
208
|
-
unless password
|
209
|
-
raise "The provided password is not valid"
|
210
|
-
end
|
211
|
-
|
212
|
-
unless session_type
|
213
|
-
raise "No session type was provided"
|
214
|
-
end
|
215
|
-
|
216
|
-
args = [
|
217
|
-
service,
|
218
|
-
username,
|
219
|
-
password,
|
220
|
-
session_type
|
221
|
-
]
|
222
|
-
|
223
|
-
# This operation can only be used on versions greater than 1.18 of
|
224
|
-
# the PKI Express.
|
225
|
-
@version_manager.require_version('1.18')
|
226
|
-
|
227
|
-
# Invoke command.
|
228
|
-
response = invoke(Commands::PASSWORD_AUTHORIZE, args)
|
229
|
-
|
230
|
-
# Parse output and return result.
|
231
|
-
model = parse_output(response)
|
232
|
-
TrustServiceSessionResult.new(model)
|
233
|
-
end
|
234
|
-
|
235
|
-
def complete_auth(code, state)
|
236
|
-
unless code
|
237
|
-
raise "The provided code is not valid"
|
238
|
-
end
|
239
|
-
|
240
|
-
unless state
|
241
|
-
raise "The provided state is not valid"
|
242
|
-
end
|
243
|
-
|
244
|
-
args = [code, state]
|
245
|
-
|
246
|
-
# This operation can only be used on versions greater than 1.18 of
|
247
|
-
# the PKI Express.
|
248
|
-
@version_manager.require_version('1.18')
|
249
|
-
|
250
|
-
# Invoke command.
|
251
|
-
response = invoke(Commands::COMPLETE_SERVICE_AUTH, args)
|
252
|
-
|
253
|
-
# Parse output and return result.
|
254
|
-
model = parse_output(response)
|
255
|
-
TrustServiceSessionResult.new(model)
|
256
|
-
end
|
257
|
-
|
258
|
-
end
|
1
|
+
module PkiExpress
|
2
|
+
class TrustServicesManager < PkiExpressOperator
|
3
|
+
def initialize(config=PkiExpressConfig.new)
|
4
|
+
super(config)
|
5
|
+
end
|
6
|
+
|
7
|
+
def check_by_cpf(service, cpf)
|
8
|
+
unless service
|
9
|
+
raise "The provided service is not valid"
|
10
|
+
end
|
11
|
+
|
12
|
+
unless cpf
|
13
|
+
raise "The provided CPF is not valid"
|
14
|
+
end
|
15
|
+
|
16
|
+
args = [
|
17
|
+
service,
|
18
|
+
'--cpf',
|
19
|
+
cpf,
|
20
|
+
]
|
21
|
+
|
22
|
+
# This operation can only be used on versions greater than 1.18 of
|
23
|
+
# the PKI Express.
|
24
|
+
@version_manager.require_version('1.18')
|
25
|
+
|
26
|
+
# Invoke command.
|
27
|
+
response = invoke(Commands::CHECK_SERVICE, args)
|
28
|
+
|
29
|
+
# Parse output and return result.
|
30
|
+
model = parse_output(response)
|
31
|
+
CheckServiceResult.new(model)
|
32
|
+
end
|
33
|
+
|
34
|
+
def check_by_cnpj(service, cnpj)
|
35
|
+
unless service
|
36
|
+
raise "The provided service is not valid"
|
37
|
+
end
|
38
|
+
|
39
|
+
unless cnpj
|
40
|
+
raise "The provided CNPJ is not valid"
|
41
|
+
end
|
42
|
+
|
43
|
+
args = [
|
44
|
+
service,
|
45
|
+
'--cnpj',
|
46
|
+
cnpj,
|
47
|
+
]
|
48
|
+
|
49
|
+
# This operation can only be used on versions greater than 1.18 of
|
50
|
+
# the PKI Express.
|
51
|
+
@version_manager.require_version('1.18')
|
52
|
+
|
53
|
+
# Invoke command.
|
54
|
+
response = invoke(Commands::CHECK_SERVICE, args)
|
55
|
+
|
56
|
+
# Parse output and return result.
|
57
|
+
model = parse_output(response)
|
58
|
+
CheckServiceResult.new(model)
|
59
|
+
end
|
60
|
+
|
61
|
+
def discover_by_cpf(cpf, throw_exceptions=false)
|
62
|
+
unless cpf
|
63
|
+
raise "The provided CPF is not valid"
|
64
|
+
end
|
65
|
+
|
66
|
+
args = [
|
67
|
+
'--cpf',
|
68
|
+
cpf
|
69
|
+
]
|
70
|
+
|
71
|
+
if throw_exceptions
|
72
|
+
args.append('--throw')
|
73
|
+
end
|
74
|
+
|
75
|
+
# This operation can only be used on versions greater than 1.18 of
|
76
|
+
# the PKI Express.
|
77
|
+
@version_manager.require_version('1.18')
|
78
|
+
|
79
|
+
# Invoke command.
|
80
|
+
response = invoke(Commands::DISCOVER_SERVICES, args)
|
81
|
+
|
82
|
+
# Parse output and return result.
|
83
|
+
model = parse_output(response)
|
84
|
+
DiscoverServicesResult.new(model).services
|
85
|
+
end
|
86
|
+
|
87
|
+
def discover_by_cnpj(cnpj, throw_exceptions=false)
|
88
|
+
unless cnpj
|
89
|
+
raise "The provided CNPJ is not valid"
|
90
|
+
end
|
91
|
+
|
92
|
+
args = [
|
93
|
+
'--cnpj',
|
94
|
+
cnpj
|
95
|
+
]
|
96
|
+
|
97
|
+
if throw_exceptions
|
98
|
+
args.append('--throw')
|
99
|
+
end
|
100
|
+
# This operation can only be used on versions greater than 1.18 of
|
101
|
+
# the PKI Express.
|
102
|
+
@version_manager.require_version('1.18')
|
103
|
+
|
104
|
+
# Invoke command.
|
105
|
+
response = invoke(Commands::DISCOVER_SERVICES, args)
|
106
|
+
|
107
|
+
# Parse output and return result.
|
108
|
+
model = parse_output(response)
|
109
|
+
DiscoverServicesResult.new(model).services
|
110
|
+
end
|
111
|
+
|
112
|
+
def discover_by_cpf_and_start_auth(cpf, redirect_url,
|
113
|
+
session_type=TrustServiceSessionTypes::SIGNATURE_SESSION,
|
114
|
+
custom_state=nil, throw_exceptions=false)
|
115
|
+
unless cpf
|
116
|
+
raise "The provided CPF is not valid"
|
117
|
+
end
|
118
|
+
unless redirect_url
|
119
|
+
raise "The provided redirectUrl is not valid"
|
120
|
+
end
|
121
|
+
unless session_type
|
122
|
+
raise "No session type was provided"
|
123
|
+
end
|
124
|
+
|
125
|
+
args = [
|
126
|
+
'--cpf',
|
127
|
+
cpf,
|
128
|
+
'--redirect-url',
|
129
|
+
redirect_url,
|
130
|
+
'--session-type',
|
131
|
+
session_type,
|
132
|
+
]
|
133
|
+
|
134
|
+
if custom_state
|
135
|
+
args.append('--custom-state')
|
136
|
+
args.append(custom_state)
|
137
|
+
end
|
138
|
+
|
139
|
+
if throw_exceptions
|
140
|
+
args.append('--throw')
|
141
|
+
end
|
142
|
+
|
143
|
+
# This operation can only be used on versions greater than 1.18 of
|
144
|
+
# the PKI Express.
|
145
|
+
@version_manager.require_version('1.18')
|
146
|
+
|
147
|
+
# Invoke command.
|
148
|
+
response = invoke(Commands::DISCOVER_SERVICES, args)
|
149
|
+
|
150
|
+
# Parse output and return result.
|
151
|
+
model = parse_output(response)
|
152
|
+
DiscoverServicesResult.new(model).auth_parameters
|
153
|
+
end
|
154
|
+
|
155
|
+
def discover_by_cnpj_and_start_auth(cnpj, redirect_url,
|
156
|
+
session_type=TrustServiceSessionTypes::SIGNATURE_SESSION,
|
157
|
+
custom_state=nil, throw_exceptions=false)
|
158
|
+
unless cnpj
|
159
|
+
raise "The provided CNPJ is not valid"
|
160
|
+
end
|
161
|
+
unless redirect_url
|
162
|
+
raise "The provided redirectUrl is not valid"
|
163
|
+
end
|
164
|
+
unless session_type
|
165
|
+
raise "No session type was provided"
|
166
|
+
end
|
167
|
+
|
168
|
+
args = [
|
169
|
+
'--cnpj',
|
170
|
+
cnpj,
|
171
|
+
'--redirect-url',
|
172
|
+
redirect_url,
|
173
|
+
'--session-type',
|
174
|
+
session_type
|
175
|
+
]
|
176
|
+
|
177
|
+
if custom_state
|
178
|
+
args.append('--custom-state')
|
179
|
+
args.append(custom_state)
|
180
|
+
end
|
181
|
+
|
182
|
+
if throw_exceptions
|
183
|
+
args.append('--throw')
|
184
|
+
end
|
185
|
+
|
186
|
+
# This operation can only be used on versions greater than 1.18 of
|
187
|
+
# the PKI Express.
|
188
|
+
@version_manager.require_version('1.18')
|
189
|
+
|
190
|
+
# Invoke command.
|
191
|
+
response = invoke(Commands::DISCOVER_SERVICES, args)
|
192
|
+
|
193
|
+
# Parse output and return result.
|
194
|
+
model = parse_output(response)
|
195
|
+
DiscoverServicesResult.new(model).auth_parameters
|
196
|
+
end
|
197
|
+
|
198
|
+
def password_authorize(service, username, password,
|
199
|
+
session_type=TrustServiceSessionTypes::SIGNATURE_SESSION)
|
200
|
+
unless service
|
201
|
+
raise "The provided service is not valid"
|
202
|
+
end
|
203
|
+
|
204
|
+
unless username
|
205
|
+
raise "The provided username is not valid"
|
206
|
+
end
|
207
|
+
|
208
|
+
unless password
|
209
|
+
raise "The provided password is not valid"
|
210
|
+
end
|
211
|
+
|
212
|
+
unless session_type
|
213
|
+
raise "No session type was provided"
|
214
|
+
end
|
215
|
+
|
216
|
+
args = [
|
217
|
+
service,
|
218
|
+
username,
|
219
|
+
password,
|
220
|
+
session_type
|
221
|
+
]
|
222
|
+
|
223
|
+
# This operation can only be used on versions greater than 1.18 of
|
224
|
+
# the PKI Express.
|
225
|
+
@version_manager.require_version('1.18')
|
226
|
+
|
227
|
+
# Invoke command.
|
228
|
+
response = invoke(Commands::PASSWORD_AUTHORIZE, args)
|
229
|
+
|
230
|
+
# Parse output and return result.
|
231
|
+
model = parse_output(response)
|
232
|
+
TrustServiceSessionResult.new(model)
|
233
|
+
end
|
234
|
+
|
235
|
+
def complete_auth(code, state)
|
236
|
+
unless code
|
237
|
+
raise "The provided code is not valid"
|
238
|
+
end
|
239
|
+
|
240
|
+
unless state
|
241
|
+
raise "The provided state is not valid"
|
242
|
+
end
|
243
|
+
|
244
|
+
args = [code, state]
|
245
|
+
|
246
|
+
# This operation can only be used on versions greater than 1.18 of
|
247
|
+
# the PKI Express.
|
248
|
+
@version_manager.require_version('1.18')
|
249
|
+
|
250
|
+
# Invoke command.
|
251
|
+
response = invoke(Commands::COMPLETE_SERVICE_AUTH, args)
|
252
|
+
|
253
|
+
# Parse output and return result.
|
254
|
+
model = parse_output(response)
|
255
|
+
TrustServiceSessionResult.new(model)
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
259
|
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'date'
|
2
|
-
|
3
|
-
module PkiExpress
|
4
|
-
|
5
|
-
class TrustServiceSessionResult
|
6
|
-
|
7
|
-
attr_accessor :session, :custom_state, :service, :session_type, :expires_on
|
8
|
-
|
9
|
-
def initialize(model)
|
10
|
-
@session = nil
|
11
|
-
@custom_state = nil
|
12
|
-
@service = nil
|
13
|
-
@session_type = nil
|
14
|
-
@expires_on = nil
|
15
|
-
|
16
|
-
unless model.nil?
|
17
|
-
@session = model.fetch(:session)
|
18
|
-
@custom_state = model.fetch(:customState)
|
19
|
-
@service = model.fetch(:service)
|
20
|
-
@session_type = model.fetch(:type)
|
21
|
-
|
22
|
-
expires_on = model.fetch(:expiresOn)
|
23
|
-
if expires_on
|
24
|
-
@expires_on = DateTime.iso8601(expires_on)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module PkiExpress
|
4
|
+
|
5
|
+
class TrustServiceSessionResult
|
6
|
+
|
7
|
+
attr_accessor :session, :custom_state, :service, :session_type, :expires_on
|
8
|
+
|
9
|
+
def initialize(model)
|
10
|
+
@session = nil
|
11
|
+
@custom_state = nil
|
12
|
+
@service = nil
|
13
|
+
@session_type = nil
|
14
|
+
@expires_on = nil
|
15
|
+
|
16
|
+
unless model.nil?
|
17
|
+
@session = model.fetch(:session)
|
18
|
+
@custom_state = model.fetch(:customState)
|
19
|
+
@service = model.fetch(:service)
|
20
|
+
@session_type = model.fetch(:type)
|
21
|
+
|
22
|
+
expires_on = model.fetch(:expiresOn)
|
23
|
+
if expires_on
|
24
|
+
@expires_on = DateTime.iso8601(expires_on)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
30
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module PkiExpress
|
2
|
-
class TrustServiceSessionTypes
|
3
|
-
SINGLE_SIGNATURE = 'SingleSignature',
|
4
|
-
MULTI_SIGNATURE = 'MultiSignature',
|
5
|
-
SIGNATURE_SESSION = 'SignatureSession',
|
6
|
-
AUTHENTICATION_SESSION = 'AuthenticationSession'
|
7
|
-
end
|
1
|
+
module PkiExpress
|
2
|
+
class TrustServiceSessionTypes
|
3
|
+
SINGLE_SIGNATURE = 'SingleSignature',
|
4
|
+
MULTI_SIGNATURE = 'MultiSignature',
|
5
|
+
SIGNATURE_SESSION = 'SignatureSession',
|
6
|
+
AUTHENTICATION_SESSION = 'AuthenticationSession'
|
7
|
+
end
|
8
8
|
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
module PkiExpress
|
2
|
-
class TsaAuthenticationType < Enum
|
3
|
-
NONE = 'None'
|
4
|
-
BASIC_AUTH = 'BasicAuth'
|
5
|
-
SSL = 'SSL'
|
6
|
-
OAUTH_TOKEN = 'OAuthToken'
|
7
|
-
|
8
|
-
VALUES = [
|
9
|
-
NONE,
|
10
|
-
BASIC_AUTH,
|
11
|
-
SSL,
|
12
|
-
OAUTH_TOKEN
|
13
|
-
]
|
14
|
-
end
|
1
|
+
module PkiExpress
|
2
|
+
class TsaAuthenticationType < Enum
|
3
|
+
NONE = 'None'
|
4
|
+
BASIC_AUTH = 'BasicAuth'
|
5
|
+
SSL = 'SSL'
|
6
|
+
OAUTH_TOKEN = 'OAuthToken'
|
7
|
+
|
8
|
+
VALUES = [
|
9
|
+
NONE,
|
10
|
+
BASIC_AUTH,
|
11
|
+
SSL,
|
12
|
+
OAUTH_TOKEN
|
13
|
+
]
|
14
|
+
end
|
15
15
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module PkiExpress
|
2
|
-
class ValidationError < CommandError
|
3
|
-
|
4
|
-
def initialize(validation_results, inner_error=nil)
|
5
|
-
super(ErrorCodes::VALIDATION_FAILED, validation_results, inner_error)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
1
|
+
module PkiExpress
|
2
|
+
class ValidationError < CommandError
|
3
|
+
|
4
|
+
def initialize(validation_results, inner_error=nil)
|
5
|
+
super(ErrorCodes::VALIDATION_FAILED, validation_results, inner_error)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|