How to get Credential from credentialSpec
Hi,
I’m working on a custom node in Java and in that node I’ll need to get an AccessToken from another node (Microsoft Authenticator).
I already have create my custom node and managed to a build it with two input ports (one for the BufferedDataTable and one for the credentials CredentialPortObject).
Here is where I’m stuck, in my execute function I can get the CredentialPortObject but I don’t know how to get the AccessToken (should be a JWToken stored as a password) from that object.
protected BufferedDataTable execute(PortObject inData, final ExecutionContext exec)
throws Exception {
/*
The input data table to work with. The “inData” array will contain as many
input tables as specified in the constructor. In this case it can only be one
(see constructor).
*/
BufferedDataTable inputTable = (BufferedDataTable) inData[DATATABLE_PORT];
DataTableSpec spec = inputTable.getDataTableSpec();
// get the access token from the credential port
CredentialPortObject credentialPortObject = (CredentialPortObject) inData[CREDENTIAL_PORT];
...
return new BufferedDataTable[] { out };
}NB this AccessToken will be required both at configuration and execution time