diff --git a/pre-registration/pre-registration-application-service/src/main/resources/application.properties b/pre-registration/pre-registration-application-service/src/main/resources/application.properties index bf3692fded3..07319c22819 100644 --- a/pre-registration/pre-registration-application-service/src/main/resources/application.properties +++ b/pre-registration/pre-registration-application-service/src/main/resources/application.properties @@ -424,4 +424,6 @@ auth.server.admin.allowed.audience=mosip-regproc-client,mosip-prereg-client,mosi #the custom auth provider component names list #mosip.security.authentication.provider.beans.list=customJWTAuthProvider mosip.security.authentication.provider.beans.list.pre-registration-application-service=customJWTAuthProvider -mosip.security.authentication.provider.beans.list.pre-registration-booking-service=customJWTAuthProvider \ No newline at end of file +mosip.security.authentication.provider.beans.list.pre-registration-booking-service=customJWTAuthProvider + +mosip.preregistration.anonymous-profile-username:admin \ No newline at end of file diff --git a/pre-registration/pre-registration-core/src/main/java/io/mosip/analytics/event/anonymous/service/AnonymousProfileService.java b/pre-registration/pre-registration-core/src/main/java/io/mosip/analytics/event/anonymous/service/AnonymousProfileService.java index 49e13944279..52118562038 100644 --- a/pre-registration/pre-registration-core/src/main/java/io/mosip/analytics/event/anonymous/service/AnonymousProfileService.java +++ b/pre-registration/pre-registration-core/src/main/java/io/mosip/analytics/event/anonymous/service/AnonymousProfileService.java @@ -31,6 +31,9 @@ public class AnonymousProfileService implements AnonymousProfileServiceIntf { @Value("${mosip.utc-datetime-pattern}") private String utcDateTimePattern; + @Value("${mosip.preregistration.anonymous-profile-username}") + private String anonymousProfileUsername; + /** * Autowired reference for {@link #AnonymousProfileRepostiory} */ @@ -67,9 +70,9 @@ public AnonymousProfileResponseDTO saveAnonymousProfile(AnonymousProfileRequestD AnonymousProfileEntity requestEntity = new AnonymousProfileEntity(); requestEntity.setId(UUIDGeneratorUtil.generateId()); requestEntity.setProfile(requestDto.getProfileDetails()); - requestEntity.setCreatedBy(authUserDetails().getUserId()); + requestEntity.setCreatedBy(anonymousProfileUsername); requestEntity.setCreateDateTime(currentDateTime); - requestEntity.setUpdatedBy(authUserDetails().getUserId()); + requestEntity.setUpdatedBy(anonymousProfileUsername); requestEntity.setUpdateDateTime(currentDateTime); requestEntity.setIsDeleted(false); diff --git a/pre-registration/pre-registration-core/src/test/java/io/mosip/analytics/event/anonymous/service/test/AnonymousProfileServiceTest.java b/pre-registration/pre-registration-core/src/test/java/io/mosip/analytics/event/anonymous/service/test/AnonymousProfileServiceTest.java index 5ac060de5fe..efce6323c63 100644 --- a/pre-registration/pre-registration-core/src/test/java/io/mosip/analytics/event/anonymous/service/test/AnonymousProfileServiceTest.java +++ b/pre-registration/pre-registration-core/src/test/java/io/mosip/analytics/event/anonymous/service/test/AnonymousProfileServiceTest.java @@ -42,6 +42,9 @@ public class AnonymousProfileServiceTest { @Value("${mosip.utc-datetime-pattern}") private String utcDateTimePattern; + @Value("${mosip.preregistration.anonymous-profile-username}") + private String anonymousProfileUsername; + AnonymousProfileResponseDTO responseDto = new AnonymousProfileResponseDTO(); LocalDateTime currentDateTime = LocalDateTime.now(ZoneId.of("UTC")); @@ -70,9 +73,9 @@ public void saveAnonymousProfileTest() { requestEntity.setId(id); requestEntity.setProfile(requestDto.getProfileDetails()); - requestEntity.setCreatedBy(anonymousProfileService.authUserDetails().getUserId()); + requestEntity.setCreatedBy(anonymousProfileUsername); requestEntity.setCreateDateTime(currentDateTime); - requestEntity.setUpdatedBy(anonymousProfileService.authUserDetails().getUserId()); + requestEntity.setUpdatedBy(anonymousProfileUsername); requestEntity.setUpdateDateTime(currentDateTime); requestEntity.setIsDeleted(false); requestDto.setProfileDetails(profile); @@ -95,9 +98,9 @@ public void saveAnonymousProfileExceptionTest() throws Exception { requestEntity.setId(id); requestEntity.setProfile(requestDto.getProfileDetails()); - requestEntity.setCreatedBy(anonymousProfileService.authUserDetails().getUserId()); + requestEntity.setCreatedBy(anonymousProfileUsername); requestEntity.setCreateDateTime(currentDateTime); - requestEntity.setUpdatedBy(anonymousProfileService.authUserDetails().getUserId()); + requestEntity.setUpdatedBy(anonymousProfileUsername); requestEntity.setUpdateDateTime(currentDateTime); requestEntity.setIsDeleted(false); requestDto.setProfileDetails(profile); diff --git a/pre-registration/pre-registration-core/src/test/resources/application.properties b/pre-registration/pre-registration-core/src/test/resources/application.properties index cc59d72a026..749d06e43f3 100644 --- a/pre-registration/pre-registration-core/src/test/resources/application.properties +++ b/pre-registration/pre-registration-core/src/test/resources/application.properties @@ -82,3 +82,5 @@ spring.cloud.config.uri=${dev.dns.url}/config spring.cloud.config.label=develop spring.cloud.config.name=pre-registration spring.profiles.active=mz + +mosip.preregistration.anonymous-profile-username:admin