Skip to content

Commit 0668288

Browse files
committed
adding Validation Code for JWT Auth Type with Request MLE
1 parent 02cf5e6 commit 0668288

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

lib/AuthenticationSDK/core/MerchantConfig.rb

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -301,30 +301,21 @@ def validateMLEConfiguration(cybsPropertyObj)
301301
end
302302
end
303303

304-
# # verify the input path for mle Cert should be correct else throw error in both case mle=true/false
305-
# if @mleForRequestPublicCertPath && [email protected]_s.strip.empty?
306-
# unless File.exist?(@mleForRequestPublicCertPath) && File.readable?(@mleForRequestPublicCertPath)
307-
# err = StandardError.new(Constants::ERROR_PREFIX + "Invalid mleForRequestPublicCertPath: file does not exist or is not readable")
308-
# @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
309-
# raise err
310-
# end
311-
# end
312-
313-
# mle_configured = @enableRequestMLEForOptionalApisGlobally
314-
315-
# @mapToControlMLEonAPI.each do |_, value|
316-
# unless [true, false].include?(value) && value
317-
# mle_configured = true
318-
# break
319-
# end
320-
# end
321-
# end
304+
request_mle_configured = @enableRequestMLEForOptionalApisGlobally
305+
if !@mapToControlMLEonAPI.nil? && !@mapToControlMLEonAPI.empty?
306+
@mapToControlMLEonAPI.each do |_, value|
307+
unless [true, false].include?(value) && value
308+
request_mle_configured = true
309+
break
310+
end
311+
end
312+
end
322313

323-
# if mle_configured && !Constants::AUTH_TYPE_JWT.eql?(@authenticationType.upcase)
324-
# err = StandardError.new(Constants::ERROR_PREFIX + "MLE can only be used with JWT authentication")
325-
# @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
326-
# raise err
327-
# end
314+
if request_mle_configured && !Constants::AUTH_TYPE_JWT.eql?(@authenticationType.upcase)
315+
err = StandardError.new(Constants::ERROR_PREFIX + "Request MLE can only be used with JWT authentication")
316+
@log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
317+
raise err
318+
end
328319
end
329320

330321
def logAllProperties(merchantPropertyObj)

0 commit comments

Comments
 (0)