akamai-edge_auth 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +5 -2
- data/edge_auth.gemspec +2 -2
- data/lib/akamai/edge_auth.rb +16 -2
- data/lib/akamai/edge_auth/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d55b497f209dc1a21a4c532da9e5cfc1a65544b0
|
4
|
+
data.tar.gz: 9b6e8dd65b3b3b1be8f39f35ea03ed8989195ad5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7371ec6353bb3a284234232b85ad17089a693496f6bb68286d2e671b044e6bd60ea284fa322f7b64a6ab2ed7746ff48a43cc51b410ffc979281439a3678574c
|
7
|
+
data.tar.gz: de724017baa9ff6af4137f3e950275de31d78ba90f63fa9acf803ba1a5c4b73772727ef166b8c5e4adc48bb7610d223a8141808be8b08b22f143a05f6b0b41a0
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[](https://travis-ci.org/sukorenomw/akamai-edgeauth)
|
2
|
+
[](https://badge.fury.io/rb/akamai-edge_auth)
|
3
|
+
|
1
4
|
# EdgeAuth (Akamai Authorization Token)
|
2
5
|
|
3
6
|
this gem is authorization token generator for Akamai, you can configure your property at [https://control.akamai.com]
|
@@ -8,7 +11,7 @@ inspired by [Akamai-AuthToken-Ruby](https://github.com/AstinCHOI/Akamai-AuthToke
|
|
8
11
|
Add this line to your application's Gemfile:
|
9
12
|
|
10
13
|
```ruby
|
11
|
-
gem 'edge_auth'
|
14
|
+
gem 'akamai-edge_auth'
|
12
15
|
```
|
13
16
|
|
14
17
|
And then execute:
|
@@ -17,7 +20,7 @@ And then execute:
|
|
17
20
|
|
18
21
|
Or install it yourself as:
|
19
22
|
|
20
|
-
$ gem install edge_auth
|
23
|
+
$ gem install akamai-edge_auth
|
21
24
|
|
22
25
|
## Usage
|
23
26
|
|
data/edge_auth.gemspec
CHANGED
@@ -11,8 +11,8 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Akamai EdgeAuth token generator}
|
13
13
|
spec.description = %q{Akamai EdgeAuth token generator for TokenAuth setting in Media Live Streaming Packaging or Segmented Media Protection}
|
14
|
-
spec.homepage = "https://github.com/sukorenomw/
|
15
|
-
spec.license = "
|
14
|
+
spec.homepage = "https://github.com/sukorenomw/akamai-edgeauth"
|
15
|
+
spec.license = "Apache-2.0"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
data/lib/akamai/edge_auth.rb
CHANGED
@@ -23,7 +23,8 @@ module Akamai
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def generate_token(start_time: "now", end_time: nil, window_seconds: nil,
|
26
|
-
acl: nil, url: nil
|
26
|
+
acl: nil, url: nil, ip: nil,
|
27
|
+
session_id: nil, payload: nil)
|
27
28
|
raise EdgeAuthError, "no end_time or window_seconds is provided" if end_time.nil? && window_seconds.nil?
|
28
29
|
raise EdgeAuthError, "you must provide an ACL or a URL." if (acl.nil? && url.nil?) || (acl && url)
|
29
30
|
|
@@ -59,14 +60,27 @@ module Akamai
|
|
59
60
|
|
60
61
|
new_token = Array.new
|
61
62
|
|
63
|
+
if ip
|
64
|
+
new_token.push "ip=#{ip}"
|
65
|
+
end
|
66
|
+
|
62
67
|
new_token.push "st=#{start_time}"
|
63
68
|
new_token.push "exp=#{end_time}"
|
64
69
|
|
65
70
|
new_token.push "acl=#{acl}" unless acl.nil?
|
66
|
-
|
71
|
+
|
72
|
+
if session_id
|
73
|
+
new_token.push "id=#{session_id}"
|
74
|
+
end
|
75
|
+
|
76
|
+
if payload
|
77
|
+
new_token.push "data=#{payload}"
|
78
|
+
end
|
67
79
|
|
68
80
|
hash_code = new_token.clone
|
69
81
|
|
82
|
+
new_token.push "url=#{url}" unless url.nil?
|
83
|
+
|
70
84
|
bin_key = Array(key.gsub(/\s/,'')).pack("H*")
|
71
85
|
digest = OpenSSL::Digest.new(algorithm)
|
72
86
|
token_hmac = OpenSSL::HMAC.new(bin_key, digest)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akamai-edge_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sukoreno Mukti
|
@@ -87,9 +87,9 @@ files:
|
|
87
87
|
- edge_auth.gemspec
|
88
88
|
- lib/akamai/edge_auth.rb
|
89
89
|
- lib/akamai/edge_auth/version.rb
|
90
|
-
homepage: https://github.com/sukorenomw/
|
90
|
+
homepage: https://github.com/sukorenomw/akamai-edgeauth
|
91
91
|
licenses:
|
92
|
-
-
|
92
|
+
- Apache-2.0
|
93
93
|
metadata:
|
94
94
|
allowed_push_host: https://rubygems.org
|
95
95
|
post_install_message:
|