Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAL2 Changes #383

Merged
merged 77 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
883f250
AAL2 Changes
NautiyalVikas1 Jul 29, 2024
332ab30
AAL2 Changes
NautiyalVikas1 Jul 29, 2024
4e244a2
AAL2 Changes
NautiyalVikas1 Jul 29, 2024
afdd215
AAL2 Changes
NautiyalVikas1 Jul 29, 2024
095366e
AAL2 Changes
NautiyalVikas1 Jul 30, 2024
d0c36ba
AAL2 Changes
NautiyalVikas1 Jul 30, 2024
d7b2ba8
AAL2 Changes
NautiyalVikas1 Jul 30, 2024
9c4e38a
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
7cf56fe
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
4a01e03
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
66170d6
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
b8b401f
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
6ddc90b
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
08d3e69
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
cfa73b8
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
0de382a
AAL2 Changes
NautiyalVikas1 Jul 31, 2024
bcf0a1c
AAL2 Changes
NautiyalVikas1 Aug 2, 2024
3de53c4
AAL2 Changes
NautiyalVikas1 Aug 2, 2024
3e6e1de
AAL2 Changes
NautiyalVikas1 Aug 2, 2024
0338875
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
b208285
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
dccc436
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
92e8132
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
48f17a9
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
031ae72
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
fc7c686
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
545f5ae
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
5a9134e
AAL2 Changes
NautiyalVikas1 Aug 5, 2024
1a97c83
Test case failure in attach logging due to assert isseue
NautiyalVikas1 Aug 5, 2024
3c71e4a
Test case failure in attach logging due to assert isseue
NautiyalVikas1 Aug 5, 2024
074c51b
APM-5429 get auth level for token exchange and update config for inte…
sophieclayton12-nhs Aug 6, 2024
911de12
APM-5429 internal-dev-int fix
sophieclayton12-nhs Aug 6, 2024
6e2ca8d
Test case failure
NautiyalVikas1 Aug 6, 2024
c7a42f7
APM-5429 backchannel logout parametrize test fixes
sophieclayton12-nhs Aug 6, 2024
fb282a4
Pytest Version Update
NautiyalVikas1 Aug 6, 2024
13d6428
Pytest Version Update
NautiyalVikas1 Aug 6, 2024
f3f6070
Pytest Version Update
NautiyalVikas1 Aug 6, 2024
8ac4e9c
Pytest Version Update
NautiyalVikas1 Aug 6, 2024
c7d6300
Updated Test Cases for test_token_exchange
NautiyalVikas1 Aug 6, 2024
8b03065
Updated Test Cases for test_token_exchange
NautiyalVikas1 Aug 6, 2024
4a95ed6
Updated Test Cases for test_attach_logging_field
NautiyalVikas1 Aug 6, 2024
a96882c
Updated Test Cases for test_attach_logging_field
NautiyalVikas1 Aug 6, 2024
f871ebb
Updated Test Cases for Splunk_Logging
NautiyalVikas1 Aug 7, 2024
4148834
Pushing latest PyJWT
NautiyalVikas1 Aug 7, 2024
2b89493
Removing Duplicate for Sonar Quality Gate Issue
NautiyalVikas1 Aug 7, 2024
f7dc210
Removing Duplicate for Sonar Quality Gate Issue
NautiyalVikas1 Aug 7, 2024
4e025a2
Removing Duplicate for Sonar Quality Gate Issue
NautiyalVikas1 Aug 7, 2024
73647dc
Removing Duplicate for Sonar Quality Gate Issue
NautiyalVikas1 Aug 7, 2024
da09c48
Removing Duplicate for Sonar Quality Gate Issue
NautiyalVikas1 Aug 8, 2024
4d74d2c
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
824e3ce
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
aa75310
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
79d14fb
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
5fb1de4
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
e7caafe
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
d4a3214
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
f1bb15e
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
d4f9af7
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
f889a8e
test_splunk_logging update
NautiyalVikas1 Aug 8, 2024
ee1933f
Resolve Client Cred Test
NautiyalVikas1 Aug 9, 2024
c47eabc
Resolve Client Cred Test
NautiyalVikas1 Aug 9, 2024
dd388f1
Resolve Client Cred Test
NautiyalVikas1 Aug 9, 2024
f74dfed
Resolve Client Cred Test
NautiyalVikas1 Aug 9, 2024
019a2dc
Resolve Client Cred Test
NautiyalVikas1 Aug 12, 2024
cdcff24
Resolve Client Cred Test
NautiyalVikas1 Aug 12, 2024
409bd4e
APM-5429 use symmetric key when testing HS algorithms
sophieclayton12-nhs Aug 12, 2024
d9e667f
APM-5429 formatting
sophieclayton12-nhs Aug 12, 2024
908d582
APM-5429 additional test fix for symmetric alg
sophieclayton12-nhs Aug 12, 2024
327853d
APM-5429 fixed parametrize issue
sophieclayton12-nhs Aug 12, 2024
7ef6cbe
APM-5429 test _token _exchange issue fix
NautiyalVikas1 Aug 12, 2024
b29fed1
APM-5429 correct redirect URL for PR CIS2
sophieclayton12-nhs Aug 13, 2024
06aafa4
APM-5429 forward acr_values parameter for combined CIS2 auth
sophieclayton12-nhs Aug 20, 2024
b15bfde
APM-5429 ignore unresolved var
sophieclayton12-nhs Aug 20, 2024
05ca747
APM-5429 added product scope tests for different auth levels
sophieclayton12-nhs Aug 21, 2024
6177f2e
APM-5429 test clean up
sophieclayton12-nhs Aug 21, 2024
1816a31
APM-5429 test clean up
sophieclayton12-nhs Aug 21, 2024
06b5add
APM-5429 update test_product_scopes.py to be clearer when testing aal3
sophieclayton12-nhs Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions azure/azure-pr-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ extends:
jinja_templates:
IDENTITY_PROVIDER_CIS2: cis2-int
IDENTITY_PROVIDER_NHS_LOGIN: nhs-login
VARIABLES_KVM: identity_service_config
VARIABLES_KVM: identity_service_config_int
ENCRYPTED_VARIABLES_KVM: identity-service-variables-encrypted
ENCRYPTED_VARIABLES_KVM_KEY_CLIENT_SECRET: keycloak_client_secret
NUM_RANDOM_LONG_INTS_FOR_STATE: 4
RATELIMITING: ${{ variables.ratelimiting }}
2 changes: 1 addition & 1 deletion e2e/performance/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ locust = "^1.1.1"
pyjwt = "^2.0.0"
cryptography = "^3.3.1"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
flake8 = "^3.8.3"
black = "^19.10b0"

