tags:

views:

28

answers:

1

I have a simple user-registration website where I keep records of registered users. I also have an admin page to upload videos, however videos are uploaded to a different server.

I'm using the <video> tag to show the video:

<video width="560" height="340" controls>
  <source src="path/to/myvideo.mp4" type="video/mp4";>
</video>`

I want to show this video only to my registered users on my website, since the video is on second server, how can I protect it?

I thought I could build an application and install it on second server, this app will watch whether the requested url is for videos, if so then it'll redirect the user to my login page and here he'll be authenticated and again redirected to the same video url.

Is this a workable plan? How else could I approach this?

A: 

If you are able to stream the videos through a web page, you can do something with query string parameters. You could e.g. make the url like this:

<source src="serve.aspx?video=path/to/myvideo.mp4&authentication=<secret authentication string>" type="video/mp4";>

The "secret authentication string" could then be something like an encrypted or hashed piece of text containing the username and password. The real quick and dirty way would probably be to instead add "username=&password=" instead if an encrypted authentication string.

Pieter
@Pieter: thanx very much, but there is no aspx or htm pages in my 2nd Server, it is used just to save uploaded videos.
FosterZ
That would probably be a problem. You need to execute some business logic somewhere because you need to authenticate the user. Don't see another way than having some server side code.
Pieter