ory-oathkeeper-client 0.38.4.beta1 → 0.38.12.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/docs/ApiApi.md +292 -37
- data/docs/CreateRuleCreated.md +8 -7
- data/docs/CreateRuleForbidden.md +8 -7
- data/docs/CreateRuleForbiddenBody.md +18 -17
- data/docs/CreateRuleInternalServerError.md +8 -7
- data/docs/CreateRuleInternalServerErrorBody.md +18 -17
- data/docs/CreateRuleUnauthorized.md +8 -7
- data/docs/CreateRuleUnauthorizedBody.md +18 -17
- data/docs/DecisionsForbidden.md +8 -7
- data/docs/DecisionsForbiddenBody.md +18 -17
- data/docs/DecisionsInternalServerError.md +8 -7
- data/docs/DecisionsInternalServerErrorBody.md +18 -17
- data/docs/DecisionsNotFound.md +8 -7
- data/docs/DecisionsNotFoundBody.md +18 -17
- data/docs/DecisionsUnauthorized.md +8 -7
- data/docs/DecisionsUnauthorizedBody.md +18 -17
- data/docs/DeleteRuleForbidden.md +8 -7
- data/docs/DeleteRuleForbiddenBody.md +18 -17
- data/docs/DeleteRuleInternalServerError.md +8 -7
- data/docs/DeleteRuleInternalServerErrorBody.md +18 -17
- data/docs/DeleteRuleNotFound.md +8 -7
- data/docs/DeleteRuleNotFoundBody.md +18 -17
- data/docs/DeleteRuleUnauthorized.md +8 -7
- data/docs/DeleteRuleUnauthorizedBody.md +18 -17
- data/docs/GetRuleForbidden.md +8 -7
- data/docs/GetRuleForbiddenBody.md +18 -17
- data/docs/GetRuleInternalServerError.md +8 -7
- data/docs/GetRuleInternalServerErrorBody.md +18 -17
- data/docs/GetRuleNotFound.md +8 -7
- data/docs/GetRuleNotFoundBody.md +18 -17
- data/docs/GetRuleOK.md +8 -7
- data/docs/GetRuleUnauthorized.md +8 -7
- data/docs/GetRuleUnauthorizedBody.md +18 -17
- data/docs/GetWellKnownForbidden.md +8 -7
- data/docs/GetWellKnownForbiddenBody.md +18 -17
- data/docs/GetWellKnownJSONWebKeysInternalServerError.md +8 -7
- data/docs/GetWellKnownJSONWebKeysInternalServerErrorBody.md +18 -17
- data/docs/GetWellKnownJSONWebKeysOK.md +8 -7
- data/docs/GetWellKnownOK.md +8 -7
- data/docs/GetWellKnownUnauthorized.md +8 -7
- data/docs/GetWellKnownUnauthorizedBody.md +18 -17
- data/docs/HealthNotReadyStatus.md +8 -7
- data/docs/HealthStatus.md +8 -7
- data/docs/InlineResponse500.md +18 -17
- data/docs/IsInstanceAliveInternalServerError.md +8 -7
- data/docs/IsInstanceAliveInternalServerErrorBody.md +18 -17
- data/docs/IsInstanceAliveOK.md +8 -7
- data/docs/JsonWebKey.md +40 -39
- data/docs/JsonWebKeySet.md +8 -7
- data/docs/JudgeForbidden.md +8 -7
- data/docs/JudgeForbiddenBody.md +18 -17
- data/docs/JudgeInternalServerError.md +8 -7
- data/docs/JudgeInternalServerErrorBody.md +18 -17
- data/docs/JudgeNotFound.md +8 -7
- data/docs/JudgeNotFoundBody.md +18 -17
- data/docs/JudgeUnauthorized.md +8 -7
- data/docs/JudgeUnauthorizedBody.md +18 -17
- data/docs/ListRulesForbidden.md +8 -7
- data/docs/ListRulesForbiddenBody.md +18 -17
- data/docs/ListRulesInternalServerError.md +8 -7
- data/docs/ListRulesInternalServerErrorBody.md +18 -17
- data/docs/ListRulesOK.md +8 -7
- data/docs/ListRulesUnauthorized.md +8 -7
- data/docs/ListRulesUnauthorizedBody.md +18 -17
- data/docs/Rule.md +20 -19
- data/docs/RuleHandler.md +10 -9
- data/docs/RuleMatch.md +10 -9
- data/docs/SwaggerCreateRuleParameters.md +8 -7
- data/docs/SwaggerGetRuleParameters.md +8 -7
- data/docs/SwaggerHealthStatus.md +8 -7
- data/docs/SwaggerJSONWebKey.md +40 -39
- data/docs/SwaggerJSONWebKeySet.md +8 -7
- data/docs/SwaggerListRulesParameters.md +10 -9
- data/docs/SwaggerNotReadyStatus.md +8 -7
- data/docs/SwaggerRule.md +20 -19
- data/docs/SwaggerRuleHandler.md +10 -9
- data/docs/SwaggerRuleMatch.md +10 -9
- data/docs/SwaggerRuleResponse.md +8 -7
- data/docs/SwaggerRulesResponse.md +8 -7
- data/docs/SwaggerUpdateRuleParameters.md +10 -9
- data/docs/SwaggerVersion.md +8 -7
- data/docs/UpdateRuleForbidden.md +8 -7
- data/docs/UpdateRuleForbiddenBody.md +18 -17
- data/docs/UpdateRuleInternalServerError.md +8 -7
- data/docs/UpdateRuleInternalServerErrorBody.md +18 -17
- data/docs/UpdateRuleNotFound.md +8 -7
- data/docs/UpdateRuleNotFoundBody.md +18 -17
- data/docs/UpdateRuleOK.md +8 -7
- data/docs/UpdateRuleUnauthorized.md +8 -7
- data/docs/UpdateRuleUnauthorizedBody.md +18 -17
- data/docs/Upstream.md +12 -11
- data/docs/Version.md +8 -7
- data/lib/ory-oathkeeper-client.rb +2 -4
- data/lib/ory-oathkeeper-client/api/api_api.rb +189 -14
- data/lib/ory-oathkeeper-client/api/health_api.rb +1 -1
- data/lib/ory-oathkeeper-client/api/version_api.rb +1 -1
- data/lib/ory-oathkeeper-client/api_client.rb +51 -49
- data/lib/ory-oathkeeper-client/api_error.rb +2 -2
- data/lib/ory-oathkeeper-client/configuration.rb +40 -11
- data/lib/ory-oathkeeper-client/models/create_rule_created.rb +20 -8
- data/lib/ory-oathkeeper-client/models/create_rule_forbidden.rb +20 -8
- data/lib/ory-oathkeeper-client/models/create_rule_forbidden_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/create_rule_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/create_rule_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/create_rule_unauthorized.rb +20 -8
- data/lib/ory-oathkeeper-client/models/create_rule_unauthorized_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/decisions_forbidden.rb +20 -8
- data/lib/ory-oathkeeper-client/models/decisions_forbidden_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/decisions_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/decisions_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/decisions_not_found.rb +20 -8
- data/lib/ory-oathkeeper-client/models/decisions_not_found_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/decisions_unauthorized.rb +20 -8
- data/lib/ory-oathkeeper-client/models/decisions_unauthorized_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/delete_rule_forbidden.rb +20 -8
- data/lib/ory-oathkeeper-client/models/delete_rule_forbidden_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/delete_rule_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/delete_rule_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/delete_rule_not_found.rb +20 -8
- data/lib/ory-oathkeeper-client/models/delete_rule_not_found_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/delete_rule_unauthorized.rb +20 -8
- data/lib/ory-oathkeeper-client/models/delete_rule_unauthorized_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/get_rule_forbidden.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_rule_forbidden_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/get_rule_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_rule_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/get_rule_not_found.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_rule_not_found_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/get_rule_ok.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_rule_unauthorized.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_rule_unauthorized_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/get_well_known_forbidden.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_well_known_forbidden_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/get_well_known_json_web_keys_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_well_known_json_web_keys_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/get_well_known_json_web_keys_ok.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_well_known_ok.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_well_known_unauthorized.rb +20 -8
- data/lib/ory-oathkeeper-client/models/get_well_known_unauthorized_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/health_not_ready_status.rb +20 -8
- data/lib/ory-oathkeeper-client/models/health_status.rb +20 -8
- data/lib/ory-oathkeeper-client/models/inline_response500.rb +20 -8
- data/lib/ory-oathkeeper-client/models/is_instance_alive_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/is_instance_alive_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/is_instance_alive_ok.rb +20 -8
- data/lib/ory-oathkeeper-client/models/json_web_key.rb +20 -8
- data/lib/ory-oathkeeper-client/models/json_web_key_set.rb +20 -8
- data/lib/ory-oathkeeper-client/models/judge_forbidden.rb +20 -8
- data/lib/ory-oathkeeper-client/models/judge_forbidden_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/judge_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/judge_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/judge_not_found.rb +20 -8
- data/lib/ory-oathkeeper-client/models/judge_not_found_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/judge_unauthorized.rb +20 -8
- data/lib/ory-oathkeeper-client/models/judge_unauthorized_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/list_rules_forbidden.rb +20 -8
- data/lib/ory-oathkeeper-client/models/list_rules_forbidden_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/list_rules_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/list_rules_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/list_rules_ok.rb +20 -8
- data/lib/ory-oathkeeper-client/models/list_rules_unauthorized.rb +20 -8
- data/lib/ory-oathkeeper-client/models/list_rules_unauthorized_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/rule.rb +20 -8
- data/lib/ory-oathkeeper-client/models/rule_handler.rb +20 -8
- data/lib/ory-oathkeeper-client/models/rule_match.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_create_rule_parameters.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_get_rule_parameters.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_health_status.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_json_web_key.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_json_web_key_set.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_list_rules_parameters.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_not_ready_status.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_rule.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_rule_handler.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_rule_match.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_rule_response.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_rules_response.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_update_rule_parameters.rb +20 -8
- data/lib/ory-oathkeeper-client/models/swagger_version.rb +20 -8
- data/lib/ory-oathkeeper-client/models/update_rule_forbidden.rb +20 -8
- data/lib/ory-oathkeeper-client/models/update_rule_forbidden_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/update_rule_internal_server_error.rb +20 -8
- data/lib/ory-oathkeeper-client/models/update_rule_internal_server_error_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/update_rule_not_found.rb +20 -8
- data/lib/ory-oathkeeper-client/models/update_rule_not_found_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/update_rule_ok.rb +20 -8
- data/lib/ory-oathkeeper-client/models/update_rule_unauthorized.rb +20 -8
- data/lib/ory-oathkeeper-client/models/update_rule_unauthorized_body.rb +21 -9
- data/lib/ory-oathkeeper-client/models/upstream.rb +20 -8
- data/lib/ory-oathkeeper-client/models/version.rb +20 -8
- data/lib/ory-oathkeeper-client/version.rb +3 -3
- data/ory-oathkeeper-client.gemspec +4 -5
- data/spec/api_client_spec.rb +3 -3
- data/spec/configuration_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +78 -98
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies.
|
5
5
|
|
6
|
-
The version of the OpenAPI document: v0.38.
|
6
|
+
The version of the OpenAPI document: v0.38.5-beta.1
|
7
7
|
Contact: hi@ory.am
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 4.3.1
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies.
|
5
5
|
|
6
|
-
The version of the OpenAPI document: v0.38.
|
6
|
+
The version of the OpenAPI document: v0.38.5-beta.1
|
7
7
|
Contact: hi@ory.am
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 4.3.1
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
#ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies.
|
5
5
|
|
6
|
-
The version of the OpenAPI document: v0.38.
|
6
|
+
The version of the OpenAPI document: v0.38.12-beta.1
|
7
7
|
Contact: hi@ory.am
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,6 +14,7 @@ require 'date'
|
|
14
14
|
require 'json'
|
15
15
|
require 'logger'
|
16
16
|
require 'tempfile'
|
17
|
+
require 'time'
|
17
18
|
require 'typhoeus'
|
18
19
|
|
19
20
|
module OryHydraClient
|
@@ -86,7 +87,7 @@ module OryHydraClient
|
|
86
87
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
87
88
|
# @return [Typhoeus::Request] A Typhoeus Request
|
88
89
|
def build_request(http_method, path, opts = {})
|
89
|
-
url = build_request_url(path)
|
90
|
+
url = build_request_url(path, opts)
|
90
91
|
http_method = http_method.to_sym.downcase
|
91
92
|
|
92
93
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
@@ -154,6 +155,44 @@ module OryHydraClient
|
|
154
155
|
data
|
155
156
|
end
|
156
157
|
|
158
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
159
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
160
|
+
# The response body is written to the file in chunks in order to handle files which
|
161
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
162
|
+
# process can use.
|
163
|
+
#
|
164
|
+
# @see Configuration#temp_folder_path
|
165
|
+
def download_file(request)
|
166
|
+
tempfile = nil
|
167
|
+
encoding = nil
|
168
|
+
request.on_headers do |response|
|
169
|
+
content_disposition = response.headers['Content-Disposition']
|
170
|
+
if content_disposition && content_disposition =~ /filename=/i
|
171
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
172
|
+
prefix = sanitize_filename(filename)
|
173
|
+
else
|
174
|
+
prefix = 'download-'
|
175
|
+
end
|
176
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
177
|
+
encoding = response.body.encoding
|
178
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
179
|
+
@tempfile = tempfile
|
180
|
+
end
|
181
|
+
request.on_body do |chunk|
|
182
|
+
chunk.force_encoding(encoding)
|
183
|
+
tempfile.write(chunk)
|
184
|
+
end
|
185
|
+
request.on_complete do |response|
|
186
|
+
if tempfile
|
187
|
+
tempfile.close
|
188
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
189
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
190
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
191
|
+
"explicitly with `tempfile.delete`"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
157
196
|
# Check if the given MIME is a JSON MIME.
|
158
197
|
# JSON MIME examples:
|
159
198
|
# application/json
|
@@ -190,7 +229,7 @@ module OryHydraClient
|
|
190
229
|
begin
|
191
230
|
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
192
231
|
rescue JSON::ParserError => e
|
193
|
-
if %w(String Date
|
232
|
+
if %w(String Date Time).include?(return_type)
|
194
233
|
data = body
|
195
234
|
else
|
196
235
|
raise e
|
@@ -215,9 +254,9 @@ module OryHydraClient
|
|
215
254
|
data.to_f
|
216
255
|
when 'Boolean'
|
217
256
|
data == true
|
218
|
-
when '
|
257
|
+
when 'Time'
|
219
258
|
# parse date time (expecting ISO 8601 format)
|
220
|
-
|
259
|
+
Time.parse data
|
221
260
|
when 'Date'
|
222
261
|
# parse date time (expecting ISO 8601 format)
|
223
262
|
Date.parse data
|
@@ -235,46 +274,9 @@ module OryHydraClient
|
|
235
274
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
236
275
|
end
|
237
276
|
else
|
238
|
-
# models
|
239
|
-
OryHydraClient.const_get(return_type)
|
240
|
-
|
241
|
-
end
|
242
|
-
|
243
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
244
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
245
|
-
# The response body is written to the file in chunks in order to handle files which
|
246
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
247
|
-
# process can use.
|
248
|
-
#
|
249
|
-
# @see Configuration#temp_folder_path
|
250
|
-
def download_file(request)
|
251
|
-
tempfile = nil
|
252
|
-
encoding = nil
|
253
|
-
request.on_headers do |response|
|
254
|
-
content_disposition = response.headers['Content-Disposition']
|
255
|
-
if content_disposition && content_disposition =~ /filename=/i
|
256
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
257
|
-
prefix = sanitize_filename(filename)
|
258
|
-
else
|
259
|
-
prefix = 'download-'
|
260
|
-
end
|
261
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
262
|
-
encoding = response.body.encoding
|
263
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
264
|
-
@tempfile = tempfile
|
265
|
-
end
|
266
|
-
request.on_body do |chunk|
|
267
|
-
chunk.force_encoding(encoding)
|
268
|
-
tempfile.write(chunk)
|
269
|
-
end
|
270
|
-
request.on_complete do |response|
|
271
|
-
if tempfile
|
272
|
-
tempfile.close
|
273
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
274
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
275
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
276
|
-
"explicitly with `tempfile.delete`"
|
277
|
-
end
|
277
|
+
# models (e.g. Pet) or oneOf
|
278
|
+
klass = OryHydraClient.const_get(return_type)
|
279
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
278
280
|
end
|
279
281
|
end
|
280
282
|
|
@@ -287,10 +289,10 @@ module OryHydraClient
|
|
287
289
|
filename.gsub(/.*[\/\\]/, '')
|
288
290
|
end
|
289
291
|
|
290
|
-
def build_request_url(path)
|
292
|
+
def build_request_url(path, opts = {})
|
291
293
|
# Add leading and trailing slashes to path
|
292
294
|
path = "/#{path}".gsub(/\/+/, '/')
|
293
|
-
@config.base_url + path
|
295
|
+
@config.base_url(opts[:operation]) + path
|
294
296
|
end
|
295
297
|
|
296
298
|
# Update hearder and query params based on authentication settings.
|
@@ -305,7 +307,7 @@ module OryHydraClient
|
|
305
307
|
case auth_setting[:in]
|
306
308
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
307
309
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
308
|
-
else fail ArgumentError, 'Authentication token must be in `query`
|
310
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
309
311
|
end
|
310
312
|
end
|
311
313
|
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
#ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies.
|
5
5
|
|
6
|
-
The version of the OpenAPI document: v0.38.
|
6
|
+
The version of the OpenAPI document: v0.38.12-beta.1
|
7
7
|
Contact: hi@ory.am
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
#ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies.
|
5
5
|
|
6
|
-
The version of the OpenAPI document: v0.38.
|
6
|
+
The version of the OpenAPI document: v0.38.12-beta.1
|
7
7
|
Contact: hi@ory.am
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -21,6 +21,18 @@ module OryHydraClient
|
|
21
21
|
# Defines url base path
|
22
22
|
attr_accessor :base_path
|
23
23
|
|
24
|
+
# Define server configuration index
|
25
|
+
attr_accessor :server_index
|
26
|
+
|
27
|
+
# Define server operation configuration index
|
28
|
+
attr_accessor :server_operation_index
|
29
|
+
|
30
|
+
# Default server variables
|
31
|
+
attr_accessor :server_variables
|
32
|
+
|
33
|
+
# Default server operation variables
|
34
|
+
attr_accessor :server_operation_variables
|
35
|
+
|
24
36
|
# Defines API keys used with API Key authentications.
|
25
37
|
#
|
26
38
|
# @return [Hash] key: parameter name, value: parameter value (API key)
|
@@ -129,6 +141,10 @@ module OryHydraClient
|
|
129
141
|
@scheme = 'http'
|
130
142
|
@host = 'localhost'
|
131
143
|
@base_path = ''
|
144
|
+
@server_index = 0
|
145
|
+
@server_operation_index = {}
|
146
|
+
@server_variables = {}
|
147
|
+
@server_operation_variables = {}
|
132
148
|
@api_key = {}
|
133
149
|
@api_key_prefix = {}
|
134
150
|
@timeout = 0
|
@@ -171,17 +187,23 @@ module OryHydraClient
|
|
171
187
|
@base_path = '' if @base_path == '/'
|
172
188
|
end
|
173
189
|
|
174
|
-
|
175
|
-
|
190
|
+
# Returns base URL for specified operation based on server settings
|
191
|
+
def base_url(operation = nil)
|
192
|
+
index = server_operation_index.fetch(operation, server_index)
|
193
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
194
|
+
|
195
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
176
196
|
end
|
177
197
|
|
178
198
|
# Gets API key (with prefix if set).
|
179
199
|
# @param [String] param_name the parameter name of API key auth
|
180
|
-
def api_key_with_prefix(param_name)
|
200
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
201
|
+
key = @api_key[param_name]
|
202
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
181
203
|
if @api_key_prefix[param_name]
|
182
|
-
"#{@api_key_prefix[param_name]} #{
|
204
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
183
205
|
else
|
184
|
-
|
206
|
+
key
|
185
207
|
end
|
186
208
|
end
|
187
209
|
|
@@ -200,18 +222,23 @@ module OryHydraClient
|
|
200
222
|
def server_settings
|
201
223
|
[
|
202
224
|
{
|
203
|
-
url: "
|
225
|
+
url: "",
|
204
226
|
description: "No description provided",
|
205
227
|
}
|
206
228
|
]
|
207
229
|
end
|
208
230
|
|
231
|
+
def operation_server_settings
|
232
|
+
{
|
233
|
+
}
|
234
|
+
end
|
235
|
+
|
209
236
|
# Returns URL based on server settings
|
210
237
|
#
|
211
238
|
# @param index array index of the server settings
|
212
239
|
# @param variables hash of variable and the corresponding value
|
213
|
-
def server_url(index, variables = {})
|
214
|
-
servers = server_settings
|
240
|
+
def server_url(index, variables = {}, servers = nil)
|
241
|
+
servers = server_settings if servers == nil
|
215
242
|
|
216
243
|
# check array index out of bound
|
217
244
|
if (index < 0 || index >= servers.size)
|
@@ -221,10 +248,12 @@ module OryHydraClient
|
|
221
248
|
server = servers[index]
|
222
249
|
url = server[:url]
|
223
250
|
|
251
|
+
return url unless server.key? :variables
|
252
|
+
|
224
253
|
# go through variable and assign a value
|
225
254
|
server[:variables].each do |name, variable|
|
226
255
|
if variables.key?(name)
|
227
|
-
if (server[:variables][name][:enum_values].include?
|
256
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
228
257
|
url.gsub! "{" + name.to_s + "}", variables[name]
|
229
258
|
else
|
230
259
|
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
@@ -3,14 +3,15 @@
|
|
3
3
|
|
4
4
|
#ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies.
|
5
5
|
|
6
|
-
The version of the OpenAPI document: v0.0.0
|
6
|
+
The version of the OpenAPI document: v0.0.0
|
7
7
|
Contact: hi@ory.am
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 5.0.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module OryHydraClient
|
16
17
|
# A rule
|
@@ -24,6 +25,11 @@ module OryHydraClient
|
|
24
25
|
}
|
25
26
|
end
|
26
27
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
29
|
+
def self.acceptable_attributes
|
30
|
+
attribute_map.values
|
31
|
+
end
|
32
|
+
|
27
33
|
# Attribute type mapping.
|
28
34
|
def self.openapi_types
|
29
35
|
{
|
@@ -103,7 +109,9 @@ module OryHydraClient
|
|
103
109
|
def build_from_hash(attributes)
|
104
110
|
return nil unless attributes.is_a?(Hash)
|
105
111
|
self.class.openapi_types.each_pair do |key, type|
|
106
|
-
if
|
112
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
113
|
+
self.send("#{key}=", nil)
|
114
|
+
elsif type =~ /\AArray<(.*)>/i
|
107
115
|
# check to ensure the input is an array given that the attribute
|
108
116
|
# is documented as an array but the input is not
|
109
117
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -111,7 +119,7 @@ module OryHydraClient
|
|
111
119
|
end
|
112
120
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
113
121
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
114
|
-
end
|
122
|
+
end
|
115
123
|
end
|
116
124
|
|
117
125
|
self
|
@@ -123,8 +131,8 @@ module OryHydraClient
|
|
123
131
|
# @return [Object] Deserialized data
|
124
132
|
def _deserialize(type, value)
|
125
133
|
case type.to_sym
|
126
|
-
when :
|
127
|
-
|
134
|
+
when :Time
|
135
|
+
Time.parse(value)
|
128
136
|
when :Date
|
129
137
|
Date.parse(value)
|
130
138
|
when :String
|
@@ -154,7 +162,9 @@ module OryHydraClient
|
|
154
162
|
end
|
155
163
|
end
|
156
164
|
else # model
|
157
|
-
|
165
|
+
# models (e.g. Pet) or oneOf
|
166
|
+
klass = OryHydraClient.const_get(type)
|
167
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
158
168
|
end
|
159
169
|
end
|
160
170
|
|
@@ -180,7 +190,7 @@ module OryHydraClient
|
|
180
190
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
181
191
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
182
192
|
end
|
183
|
-
|
193
|
+
|
184
194
|
hash[param] = _to_hash(value)
|
185
195
|
end
|
186
196
|
hash
|
@@ -203,5 +213,7 @@ module OryHydraClient
|
|
203
213
|
value
|
204
214
|
end
|
205
215
|
end
|
216
|
+
|
206
217
|
end
|
218
|
+
|
207
219
|
end
|
@@ -3,14 +3,15 @@
|
|
3
3
|
|
4
4
|
#ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies.
|
5
5
|
|
6
|
-
The version of the OpenAPI document: v0.0.0
|
6
|
+
The version of the OpenAPI document: v0.0.0
|
7
7
|
Contact: hi@ory.am
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 5.0.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module OryHydraClient
|
16
17
|
# The standard error format
|
@@ -24,6 +25,11 @@ module OryHydraClient
|
|
24
25
|
}
|
25
26
|
end
|
26
27
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
29
|
+
def self.acceptable_attributes
|
30
|
+
attribute_map.values
|
31
|
+
end
|
32
|
+
|
27
33
|
# Attribute type mapping.
|
28
34
|
def self.openapi_types
|
29
35
|
{
|
@@ -103,7 +109,9 @@ module OryHydraClient
|
|
103
109
|
def build_from_hash(attributes)
|
104
110
|
return nil unless attributes.is_a?(Hash)
|
105
111
|
self.class.openapi_types.each_pair do |key, type|
|
106
|
-
if
|
112
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
113
|
+
self.send("#{key}=", nil)
|
114
|
+
elsif type =~ /\AArray<(.*)>/i
|
107
115
|
# check to ensure the input is an array given that the attribute
|
108
116
|
# is documented as an array but the input is not
|
109
117
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -111,7 +119,7 @@ module OryHydraClient
|
|
111
119
|
end
|
112
120
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
113
121
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
114
|
-
end
|
122
|
+
end
|
115
123
|
end
|
116
124
|
|
117
125
|
self
|
@@ -123,8 +131,8 @@ module OryHydraClient
|
|
123
131
|
# @return [Object] Deserialized data
|
124
132
|
def _deserialize(type, value)
|
125
133
|
case type.to_sym
|
126
|
-
when :
|
127
|
-
|
134
|
+
when :Time
|
135
|
+
Time.parse(value)
|
128
136
|
when :Date
|
129
137
|
Date.parse(value)
|
130
138
|
when :String
|
@@ -154,7 +162,9 @@ module OryHydraClient
|
|
154
162
|
end
|
155
163
|
end
|
156
164
|
else # model
|
157
|
-
|
165
|
+
# models (e.g. Pet) or oneOf
|
166
|
+
klass = OryHydraClient.const_get(type)
|
167
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
158
168
|
end
|
159
169
|
end
|
160
170
|
|
@@ -180,7 +190,7 @@ module OryHydraClient
|
|
180
190
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
181
191
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
182
192
|
end
|
183
|
-
|
193
|
+
|
184
194
|
hash[param] = _to_hash(value)
|
185
195
|
end
|
186
196
|
hash
|
@@ -203,5 +213,7 @@ module OryHydraClient
|
|
203
213
|
value
|
204
214
|
end
|
205
215
|
end
|
216
|
+
|
206
217
|
end
|
218
|
+
|
207
219
|
end
|