Generating an Encrypted URL for a Report

image_pdfimage_print

To generate an encrypted URL with user data for a report, you can use a PHP script like in the example below. This example demonstrates how the script allows you to encrypt a link to generate a link in an external web server.

<h3>Please enter data then click on submit button</h3>
<?php
 $url = '';
 $secret = '';
 $user = '';
 $pass = '';
 if(isset($_GET['pass'])){
 $url = $_GET['url'];
 $secret = $_GET['secret'];
 $user = $_GET['user'];
 $password = $_GET['pass'];
 
 echo '<div style="padding: 10px; border: 1px solid #333; color: black; font-style: bold; margin-bottom: 15px;">Click <a href="' . concat_url($url, $user, $password, $secret) . '" target="_new">here</a> to jump to report.</div>';
}
?>
 
<form action="passgen.php" name="gen" type="post">
<input type="text" name="url" value="<?php echo $url;?>"> <b>URL</b>: copy/paste URL from a report (Properties/Link -without user credentials)<br>
<input type="text" name="secret" value="<?php echo $secret;?>"> <b>Secret</b>: copy/paste secret from "Jedox Suite\httpd\app\etc\config.php"<br>
<input type="text" name="user" value="<?php echo $user;?>"> <b>Username</b>: enter valid username<br>
<input type="text" name="pass" value="<?php echo $pass;?>"> <b>Password</b>: enter valid password<br>
<input type="submit">
<input type="reset"><br><b>
</form>
 
<?php
 function encrypt_password($password, $secret)
 {
 $iv = openssl_random_pseudo_bytes(16);
 $password = base64_encode($iv . openssl_encrypt($password, 'AES-128-CFB8', $secret, OPENSSL_RAW_DATA, $iv));
 $password = "\ta\t" . $password;
 $password = urlencode($password);
 return $password;
 }
 function concat_url($url, $username, $password, $secret)
 {
 return $url . '&user=' . $username . '&pass=' . encrypt_password($password, $secret);
 }
?>

The following dialog will result:

To copy the link, open the Reports component of Jedox Web, right-click on a report, and navigate to Properties > Link, then copy the link without login info.

image_pdfimage_print