Use VG Authorization Token Access

This section provides introductory information about how to integrate VideoGuard into your existing systems. It is not necessary to run IIS and WMS in the same machine.  VideoGuard can be used in a different environments. 

The time of machines in the clustered servers must be in sync.



1. A request to view a video http://mediaserver/PlayVideo.asp?video=ID4.asf is sent from userís browser to web server.

2. The web page PlayVideo.asp calls a web page GetTokenID.asp in another IIS server to get the TokenID.

<% '-- PlayVideo.asp --

'assume the  publishing point name is securedir, and userip=
sURL = http://iisserver/GetTokenID.asp?ppn=securedir&

'use a scraping web page program to get TokenID from GetTokenID.asp, such as WebScraper 2.0
Set obj = Server.CreateObject("Hoyasoft.HTTP")
TokenID = obj.RequestURL(sURL)



3. The IIS web page GetTokenID.asp calls the method GetEncryptedToken() in VGAuthorization.dll component interface to return a TOKENID with encrypted TokenValidPeriod, Username, and UserIP back to the first web page PlayVideo.asp.

<% '-- GetTokenID.asp --

PublishingPointName = Request.QueryString("ppn")

PluginName = "Hoyasoft VideoGuard Authorization Plugin"

TokenTime = 5 

Username = Request.QueryString("uid")

UserIP = Request.QueryString("uip")

'create a Window Media services object
Set Obj = Server.CreateObject("wmsserver.server")

'get encrypted TokneID using the method in the VideoGuard Authorization component interface under that publishing point.
TokenID = Obj.PublishingPoints.Item(PublishingPointName).EventHandlers.Item(PluginName).CustomInterface.GetEncryptedToken(TokenTime,UserIP,Username)

'if you are using server level token ID, you can simply use the following lines get it from the VideoGuard Authorization component interface without using publishing point
'Set Obj = Server.CreateObject("VGAuthorization.AuthorizeAdmin")
'STokenID = Obj.GetEncryptedSToken(TokenTime ,UserIP,Username)



4. The Web servers returns a URL mms://mediaserver/ID4.asf?TOKENID=FDS321AEWTRE543TRTY324TRYTRUYT321H243JH to the browser.

<% '-- PlayVideo.asp --

sURL = http://iisserver/GetTokenID.asp?ppn=securedir&
Set obj = Server.CreateObject("Hoyasoft.HTTP")
TokenID = obj.RequestURL(sURL)
VideoFile= Request.QueryString("video")
Response.Redirect "mms://mediaserver/" & VideoFile & "?TOKENID=" & TokenID 



5. The browser connects to WMS with the above URL. VG authorization plug-in captures the TOKENID value. The streaming request is granted if the decrypted TOKENID value matches the IP address of Window Media Player and also the connection time is within token valid period time. Otherwise, the request is denied. If the request is granted, the username will be used in all VG plug-ins.

6. Windows Media Services depends on the result of Token Access checking to grant/deny the streaming request.


Note: if the web page is  PlayVideo.php 


$pubpointname = "secured";
$uid = "";
$fd = fopen("http://$mediaserver/GetTokenID.asp?ppn=$publishpointname&uid=$username&uip=$userip", "r");
$tokenid = trim(fread($fd, 4096));