Authntication Webservice PHP
Posted: Tue Feb 05, 2008 6:40 pm
hello guys..!
i have an Account with internap. i am planning to stream live videos through them. and i have 2 websites to get my feeds.
i saw that in internap they have php Authntication method Which will Allow me to block the leechers.
As per thier web, they discribe thier authntication method works
"Multiple authentication systems can be used to control access to your media.
When a user tries to view secure media, Internap’s Authentication Service passes the call to the remote web service specified by the customer.
This web service call is made in real-time and will only allow authorized users to access once the reply is received from the content owner."
And also they stated that
"Three Methods of Authentication Controls in thier php script
-Tokens: Link into any web service by requesting information from the user such as username and password or a time stamp for expiring links.
-IP Addresses: Only allow users in a specific IP block to view your media.
- Referrers: Ensure that links to media only come from websites authorized by you.
You can use any combination of these three attributes to accept or reject requests to view secure media. "
source : http://www.internapcdn.com/authentication/index.html
I need a little help with the Web service authentication php script. i am beginner and i have lot of doubts with it.
i want to play my videos from my 2 domain only. For example, if i need to play this videos from devnetwork.net and internap.com .
how i will modify the authentication.php? Should i edit WSDL file too..? i want to block all the other websites from playing this content.
i read on internap website that it is possible to do so with referer blocking method or a time stamp for expiring links. (token) i would like to have those two options.
please help me to edit these files. i will paste the files, the ones i downloaded from internap for webservice Authentication
the files are :
1.Authentication.php
2.Authentication.wsdl
=================================================================
Authentication.php
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PHP Code:
===============================================================
2nd file is Authentication.wsdl
=============================================================
PHP Code:
Once again Thank you so Much
With regards
E Buddy
i have an Account with internap. i am planning to stream live videos through them. and i have 2 websites to get my feeds.
i saw that in internap they have php Authntication method Which will Allow me to block the leechers.
As per thier web, they discribe thier authntication method works
"Multiple authentication systems can be used to control access to your media.
When a user tries to view secure media, Internap’s Authentication Service passes the call to the remote web service specified by the customer.
This web service call is made in real-time and will only allow authorized users to access once the reply is received from the content owner."
And also they stated that
"Three Methods of Authentication Controls in thier php script
-Tokens: Link into any web service by requesting information from the user such as username and password or a time stamp for expiring links.
-IP Addresses: Only allow users in a specific IP block to view your media.
- Referrers: Ensure that links to media only come from websites authorized by you.
You can use any combination of these three attributes to accept or reject requests to view secure media. "
source : http://www.internapcdn.com/authentication/index.html
I need a little help with the Web service authentication php script. i am beginner and i have lot of doubts with it.
i want to play my videos from my 2 domain only. For example, if i need to play this videos from devnetwork.net and internap.com .
how i will modify the authentication.php? Should i edit WSDL file too..? i want to block all the other websites from playing this content.
i read on internap website that it is possible to do so with referer blocking method or a time stamp for expiring links. (token) i would like to have those two options.
please help me to edit these files. i will paste the files, the ones i downloaded from internap for webservice Authentication
the files are :
1.Authentication.php
2.Authentication.wsdl
=================================================================
Authentication.php
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PHP Code:
Code: Select all
<?php
// Version 1.0
// This is a sample PHP to implement an authentication web service
// VitalStream's servers will call your web service to Accept or Reject connections
// If code is to provide a starting point for a developer wanting to create their own
// authentication rules for their streaming.
//
// If you modify this script or create a new one make sure you keep your SOAP messages compatible
// with the definitions inside Authentication.wsdl
//
// If you change the WSDL definitions or SOAP structure the client may not understand how to
// interact with your code
header("Content-Type: text/xml"); // The client calling this code expects XML content-type
// Create a soap server object based off the standard WSDL provided.
$server = new soapserver("Authentication.wsdl", array('encoding'=>'UTF-8'));
/* function: Authenticate
* Purpose: This is the method that will be called during each connection
* Use one of the input parameters as a criteria to authenticate the client
*
* Comments: Keep the duration between entering and exiting this function to a minimum
* The client cannot begin streaming until you send back a result
* If an extremely long time has lapsed the web service client may also terminate the
* connection
*
* Inputs:
* (strings)account The name of the VitalStream account associated with this request
* This could be useful if you have multiple accounts, otherwise is will
* always contain the same value.
*
* (strings)token This is the unique string that was passed into the Player
* This can be a alpha numeric and should not be predictable
*
* (strings)referrer This is the referrer passed to the server, usually this is the url
* to the .swf
*
* (strings)sourceURL This is the full URL being requested from the server
*
* (strings)ip This is the IP of the client connecting to the server
*
* Output:
* (int)0 Reject Access
* (int)1 Accept Access
*/
function Authenticate($account, $token, $referrer, $sourceurl, $ip)
{
// A very simple demonstration of how you can accept/reject connection on specific criteria
// In this case if the token is an even number we will allow access, if the number is odd we reject
if($token % 2 == 0) { $retval = "1"; }
return $retval; // return ACCEPT(1) or REJECT(0)
}
// map the SOAP operation to the appropriate PHP function above
$server->addFunction("Authenticate");
// This is just some extra code to show what web service function is available if you browse this PHP
if ($_SERVER["REQUEST_METHOD"] == "POST") // If this is a post from the web service client then handle soap
{
$server->handle(); // process the soap
}
else // this is probably a browser querying what function is available in this php
{
echo "This SOAP server can handle following functions: ";
$functions = $server->getFunctions();
foreach($functions as $func)
{
echo $func . "\n";
}
}
?>===============================================================
2nd file is Authentication.wsdl
=============================================================
PHP Code:
Code: Select all
<?xml version="1.0" ?>
<definitions name="VSAuthentication" targetNamespace="http://vitalstream.com/webservices" xmlns:typens="http://vitalstream.com/webservices" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://vitalstream.com/webservices">
</xsd:schema>
</types>
<message name="doAuthenticate">
<part name="strAccount" type="xsd:string" />
<part name="strToken" type="xsd:string" />
<part name="strReferrer" type="xsd:string" />
<part name="strSourceURL" type="xsd:string" />
<part name="strClientIP" type="xsd:string" />
</message>
<message name="doAuthenticateResponse">
<part name="Result" type="xsd:int" />
</message>
<portType name="VSAuthenticationPort">
<operation name="Authenticate">
<input message="typens:doAuthenticate" />
<output message="typens:doAuthenticateResponse" />
</operation>
</portType>
<binding name="VSAuthenticationBinding" type="typens:VSAuthenticationPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="Authenticate">
<soap:operation soapAction="http://vitalstream.com/webservices/Authenticate" />
<input>
<soap:body use="encoded" namespace="http://vitalstream.com/webservices" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="http://vitalstream.com/webservices" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="VSAuthenticationService">
<port name="VSAuthenticationPort" binding="typens:VSAuthenticationBinding">
<soap:address location="http://localhost/VSAuthenticationWS/php/Authentication.php" />
</port>
</service>
</definitions>Once again Thank you so Much
With regards
E Buddy