prx_auth 1.7.0 → 1.7.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
  SHA256:
3
- metadata.gz: 9e89ea4feff47dadbac479d38e5a35fa04be2e148cb10ebe4b41d800e2df48c3
4
- data.tar.gz: b3ae9ed7381ff2765abc01c4126c3b7ede3db2f06a73cbd9da6918c9ac3a41ab
3
+ metadata.gz: b11c5af8dd4126044aa9d468a50dee909483bc6de84b6fa8f46362e208dac776
4
+ data.tar.gz: 8e308914d3c6f254130bbc02f245ec9a690ea3efbd67c7e03af27d89248e1285
5
5
  SHA512:
6
- metadata.gz: 17ffcb56a69a9c5d674f418967a56405a9f44dac40a0359d9bac42bd93421e7273af08632b311718ca10844ac3a37347d1b8753f1cac7f661b62d75752d25875
7
- data.tar.gz: bb3d2a19cabf47a5f6d3d62edebf9bdb0ac368521b6c6128c1dc73edb00f2a2d353c8e0a17a46c52334e651a3c2926cfaf9215053d4f260d258a75793ee13d14
6
+ metadata.gz: 1e41ac8e49eb3bbf6e77a60dbd7a607766dceecc131a221eaefb9d1c6251507cf9b526a7d031dc0a686dd32683ef9113031db1a6de957a86a19738ec9ad5a7d5
7
+ data.tar.gz: 27a2c10518729f37f366ff301835618c959ea7ef5a8446ee0ed0176b6f3046e820fedc58cbce6ce790f114875f98b2c68fbbc06592e8d9685a4eb985e0305d43
@@ -42,7 +42,7 @@ module PrxAuth
42
42
 
43
43
  def initialize(list)
44
44
  @string = list
45
- @string.split(SCOPE_SEPARATOR).each do |value|
45
+ @string.split(SCOPE_SEPARATOR).uniq.each do |value|
46
46
  next if value.length < 1
47
47
 
48
48
  parts = value.split(NAMESPACE_SEPARATOR, 2)
@@ -56,21 +56,21 @@ module PrxAuth
56
56
 
57
57
  def contains?(namespace, scope=nil)
58
58
  entries = if scope.nil?
59
- scope, namespace = namespace, NO_NAMESPACE
59
+ scope, namespace = namespace, NO_NAMESPACE
60
60
  [Entry.new(namespace, symbolize(scope), nil)]
61
61
  else
62
62
  scope = symbolize(scope)
63
63
  namespace = symbolize(namespace)
64
64
  [Entry.new(namespace, scope, nil), Entry.new(NO_NAMESPACE, scope, nil)]
65
65
  end
66
-
66
+
67
67
  entries.any? do |possible_match|
68
68
  include?(possible_match)
69
69
  end
70
70
  end
71
71
 
72
72
  def to_s
73
- @string
73
+ entries.join(SCOPE_SEPARATOR)
74
74
  end
75
75
 
76
76
  def condense
@@ -125,7 +125,7 @@ module PrxAuth
125
125
 
126
126
  def &(other_list)
127
127
  return ScopeList.new('') if other_list.nil?
128
-
128
+
129
129
  self - (self - other_list) + (other_list - (other_list - self))
130
130
  end
131
131
 
@@ -1,3 +1,3 @@
1
1
  module PrxAuth
2
- VERSION = "1.7.0"
2
+ VERSION = "1.7.1"
3
3
  end
@@ -12,7 +12,7 @@ describe PrxAuth::ScopeList do
12
12
  it 'looks up successfully for a given scope' do
13
13
  assert list.contains?('write')
14
14
  end
15
-
15
+
16
16
  it 'scans for symbols' do
17
17
  assert list.contains?(:read)
18
18
  end
@@ -27,7 +27,7 @@ describe PrxAuth::ScopeList do
27
27
 
28
28
  describe 'with namespace' do
29
29
  let (:scopes) { 'ns1:hello ns2:goodbye aloha 1:23' }
30
-
30
+
31
31
  it 'works for namespaced lookups' do
32
32
  assert list.contains?(:ns1, :hello)
33
33
  end
@@ -76,6 +76,11 @@ describe PrxAuth::ScopeList do
76
76
  assert sl.to_s == 'The-Beginning the-end'
77
77
  end
78
78
 
79
+ it 'dedups and condenses' do
80
+ sl = new_list('one ns1:two ns2:two one three three') - new_list('ns1:two three')
81
+ assert_equal sl.length, 2
82
+ assert_equal sl.to_s, 'one ns2:two'
83
+ end
79
84
  end
80
85
 
81
86
  describe '#+' do
@@ -86,6 +91,12 @@ describe PrxAuth::ScopeList do
86
91
  assert sl.contains?(:two)
87
92
  end
88
93
 
94
+ it 'dedups and condenses' do
95
+ sl = new_list('one ns1:one two') + new_list('two three') + new_list('two')
96
+ assert_equal sl.length, 3
97
+ assert_equal sl.to_s, 'one two three'
98
+ end
99
+
89
100
  it 'accepts nil' do
90
101
  sl = new_list('one two') + nil
91
102
  assert sl.contains?(:one) && sl.contains?(:two)
@@ -126,4 +137,4 @@ describe PrxAuth::ScopeList do
126
137
  refute_equal PrxAuth::ScopeList.new("foo bar"), PrxAuth::ScopeList.new("foo:bar bar:foo")
127
138
  end
128
139
  end
129
- end
140
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prx_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eve Asher
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-19 00:00:00.000000000 Z
12
+ date: 2022-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler