View Only

 Dynamic authentication token in KTR Rest Client

Marek Tomko's profile image
Marek Tomko posted 05-02-2022 10:50

We provide Authorization HTTP Header with the value Basic and the Base64 encoded username and password in Rest Client in KTR file.
In examples I see only hardcoded values of authentication token.

Is it possible to get that dynamically according to user logged (through PUC) in Pentaho server?
I have not found such "built in" variable offered by spoon while creating ktr.

Thanks in advance for an advice.

Andrew Cave's profile image
Andrew Cave
Hi Marek
Password is not available in the PUC, though you can get the current user with pentaho/api/session/userName  The authentication is handled by Spring security and it hashes the password itself before storing.

You can pass variables to the ktr via the REST interface and I suppose you could set the BasicAuth string but as base64 encoding is completely reversible, you probably shouldn't.

You could set up OAuth and pass the token through to the ktr and have it authenticate against your resource but that is a whole 'nother can of worms.