Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ai
sso
Commits
a92b96ee
Commit
a92b96ee
authored
Jul 23, 2018
by
ale
Browse files
Add some verifier tests with nonces
parent
01eb7558
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/python/test/verifier_test.py
View file @
a92b96ee
...
...
@@ -33,6 +33,20 @@ class VerifierTest(unittest.TestCase):
tkt2
=
v
.
verify
(
signed
)
self
.
assertEquals
(
tkt
,
tkt2
)
def
test_verify_ok_with_nonce
(
self
):
tkt
=
sso
.
Ticket
(
'user'
,
'service/'
,
'domain'
,
nonce
=
'nonce'
)
signed
=
self
.
_sign_token
(
tkt
)
v
=
sso
.
Verifier
(
self
.
public
,
'service/'
,
'domain'
)
tkt2
=
v
.
verify
(
signed
,
'nonce'
)
self
.
assertEquals
(
tkt
,
tkt2
)
self
.
assertEquals
(
'user'
,
tkt2
.
user
())
def
test_verify_fail_with_bad_nonce
(
self
):
tkt
=
sso
.
Ticket
(
'user'
,
'service/'
,
'domain'
,
nonce
=
'nonce'
)
signed
=
self
.
_sign_token
(
tkt
)
v
=
sso
.
Verifier
(
self
.
public
,
'service/'
,
'domain'
)
self
.
assertRaises
(
sso
.
Error
,
v
.
verify
,
signed
,
'bad_nonce'
)
def
test_verify_fail_too_short
(
self
):
signed
=
base64
.
b64encode
(
'some data'
)
v
=
sso
.
Verifier
(
self
.
public
,
'service/'
,
'domain'
,
self
.
groups
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment