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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4eb6c5e2bea17ce0a682ffaf0a215f7db4bba186
4
- data.tar.gz: 10584aeb37a3ba4cae5038147b3c5f78f5fd7a12
3
+ metadata.gz: d55b497f209dc1a21a4c532da9e5cfc1a65544b0
4
+ data.tar.gz: 9b6e8dd65b3b3b1be8f39f35ea03ed8989195ad5
5
5
  SHA512:
6
- metadata.gz: e598f0b103f69755b8e00af8e617c016d9d447912e85104f4b8cd19b8433d31b8254da15afbc57a0c76effa8f7e1d9a733c98330a657e4a09d1ea24af461e093
7
- data.tar.gz: 17547a958f84bb57bf70ea2f8e5e879e40e6b58d6bfd16605de257b11b34d4116224ef3b8ec222d3c45420e33dd345d1aaeff1d49a6c12b640e9468eb6fbd177
6
+ metadata.gz: c7371ec6353bb3a284234232b85ad17089a693496f6bb68286d2e671b044e6bd60ea284fa322f7b64a6ab2ed7746ff48a43cc51b410ffc979281439a3678574c
7
+ data.tar.gz: de724017baa9ff6af4137f3e950275de31d78ba90f63fa9acf803ba1a5c4b73772727ef166b8c5e4adc48bb7610d223a8141808be8b08b22f143a05f6b0b41a0
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ .gem
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Build Status](https://travis-ci.org/sukorenomw/akamai-edgeauth.svg?branch=master)](https://travis-ci.org/sukorenomw/akamai-edgeauth)
2
+ [![Gem Version](https://badge.fury.io/rb/akamai-edge_auth.svg)](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/akamai_edge_auth"
15
- spec.license = "MIT"
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.
@@ -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
- new_token.push "url=#{url}" unless url.nil?
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)
@@ -1,5 +1,5 @@
1
1
  module Akamai
2
2
  class EdgeAuth
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
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.0
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/akamai_edge_auth
90
+ homepage: https://github.com/sukorenomw/akamai-edgeauth
91
91
  licenses:
92
- - MIT
92
+ - Apache-2.0
93
93
  metadata:
94
94
  allowed_push_host: https://rubygems.org
95
95
  post_install_message: