Authorization and Registration (Windows Embedded CE 6.0)
1/5/2010
Authorization is the process in which a user grants a device permission to receive shared content from a computer that is running Windows Media Connect (WMC). Registration is performed after authorization, and registration allows devices that support Microsoft Windows Media DRM 10 for Network Devices to stream protected content from the computer that is running Windows Media Connect.
Authorization
Windows Media Connect requires each networked media device to be authorized by the user before the device can access content or metadata. The first time that a UPnP Media Renderer, a UPnP Media Renderer and UPnP Control Point combination, or a UPnP Control Point announces itself or tries to connect to the server, Windows Media Connect notifies the user by displaying a balloon tip on the computer screen.
After Windows Media Connect discovers a device, the user must authorize the device on the server. The user authorizes the device by clicking Allow in the WMC application.
UPnP Media Renderers
UPnP Media Renderers are identified by a combination of a MAC address and a unique device name (UDN). If a device with a MAC address and UDN combination, that has not been seen before, is discovered, the device is listed as a new device. The user can choose to authorize or not authorize the device. After a device is authorized, neither of these numbers can change. If one or both changes, the device is automatically unauthorized.
UDNs
The device must a supply a globally unique UDN. The UDN must be a UTF-encoded string value containing "uuid:" followed by a 128-bit value in hexadecimal form. The maximum length is 68 bytes. The following example shows the syntax for the UDN:
uuid:XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXXXXX
Control Points
Control points are identified by the MAC address only. If a device with a MAC address, that has not been seen before, is discovered, it is listed as a new device. The device must then be authorized by user action.
Authorization Status
Windows Media Connect supports a custom service called X_MS_MediaReceiverRegistrar that provides mechanisms for devices to discover their authorization status.
The service provides a function called IsAuthorized. UPnP Media Renderer and UPnP Control Point combination devices and UPnP Control Points can ask about themselves by calling the IsAuthorized function and passing in an empty string, as shown in the following example:
IsAuthorized("")
UPnP Control Points can ask about the authorization status of another UPnP Media Renderer by calling the IsAuthorized function by using the device's UDN.
IsAuthorized(UDN)
Windows Media Connect also supports events for changing authorization status. Devices must subscribe to events from the X_MS_MediaReceiverRegistrar service as they would to any UPnP service. The two events are AuthorizationGrantedUpdateID and AuthorizationDeniedUpdateID.
These events are global. This means that they are sent to all devices with no indication of which device has been granted or denied authorization. Each device must call the IsAuthorized function after the device receives the event to determine whether it is the device that had a status change.
Another way of determining the authorization status of a device is to call any UPnP action and look at its result. Authorized devices receive a proper response, whereas unauthorized devices receive an 801 error code, as shown in the following example:
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode >801</errorCode>
<errorDescription >Access Denied</errorDescription>
</UPnPError>
Registration
To access protected content, devices must register with the DRM service. Registration is done by using a UPnP action called RegisterDevice.
Windows Media Connect also provides a mechanism for determining the registration status of a device. The X_MS_MediaReceiverRegistrar service contains a function called IsValidated. As with the IsAuthorized action, a Control Point or Control Point and Media Renderer combination device should call the IsValidated function by using an empty string to ask about itself.
IsValidated("")
A UPnP Control Point that needs to ask about a UPnP Media Renderer should pass in the Media Renderer's UDN, as shown in the following:
IsValidated(UDN)
The X_MS_MediaReceiverRegistrar service also supports events for changes in registration status. The two event variables are ValidationSucceededUpdateID and ValidationRevokedUpdateID. When either of these event variables is received and indicates a change, the device should call the IsValidated action to determine the registration status of the device.