matterhorn_whymper 1.7.6 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/config/initializers/matterhorn_whymper.rb +25 -0
- data/config/matterhorn.yml.sample +21 -0
- data/lib/matterhorn/endpoint/security.rb +49 -0
- data/lib/matterhorn_whymper.rb +1 -0
- data/lib/matterhorn_whymper/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjM2OGU1ZTQ3ODc5MjczZDI2ZGU5NTdmMTJmNGJjYWEwM2YxYzFmOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGUyYTYwNjQ1ZTIwYzI0NmYxOGMyODRjMzdmMjU0MjhlYTYwNTFlYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmM3NzczMzg3NzBmOTk1OGNkZjc0YmYzYWI0M2JlNTIxODg5ZjFmMzFhZDhh
|
10
|
+
MTkyOTIzODgyMTA1Y2E2ZGVmYTdhYWYxODNkOTY0ZTNlY2UzYzRkN2VlYjZm
|
11
|
+
NmQ5NmI0MTc3N2U5YzQ3MWIxZTkwZGFjZjc3NGM4YWI4ZjAzOTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDExNWY3MzQ2NzIwMGI3NWFiNWZhZDU5MTAzMDdkODYxMTAxNjY3MjA5OGZh
|
14
|
+
YmEyZGI5N2U0NjMzODdlZGMzMmE3YmNhNTg2ZTQ2NWU0ZWZjYzQ1ZjliYzMy
|
15
|
+
ZjQ0NDU4YzgyYWI2YmI0YjMxYWI1YTkwOWM0ZGZiNzBiZWQ2OTA=
|
data/.gitignore
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# load mattehonr whymper in irb
|
2
|
+
#
|
3
|
+
# require "#{File.dirname( __FILE__)}/config/initializers/matterhorn_whymper"
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'yaml'
|
7
|
+
require 'matterhorn_whymper'
|
8
|
+
|
9
|
+
|
10
|
+
MatterhornWhymper.configure do |mhw_config|
|
11
|
+
mhw_yml = YAML.load(File.read(File.expand_path('../../matterhorn.yml', __FILE__)))
|
12
|
+
mhw_yml.each do |mh_name, mh_config|
|
13
|
+
if mh_name != 'default'
|
14
|
+
mhw_config.add_matterhorn_instance(mh_name)
|
15
|
+
if !mh_config['endpoint'].nil?
|
16
|
+
mhw_config.add_endpoint(mh_config['endpoint'], mh_name)
|
17
|
+
end
|
18
|
+
if !mh_config['api'].nil?
|
19
|
+
mhw_config.add_api(mh_config['api'], mh_name)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
mhw_config.set_default_matterhorn_instance(mh_config)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# ------------------------------------------------------------------------ default configuration ---
|
2
|
+
|
3
|
+
|
4
|
+
p2:
|
5
|
+
endpoint:
|
6
|
+
protocol: https
|
7
|
+
domain: producer.cast-test.switch.ch
|
8
|
+
user: matterhorn_system_account
|
9
|
+
password: <password>
|
10
|
+
auth_mode: digest
|
11
|
+
ssl_dont_verify_cert: true
|
12
|
+
multi_tenant: true
|
13
|
+
api:
|
14
|
+
protocol: https
|
15
|
+
domain: api-ng.cast-test.switch.ch
|
16
|
+
user: cast
|
17
|
+
password: <password>
|
18
|
+
auth_mode: basic
|
19
|
+
ssl_dont_verify_cert: true
|
20
|
+
multi_tenant: true
|
21
|
+
default: p2
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
# =============================================================== Matterhorn::Endpoint::Security ===
|
4
|
+
|
5
|
+
class Matterhorn::Endpoint::Security < Matterhorn::Endpoint
|
6
|
+
|
7
|
+
|
8
|
+
# -------------------------------------------------------------------------- endpoint methodes ---
|
9
|
+
|
10
|
+
# ------------------------------------------------------------------------------------- create ---
|
11
|
+
|
12
|
+
# Create a signed url.
|
13
|
+
# - url: the url which should be signed
|
14
|
+
# - valid_until: The date and time until the signed url is valid
|
15
|
+
# - valid_source: The IP address from which the request is allowed
|
16
|
+
#
|
17
|
+
def sign(url, valid_until = nil, valid_source = nil)
|
18
|
+
signed_url = nil
|
19
|
+
begin
|
20
|
+
params = {}
|
21
|
+
params['url'] = url.to_s
|
22
|
+
if !valid_until.nil? && (valid_until.kind_of?(DateTime) || valid_until.kind_of?(Time))
|
23
|
+
params['valid_until'] = valid_until.xmlschema
|
24
|
+
elsif !valid_until.nil? && valid_until.respond_to?(:to_s)
|
25
|
+
params['valid_until'] = valid_until.to_s
|
26
|
+
end
|
27
|
+
if !valid_source.nil? && valid_source.respond_to?(:to_s)
|
28
|
+
params['valid_source'] = ivalid_source.to_s
|
29
|
+
end
|
30
|
+
split_response http_endpoint_client.post(
|
31
|
+
"api/security/sign",
|
32
|
+
params
|
33
|
+
)
|
34
|
+
signed_url = JSON.parse(response_body)['url']
|
35
|
+
rescue => ex
|
36
|
+
exception_handler('create', ex, {
|
37
|
+
401 => "The caller is not authorized to have the link signed!"
|
38
|
+
}
|
39
|
+
)
|
40
|
+
end
|
41
|
+
signed_url
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
# ---------------------------------------------------------------------------- private section ---
|
46
|
+
private
|
47
|
+
|
48
|
+
|
49
|
+
end # ------------------------------------------------------- end Matterhorn::Endpoint::Security ---
|
data/lib/matterhorn_whymper.rb
CHANGED
@@ -12,6 +12,7 @@ require 'matterhorn/endpoint/acl'
|
|
12
12
|
require 'matterhorn/endpoint/event'
|
13
13
|
require 'matterhorn/endpoint/group'
|
14
14
|
require 'matterhorn/endpoint/ingest'
|
15
|
+
require 'matterhorn/endpoint/security'
|
15
16
|
require 'matterhorn/endpoint/series'
|
16
17
|
require 'matterhorn/endpoint/staticfiles'
|
17
18
|
require 'matterhorn/endpoint/user'
|
@@ -5,7 +5,7 @@ module MatterhornWhymper
|
|
5
5
|
|
6
6
|
# -------------------------------------------------------------------------- const definitions ---
|
7
7
|
|
8
|
-
VERSION = "1.
|
8
|
+
VERSION = "1.8.1"
|
9
9
|
|
10
10
|
|
11
11
|
end # -------------------------------------------------------------------- end MatterhornWhymper ---
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matterhorn_whymper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Fritschi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|
@@ -137,6 +137,8 @@ files:
|
|
137
137
|
- LICENSE.txt
|
138
138
|
- README.md
|
139
139
|
- Rakefile
|
140
|
+
- config/initializers/matterhorn_whymper.rb
|
141
|
+
- config/matterhorn.yml.sample
|
140
142
|
- doc/cutting.smil
|
141
143
|
- doc/release.md
|
142
144
|
- doc/source+partial.smil
|
@@ -147,6 +149,7 @@ files:
|
|
147
149
|
- lib/matterhorn/endpoint/event.rb
|
148
150
|
- lib/matterhorn/endpoint/group.rb
|
149
151
|
- lib/matterhorn/endpoint/ingest.rb
|
152
|
+
- lib/matterhorn/endpoint/security.rb
|
150
153
|
- lib/matterhorn/endpoint/series.rb
|
151
154
|
- lib/matterhorn/endpoint/staticfiles.rb
|
152
155
|
- lib/matterhorn/endpoint/user.rb
|