mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
Add unit test for OIDC PKCE parameters
This commit is contained in:
@@ -17,7 +17,7 @@ import jwt
|
||||
import requests
|
||||
|
||||
from galaxy.app_unittest_utils.galaxy_mock import MockTrans
|
||||
from galaxy.authnz import custos_authnz
|
||||
from galaxy.authnz import custos_authnz, pkce_utils
|
||||
from galaxy.model import (
|
||||
CustosAuthnzToken,
|
||||
User,
|
||||
@@ -262,6 +262,16 @@ class CustosAuthnzTestCase(unittest.TestCase):
|
||||
hashed_nonce = self.custos_authnz._hash_nonce(nonce_in_cookie)
|
||||
self.assertEqual(hashed_nonce, hashed_nonce_in_url)
|
||||
|
||||
def test_authenticate_set_pkce_verifier_cookie(self):
|
||||
"""Verify that authenticate() sets a code verifier cookie."""
|
||||
self.custos_authnz.config["pkce_support"] = True
|
||||
authorization_url = self.custos_authnz.authenticate(self.trans)
|
||||
parsed = urlparse(authorization_url)
|
||||
code_challenge_in_url = parse_qs(parsed.query)["code_challenge"][0]
|
||||
verifier_in_cookie = self.trans.cookies[custos_authnz.VERIFIER_COOKIE_NAME]
|
||||
code_challenge_from_verifier = pkce_utils.get_code_challenge(verifier_in_cookie)
|
||||
self.assertEqual(code_challenge_in_url, code_challenge_from_verifier)
|
||||
|
||||
def test_authenticate_adds_extra_params(self):
|
||||
"""Verify that authenticate() adds configured extra params."""
|
||||
authorization_url = self.custos_authnz.authenticate(self.trans)
|
||||
|
||||
Reference in New Issue
Block a user