Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Protect a directory, but allow any file #24

Open
GoogleCodeExporter opened this issue Mar 10, 2016 · 4 comments
Open

feature: Protect a directory, but allow any file #24

GoogleCodeExporter opened this issue Mar 10, 2016 · 4 comments

Comments

@GoogleCodeExporter
Copy link

Hello,

I need to protect a directory with time-limit, but allow any file in this 
directory (including subdirs), without specifically encoding a new URL for each 
file.

Please find the attached patch that adds the above option.

To use it:

In the apache configuration path, put:
<Location /datafiles/>
      AuthTokenSecret       "foobar"
      AuthTokenPrefix       /datafiles/
      AuthTokenTimeout      60
      AuthTokenAnyPath      on
</Location>

And so any (valid) encoded time under "/datafiles/" will work, regardless of 
the actual file being accessed.

Example:
<?php
$secret = "foobar";             // Same as AuthTokenSecret
$protectedPath = "/datafiles/";        // Same as AuthTokenPrefix
$hexTime = dechex(time());             // Time in Hexadecimal  

// NOTE: No file name is encoded, just the time
$token = md5($secret . $hexTime);  

// build the url
$url = "http://myserver.com/datafiles/$token/any/file.would.work.txt";
?>


Hope this helps someone.

regards,
 -gordon


Original issue reported on code.google.com by [email protected] on 2 Nov 2011 at 10:14

Attachments:

@GoogleCodeExporter
Copy link
Author

Correction to the PHP script:
the last line should be:
$url = "http://myserver.com/datafiles/$token/$hexTime/any/file.would.work.txt";

Original comment by [email protected] on 4 Nov 2011 at 7:04

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 24 May 2012 at 7:29

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Hi,
how do you install this patch on 1.0.6-beta version please?
I've a centos 6 system.
thanks.

Original comment by [email protected] on 25 Sep 2012 at 8:22

@GoogleCodeExporter
Copy link
Author

with a such protection, some php commands doesn't work like 'filesize'.

Original comment by [email protected] on 26 Sep 2012 at 10:04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant