You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "szaszm (via GitHub)" <gi...@apache.org> on 2024/07/11 10:38:13 UTC

Re: [PR] MINIFICPP-2368 Add sensitive parameter support [nifi-minifi-cpp]

szaszm commented on code in PR #1806:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1806#discussion_r1673798510


##########
libminifi/include/core/ParameterTokenParser.h:
##########
@@ -131,5 +138,27 @@ class ParameterTokenParser {
   std::vector<std::unique_ptr<ParameterToken>> tokens_;
 };
 
+class NonSensitiveParameterTokenParser : public ParameterTokenParser {
+ public:
+  using ParameterTokenParser::ParameterTokenParser;
+
+ protected:
+  std::string getRawParameterValue(const Parameter& parameter) const override;
+};
+
+class SensitiveParameterTokenParser : public ParameterTokenParser {
+ public:
+  SensitiveParameterTokenParser(std::string input, utils::crypto::EncryptionProvider& sensitive_values_encryptor)
+      : ParameterTokenParser(std::move(input)),
+        sensitive_values_encryptor_(sensitive_values_encryptor) {
+  }
+
+ protected:
+  std::string getRawParameterValue(const Parameter& parameter) const override;
+
+ private:
+  utils::crypto::EncryptionProvider& sensitive_values_encryptor_;
+};
+

Review Comment:
   I think inheritance is unnecessary abstraction here. Wherever we're parsing the property could just call the token parser with or without decryption as needed. It's just an `if` statement. If encrypted, then decrypt. Then parse and substitute parameters.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org