Class: Authorization
- Inherits:
-
Object
- Object
- Authorization
- Defined in:
- lib/AuthenticationSDK/core/Authorization.rb
Overview
This function calls for the generation of Signature message depending on the authentication type.
Instance Method Summary collapse
Instance Method Details
#getToken(merchantconfig_obj, gmtdatetime) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/AuthenticationSDK/core/Authorization.rb', line 11 def getToken(merchantconfig_obj, gmtdatetime) @log_obj = Log.new merchantconfig_obj.log_config, "Authorization" authenticationType = merchantconfig_obj.authenticationType.upcase @log_obj.logger.info("Authentication Type: " + authenticationType) if merchantconfig_obj.requestType.to_s.empty? raise StandardError.new(Constants::ERROR_PREFIX + Constants::REQUEST_TYPE_EMPTY) end if authenticationType == Constants::AUTH_TYPE_HTTP token = GenerateHttpSignature.new.getToken(merchantconfig_obj, gmtdatetime) elsif authenticationType == Constants::AUTH_TYPE_JWT token = GenerateJwtToken.new.getToken(merchantconfig_obj, gmtdatetime) elsif authenticationType == Constants::AUTH_TYPE_OAUTH token = GenerateOAuthToken.new.getToken(merchantconfig_obj, gmtdatetime) else raise StandardError.ner(Constants::ERROR_PREFIX + Constants::AUTH_ERROR) end rescue StandardError => err @log_obj.logger.error(ExceptionHandler.new.new_api_exception err) raise err # exit! end |