Skip to content

Commit

Permalink
Merge pull request #952 from nandhu-kumar/develop
Browse files Browse the repository at this point in the history
MOSIP-36485 | Fix the esignet failures with the IDA plugin
  • Loading branch information
ckm007 authored Oct 14, 2024
2 parents bda8fd8 + a0c2293 commit e6a5b65
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class AddIdentity extends AdminTestUtil implements ITest {
private static final Logger logger = Logger.getLogger(AddIdentity.class);
protected String testCaseName = "";
public Response response = null;
private boolean isWaitRequired = false;
private boolean isvalueReplaced = false;

/**
* get current testcaseName
Expand Down Expand Up @@ -125,12 +127,18 @@ public void test(TestCaseDTO testCaseDTO) throws Exception {
response = RestClient.post(url, inputJson);

GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response);

writeAutoGeneratedId("ESignet_GenerateApiKey_Valid_Smoke_sid", "apiKey", generateRandomNumberString(20));

writeAutoGeneratedId("Esignet_PartnerSelfRegistration_All_Valid_Smoke_sid", "partnerId", generateRandomNumberString(20));
if (isvalueReplaced == false) {
writeAutoGeneratedId("ESignet_GenerateApiKey_Valid_Smoke_sid", "apiKey",
generateRandomNumberString(20));
writeAutoGeneratedId("ESignet_GenerateApiKeyKyc_Valid_Smoke_sid", "apiKey",
generateRandomNumberString(20));

writeAutoGeneratedId("Esignet_PartnerSelfRegistration_All_Valid_Smoke_sid", "partnerId",
generateRandomNumberString(20));
isvalueReplaced = true;
}
} else {

isWaitRequired = true;
testCaseDTO.setInputTemplate(AdminTestUtil.modifySchemaGenerateHbs(testCaseDTO.isRegenerateHbs()));
String uin = JsonPrecondtion.getValueFromJson(
RestClient.getRequestWithCookie(ApplnURI + "/v1/idgenerator/uin", MediaType.APPLICATION_JSON,
Expand Down Expand Up @@ -213,7 +221,7 @@ public void waittime() {

try {
if (EsignetUtil.getIdentityPluginNameFromEsignetActuator().toLowerCase()
.contains("mockauthenticationservice") == false) {
.contains("idaauthenticatorimpl") == true && isWaitRequired == true) {
logger.info("waiting for " + properties.getProperty("Delaytime")
+ " mili secs after UIN Generation In IDREPO");
Thread.sleep(Long.parseLong(properties.getProperty("Delaytime")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public static void init() {
Properties props = getproperties(path);
// Convert Properties to Map and add to moduleSpecificPropertiesMap
for (String key : props.stringPropertyNames()) {
moduleSpecificPropertiesMap.put(key, props.getProperty(key));
String value = System.getenv(key) == null ? props.getProperty(key) : System.getenv(key);
moduleSpecificPropertiesMap.put(key, value);
}
} catch (Exception e) {
LOGGER.error(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public static String getIdentityPluginNameFromEsignetActuator() {
plugin = getValueFromEsignetActuator("classpath:/application-default.properties",
"mosip.esignet.integration.authenticator");
}

if (plugin == null || plugin.isBlank() == true) {
plugin = getValueFromEsignetActuator("mosip-config/esignet",
"mosip.esignet.integration.authenticator");
}

return plugin;
}
Expand Down Expand Up @@ -94,18 +99,30 @@ public static String isTestCaseValidForExecution(TestCaseDTO testCaseDTO) {
&& endpoint.contains("$GETENDPOINTFROMWELLKNOWN$") == false) {
throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
}
if ((testCaseName.contains("_KycBioAuth_") || testCaseName
.contains("_BioAuth_")
|| testCaseName.contains("_SendBindingOtp_uin_Email_Valid_Smoke"))) {
if ((testCaseName.contains("_KycBioAuth_") || testCaseName.contains("_BioAuth_")
|| testCaseName.contains("_SendBindingOtp_uin_Email_Valid_Smoke")
|| testCaseName.contains("ESignet_AuthenticateUserIDP_NonAuth_uin_Otp_Valid_Smoke"))) {
throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
}

} else if (getIdentityPluginNameFromEsignetActuator().toLowerCase().contains("idaauthenticatorimpl")) {
// Let run test cases eSignet & MOSIP API calls --- both UIN and VID
// Let run test cases eSignet & MOSIP API calls --- both UIN and VID

BaseTestCase.setSupportedIdTypes(Arrays.asList("UIN", "VID"));

String endpoint = testCaseDTO.getEndPoint();
if (endpoint.contains("/v1/signup/") == true || endpoint.contains("/mock-identity-system/") == true
|| ((testCaseName.equals("ESignet_CreateOIDCClient_all_Valid_Smoke_sid")
|| testCaseName.equals("ESignet_CreateOIDCClient_Misp_Valid_Smoke_sid")
|| testCaseName.equals("ESignet_CreateOIDCClient_NonAuth_all_Valid_Smoke_sid"))
&& endpoint.contains("/v1/esignet/client-mgmt/oauth-client"))) {
throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
}

JSONArray individualBiometricsArray = new JSONArray(
getValueFromAuthActuator("json-property", "individualBiometrics"));
String individualBiometrics = individualBiometricsArray.getString(0);

if ((testCaseName.contains("_KycBioAuth_") || testCaseName.contains("_BioAuth_")
|| testCaseName.contains("_SendBindingOtp_uin_Email_Valid_Smoke"))
&& (!isElementPresent(new JSONArray(schemaRequiredField), individualBiometrics))) {
Expand Down
21 changes: 2 additions & 19 deletions api-test/src/main/resources/config/esignet.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,13 @@ tokenEndpoint=/v1/esignet/oauth/token
validateBindingEndpoint=ida-binding
esignetWellKnownEndPoint=/v1/esignet/oidc/.well-known/openid-configuration
signupSettingsEndPoint=/v1/signup/settings
esignetActuatorPropertySection=classpath:/application-default.properties
enableDebug=yes
preconfiguredOtp=111111
usePreConfiguredOtp=true
# supported values yes or no. Assume that by Default e-signet is deployed
eSignetDeployed=yes
reportIgnoredTestCases=no
reportKnownIssueTestCases=no
esignetActuatorPropertySection=esignet-default.properties
servicesNotDeployed=resident,ridgenerator,admin,hotlist,preregistration,registrationprocessor,hub,print,packetcreator,packetmanager,mock-abis-service,mockmv,sunbirdrc
esignetMockBaseURL=esignet-insurance.
sunBirdBaseURL=https://registry.dev1.mosip.net
#Once sunbird registry is pointing to specific env, remove the above line and uncomment below line
#sunBirdBaseURL=registry
slack-webhook-url=
serverErrorsToMonitor=IDA-MLC-018

#------------------------- Need to check if these are used or not ------------------------#
OTPTimeOut = 181
attempt = 10


#----------------------------------AuthDemoService Host properties----------------------------------------------------------#
authCertsPath=
#authCertsPath=/home/mosip/authcerts

mosip_components_base_urls=
#auditmanager=api-internal.dev1.mosip.net;idrepository=api-internal.dev1.mosip.net;partnermanager=api-internal.qa-inji.mosip.net;idauthentication=api-internal.qa-inji.mosip.net;policymanager=api-internal.qa-inji.mosip.net
attempt = 10
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AuthenticateUserPassword:
"encodedHash": "$ID:OAuthDetailsRequest_Password_all_Valid_Smoke_sid_encodedResp$",
"requestTime": "$TIMESTAMP$",
"transactionId": "$ID:OAuthDetailsRequest_Password_all_Valid_Smoke_sid_transactionId$",
"individualId": "$ID:GenerateChallenge_STransId_Valid_smoke_Pos_PHONE$@phone",
"individualId": "$ID:GenerateChallenge_STransId_Valid_smoke_Pos_PHONE$",
"authFactorType" : "PWD",
"challenge" : "$RESETPASSWORDFORAUTHENTICATION$"
}'
Expand All @@ -31,7 +31,7 @@ AuthenticateUserPassword:
"encodedHash": "$ID:OAuthDetailsRequest_Password_V2_all_Valid_Smoke_sid_encodedResp$",
"requestTime": "$TIMESTAMP$",
"transactionId": "$ID:OAuthDetailsRequest_Password_V2_all_Valid_Smoke_sid_transactionId$",
"individualId": "$ID:GenerateChallenge_STransId_Valid_smoke_Pos_PHONE$@phone",
"individualId": "$ID:GenerateChallenge_STransId_Valid_smoke_Pos_PHONE$",
"authFactorType" : "PWD",
"challenge" : "$RESETPASSWORDFORAUTHENTICATION$"
}'
Expand Down
Loading

0 comments on commit e6a5b65

Please sign in to comment.