This repository has been archived by the owner on Jun 12, 2021. It is now read-only.
forked from blackwinter/apache_secure_download
/
README
77 lines (49 loc) · 2.54 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
= apache_secure_download - Apache module providing secure downloading functionality, just like Mongrel Secure Download does for mongrel.
== VERSION
This documentation refers to apache_secure_download version 0.2.1
== DESCRIPTION
Place the following snippet in your Apache config:
# protect files by Apache Secure Download
<IfModule mod_ruby.c>
RubyRequire apache/ruby-run
RubyRequire /path/to/apache_secure_download
# or
#RubyRequire rubygems
#RubyRequire apache/secure_download
<Location /secure>
# pass your shared secret string to the handler -- secret means SECRET!
RubyAccessHandler Apache::SecureDownload.new("secret")
</Location>
</IfModule>
And create links to your resources with timestamp and token:
require 'apache/secure_download/util'
timestamp = 1.minute.from_now # e.g.
token = Apache::SecureDownload::Util.token("secret", path, timestamp)
url = path + "?timestamp=#{timestamp}&token=#{token}"
# or simply use the provided helper:
url = Apache::SecureDownload::Util.secure_url("secret", path, 1.minute.from_now)
# make resulting URL cacheable for 30 seconds (on average):
url = Apache::SecureDownload::Util.secure_url("secret", path, :expires => 1.minute.from_now, :cache => 30)
# specify expiration time using an offset (results in Time.now + 60; also includes caching for 60 seconds):
url = Apache::SecureDownload::Util.secure_url("secret", path, :offset => 60)
See Apache::SecureDownload::Util.secure_url for more examples.
== LINKS
<b></b>
Documentation:: http://prometheus.rubyforge.org/apache_secure_download
Source code:: http://github.com/blackwinter/apache_secure_download
RubyForge project:: http://rubyforge.org/projects/prometheus
== AUTHORS
* Jens Wille <mailto:jens.wille@uni-koeln.de>
== LICENSE AND COPYRIGHT
Copyright (C) 2008-2011 University of Cologne,
Albertus-Magnus-Platz, 50923 Cologne, Germany
apache_secure_download is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
apache_secure_download is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
for more details.
You should have received a copy of the GNU Affero General Public License along
with apache_secure_download. If not, see <http://www.gnu.org/licenses/>.