prx_auth 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prx_auth/scope_list.rb +12 -12
- data/lib/prx_auth/version.rb +1 -1
- data/test/prx_auth/scope_list_test.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a851973aab51bd36533ff3959ab4d494886d0c6803fa1be1359ee1a5e0a68c0
|
4
|
+
data.tar.gz: 9033b3e43be7f508ec7956df7be578e4b860f3285169ac1de6c5ee80b1e21c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92e74203143a4920470336dd93bedfe07fe03235bbcafc20229f4076bdfabe5240e5908b0765b035c9471c0a8bfbc001435e08e61830dd954f64e65f0d0f2e26
|
7
|
+
data.tar.gz: 139726fa863102b0e179c63e29df3d42f4fa03082e1208668cc6f9d32062bcab1995921677f22138718449a5b6a1cb67694003e141b829f585f0b6cc141e5dc9
|
data/lib/prx_auth/scope_list.rb
CHANGED
@@ -4,19 +4,15 @@ module PrxAuth
|
|
4
4
|
NAMESPACE_SEPARATOR = ':'
|
5
5
|
NO_NAMESPACE = :_
|
6
6
|
|
7
|
-
Entry = Struct.new(:namespace, :scope)
|
7
|
+
Entry = Struct.new(:namespace, :scope, :string)
|
8
8
|
|
9
9
|
class Entry
|
10
|
-
def
|
10
|
+
def ==(other_entry)
|
11
11
|
namespace == other_entry.namespace && scope == other_entry.scope
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_s
|
15
|
-
|
16
|
-
"#{namespace}:#{scope}"
|
17
|
-
else
|
18
|
-
scope.to_s
|
19
|
-
end
|
15
|
+
string
|
20
16
|
end
|
21
17
|
|
22
18
|
def namespaced?
|
@@ -25,11 +21,15 @@ module PrxAuth
|
|
25
21
|
|
26
22
|
def unnamespaced
|
27
23
|
if namespaced?
|
28
|
-
Entry.new(NO_NAMESPACE, scope)
|
24
|
+
Entry.new(NO_NAMESPACE, scope, string.split(':').last)
|
29
25
|
else
|
30
26
|
self
|
31
27
|
end
|
32
28
|
end
|
29
|
+
|
30
|
+
def inspect
|
31
|
+
"#<ScopeList::Entry \"#{to_s}\">"
|
32
|
+
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.new(list)
|
@@ -47,9 +47,9 @@ module PrxAuth
|
|
47
47
|
|
48
48
|
parts = value.split(NAMESPACE_SEPARATOR, 2)
|
49
49
|
if parts.length == 2
|
50
|
-
push Entry.new(symbolize(parts[0]), symbolize(parts[1]))
|
50
|
+
push Entry.new(symbolize(parts[0]), symbolize(parts[1]), value)
|
51
51
|
else
|
52
|
-
push Entry.new(NO_NAMESPACE, symbolize(parts[0]))
|
52
|
+
push Entry.new(NO_NAMESPACE, symbolize(parts[0]), value)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -57,11 +57,11 @@ module PrxAuth
|
|
57
57
|
def contains?(namespace, scope=nil)
|
58
58
|
entries = if scope.nil?
|
59
59
|
scope, namespace = namespace, NO_NAMESPACE
|
60
|
-
[Entry.new(namespace, symbolize(scope))]
|
60
|
+
[Entry.new(namespace, symbolize(scope), nil)]
|
61
61
|
else
|
62
62
|
scope = symbolize(scope)
|
63
63
|
namespace = symbolize(namespace)
|
64
|
-
[Entry.new(namespace, scope), Entry.new(NO_NAMESPACE, scope)]
|
64
|
+
[Entry.new(namespace, scope, nil), Entry.new(NO_NAMESPACE, scope, nil)]
|
65
65
|
end
|
66
66
|
|
67
67
|
entries.any? do |possible_match|
|
data/lib/prx_auth/version.rb
CHANGED
@@ -70,6 +70,12 @@ describe PrxAuth::ScopeList do
|
|
70
70
|
sl = new_list('one two') - nil
|
71
71
|
assert sl.contains?(:one) && sl.contains?(:two)
|
72
72
|
end
|
73
|
+
|
74
|
+
it 'maintains dashes and capitalization in the result' do
|
75
|
+
sl = new_list('The-Beginning the-middle the-end') - new_list('the-Middle')
|
76
|
+
assert sl.to_s == 'The-Beginning the-end'
|
77
|
+
end
|
78
|
+
|
73
79
|
end
|
74
80
|
|
75
81
|
describe '#+' do
|
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.2.
|
4
|
+
version: 1.2.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: 2020-08-
|
12
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|