Navigation
Records in this category
- How can I update the Muse Navigation Manager component?
- What is Proxy Chaining?
- How can I change the Muse Proxy administrator user password?
- What is the Muse Proxy Authentication Token Filter role?
- Where are the Client Sessions used?
- Where are the Navigation Sessions used?
- There are 2 time-out values that can be set up in Muse Proxy: - Connect time-out - Read time-out These 2 time-out values are base settings for connection to sockets: - the Connect time-out is the time to wait until a connection is timing out. - the Read
- Will the Proxy Server/Navigation Manager relationship still be functional if the two entities are in different subnets?
- How can I change the Muse Proxy administrator user password?
- Muse servers not running after closing the console.
- How can I tell if my Muse Proxy is secure?
- How can I update the Muse Navigation Manager component?
- How to set up HMAC authentication on a Muse Proxy application?
- How can I generate HMAC Muse Proxy proxified links in PHP?
- How can I generate HMAC Muse Proxy proxified links in Java?
- How can I generate HMAC Muse Proxy proxified links in .Net?
- What URL format do you use to create a persistent URL to a specific article in a database, when using Muse Proxy?
Tags
Sticky FAQs
Muse Proxy » Usage
How can I generate HMAC Muse Proxy proxified links in PHP?
The instructions and code provided below are based on the following assumptions:
- MuseProxyFoundationHMAC is the Muse Proxy application configured with HMAC authentication;
- quiet is the value of the secret;
- userName and timestamp are the signature parameters;
- SHA256 is the algorithm;
- the separator between the signature parameters is . .
Add the following code into your PHP page:
<?php
require_once './MuseProxyHMAC.php';
$museProxyURL = "http://MUSE_PROXY_HOST:PORT";
$applicationID = "MuseProxyFoundationHMAC";
$secret = "quiet";
$algorithm = "sha256";
$separator = ".";
// $timestamp is the current unix timestamp
$timestamp = time();
// $userAgent represent the userAgent from the request
//$userAgent = filter_input(INPUT_SERVER, "HTTP_USER_AGENT");
// $referer represent the referer from the request
//$referer = filter_input(INPUT_SERVER, "REQUEST_SCHEME") . "://" . filter_input(INPUT_SERVER, "HTTP_HOST") . filter_input(INPUT_SERVER, "REQUEST_URI");
// $userAddress represents the remote adress
//$userAddress = gethostbyname(gethostbyaddr(filter_input(INPUT_SERVER, "REMOTE_ADDR")));
//The order from this array must be the same with order and parameters name from the hmac configuration file ${APPLICATION_HOME}/profiles/login/ProxyLoginModuleHMAC.xml.
//$used_params = array("userName" => "MuseProxyFoundation", "ts" => $timestamp, "userAgent" => $userAgent, "referer" => $referer, "userAddress" => $userAddress);
$used_params = array("userName" => $applicationID, "ts" => $timestamp);
$museProxy = new MuseProxyHMAC($museProxyURL, $applicationID, $secret, $algorithm, $separator, $used_params);
echo $museProxy->generatedHmacDigest . "<br/>";
echo "<a href='" . $museProxy->generatedURL . "' target='_blank'>TEST<a/>";
?>
where replace MUSE_PROXY_HOST:PORT with your actual Muse Proxy host and port.
The aditional MuseProxyHMAC.php file can be downloaded from here.
The code will generate the HMAC link on the TEST label.
The commented lines are for the cases when you want to use in the signature the userAgent/referer/userAddress values.
Note that they must be specified in the Muse Proxy as well (in the $MUSE_HOME\proxy\webcontexts\Applications\MuseProxyFoundationHMAC
\profiles\login\ProxyLoginModuleHMAC.xml file).
Tags: can, generate, HMAC, how, links, muse, PHP, proxified, proxy
Related entries: -
Last update: 2017-05-23 12:31
Author: Administrator
Revision: 1.7
You cannot comment on this entry
powered by phpMyFAQ 2.7.2