cancel
Showing results for 
Search instead for 
Did you mean: 

Credentials how to get clear pasword

Former Member
0 Kudos

For Some process(redwoodscript code) I need to use a username/password

so I thought that can be a good idea to store it using credentials

and then from the code be able to retrieve the password.

But when I did it my paswword was not cleared.

  Credential c = jcsSession.getCredentialByCredentialProtocolEndpointRealUser(jcsSession.getCredentialProtocolByName("XXX"), "XXX", "XXX");

  jcsOut.println(c.getPassword());

The api doc sais that it is encripted some how.

Get the value for Password. (The password for a connection. Encrypted by postSetPassword) This value is mandatory, and therefore will not be null if this object has been retrieved from the database.

So is there any way of Clearing that password?

it's clear that internally sapcps is able to clear those, however it would make sense that we users/admin cant event using redwood scripting.

My other alternative was to store the password in a systemtable using standard Java crypto api (but again I could not find a way of insert the value into the table from redwood script and I do not want to use copy and paste since Encrypted password might not be printable characters.

Could someone give me first any confirmation that option 1 and 2 are not viable and if so. any idea on how to store and retrieve a password.

(the idea is not to make bullet prove system but just avoid to have something in plain text password=XXXXX

I hope I made my self clear.

Thanks

Miguel Campos.

Accepted Solutions (0)

Answers (2)

Answers (2)

basv
Explorer
0 Kudos

Hi Miguel,

Regarding option 2, it is possible to store values in a table using the below code example.

This assumes you have created a table in Cronacle called CREDENTIALS on the Global partition. You can use table definition 'System_Variables_Definition' to create it.

{

  Partition part = jcsSession.getPartitionByName("GLOBAL");

  Table table = jcsSession.getTableByName(part, "CREDENTIALS");

TableValue value1 = table.createTableValue();

  value1.setKey("JOHNDOE");

  value1.setColumnName("SystemValue");

  value1.setColumnValue("your_encrypted_password_string");

  jcsSession.persist();

}

This creates a record in table CREDENTIALS like below.

KeySystemValue
JOHNDOE your_encrypted_password_string

Replace the password string in the code with the outcome of you custom crypto function.

You can retrieve the value from the table like this.


{

  Partition part = jcsSession.getPartitionByName("GLOBAL");

  Table table = jcsSession.getTableByName(part, "CREDENTIALS");

  TableValue value = table.getTableValueBySearchKeySearchColumnName("JOHNDOE", "SystemValue");

  String encryptedpassword = value.getColumnValue();

}

It is also possible to create a jobdefinition parameter called 'password', and set the parameter options to 'Password'.

Whenever you submit the jobdefinition, Cronacle will ** star out the plain text password during entry, and when viewing the jobs parameters via the monitor. However you can still retrieve the parameter's plain text value in redwood script.

gmblom
Active Contributor
0 Kudos

Hello,

This intended usage for 'Custom' Credentials that can be decrypted this way as well is planned to be implemented soon.

Regards Gerben