The MembersOnly authorization component sample, written in C++, provides a working example of how to write a NetShow Theater Server authorization plug-in component. The source code can be found in the \NetShowTheaterRoot\SDK\Samples\Authorization\Member directory. Here, \NetShowTheaterRoot is the root directory where NetShow Theater Server is installed.
You can build and register the sample component either in Visual Studio 97 (by opening MembersOnlyPlugin.dsw workspace file and then, on the Tools menu, clicking Build) or from an MS-DOS shell (by typing the NMAKE -f MembersOnlyPlugin.mak command).
You also must run the MembersOnly.reg script in the \NetShowTheaterRoot\SDK\Samples\Commerce\Dlls\ directory to add the \HKEY_LOCAL\MACHINE\Software\Microsoft\NetShow\Servers\Default\Event Notification\MembersOnly Module key to the registry. The computer running NetShow Theater Server uses this key to determine if this sample authorization plug-in component is to be used for event authorization. The registry entry contains the information about the data source as well as the user name and/or password that must be used to access the data source. The database schema is specified in \NetShowTheaterRoot\SDK\Samples\Commerce\Store\Config\SQL\SQLSvr\schema.sql.
The MembersOnly component implements the business logic of two cases. In the first case, when the Charge Type attribute of the open title has the MEMBER Charge Type attribute, the component notifies the server that authentication is required in the SKIP_AUTHENTICATION authorization request Subsequently, it always approves the OPEN authorizationbecause any authenticated user is considered to be a valid MEMBER.
In the second case, when the open title has the PLAYER Charge Type attribute, the component uses the client GUID to determine if the user is allowed to watch the title. In this case, the component informs the server that authentication is not required in the SKIP_AUTHENTICATION authorization request. Subsequently, it approves the OPEN authorization only if the client GUID is registered in the database.
The MembersOnly authorization component includes the two main classes: CMembersOnly and CDataAccess. The former implements the methods of the INNSEventNotification and INNSEventAuthorization interfaces. The latter is an abstraction layer for ADO/ODBC database access, and manages the connection to the data source and performs database queries.
[Previous][Next]