Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,12 @@ public void getListOfDevices(@NonNull String modality, @NonNull BiometricsPigeon
}
}

@Override
public void getOperatorOnboardingBioattributes(@NonNull BiometricsPigeon.Result<String> result) {
String response = globalParamRepository.getCachedStringOperatorOnboardingBioAttributes();
result.success(response == null ? "" : response);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

public void handleDeviceInfoResponseForList(Bundle bundle) {
try {
byte[] infoBytes = bundle.getByteArray(RegistrationConstants.SBI_INTENT_RESPONSE_KEY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,70 @@ public void saveScreenHeaderToGlobalParam(@NonNull String id, @NonNull String va
}
result.success(response);
}

@Override
public void getOnboardYourselfUrl(@NonNull CommonDetailsPigeon.Result<String> result) {
String response = "";
try {
response = masterDataService.getCachedStringOnboardYourselfUrl();
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "Error fetching Onboard Yourself URL", e);
}
result.success(response);
}

@Override
public void getRegisteringIndividualUrl(@NonNull CommonDetailsPigeon.Result<String> result) {
String response = "";
try {
response = masterDataService.getCachedStringRegisteringIndividualUrl();
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "Error fetching Registering Individual URL", e);
}
result.success(response);
}

@Override
public void getSyncDataUrl(@NonNull CommonDetailsPigeon.Result<String> result) {
String response = "";
try {
response = masterDataService.getCachedStringSyncDataUrl();
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "Error fetching Sync Data URL", e);
}
result.success(response);
}

@Override
public void getMappingDevicesUrl(@NonNull CommonDetailsPigeon.Result<String> result) {
String response = "";
try {
response = masterDataService.getCachedStringMappingDevicesUrl();
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "Error fetching Mapping Devices URL", e);
}
result.success(response);
}

@Override
public void getUploadingDataUrl(@NonNull CommonDetailsPigeon.Result<String> result) {
String response = "";
try {
response = masterDataService.getCachedStringUploadingDataUrl();
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "Error fetching Uploading Data URL", e);
}
result.success(response);
}