Expand Down
1 change: 1 addition & 0 deletions e2e/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def cis2_subject_token_claims():
"c_hash": "bc7zzGkClC3MEiFQ3YhPKg",
"acr": "AAL3_ANY",
"id_assurance_level": int(3),
"authentication_assurance_level": int(3),
"org.forgerock.openidconnect.ops": "-I45NjmMDdMa-aNF2sr9hC7qEGQ",
"s_hash": "LPJNul-wow4m6Dsqxbning",
"azp": "969567331415.apps.national",
Expand Down
66 changes: 66 additions & 0 deletions e2e/tests/logging/test_attach_logging_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,38 @@ def get_token_details(self, token_data):
force_new_token=True,
),
),
# User-restricted CIS2 combined aal2
pytest.param(
{
"auth_type": "user",
"auth_grant_type": "authorization_code",
"auth_level": "aal2",
"auth_provider": "apim-mock-nhs-cis2",
"auth_user_id": "656005750109",
},
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level="aal2",
login_form={"username": "656005750109"},
force_new_token=True,
),
),
# User-restricted CIS2 combined aal1
pytest.param(
{
"auth_type": "user",
"auth_grant_type": "authorization_code",
"auth_level": "aal1",
"auth_provider": "apim-mock-nhs-cis2",
"auth_user_id": "656005750110",
},
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level="aal1",
login_form={"username": "656005750110"},
force_new_token=True,
),
),
# User-restricted CIS2 seperate aal3
pytest.param(
{
Expand All @@ -48,6 +80,40 @@ def get_token_details(self, token_data):
force_new_token=True,
),
),
# User-restricted CIS2 seperate aal2
pytest.param(
{
"auth_type": "user",
"auth_grant_type": "token_exchange",
"auth_level": "aal2",
"auth_provider": "apim-mock-nhs-cis2",
"auth_user_id": "656005750109",
},
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level="aal2",
login_form={"username": "656005750109"},
authentication="separate",
force_new_token=True,
),
),
# User-restricted CIS2 seperate aal1
pytest.param(
{
"auth_type": "user",
"auth_grant_type": "token_exchange",
"auth_level": "aal1",
"auth_provider": "apim-mock-nhs-cis2",
"auth_user_id": "656005750110",
},
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level="aal1",
login_form={"username": "656005750110"},
authentication="separate",
force_new_token=True,
),
),
# User-restricted NHS-login combined P0
pytest.param(
{
Expand Down
98 changes: 47 additions & 51 deletions e2e/tests/logging/test_splunk_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from uuid import uuid4

from e2e.tests.utils.config import MOCK_CIS2_USERNAMES
from e2e.tests.utils.helpers import (
create_client_assertion,
create_subject_token,
Expand All @@ -15,37 +16,59 @@

class TestSplunkLoggingFields:
"""Test suite for testing logging fields are sent to splunk"""
# We are on our second generation of mock identity provider for
# healthcare_worker access (CIS2). This allows you to log-in using a
# username.

# Create a list of pytest.param for each combination of username and level for combined auth
combined_auth_params = [
pytest.param(
False, username, "apim-mock-nhs-cis2", level,
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level=level,
login_form={"username": username},
force_new_token=True,
),
)
for level, usernames in MOCK_CIS2_USERNAMES.items()
for username in usernames
]

# Create a list of pytest.param for each combination of username and level for separate auth
separate_auth_params = [
pytest.param(
username, level,
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level=level,
login_form={"username": username},
authentication="separate",
force_new_token=True,
),
)
for level, usernames in MOCK_CIS2_USERNAMES.items()
for username in usernames
]

@pytest.mark.happy_path
@pytest.mark.logging
@pytest.mark.parametrize(
"is_nhs_login,username,provider",
"is_nhs_login,username,provider,level", combined_auth_params +
[
# CIS2
pytest.param(
False,
"656005750104",
"apim-mock-nhs-cis2",
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level="aal3",
login_form={"username": "656005750104"},
force_new_token=True,
),
),
# NHS Login
pytest.param(
True,
"9912003071",
"apim-mock-nhs-login",
"P9",
marks=pytest.mark.nhsd_apim_authorization(
access="patient",
level="P9",
login_form={"username": "9912003071"},
force_new_token=True,
),
),
],
]
)
def test_splunk_fields_for_authorize_endpoint(
self,
Expand All @@ -55,6 +78,7 @@ def test_splunk_fields_for_authorize_endpoint(
is_nhs_login,
username,
provider,
level
):
session_name = str(uuid4())
header_filters = {"trace_id": session_name}
Expand Down Expand Up @@ -82,6 +106,7 @@ def test_splunk_fields_for_authorize_endpoint(
assert auth_meta["auth_type"] == "user"
assert auth_meta["grant_type"] == "authorization_code"
assert auth_meta["level"] == "" # level is unknown when hitting /authorize

assert auth_meta["provider"] == provider

auth_user = auth["user"]
Expand All @@ -90,21 +115,8 @@ def test_splunk_fields_for_authorize_endpoint(
@pytest.mark.happy_path
@pytest.mark.logging
@pytest.mark.parametrize(
"is_nhs_login,username,provider,level",
"is_nhs_login,username,provider,level", combined_auth_params +
[
# CIS2
pytest.param(
False,
"656005750104",
"apim-mock-nhs-cis2",
"aal3",
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level="aal3",
login_form={"username": "656005750104"},
force_new_token=True,
),
),
# NHS Login
pytest.param(
True,
Expand All @@ -118,7 +130,7 @@ def test_splunk_fields_for_authorize_endpoint(
force_new_token=True,
),
),
],
]
)
def test_splunk_fields_for_callback_endpoint(
self,
Expand Down Expand Up @@ -165,21 +177,8 @@ def test_splunk_fields_for_callback_endpoint(
@pytest.mark.happy_path
@pytest.mark.logging
@pytest.mark.parametrize(
"is_nhs_login,username,provider,level",
"is_nhs_login,username,provider,level", combined_auth_params +
[
# CIS2
pytest.param(
False,
"656005750104",
"apim-mock-nhs-cis2",
"aal3",
marks=pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level="aal3",
login_form={"username": "656005750104"},
force_new_token=True,
),
),
# NHS Login
pytest.param(
True,
Expand Down Expand Up @@ -243,6 +242,7 @@ def test_splunk_fields_for_token_endpoint_authorization_code(
assert auth_meta["auth_type"] == "user"
assert auth_meta["grant_type"] == "authorization_code"
assert auth_meta["level"] == level

assert auth_meta["provider"] == provider

auth_user = auth["user"]
Expand Down Expand Up @@ -298,13 +298,7 @@ def test_splunk_fields_for_token_endpoint_client_credentials(

@pytest.mark.happy_path
@pytest.mark.logging
@pytest.mark.nhsd_apim_authorization(
access="healthcare_worker",
level="aal3",
login_form={"username": "aal3"},
authentication="separate",
force_new_token=True,
)
@pytest.mark.parametrize("username, level", separate_auth_params)
def test_splunk_fields_for_token_endpoint_token_exchange_cis2(
self,
nhsd_apim_proxy_url,
Expand All @@ -313,6 +307,8 @@ def test_splunk_fields_for_token_endpoint_token_exchange_cis2(
token_data_token_exchange,
_jwt_keys,
cis2_subject_token_claims,
username,
level
):
token_data_token_exchange["client_assertion"] = create_client_assertion(
claims, _jwt_keys["private_key_pem"]
Expand Down
Loading
Loading