From c935652bfd4f333fac81b63aae9b50c61f3e903a Mon Sep 17 00:00:00 2001 From: Anup Nehe Date: Mon, 16 Oct 2023 17:33:32 +0530 Subject: [PATCH 1/2] MOSIP-29798 Signed-off-by: Anup Nehe --- .../resources/config/pmsDataDeleteQueries.txt | 2 +- .../policy/DefinePolicy/DefinePolicy.yml | 148 +++++++++++++++--- .../DefinePolicyGroup/DefinePolicyGroup.yml | 17 ++ 3 files changed, 148 insertions(+), 19 deletions(-) diff --git a/automationtests/src/main/resources/config/pmsDataDeleteQueries.txt b/automationtests/src/main/resources/config/pmsDataDeleteQueries.txt index dea658b9179..d37bb391b1b 100644 --- a/automationtests/src/main/resources/config/pmsDataDeleteQueries.txt +++ b/automationtests/src/main/resources/config/pmsDataDeleteQueries.txt @@ -18,7 +18,7 @@ delete from pms.partner where id in ('Tech-123','MOVP','DPP','MISP','MISP2','FTP delete from auth_policy where cr_by='partner-111997' delete from pms.auth_policy where name in('mosip policy','mosip policy2','mosip policy3','mosip data share policy','mosip data share policy2') delete from policy_group where cr_by='partner-111997' -delete from pms.policy_group where name in ('mosip policy group','mosip policy role testing groupp','mosip policy group2','update_policy_group','mosip policy status testing groupp with policy','mosip policy group for req key For_Req_Key_deactivaed_Policy','mosip policy group for req key For Update') +delete from pms.policy_group where name in ('mosip policy group','mosip policy role testing groupp','mosip policy group2','update_policy_group','mosip policy status testing groupp with policy') delete from pms.misp_license where cr_by='pm_testuser' delete from pms.misp_license where misp_id in ('MISP','MISP2') delete from pms.ftp_chip_detail where foundational_trust_provider_id='FTP' diff --git a/automationtests/src/main/resources/partner/policy/DefinePolicy/DefinePolicy.yml b/automationtests/src/main/resources/partner/policy/DefinePolicy/DefinePolicy.yml index 5120981cbe1..e9eda160ed6 100644 --- a/automationtests/src/main/resources/partner/policy/DefinePolicy/DefinePolicy.yml +++ b/automationtests/src/main/resources/partner/policy/DefinePolicy/DefinePolicy.yml @@ -50,45 +50,156 @@ definePolicy: "desc": "desc mosip policy", "is_Active": false }' - Partner_DefinePolicy_RandomTokenType_All_Valid_Smoke_sid: + + Partner_DefinePolicy_All_Valid_For_Test_AuthTypeToken_Null_Neg: endPoint: /v1/policymanager/policies role: partner restMethod: post inputTemplate: partner/policy/DefinePolicy/definePolicy - outputTemplate: partner/policy/DefinePolicy/definePolicyResult + outputTemplate: partner/error input: '{ - "desc": "desc mosip policy2", - "name": "mosip policy2", + "desc": "desc mosip policy group AuthTypeToken", + "name": "mosip policy AuthTypeToken", "authSubType": "FINGER", "authType": "bio", - "mandatory": false, + "mandatory": true, "attributeName": "string", - "authTokenType": "random", - "policyGroupName": "mosip policy group", + "authTokenType": "null", + "policyGroupName": "mosip policy group for AuthTypeToken", "policyType": "Auth", "version": "1.0", "requesttime": "$TIMESTAMP$" }' output: ' { - "policyGroupName": "mosip policy group", - "name": "mosip policy2", - "desc": "desc mosip policy2", - "is_Active": false + "errors": [ + { + "errorCode": "PMS_PV_005" + } + ] }' - Partner_DefinePolicy_PolicyTokenType_All_Valid_Smoke_sid: + + Partner_DefinePolicy_All_Valid_For_Test_AuthTypeToken_Policy: endPoint: /v1/policymanager/policies role: partner restMethod: post inputTemplate: partner/policy/DefinePolicy/definePolicy - outputTemplate: partner/policy/DefinePolicy/definePolicyResult + outputTemplate: partner/error + input: '{ + "desc": "desc mosip policy group AuthTypeToken", + "name": "mosip policy AuthTypeToken", + "authSubType": "FINGER", + "authType": "bio", + "mandatory": true, + "attributeName": "string", + "authTokenType": "Policy", + "policyGroupName": "mosip policy group for AuthTypeToken", + "policyType": "Auth", + "version": "1.0", + "requesttime": "$TIMESTAMP$" +}' + output: ' { + "errors": [ + { + "errorCode": "PMS_PV_005" + } + ] +}' + + Partner_DefinePolicy_All_Valid_For_Test_AuthTypeToken_Invalid_Neg: + endPoint: /v1/policymanager/policies + role: partner + restMethod: post + inputTemplate: partner/policy/DefinePolicy/definePolicy + outputTemplate: partner/error + input: '{ + "desc": "desc mosip policy group AuthTypeToken", + "name": "mosip policy AuthTypeToken", + "authSubType": "FINGER", + "authType": "bio", + "mandatory": true, + "attributeName": "string", + "authTokenType": "kjh54", + "policyGroupName": "mosip policy group for AuthTypeToken", + "policyType": "Auth", + "version": "1.0", + "requesttime": "$TIMESTAMP$" +}' + output: ' { + "errors": [ + { + "errorCode": "PMS_PV_005" + } + ] +}' + + Partner_DefinePolicy_All_Valid_For_Test_AuthTypeToken_Blank: + endPoint: /v1/policymanager/policies + role: partner + restMethod: post + inputTemplate: partner/policy/DefinePolicy/definePolicy + outputTemplate: partner/error + input: '{ + "desc": "desc mosip policy group AuthTypeToken", + "name": "mosip policy AuthTypeToken", + "authSubType": "FINGER", + "authType": "bio", + "mandatory": true, + "attributeName": "string", + "authTokenType": "", + "policyGroupName": "mosip policy group for AuthTypeToken", + "policyType": "Auth", + "version": "1.0", + "requesttime": "$TIMESTAMP$" +}' + output: ' { + "errors": [ + { + "errorCode": "PMS_PV_005" + } + ] +}' + + Partner_DefinePolicy_All_Valid_For_Test_AuthTypeToken_Space: + endPoint: /v1/policymanager/policies + role: partner + restMethod: post + inputTemplate: partner/policy/DefinePolicy/definePolicy + outputTemplate: partner/error input: '{ - "desc": "desc mosip policy3", - "name": "mosip policy3", + "desc": "desc mosip policy group AuthTypeToken", + "name": "mosip policy AuthTypeToken", "authSubType": "FINGER", "authType": "bio", "mandatory": true, "attributeName": "string", - "authTokenType": "policy", + "authTokenType": " ", + "policyGroupName": "mosip policy group for AuthTypeToken", + "policyType": "Auth", + "version": "1.0", + "requesttime": "$TIMESTAMP$" +}' + output: ' { + "errors": [ + { + "errorCode": "PMS_PV_005" + } + ] +}' + + Partner_DefinePolicy_RandomTokenType_All_Valid_Smoke_sid: + endPoint: /v1/policymanager/policies + role: partner + restMethod: post + inputTemplate: partner/policy/DefinePolicy/definePolicy + outputTemplate: partner/policy/DefinePolicy/definePolicyResult + input: '{ + "desc": "desc mosip policy2", + "name": "mosip policy2", + "authSubType": "FINGER", + "authType": "bio", + "mandatory": false, + "attributeName": "string", + "authTokenType": "random", "policyGroupName": "mosip policy group", "policyType": "Auth", "version": "1.0", @@ -96,10 +207,11 @@ definePolicy: }' output: ' { "policyGroupName": "mosip policy group", - "name": "mosip policy3", - "desc": "desc mosip policy3", + "name": "mosip policy2", + "desc": "desc mosip policy2", "is_Active": false }' + Partner_DefinePolicy_demo_All_Valid_Smoke_sid: endPoint: /v1/policymanager/policies role: partner diff --git a/automationtests/src/main/resources/partner/policy/DefinePolicyGroup/DefinePolicyGroup.yml b/automationtests/src/main/resources/partner/policy/DefinePolicyGroup/DefinePolicyGroup.yml index 98ebe873e1d..a8582b7e299 100644 --- a/automationtests/src/main/resources/partner/policy/DefinePolicyGroup/DefinePolicyGroup.yml +++ b/automationtests/src/main/resources/partner/policy/DefinePolicyGroup/DefinePolicyGroup.yml @@ -31,6 +31,23 @@ definePolicyGroup: "name": "mosip policy group for req key For_Req_Key_deactivaed_Policy", "desc": "desc mosip policy group for req key For_Req_Key_deactivaed_Policy", "is_Active": true + }' + + Partner_DefinePolicyGroup_All_Valid_Smoke_For_Test_AuthTypeToken_sid: + endPoint: /v1/policymanager/policies/group/new + role: partner + restMethod: post + inputTemplate: partner/policy/DefinePolicyGroup/definePolicyGroup + outputTemplate: partner/policy/DefinePolicyGroup/definePolicyGroupResult + input: '{ + "desc": "desc mosip policy group AuthTypeToken", + "name": "mosip policy group for AuthTypeToken", + "requesttime": "$TIMESTAMP$" + }' + output: ' { + "name": "mosip policy group for AuthTypeToken", + "desc": "desc mosip policy group AuthTypeToken", + "is_Active": true }' Partner_DefinePolicyGroup_All_Valid_Smoke_For_updatePolicy_sid: From 9ad42c3b2776c7b9403d521ab1bc89330bf3fd15 Mon Sep 17 00:00:00 2001 From: Nandhukumar Date: Mon, 16 Oct 2023 20:01:42 +0530 Subject: [PATCH 2/2] MOSIP-29715 Signed-off-by: Nandhukumar --- .../GenerateTokenVCI/GenerateTokenVCI.yml | 60 ++++++++++++++++++ .../GetCredential/GetCredential.yml | 63 +++++++++++++++++++ .../testNgXmlFiles/esignetSuite.xml | 14 ++--- 3 files changed, 130 insertions(+), 7 deletions(-) diff --git a/automationtests/src/main/resources/esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCI.yml b/automationtests/src/main/resources/esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCI.yml index 2234518c67a..4dcb90b3d93 100644 --- a/automationtests/src/main/resources/esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCI.yml +++ b/automationtests/src/main/resources/esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCI.yml @@ -77,4 +77,64 @@ GenerateTokenVCIVidNegTC: }' output: '{ "error": "pkce_failed" +}' + + ESignet_GenerateTokenVCI_Vid_NegCredScen1_Smoke_sid: + endPoint: /v1/esignet/oauth/v2/token + role: resident + restMethod: post + validityCheckRequired: true + inputTemplate: esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCI + outputTemplate: esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCIResult + input: '{ + "grant_type": "authorization_code", + "code": "$ID:AuthorizationCode_VCI_Vid_NegCredScen1_Valid_Smoke_sid_code$", + "client_id": "$ID:CreateOIDCClient_all_Valid_Smoke_sid_clientId$", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": "$CLIENT_ASSERTION_JWK$", + "redirect_uri": "$IDPREDIRECTURI$", + "code_verifier": "$CODEVERIFIER$" +}' + output: '{ + "token_type": "Bearer" +}' + + ESignet_GenerateTokenVCI_Vid_NegCredScen2_Smoke_sid: + endPoint: /v1/esignet/oauth/v2/token + role: resident + restMethod: post + validityCheckRequired: true + inputTemplate: esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCI + outputTemplate: esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCIResult + input: '{ + "grant_type": "authorization_code", + "code": "$ID:AuthorizationCode_VCI_Vid_NegCredScen2_Valid_Smoke_sid_code$", + "client_id": "$ID:CreateOIDCClient_all_Valid_Smoke_sid_clientId$", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": "$CLIENT_ASSERTION_JWK$", + "redirect_uri": "$IDPREDIRECTURI$", + "code_verifier": "$CODEVERIFIER$" +}' + output: '{ + "token_type": "Bearer" +}' + + ESignet_GenerateTokenVCI_Vid_NegCredScen3_Smoke_sid: + endPoint: /v1/esignet/oauth/v2/token + role: resident + restMethod: post + validityCheckRequired: true + inputTemplate: esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCI + outputTemplate: esignet/VCIVidNegTC/GenerateTokenVCI/GenerateTokenVCIResult + input: '{ + "grant_type": "authorization_code", + "code": "$ID:AuthorizationCode_VCI_Vid_NegCredScen3_Valid_Smoke_sid_code$", + "client_id": "$ID:CreateOIDCClient_all_Valid_Smoke_sid_clientId$", + "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", + "client_assertion": "$CLIENT_ASSERTION_JWK$", + "redirect_uri": "$IDPREDIRECTURI$", + "code_verifier": "$CODEVERIFIER$" +}' + output: '{ + "token_type": "Bearer" }' \ No newline at end of file diff --git a/automationtests/src/main/resources/esignet/VCIVidNegTC/GetCredential/GetCredential.yml b/automationtests/src/main/resources/esignet/VCIVidNegTC/GetCredential/GetCredential.yml index e69de29bb2d..08b298c90ed 100644 --- a/automationtests/src/main/resources/esignet/VCIVidNegTC/GetCredential/GetCredential.yml +++ b/automationtests/src/main/resources/esignet/VCIVidNegTC/GetCredential/GetCredential.yml @@ -0,0 +1,63 @@ +GetCredentialVidNegTC: + ESignet_GetCredential_Vid_IdpAccessToken_NegCredScen1_Invalid_Format_Neg: + endPoint: /v1/esignet/vci/credential + role: resident + checkErrorsOnlyInResponse: true + restMethod: post + validityCheckRequired: true + inputTemplate: esignet/VCIVidNegTC/GetCredential/GetCredential + outputTemplate: esignet/error2 + input: '{ + "client_id": "$ID:CreateOIDCClient_all_Valid_Smoke_sid_clientId$", + "idpAccessToken": "$ID:GenerateTokenVCI_Vid_NegCredScen1_Smoke_sid_access_token$", + "format": "dfsfd", + "type": [{types: "VerifiableCredential"}, {types: "MOSIPVerifiableCredential"}], + "@context": [{context: "$VCICONTEXTURL$"}], + "proof_type": "jwt", + "proof_jwt": "$PROOFJWT$" +}' + output: '{ + "error":"unsupported_credential_format" +}' + + ESignet_GetCredential_Vid_IdpAccessToken_NegCredScen2_Invalid_Proof_Neg: + endPoint: /v1/esignet/vci/credential + role: resident + checkErrorsOnlyInResponse: true + restMethod: post + validityCheckRequired: true + inputTemplate: esignet/VCIVidNegTC/GetCredential/GetCredential + outputTemplate: esignet/error2 + input: '{ + "client_id": "$ID:CreateOIDCClient_all_Valid_Smoke_sid_clientId$", + "idpAccessToken": "$ID:GenerateTokenVCI_Vid_NegCredScen2_Smoke_sid_access_token$", + "format": "ldp_vc", + "type": [{types: "VerifiableCredential"}, {types: "MOSIPVerifiableCredential"}], + "@context": [{context: "$VCICONTEXTURL$"}], + "proof_type": "jwt", + "proof_jwt": "wewrt" +}' + output: '{ + "error":"invalid_proof" +}' + + ESignet_GetCredential_Vid_IdpAccessToken_Missing_Format_Neg: + endPoint: /v1/esignet/vci/credential + role: resident + checkErrorsOnlyInResponse: true + restMethod: post + validityCheckRequired: true + inputTemplate: esignet/VCIVidNegTC/GetCredential/GetCredential + outputTemplate: esignet/error2 + input: '{ + "client_id": "$ID:CreateOIDCClient_all_Valid_Smoke_sid_clientId$", + "idpAccessToken": "$ID:GenerateTokenVCI_Vid_NegCredScen3_Smoke_sid_access_token$", + "format": "$REMOVE$", + "type": [{types: "VerifiableCredential"}, {types: "MOSIPVerifiableCredential"}], + "@context": [{context: "$VCICONTEXTURL$"}], + "proof_type": "jwt", + "proof_jwt": "$PROOFJWT$" +}' + output: '{ + "error": "invalid_vc_format" +}' \ No newline at end of file diff --git a/automationtests/testNgXmlFiles/esignetSuite.xml b/automationtests/testNgXmlFiles/esignetSuite.xml index 77cbb346cbe..b53ba2b47dd 100644 --- a/automationtests/testNgXmlFiles/esignetSuite.xml +++ b/automationtests/testNgXmlFiles/esignetSuite.xml @@ -578,6 +578,13 @@ + + + + + + @@ -611,13 +618,6 @@ - - - - - -