10-11-2023 01:31 AM
I’m working on setting up authentication flow towards SuperOffice.
We have this set up currently using Python script from another platform but I’m trying to recreate it without using Script Snaps.
The auth flow should work like this:
Step 1. Sign the SystemUserToken with Private key.
Step 2. Exchange the signed SystemUserToken for a JWT.
Step 3. Validate the returned JWT and extract SystemUserTicket.
This is how Step 1 is performed using Python script from another platform:
private_key_pem = ‘-----BEGIN RSA PRIVATE KEY-----’ + ‘\n’ + private_key_pem + ‘\n’ + ‘-----END RSA PRIVATE KEY-----’
private_key = crypto.load_privatekey(crypto.FILETYPE_PEM, private_key_pem)
utcnow = datetime.utcnow().strftime(“%Y%m%d%H%M”)
system_user_token_with_time = system_user_token + “.” + utcnow
signature = crypto.sign(private_key, system_user_token_with_time, ‘sha256’)
signed_system_user_token = system_user_token_with_time + “.” + b64encode(signature).decode(‘utf-8’)
The part I'm struggling with is how to do the crypto.sign() equivalent in SnapLogic. I've tried using PGP Sign but it requires a passphrase together with the Private Key when setting up the Private Key account.
Unfortunately the Private Key provided to me doesn't have a passphrase connected to it.
Does anyone have any ideas or suggestions on what I could do to solve this? Is it possible to set a Passphrase on an existing Private Key?
Thank you in advance.
B.R.
Teddie