@Override
public void getUpdatingBiometricsUrl(@NonNull CommonDetailsPigeon.Result<String> result) {
String response = "";
try {
response = masterDataService.getCachedStringUpdatingBiometricsUrl();
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "Error fetching Updating Biometrics URL", e);
}
result.success(response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ Biometrics095Service provideBiometrics095Service(ObjectMapper objectMapper, Audi
@Singleton
UserOnboardService provideUserOnboardService(ObjectMapper objectMapper, AuditManagerService auditManagerService,
CertificateManagerService certificateManagerService,
SyncRestService syncRestService, CryptoManagerService cryptoManagerService, RegistrationService registrationService, UserBiometricRepository userBiometricRepository, ClientCryptoManagerService clientCryptoManagerService, UserDetailRepository userDetailRepository) {
SyncRestService syncRestService, CryptoManagerService cryptoManagerService, RegistrationService registrationService, UserBiometricRepository userBiometricRepository, ClientCryptoManagerService clientCryptoManagerService, UserDetailRepository userDetailRepository, GlobalParamRepository globalParamRepository) {
return new UserOnboardService(appContext, objectMapper, auditManagerService, certificateManagerService, syncRestService,
cryptoManagerService, registrationService, userBiometricRepository, clientCryptoManagerService, userDetailRepository);
cryptoManagerService, registrationService, userBiometricRepository, clientCryptoManagerService, userDetailRepository, globalParamRepository);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ public class RegistrationConstants {
public static final String JOB_TRIGGER_POINT_USER = "User";
public static final String GPS_DEVICE_ENABLE_FLAG = "mosip.registration.gps_device_enable_flag";
public static final String DIST_FRM_MACHINE_TO_CENTER = "mosip.registration.distance.from.machine.to.center";
public static final String OPERATOR_ONBOARDING_BIO_ATTRIBUTES = "mosip.registration.operator.onboarding.bioattributes";
public static final String SERVER_ACTIVE_PROFILE = "mosip.registration.server_profile";
public static final String ONBOARD_YOURSELF_URL = "mosip.registration.onboard_yourself_url";
public static final String REGISTERING_INDIVIDUAL_URL = "mosip.registration.registering_individual_url";
public static final String SYNC_DATA_URL = "mosip.registration.sync_data_url";
public static final String MAPPING_DEVICES_URL = "mosip.registration.mapping_devices_url";
public static final String UPLOADING_DATA_URL = "mosip.registration.uploading_data_url";
public static final String UPDATING_BIOMETRICS_URL = "mosip.registration.updating_biometrics_url";
public static final String PWORD_LENGTH = "mosip.registration.username_pwd_length";
public static final String DOC_SIZE = "mosip.registration.document_size";
public static final String MAX_AGE = "mosip.registration.max_age";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,34 @@ public String getCachedStringMachineToCenterDistance() {
return globalParamMap.get(RegistrationConstants.DIST_FRM_MACHINE_TO_CENTER);
}

public String getCachedStringOperatorOnboardingBioAttributes() {
return globalParamMap.get(RegistrationConstants.OPERATOR_ONBOARDING_BIO_ATTRIBUTES);
}

public String getCachedStringOnboardYourselfUrl() {
return globalParamMap.get(RegistrationConstants.ONBOARD_YOURSELF_URL);
}

public String getCachedStringRegisteringIndividualUrl() {
return globalParamMap.get(RegistrationConstants.REGISTERING_INDIVIDUAL_URL);
}

public String getCachedStringSyncDataUrl() {
return globalParamMap.get(RegistrationConstants.SYNC_DATA_URL);
}

public String getCachedStringMappingDevicesUrl() {
return globalParamMap.get(RegistrationConstants.MAPPING_DEVICES_URL);
}

public String getCachedStringUploadingDataUrl() {
return globalParamMap.get(RegistrationConstants.UPLOADING_DATA_URL);
}

public String getCachedStringUpdatingBiometricsUrl() {
return globalParamMap.get(RegistrationConstants.UPDATING_BIOMETRICS_URL);
}

public String getCachedStringPasswordLength() {
return globalParamMap.get(RegistrationConstants.PWORD_LENGTH);
}
Expand All @@ -177,7 +205,6 @@ public long getCachedWriteTimeout() {
return parseLongWithDefault(RegistrationConstants.HTTP_API_WRITE_TIMEOUT);
}


/**
* Refresh configuration cache by merging global params with local preferences
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class Biometrics095Service extends BiometricsService {
private static final String TAG = Biometrics095Service.class.getSimpleName();

private static final String TRUST_DOMAIN_DEVICE = "DEVICE";
private static final String DEFAULT_SERVER_ACTIVE_PROFILE = "Staging";
Comment thread
This conversation was marked as resolved.

private String rCaptureTrustDomain = TRUST_DOMAIN_DEVICE;
private String deviceInfoTrustDomain = TRUST_DOMAIN_DEVICE;
Expand Down Expand Up @@ -90,7 +91,7 @@ public Biometrics095Service(Context context, ObjectMapper objectMapper,

public CaptureRequest getRCaptureRequest(Modality modality, String deviceId, List<String> exceptionAttributes) {
CaptureRequest captureRequest = new CaptureRequest();
captureRequest.setEnv("Developer");
captureRequest.setEnv(getServerActiveProfile());
captureRequest.setPurpose("Registration");
captureRequest.setTimeout(10000);
captureRequest.setSpecVersion("0.9.5");
Expand Down Expand Up @@ -313,4 +314,14 @@ public void addBioDevice(Modality modality, String deviceCode, DigitalId digital
registeredDevice.put("deviceCode", deviceCode);
BIO_DEVICES.put(modality, registeredDevice);
}

private String getServerActiveProfile() {
if (globalParamRepository != null) {
String value = globalParamRepository.getCachedStringGlobalParam(RegistrationConstants.SERVER_ACTIVE_PROFILE);
if (value != null && !value.trim().isEmpty()) {
return value.trim();
}
}
return DEFAULT_SERVER_ACTIVE_PROFILE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1082,4 +1082,40 @@ public Map<String, Object> getRegistrationParams() {
return globalParamRepository.getGlobalParamsByPattern("mosip.registration%");
}

@Override
public String getCachedStringOnboardYourselfUrl() {
String value = globalParamRepository.getCachedStringOnboardYourselfUrl();
return value == null ? "" : value;
}

@Override
public String getCachedStringRegisteringIndividualUrl() {
String value = globalParamRepository.getCachedStringRegisteringIndividualUrl();
return value == null ? "" : value;
}

@Override
public String getCachedStringSyncDataUrl() {
String value = globalParamRepository.getCachedStringSyncDataUrl();
return value == null ? "" : value;
}

@Override
public String getCachedStringMappingDevicesUrl() {
String value = globalParamRepository.getCachedStringMappingDevicesUrl();
return value == null ? "" : value;
}

@Override
public String getCachedStringUploadingDataUrl() {
String value = globalParamRepository.getCachedStringUploadingDataUrl();
return value == null ? "" : value;
}

@Override
public String getCachedStringUpdatingBiometricsUrl() {
String value = globalParamRepository.getCachedStringUpdatingBiometricsUrl();
return value == null ? "" : value;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.mosip.registration.clientmanager.dto.registration.BiometricsDto;
import io.mosip.registration.clientmanager.exception.ClientCheckedException;
import io.mosip.registration.clientmanager.repository.UserBiometricRepository;
import io.mosip.registration.clientmanager.repository.GlobalParamRepository;
import io.mosip.registration.clientmanager.repository.UserDetailRepository;
import io.mosip.registration.clientmanager.spi.AuditManagerService;
import io.mosip.registration.clientmanager.spi.RegistrationService;
Expand Down Expand Up @@ -81,7 +82,7 @@ public class UserOnboardService {
public static final String BIO = "bio";
public static final String REQUEST_AUTH = "requestedAuth";
public static final String PACKET_SYNC_VERSION = "1.0";
public static final String SERVER_ACTIVE_PROFILE = "Staging";
private static final String DEFAULT_SERVER_ACTIVE_PROFILE = "Staging";
public static final String TRANSACTION_ID_VALUE = "1234567890";
public static final String USER_ID_CODE = "USERID";
public static final String ON_BOARD_BIO_TYPE = "bioType";
Expand All @@ -103,6 +104,7 @@ public class UserOnboardService {
private AuditManagerService auditManagerService;
private ObjectMapper objectMapper;
private ClientCryptoManagerService clientCryptoManagerService;
private GlobalParamRepository globalParamRepository;
SharedPreferences sharedPreferences;
public static final String USER_ID = "user_id";
public static final String USER_TOKEN = "user_token";
Expand Down Expand Up @@ -138,7 +140,7 @@ public void setIdaResponse(boolean idaResponse) {
@Inject
public UserOnboardService(Context context, ObjectMapper objectMapper, AuditManagerService auditManagerService,
CertificateManagerService certificateManagerService,
SyncRestService syncRestService, CryptoManagerService cryptoManagerService, RegistrationService registrationService, UserBiometricRepository userBiometricRepository, ClientCryptoManagerService clientCryptoManagerService, UserDetailRepository userDetailRepository) {
SyncRestService syncRestService, CryptoManagerService cryptoManagerService, RegistrationService registrationService, UserBiometricRepository userBiometricRepository, ClientCryptoManagerService clientCryptoManagerService, UserDetailRepository userDetailRepository, GlobalParamRepository globalParamRepository) {
this.context = context;
this.userDetailRepository=userDetailRepository;
this.certificateManagerService = certificateManagerService;
Expand All @@ -149,11 +151,22 @@ public UserOnboardService(Context context, ObjectMapper objectMapper, AuditManag
this.registrationService = registrationService;
this.userBiometricRepository = userBiometricRepository;
this.clientCryptoManagerService = clientCryptoManagerService;
this.globalParamRepository = globalParamRepository;
sharedPreferences = this.context.getSharedPreferences(
this.context.getString(R.string.app_name),
Context.MODE_PRIVATE);
}

private String getServerActiveProfile() {
if (globalParamRepository != null) {
String value = globalParamRepository.getCachedStringGlobalParam(RegistrationConstants.SERVER_ACTIVE_PROFILE);
if (value != null && !value.trim().isEmpty()) {
return value.trim();
}
}
return DEFAULT_SERVER_ACTIVE_PROFILE;
}

public void onboardOperator(List<BiometricsDto> biometrics, Runnable onFinish) throws ClientCheckedException {
Log.i(TAG, "validateWithIDAuthAndSave invoked ");

Expand Down Expand Up @@ -184,7 +197,7 @@ public void validateWithIDA(String userId, List<BiometricsDto> biometrics, Runna
idaRequestMap.put(VERSION, PACKET_SYNC_VERSION);
idaRequestMap.put(REQUEST_TIME,
DateUtils.formatToISOString(ZonedDateTime.now(ZoneOffset.UTC).toLocalDateTime()));
idaRequestMap.put(ENV, SERVER_ACTIVE_PROFILE);
idaRequestMap.put(ENV, getServerActiveProfile());
idaRequestMap.put(DOMAIN_URI, BuildConfig.BASE_URL);
idaRequestMap.put(TRANSACTION_ID, TRANSACTION_ID_VALUE);
idaRequestMap.put(CONSENT_OBTAINED, true);
Expand Down Expand Up @@ -242,7 +255,7 @@ private LinkedHashMap<String, Object> buildDataBlock(String bioType, String bioS
data.put(ON_BOARD_BIO_VALUE, splitEncryptedData.getEncryptedData());
data.put(TRANSACTION_UNIQUE_ID, TRANSACTION_ID_VALUE);
data.put(PURPOSE, PURPOSE_AUTH);
data.put(ENV, SERVER_ACTIVE_PROFILE);
data.put(ENV, getServerActiveProfile());
Comment thread
MadhuMosip marked this conversation as resolved.
data.put(DOMAIN_URI, BuildConfig.BASE_URL);
String dataBlockJsonString = this.objectMapper.writeValueAsString(data);
dataBlock.put(ON_BOARD_BIO_DATA, CryptoUtil.encodeToURLSafeBase64(dataBlockJsonString.getBytes()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,16 @@ public interface MasterDataService {
Map<String, Object> getRegistrationParams();

// void downloadUrlData(Path path, JSONObject jsonObject);

String getCachedStringOnboardYourselfUrl();

String getCachedStringRegisteringIndividualUrl();

String getCachedStringSyncDataUrl();

String getCachedStringMappingDevicesUrl();

String getCachedStringUploadingDataUrl();

String getCachedStringUpdatingBiometricsUrl();
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void testProvideBiometrics095Service() {
public void testProvideUserOnboardService() {
UserOnboardService service = appModule.provideUserOnboardService(
objectMapper, auditManagerService, certificateManagerService, syncRestService, cryptoManagerService,
mock(RegistrationService.class), userBiometricRepository, clientCryptoManagerService, userDetailRepository
mock(RegistrationService.class), userBiometricRepository, clientCryptoManagerService, userDetailRepository, globalParamRepository
);
assertNotNull(service);
assertTrue(service instanceof UserOnboardService);
Expand Down
Loading