Skip to content

Commit

Permalink
Fix check on RESOURCE_SERVER_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervdw committed Mar 20, 2024
1 parent d95d326 commit baa6bf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
8 changes: 6 additions & 2 deletions nens_auth_client/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ def check_resource_server_id(app_configs=None, **kwargs):
"AccessTokenMiddleware is used."
)
]
if not url.endswith("/"):
if (
settings.NENS_AUTH_OAUTH_BACKEND
== "nens_auth_client.cognito.CognitoOAuthClient"
and not url.endswith("/")
):
return [
Error(
"The NENS_AUTH_RESOURCE_SERVER_ID setting needs to end with a "
"slash (because AWS Cognito will automatically add one)."
"slash when using the CognitoOAuthClient."
)
]
return []
Expand Down
12 changes: 0 additions & 12 deletions nens_auth_client/tests/test_wso2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from authlib.oidc.discovery import get_well_known_url
from django.conf import settings
from nens_auth_client.wso2 import WSO2AuthClient

import pytest
Expand All @@ -19,13 +17,3 @@ def test_extract_provider_name():
)
def test_extract_username(claims, expected):
assert WSO2AuthClient.extract_username(claims) == expected


@pytest.fixture
def wso2_client():
return WSO2AuthClient(
"foo",
server_metadata_url=get_well_known_url(
settings.NENS_AUTH_ISSUER, external=True
),
)

0 comments on commit baa6bf4

Please sign in to comment.