glogin 0.3 → 0.3.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/lib/glogin/cookie.rb +2 -2
- data/lib/glogin/version.rb +1 -1
- data/test/glogin/test_cookie.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63e189fe6aa0a2beabdf350b2a2961d2574c8a56
|
4
|
+
data.tar.gz: a85fc1af68481b0d09b9ea51b6fb7d142bf00b29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06feacc9f00908e1bc6a236becc270e81a15131fe721873fba3106d3ff74dc1ccff7b60c1c0f61fece548d910cf6fb686e4c81cbb29dbb2f2fe74fc5da3acd1b
|
7
|
+
data.tar.gz: 144553e5e4d3ccdd9fe21e75f3eabd9aa124f7c51b172669540a81d95489b5d5582d4778009fb051722e32f8d2e02349af6ad8213a99335f0be1bfd6398fceae
|
data/lib/glogin/cookie.rb
CHANGED
@@ -60,10 +60,10 @@ module GLogin
|
|
60
60
|
decrypted.to_s
|
61
61
|
end
|
62
62
|
parts = plain.split('|', 3)
|
63
|
-
|
63
|
+
if !@secret.empty? && parts[2].to_s != @context
|
64
64
|
raise(
|
65
65
|
OpenSSL::Cipher::CipherError,
|
66
|
-
"Context '#{@context}'
|
66
|
+
"Context '#{@context}' expected, but '#{parts[2]}' found"
|
67
67
|
)
|
68
68
|
end
|
69
69
|
{ login: parts[0], avatar: parts[1] }
|
data/lib/glogin/version.rb
CHANGED
data/test/glogin/test_cookie.rb
CHANGED
@@ -63,6 +63,14 @@ class TestCookie < Minitest::Test
|
|
63
63
|
assert_equal(user[:avatar], 'http://example.com')
|
64
64
|
end
|
65
65
|
|
66
|
+
def test_decrypts_in_test_mode_with_context
|
67
|
+
user = GLogin::Cookie::Closed.new(
|
68
|
+
'tester', '', 'some context'
|
69
|
+
).to_user
|
70
|
+
assert_equal('tester', user[:login])
|
71
|
+
assert_nil(user[:avatar])
|
72
|
+
end
|
73
|
+
|
66
74
|
def test_fails_on_broken_text
|
67
75
|
assert_raises OpenSSL::Cipher::CipherError do
|
68
76
|
GLogin::Cookie::Closed.new(
|