Class: McAPI::Encryption::OpenAPIInterceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/mcapi/encryption/openapi_interceptor.rb

Overview

Service class that provide interceptor facilities for OpenApi swagger client

Class Method Summary collapse

Class Method Details

.install_field_level_encryption(swagger_client, config) ⇒ Object

Install the field level encryption in the OpenAPI HTTP client adding encryption/decryption capabilities for the request/response payload.

Parameters:

  • swagger_client (Object)

    OpenAPI service client (it can be generated by the swagger code generator)

  • config (Hash)

    configuration object describing which field to enable encryption/decryption



21
22
23
24
25
26
27
28
29
# File 'lib/mcapi/encryption/openapi_interceptor.rb', line 21

def install_field_level_encryption(swagger_client, config)
  fle = McAPI::Encryption::FieldLevelEncryption.new(config)
  # Hooking ApiClient#call_api
  hook_call_api fle
  # Hooking ApiClient#deserialize
  hook_deserialize fle
  McAPI::Encryption::OpenAPIInterceptor.init_call_api swagger_client
  McAPI::Encryption::OpenAPIInterceptor.init_deserialize swagger_client
end

.install_jwe_encryption(swagger_client, config) ⇒ Object

Install the JWE encryption in the OpenAPI HTTP client adding encryption/decryption capabilities for the request/response payload.

Parameters:

  • swagger_client (Object)

    OpenAPI service client (it can be generated by the swagger code generator)

  • config (Hash)

    configuration object describing which field to enable encryption/decryption



38
39
40
41
42
43
44
45
46
# File 'lib/mcapi/encryption/openapi_interceptor.rb', line 38

def install_jwe_encryption(swagger_client, config)
  jwe = McAPI::Encryption::JweEncryption.new(config)
  # Hooking ApiClient#call_api
  hook_call_api jwe
  # Hooking ApiClient#deserialize
  hook_deserialize jwe
  McAPI::Encryption::OpenAPIInterceptor.init_call_api swagger_client
  McAPI::Encryption::OpenAPIInterceptor.init_deserialize swagger_client
end