Dayalan Punniyamoorthy Blog

Monday, September 5, 2022

Invoking REST API via Groovy program outside of EPM Cloud – Authentication to EPM Cloud Part-2



This post is the continuation of the previous one where I explained how to read the User ID, Password, etc.. from a file in the Groovy Program. So the file containing the  User ID, Password, etc.. is a central repository where you need to change it only once.

In this post, I will extend that feature by using the encoding/decoding methods to encode the password and decode it wherever needed. So the password Is not exposed anywhere and no security breach of storing the password in a file or a program.

Let me divide this post into two parts

  1. Encode the Oracle EPM authenticating Password using a Secret Key.

Kindly note I have used the AES encryption algorithm to encrypt the password.

 

 


Create a class to use the AES algorithm, where the needed inputs are the password as the string and the Secret Key of your choice. 



In Line 45 we are encrypting the password by providing the password and the Secret Key



Finally print Secret Key that is used, the Original Password, and the encrypted Password. 


An example executed result is shown in the above picture. 


2. Using the encrypted password in the Groovy program to authenticate to the Oracle EPM Cloud.

The complete program can be found here

The Program uses the encrypted password stored in the file and decrypts it using the AES algorithm and the secret key used to encrypt it.

The password and all other parameters are read from the file. 

PBCSDetails.properties files are given for your reference. 



Creating a class to decrypt the password

Passing the decrypted password and constructing a connect string with the needed details and initiating a connection.



Creating a class to execute Refresh database on the Oracle EPM instance after login using the decrypted password.

The sample of the output is even below as reference.  


Hope this is useful, more fun to come! 

No comments:

Post a Comment