Having issues while storing user and password into REFramework Dictionary


#1

Hi I am trying to use the REFramework. In the IntiAllSettings, we need to get the credentials from orchestrator. So while receiving user and password from GetAppCredentials.xaml, it says
“strict disallow implicit conversion”. Here the out arguments are String and Secure String; and these are getting pushed into a dictionary Value which takes “object”.

image


#2

Hi,

First, the dictionary value needs to be converted to a string with .ToString.
Lastly, you can technically convert the string to a SecureString using a .net function, however, it is recommended that you use the Get Credential activity under Assets, which you can store the password directly into the variable or argument that stores the Username and Password, so you don’t need to put the Username and Password as a string in your config file visible to anyone who looks.

Regards.


#3

Thanks Clayton. Appreciate your help. I figured that we should not persistently store user-pass into a dictionary during the tenure of the program. Instead we should use get credential to extract and login into the application and then discard. I am thinking, that may be the reason why “GetAppCredential.xaml” is a standalone program in the REFramework; so that it can be called only when needed.

While trying to fix my code I learnt something new…

Realized that the compiler is trying to convert the variable in the “Value” to the type of the argument variable (though its a 'Out" direction argument). Which is little weird. Since the variable in the “Value” is the final container of the object being transferred from the out variable.
We can bypass this issue by storing the out argument into a temporary variable (of the same type). and then assign the temporary variable to the dictionary.

Thanks again for your help. You have a very good day!


#4

No problem. Also, my approach with passwords is typically, I just store the Asset Name in my dictionary, then for every app or web portal I build a Login component that receives the Asset Name and retrieves the password only within that one component. There are probably some better ideas out there though, but I’m just trying to avoid passing credentials around more times than I need to.