Skip to content

Commit

Permalink
fix event token claim validation
Browse files Browse the repository at this point in the history
  • Loading branch information
aktaskaan committed Jun 18, 2024
1 parent 4e1f4dd commit 8154161
Show file tree
Hide file tree
Showing 56 changed files with 1,481 additions and 380 deletions.
1 change: 1 addition & 0 deletions Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ env.BEFTA_RETRY_MAX_ATTEMPTS = "3"
env.BEFTA_RETRY_STATUS_CODES = "500,502,503,504"
env.BEFTA_RETRY_MAX_DELAY = "1000"
env.BEFTA_RETRY_NON_RETRYABLE_HTTP_METHODS = "POST,PUT"
env.TOKEN_CLAIM_VALIDATION_ENABLED="true"

withPipeline(type, product, component) {
onMaster {
Expand Down
1 change: 1 addition & 0 deletions Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ env.BEFTA_RETRY_MAX_ATTEMPTS = "3"
env.BEFTA_RETRY_STATUS_CODES = "500,502,503,504"
env.BEFTA_RETRY_MAX_DELAY = "1000"
env.BEFTA_RETRY_NON_RETRYABLE_HTTP_METHODS = "POST,PUT"
env.TOKEN_CLAIM_VALIDATION_ENABLED="true"

withNightlyPipeline(type, product, component) {
overrideVaultEnvironments(vaultOverrides)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"request": {
"pathVariables": {
"ctid": "AAT_AUTH_8"
}
},
"body": {
"event_token": "${[scenarioContext][parentContext][childContexts][S-156_Case_Creation_Data_Token_Creation][testData][actualResponse][body][token]}"
}
},

"expectedResponse": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"_guid_": "S-156_Case_Creation_Data_Token_Creation",

"productName": "CCD Data Store",
"operationName": "Start event creation as Case worker",

"method": "GET",
"uri": "/caseworkers/{uid}/jurisdictions/{jid}/case-types/{ctid}/event-triggers/{etid}/token",

"specs": [
"to create a token for case creation"
],

"users": {
"invokingUser": {
"_extends_": "PrivateCaseworker"
}
},

"request": {
"headers": {
"_extends_": "Common_Request_Headers"
},
"pathVariables": {
"uid": "[[DEFAULT_AUTO_VALUE]]",
"jid": "AUTOTEST1",
"ctid": "AAT_AUTH_8",
"etid": "CREATE"
}
},

"expectedResponse": {
"_extends_": "Common_200_Response",
"headers": {
"Content-Encoding": "gzip",
"Content-Length": "[[ANY_INTEGER_NOT_NULLABLE]]"
},
"body": {
"token": "[[ANY_STRING_NOT_NULLABLE]]",
"case_details": {
"id": null,
"jurisdiction": "[[ANYTHING_PRESENT]]",
"state": null,
"version": null,
"case_type_id": "[[ANYTHING_PRESENT]]",
"created_date": null,
"last_modified": null,
"last_state_modified_date": null,
"security_classification": null,
"case_data": {},
"data_classification": {},
"supplementary_data": null,
"after_submit_callback_response": null,
"callback_response_status_code": null,
"callback_response_status": null,
"delete_draft_response_status_code": null,
"delete_draft_response_status": null
},
"event_id": "CREATE"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_guid_": "Case_Creation_Using_Caseworker1_Role",
"_extends_": "Case_Creation_Data_Base",
"_extends_": "F-042_Case_Creation_Data_Base",

"users": {
"invokingUser": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"_guid_": "F-042_Case_Creation_Data_Base",
"_extends_": "Case_Creation_Base",

"request": {
"body": {
"event_token": "${[scenarioContext][parentContext][childContexts][Case_Creation_Using_Caseworker1_Role_Token_Creation][testData][actualResponse][body][token]}"
}
},

"expectedResponse": {
"_extends_": "Common_201_Response",
"headers": {
"Content-Encoding": "gzip",
"vary": "accept-encoding",
"Content-Length": "[[ANYTHING_PRESENT]]"
},
"body": {
"id": "[[ANYTHING_PRESENT]]",
"state": "TODO",
"version": 0,
"last_state_modified_date": "[[ANYTHING_PRESENT]]",
"created_date": "[[ANYTHING_PRESENT]]",
"last_modified": "[[ANYTHING_PRESENT]]",
"security_classification": "PUBLIC",
"after_submit_callback_response": null,
"callback_response_status_code": null,
"callback_response_status": null,
"delete_draft_response_status_code": null,
"delete_draft_response_status": null
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"_guid_": "Case_Creation_Using_Caseworker1_Role_Token_Creation",

"productName": "CCD Data Store",
"operationName": "Start event creation as Case worker",

"method": "GET",
"uri": "/caseworkers/{uid}/jurisdictions/{jid}/case-types/{ctid}/event-triggers/{etid}/token",

"specs": [
"to create a token for case creation"
],

"users": {
"invokingUser": {
"_extends_": "BeftaCaseworker1"
}
},

"request": {
"headers": {
"_extends_": "Common_Request_Headers"
},
"pathVariables": {
"uid": "[[DEFAULT_AUTO_VALUE]]",
"jid": "BEFTA_JURISDICTION_1",
"ctid": "BEFTA_CASETYPE_1_1",
"etid": "CREATE"
}
},

"expectedResponse": {
"_extends_": "Common_200_Response",
"headers": {
"Content-Encoding": "gzip",
"Content-Length": "[[ANY_INTEGER_NOT_NULLABLE]]"
},
"body": {
"token": "[[ANY_STRING_NOT_NULLABLE]]",
"case_details": {
"id": null,
"jurisdiction": "[[ANYTHING_PRESENT]]",
"state": null,
"version": null,
"case_type_id": "[[ANYTHING_PRESENT]]",
"created_date": null,
"last_modified": null,
"last_state_modified_date": null,
"security_classification": null,
"case_data": {},
"data_classification": {},
"supplementary_data": null,
"after_submit_callback_response": null,
"callback_response_status_code": null,
"callback_response_status": null,
"delete_draft_response_status_code": null,
"delete_draft_response_status": null
},
"event_id": "CREATE"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ Scenario: must return 409 when case is altered out of the transaction
And the response has all other details as expected.

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@S-283
# After the event token validation fix(ccd-5521), we get the same error in the token creation process since the token
# creation has to be with the same eventId; STOP_PROGRESS, which is not valid for the event process. That's why S-283
# is not a valid scenario anymore
@S-283 @Ignore
Scenario: must return 422 when event submission has failed

Given a user with [an active profile in CCD],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"data_classification": "[[ANYTHING_PRESENT]]"
},

"event_id": "updateCaseSubmitTTL"
"event_id": "[[ANYTHING_PRESENT]]"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"_guid_": "S-1016.21_GetUpdateSuspendedCaseTokenCitizen",
"_extends_": "F-1016_GetEventTokenBase",

"users": {
"invokingUser": {
"_extends_": "BeftaCitizen2"
}
},

"request": {
"pathVariables": {
"cid": "${[scenarioContext][parentContext][childContexts][F-1016_CreateSuspendedCasePreRequisiteCitizen][testData][actualResponse][body][id]}",
"etid": "updateCaseSubmitSuspendedTTL"
}
},

"expectedResponse": {
"body": {
"event_id": "updateCaseSubmitSuspendedTTL"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"_guid_": "S-1016.7_GetUpdateSuspendedCaseTokenCaseworker",
"_extends_": "F-1016_GetEventTokenBase",

"users": {
"invokingUser": {
"_extends_": "BeftaMasterCaseworker"
}
},

"request": {
"pathVariables": {
"cid": "${[scenarioContext][parentContext][childContexts][F-1016_CreateSuspendedCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
"etid": "updateCaseSubmitSuspendedTTL"
}
},

"expectedResponse": {
"body": {
"event_id": "updateCaseSubmitSuspendedTTL"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Feature: F-1016: Submit Event to Update TTL
Then a positive response is received
And the response has all other details as expected

@S-1016.7 #AC-7 #AC-8 #AC-9
@S-1016.7 @Smoke #AC-7 #AC-8 #AC-9
Scenario: TTL.Suspended changed to "No", SystemTTL and OverrideTTL greater than Guard value and Submit Event is invoked on v1_external#/case-details-endpoint/createCaseEventForCaseWorkerUsingPOST
Given a user with [an active profile in CCD]
And a successful call [to create a case] as in [F-1016_CreateSuspendedCasePreRequisiteCaseworker]
Expand Down Expand Up @@ -361,7 +361,7 @@ Feature: F-1016: Submit Event to Update TTL
Then a positive response is received
And the response has all other details as expected

@S-1016.14 #AC-7 #AC-8 #AC-9 #AC-11
@S-1016.14 @Smoke #AC-7 #AC-8 #AC-9 #AC-11
Scenario: TTL.Suspended changed to "No", SystemTTL and OverrideTTL greater than Guard value and Submit Event is invoked on v2_external#/case-controller/createEventUsingPOST
Given a user with [an active profile in CCD]
And a successful call [to create a case] as in [F-1016_CreateSuspendedCasePreRequisiteCaseworker]
Expand Down Expand Up @@ -548,7 +548,7 @@ Feature: F-1016: Submit Event to Update TTL
Then a positive response is received
And the response has all other details as expected

@S-1016.21 #AC-7 #AC-8 #AC-9 #AC-10
@S-1016.21 @Smoke #AC-7 #AC-8 #AC-9 #AC-10
Scenario: TTL.Suspended changed to "No", SystemTTL and OverrideTTL greater than Guard value and Submit Event is invoked on v1_external#/case-details-endpoint/createCaseEventForCitizenUsingPOST
Given a user with [an active profile in CCD]
And a successful call [to create a case] as in [F-1016_CreateSuspendedCasePreRequisiteCitizen]
Expand Down Expand Up @@ -953,7 +953,7 @@ Feature: F-1016: Submit Event to Update TTL
# CCD-3476: TTL Increment tests when data not present in event data or permission restricted: v1_external#/case-details-endpoint/createCaseEventForCitizenUsingPOST
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@S-1016.71 #CCD-3476
@S-1016.71 @Smoke #CCD-3476
Scenario: Set TTL for first time when TTL data not present in event data and Submit Event is invoked on v1_external#/case-details-endpoint/createCaseEventForCitizenUsingPOST
Given a user with [an active profile in CCD]
And a user with [a caseworker with an active profile in CCD]
Expand All @@ -970,7 +970,7 @@ Feature: F-1016: Submit Event to Update TTL
And the response has all other details as expected
And another call [to verify that the TTL data has changed] will get the expected response as in [S-1016.71.VerifyCaseDetails]

@S-1016.72 #CCD-3476
@S-1016.72 @Smoke #CCD-3476
Scenario: Update TTL value when TTL data not present in event data and Submit Event is invoked on v1_external#/case-details-endpoint/createCaseEventForCitizenUsingPOST
Given a user with [an active profile in CCD]
And a user with [a caseworker with an active profile in CCD]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "TTL.Suspended changed to \"No\", SystemTTL and OverrideTTL greater than Guard value using v2 '/cases/{cid}/events'",

"prerequisites" : [ {
"Token_Creation": "S-1016_GetUpdateSuspendedCaseTokenCaseworker"
"Token_Creation": "S-1016.7_GetUpdateSuspendedCaseTokenCaseworker"
}
],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "TTL.Suspended changed to \"No\", SystemTTL and OverrideTTL greater than Guard value using '/citizens/{uid}/jurisdictions/{jid}/case-types/{ctid}/cases/{cid}/events'",

"prerequisites" : [{
"Token_Creation": "S-1016_GetUpdateSuspendedCaseTokenCitizen"
"Token_Creation": "S-1016.21_GetUpdateSuspendedCaseTokenCitizen"
}],

"specs": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "TTL.Suspended changed to \"No\", SystemTTL and OverrideTTL greater than Guard value using '/caseworkers/{uid}/jurisdictions/{jid}/case-types/{ctid}/cases/{cid}/events'",

"prerequisites" : [ {
"Token_Creation": "S-1016_GetUpdateSuspendedCaseTokenCaseworker"
"Token_Creation": "S-1016.7_GetUpdateSuspendedCaseTokenCaseworker"
}
],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"request": {
"pathVariables": {
"cid": "${[scenarioContext][siblingContexts][CreateCase_TTLCaseType_PreRequisiteCitizen][testData][actualResponse][body][id]}",
"etid": "updateCaseTTLInc"
"etid": "updateCaseTTLIncHidden"
}
},

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"title": "should create an event token for correct inputs",
"_guid_": "S-1018.11-GetUpdateEventToken",
"_extends_": "Token_Creation_Data_For_Master_Caseworker_Case_Creation",

"users": {
"invokingUser": {
"_extends_": "BeftaMasterCaseworker"
}
},

"request": {
"pathVariables": {
"cid": "${[scenarioContext][siblingContexts][F-1018_CreateAnotherCasePreRequisiteCaseworkerBase][testData][actualResponse][body][id]}"
}
},

"expectedResponse": {
"_extends_": "Common_200_Response",
"headers": {
"Content-Encoding": "gzip",
"Content-Length": "[[ANYTHING_PRESENT]]"
},
"body": {
"token": "[[ANYTHING_PRESENT]]",
"case_details": "[[ANYTHING_PRESENT]]",
"event_id": "updateCase"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"title": "should create an event token for correct inputs",
"_guid_": "S-1018.21-GetCitizenUpdateEventToken",
"_extends_": "F-1018-GetCitizenUpdateEventTokenBase",

"request": {
"pathVariables": {
"cid": "${[scenarioContext][siblingContexts][F-1018_CreateAnotherCasePreRequisiteCitizenBase][testData][actualResponse][body][id]}"
}
}
}
Loading

0 comments on commit 8154161

Please sign in to comment.