Windows Media Services SDK banner art
PreviousNext

Pay-Per-View Authorization Component Sample

The Pay-per-View Authorization Component Sample, written in C++, provides a working example of how to write a Windows Media Services authorization plug-in component. The source code can be found in the C:\Program Files\Windows Media Components\SDK\Source\Authorization\ directory.

You can build the sample component either in Microsoft® Visual Studio® 98 (by opening NSMemberPPV.dsw workspace file and then, on the Tools menu, clicking Build).

Note If you are using Microsoft® Visual Studio® 97 to run this sample, you must download Microsoft® Active Directory Service Interfaces (ADSI) version 2.0 from the ADSI page at the Microsoft Web site.

This Pay-per-View Authorization Component implements a business logic to grant permission for a client to view a Windows Media Services title if the user is a member of the specified group and has paid for that title. Authorization is performed against the information available in the connected database.

The time frame in which the user is allowed to view the title is determined by entries in the database that have been set when the user paid.

The main class is CPayPerView, which implements the INSSEventNotification and INSSEventAuthorization interfaces for Windows Media Services event notification and authorization. The CPayPerView class handles initialization of the plug-in component, and all the communications to and from the server running Windows Media Services.

Calls to AuthorizeEvent return asynchronously (to avoid monopolizing a server thread for too long). As a result, most of the actual work involved in authorization and event notification is passed to separate worker threads through a 2000 I/O completion port in Microsoft® Windows NT® Server.

The CPayPerView class uses the CLDAPAccess class to maintain a connection to an ADO/ODBC data source for executing database queries and updates. It also uses the CSGroups class to implement the authorization policy. The CpayPerView, CLDAPAccess and CSGroups classes are contained in the PayPerView.cpp, LDAPAccess.cpp and Sgroups.cpp files, respectively.

PreviousNext


© 1996-1999 Microsoft Corporation. All rights reserved.