Using the DRMAuthenticateEvent class



The DRMAuthenticateEvent object is dispatched when a NetStream object tries to play a digital rights management (DRM) encrypted content that requires a user credential for authentication before play back.

The DRMAuthenticateEvent handler is responsible for gathering the required credentials (user name, password, and type) and passing the values to the NetStream.setDRMAuthenticationCredentials() method for validation. Each AIR application must provide some mechanism for obtaining user credentials. For example, the application could provide a user with a simple user interface to enter the username and password values, and optionally the type value as well. The AIR application should also provide a mechanism for handling and limiting the repeated authentication attempts.

DRMAuthenticateEvent properties

The DRMAuthenticateEvent class includes the following properties:

Property

Description

authenticationType

Indicates whether the supplied credentials are for authenticating against the FMRMS (“drm”) or a proxy server (“proxy”). For example, the "proxy" option allows the application to authenticate against a proxy server if an enterprise requires such a step before the user can access the Internet. Unless anonymous authentication is used, after the proxy authentication, the user still must authenticate against the FMRMS in order to obtain the voucher and play the content. You can use setDRMAuthenticationcredentials() a second time, with "drm" option, to authenticate against the FMRMS.

header

The encrypted content file header provided by the server. It contains information about the context of the encrypted content.

netstream

The NetStream object that initiated this event.

passwordPrompt

A prompt for a password credential, provided by the server. The string can include instruction for the type of password required.

urlPrompt

A prompt for a URL string, provided by the server. The string can provide the location where the username and password is sent.

usernamePrompt

A prompt for a user name credential, provided by the server. The string can include instruction for the type of user name required. For example, a content provider may require an e-mail address as the user name.

Creating a DRMAuthenticateEvent handler

The following example creates an event handler that passes a set of hard-coded authentication credentials to the NetStream object that originated the event. (The code for playing the video and making sure that a successful connection to the video stream has been made is not included here.)

Creating an interface for retrieving user credentials

In the case where DRM content requires user authentication, the AIR application usually needs to retrieve the user’s authentication credentials via a user interface.