Token-based security for links to media streams
Systems and methods of token-based protection for links to media streams are disclosed. For example, a computing device may generate a first token based on a private key and an encryption algorithm. The first token may be inserted into a link to a media stream. When the link is selected at a client device, a media request including the first token may be sent to a server. The server may generate a second token based on the private key and the encryption algorithm. The server may grant or deny the media request based on a comparison of the first token and the second token.
1. An apparatus comprising:
a processor; and
a memory storing instructions executable by the processor to perform operations comprising:
receiving, at a computing device, a media request in response to selection of a link to a media stream, wherein the link includes a first token that is generated based on a private key and an encryption algorithm, and wherein the media request includes the first token;
generating, at the computing device, a second token based on the private key and the encryption algorithm; and
granting or denying the media request based on a comparison of the first token and the second token.
2. The apparatus of claim 1 , further comprising receiving the private key from a publisher of the media stream.
3. The apparatus of claim 1 , wherein the private key and the encryption algorithm are identified in a configuration file of the computing device.
4. The apparatus of claim 1 , further comprising receiving the private key and a selection of the encryption algorithm from a second computing device.
5. The apparatus of claim 1 , wherein the link further includes a key/value pair corresponding to a media streaming parameter, wherein the media streaming parameter includes a validity start date, a validity start time, a validity end date, a validity end time, a validity duration, or any combination thereof.
6. The apparatus of claim 5 , wherein the media request includes the key/value pair.
7. The apparatus of claim 5 , wherein the operations further comprise:
determining whether the link to the media stream is valid based on the key/value pair; and
granting or denying the media request based on whether the link to the media stream is valid.
8. The apparatus of claim 1 , wherein granting the media request comprises transmitting an adaptive streaming manifest associated with the media stream to a second computing device.
9. The apparatus of claim 1 , wherein granting the media request comprises transmitting an adaptive bitrate rendition of the media stream to a second computing device.
10. The apparatus of claim 9 , wherein the adaptive bitrate rendition is transmitted using an adaptive streaming protocol, wherein the adaptive streaming protocol comprises:
hypertext transfer protocol (HTTP) live streaming (HLS),
HTTP dynamic streaming (HDS),
smooth streaming, or
motion picture experts group (MPEG) dynamic adaptive streaming over HTTP (MPEG-DASH).
11. The apparatus of claim 1 , wherein the media stream comprises a live stream.
12. The apparatus of claim 1 , wherein the media stream comprises a video on demand (VOD) item.
13. The apparatus of claim 1 , wherein the encryption algorithm comprises hash-based message authentication code (HMAC) secure hash algorithm (SHA) 2 (HMAC-SHA-2), HMAC-SHA-256, HMAC-SHA-3, or any combination thereof.
14. The apparatus of claim 1 , wherein the media request is received from a server.
15. The apparatus of claim 1 , wherein the media request is received from a client device.
16. A method comprising:
generating, at a processor of a computing device, a first token based on a private key and an encryption algorithm;
generating a link to a media stream, wherein the link includes the first token; and
sending the link to a client device,
wherein selection of the link causes a media request to be sent to a server associated with the media stream, wherein the media request includes the first token, and wherein the media request is granted or denied based on a comparison of the first token to a second token generated at the server.
17. The method of claim 16 , further comprising generating the first token in response to receiving the media request from the client device.
18. The method of claim 16 , further comprising sending the media request to the server.
19. A computer-readable storage device storing instructions that, when executed by a computer, cause the computer to perform operations comprising:
receiving, at a first computing device, a link to a media stream associated with a server, wherein the link includes a first token;
in response to a selection of the link, sending a media request to the server, wherein the media request includes the first token; and
receiving, from the server, data associated with the media stream or a denial of the media request based on a comparison of the first token to a second token generated at the server.
20. The computer-readable storage device of claim 19 , wherein the data associated with the media stream includes an adaptive bitrate rendition of the media stream, an adaptive streaming manifest associated with the media stream, or any combination thereof.