Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sohandey committed Oct 14, 2024
2 parents 9c1bdb7 + 8cc4224 commit d8e25aa
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class BaseTestCase extends AbstractTestNGSpringContextTests {
public String adminCookie = null;
public String partnerCookie = null;
public String partnerrevampCookie = null;
public String partnerrevampdeviceCookie = null;
public String partnerNewCookie = null;
public String withoutpartnerCookie = null;
public String withoutpolicyCookie = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ protected Response postWithBodyAndCookieWithText(String url, String jsonInput, S
protected Response postWithBodyAndCookieWithoutBody(String url, String jsonInput, String cookieName, String role,
String testCaseName) {
Response response = null;
jsonInput = null;

String inputJson = inputJsonKeyWordHandeler(jsonInput, testCaseName);
url = uriKeyWordHandelerUri(url, testCaseName);
token = kernelAuthLib.getTokenByRole(role);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class KernelAuthentication extends BaseTestCase {
private String partner_password = props.get("partner_user_password");
private String partner_userName = props.get("partner_userName");
private String partner_revamp_userName = props.get("partner_revamp_userName");
private String partner_revamp_device_userName = props.get("partner_revamp_device_userName");
private String partner_userName_without_role = props.get("policytest_userName");
private String partner_userName_without_pm_role = props.get("policytest_without_pmrole_userName");

Expand Down Expand Up @@ -114,6 +115,10 @@ public String getTokenByRole(String role, String tokenType) {
if (!kernelCmnLib.isValidToken(partnerrevampCookie))
partnerrevampCookie = kernelAuthLib.getAuthForPartnerRevamp();
return partnerrevampCookie;
case "partnerrevampdevice":
if (!kernelCmnLib.isValidToken(partnerrevampdeviceCookie))
partnerrevampdeviceCookie = kernelAuthLib.getAuthForPartnerRevampDevice();
return partnerrevampdeviceCookie;
case "partner":
if (!kernelCmnLib.isValidToken(partnerCookie))
partnerCookie = kernelAuthLib.getAuthForPartner();
Expand Down Expand Up @@ -307,6 +312,30 @@ public String getAuthForPartnerRevamp() {
String responseBody = reponse.getBody().asString();
return new org.json.JSONObject(responseBody).getJSONObject(dataKey).getString(GlobalConstants.TOKEN);
}

@SuppressWarnings({ "unchecked" })
public String getAuthForPartnerRevampDevice() {

JSONObject request = new JSONObject();

request.put(GlobalConstants.APPID, ConfigManager.getPmsAppId());
request.put(GlobalConstants.PASSWORD, partner_password);
request.put(GlobalConstants.USER_NAME, partner_revamp_device_userName);
JSONObject actualInternalrequest = getRequestJson(authInternalRequest);
if (BaseTestCase.isTargetEnvLTS()) {
request.put(GlobalConstants.CLIENTID, ConfigManager.getPmsClientId());
request.put(GlobalConstants.CLIENTSECRET, ConfigManager.getPmsClientSecret());
} else {
request.put(GlobalConstants.CLIENTID, ConfigManager.getPartnerClientId());
request.put(GlobalConstants.CLIENTSECRET, ConfigManager.getPartnerClientSecret());
}
request.put(GlobalConstants.CLIENTID, ConfigManager.getPmsClientId());

actualInternalrequest.put(GlobalConstants.REQUEST, request);
Response reponse = appl.postWithJson(authenticationInternalEndpoint, actualInternalrequest);
String responseBody = reponse.getBody().asString();
return new org.json.JSONObject(responseBody).getJSONObject(dataKey).getString(GlobalConstants.TOKEN);
}

@SuppressWarnings({ "unchecked" })
public String getAuthForNewPartner() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ else if(needsToBeCreatedUser.equals("masterdata-220005")){
else if(needsToBeCreatedUser.equals("111999")){
moduleSpecificUser = needsToBeCreatedUser;

}
else if(needsToBeCreatedUser.equals("111998")){
moduleSpecificUser = needsToBeCreatedUser;

}

else {
Expand Down
2 changes: 2 additions & 0 deletions apitest-commons/src/main/resources/config/Kernel.properties
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ roles.111999=AUTH_PARTNER,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_SUP
roles.111887=AUTH_PARTNER,PARTNER_ADMIN,PMS_ADMIN,REGISTRATION_SUPERVISOR
roles.111998=POLICYMANAGER
roles.111992=GLOBAL_ADMIN
roles.111998=DEVICE_PROVIDER,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_SUPERVISOR
roles.globaladmin = GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip


Expand Down Expand Up @@ -250,6 +251,7 @@ pmsAuthInternal=true
partner_password=mosip123
partner_userName=111997
partner_revamp_userName=111999
partner_revamp_device_userName=111998
partner_user_password=mosip123
policytest_password=mosip123
policytest_userName=111998
Expand Down

0 comments on commit d8e25aa

Please sign in to comment.