Add support for using OIDC tokens via the Docker CLI
This commit is contained in:
parent
6600b380ca
commit
e724125459
16 changed files with 176 additions and 14 deletions
19
data/users/test/test_oidc.py
Normal file
19
data/users/test/test_oidc.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from httmock import HTTMock
|
||||
|
||||
from data.users.oidc import OIDCInternalAuth
|
||||
from oauth.test.test_oidc import (id_token, oidc_service, signing_key, jwks_handler,
|
||||
discovery_handler, app_config, http_client,
|
||||
discovery_content)
|
||||
|
||||
def test_oidc_login(app_config, id_token, jwks_handler, discovery_handler):
|
||||
internal_auth = OIDCInternalAuth(app_config, 'someoidc', False)
|
||||
with HTTMock(jwks_handler, discovery_handler):
|
||||
# Try a valid token.
|
||||
(user, err) = internal_auth.verify_credentials('someusername', id_token)
|
||||
assert err is None
|
||||
assert user.username == 'cooluser'
|
||||
|
||||
# Try an invalid token.
|
||||
(user, err) = internal_auth.verify_credentials('someusername', 'invalidtoken')
|
||||
assert err is not None
|
||||
assert user is None
|
Reference in a new issue