import com.sap.it.api.ITApi
import com.sap.it.api.ITApiFactory
import com.sap.it.api.securestore.*;
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
//Body
def body = message.getBody();
String password;
String _output="";
def pMap = message.getProperties();
String CREDENTIAL_NAME=pMap.get("ARC_CRED").toString();
def service = ITApiFactory.getApi(SecureStoreService.class, null);
def credential = service.getUserCredential(CREDENTIAL_NAME);
if (credential == null)
{
throw new IllegalStateException("No credential found for alias 'CREDENTIAL_NAME'");
}
else
{
password= new String(credential.getPassword());
}
message.setProperty("P_Password", password);
return message;
}
No comments:
Post a Comment