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