diff --git a/.github/workflows/push_trigger.yml b/.github/workflows/push_trigger.yml
index f5038f38f..a8ad836ed 100644
--- a/.github/workflows/push_trigger.yml
+++ b/.github/workflows/push_trigger.yml
@@ -10,6 +10,7 @@ on:
- 1.*
- develop
- main
+ - bugfix-ES-218
jobs:
call-workflow-codeql-analysis:
diff --git a/.github/workflows/release_chart.yml b/.github/workflows/release_chart.yml
index 4c9e2158c..98c63f92b 100644
--- a/.github/workflows/release_chart.yml
+++ b/.github/workflows/release_chart.yml
@@ -19,6 +19,6 @@ jobs:
with:
token: ${{ secrets.ACTION_PAT }}
charts_dir: ./helm
- charts_url: https://github.com/mosip
+ charts_url: https://mosip.github.io/mosip-helm
repository: mosip-helm
branch: gh-pages
diff --git a/README.md b/README.md
index 5524b9525..7a06b323f 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,62 @@ The project requires JDK 11.
$ docker build -f Dockerfile
```
+## Installing in k8s cluster using helm
+### Pre-requisites
+1. Set the kube config file of the Mosip cluster having dependent services is set correctly in PC.
+1. Make sure [DB setup](db_scripts/README.md#install-in-existing-mosip-k8-cluster) is done.
+1. Add / merge below mentioned properties files into existing config branch:
+ * [esignet-default.properties](https://github.com/mosip/mosip-config/blob/v1.2.0.1-B3/esignet-default.properties)
+ * [application-default.properties](https://github.com/mosip/mosip-config/blob/v1.2.0.1-B3/application-default.properties)
+1. Below are the dependent services required for esignet service:
+ | Chart | Chart version |
+ |---|---|
+ |[Keycloak](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/external/iam) | 7.1.18 |
+ |[Keycloak-init](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/external/iam) | 12.0.1-B3 |
+ |[Postgres](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/external/postgres) | 10.16.2 |
+ |[Postgres Init](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/external/postgres) | 12.0.1-B3 |
+ |[Minio](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/external/object-store) | 10.1.6 |
+ |[Kafka](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/external/kafka) | 0.4.2 |
+ |[Config-server](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/mosip/config-server) | 12.0.1-B3 |
+ |[Websub](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/mosip/websub) | 12.0.1-B2 |
+ |[Artifactory server](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/mosip/artifactory) | 12.0.1-B3 |
+ |[Keymanager service](https://github.com/mosip/mosip-infra/blob/v1.2.0.1-B3/deployment/v3/mosip/keymanager) | 12.0.1-B2 |
+ |[Kernel services](https://github.com/mosip/mosip-infra/blob/v1.2.0.1-B3/deployment/v3/mosip/kernel) | 12.0.1-B2 |
+ |[Biosdk service](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/mosip/biosdk) | 12.0.1-B3 |
+ |[Idrepo services](https://github.com/mosip/mosip-infra/blob/v1.2.0.1-B3/deployment/v3/mosip/idrepo) | 12.0.1-B2 |
+ |[Pms services](https://github.com/mosip/mosip-infra/blob/v1.2.0.1-B3/deployment/v3/mosip/pms) | 12.0.1-B3 |
+ |[IDA services](https://github.com/mosip/mosip-infra/blob/v1.2.0.1-B3/deployment/v3/mosip/ida) | 12.0.1-B3 |
+
+### Install
+* Install `kubectl` and `helm` utilities.
+* Run `install-all.sh` to deploy esignet services.
+ ```
+ cd helm
+ ./install-all.sh
+ ```
+* During the execution of the `install-all.sh` script, a prompt appears requesting information regarding the presence of a public domain and a valid SSL certificate on the server.
+* If the server lacks a public domain and a valid SSL certificate, it is advisable to select the `n` option. Opting it will enable the `init-container` with an `emptyDir` volume and include it in the deployment process.
+* The init-container will proceed to download the server's self-signed SSL certificate and mount it to the specified location within the container's Java keystore (i.e., `cacerts`) file.
+* This particular functionality caters to scenarios where the script needs to be employed on a server utilizing self-signed SSL certificates.
+
+### Delete
+* Run `delete-all.sh` to remove esignet services.
+ ```
+ cd helm
+ ./delete-all.sh
+ ```
+
+### Restart
+* Run `restart-all.sh` to restart esignet services.
+ ```
+ cd helm
+ ./restart-all.sh
+ ```
+
+## Onboard esignet
+* Run onboarder's [install.sh](partner-onboarder) script to exchange jwk certificates.
+
+
## APIs
API documentation is available [here](https://mosip.stoplight.io/docs/identity-provider/branches/main/6f1syzijynu40-identity-provider).
diff --git a/binding-service-impl/pom.xml b/binding-service-impl/pom.xml
index 557018e0b..6791fb508 100644
--- a/binding-service-impl/pom.xml
+++ b/binding-service-impl/pom.xml
@@ -8,7 +8,7 @@
io.mosip.esignetesignet-parent
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOTio.mosip.esignet
diff --git a/binding-service-impl/src/main/java/io/mosip/esignet/services/KeyBindingServiceImpl.java b/binding-service-impl/src/main/java/io/mosip/esignet/services/KeyBindingServiceImpl.java
index cc4f746b5..6f8fd1ec1 100644
--- a/binding-service-impl/src/main/java/io/mosip/esignet/services/KeyBindingServiceImpl.java
+++ b/binding-service-impl/src/main/java/io/mosip/esignet/services/KeyBindingServiceImpl.java
@@ -12,6 +12,7 @@
import java.time.format.DateTimeFormatter;
import java.util.*;
+import io.mosip.esignet.api.dto.AuthChallenge;
import io.mosip.esignet.api.dto.KeyBindingResult;
import io.mosip.esignet.api.dto.SendOtpResult;
import io.mosip.esignet.api.exception.KeyBindingException;
@@ -80,13 +81,23 @@ public BindingOtpResponse sendBindingOtp(BindingOtpRequest bindingOtpRequest, Ma
return otpResponse;
}
+ private void validateChallengeListAuthFormat(List challengeList){
+ if(!challengeList.stream().allMatch(challenge->keyBindingWrapper.getSupportedChallengeFormats(challenge.getAuthFactorType()).
+ contains(challenge.getFormat()))) {
+ log.error("Invalid auth factor type or challenge format in the challenge list");
+ throw new EsignetException(INVALID_AUTH_FACTOR_TYPE_OR_CHALLENGE_FORMAT);
+ }
+ }
+
@Override
public WalletBindingResponse bindWallet(WalletBindingRequest walletBindingRequest, Map requestHeaders) throws EsignetException {
log.debug("bindWallet :: Request headers >> {}", requestHeaders);
+ validateChallengeListAuthFormat(walletBindingRequest.getChallengeList());
+
//Do not store format, only check if the format is supported by the wrapper.
if(!keyBindingWrapper.getSupportedChallengeFormats(walletBindingRequest.getAuthFactorType()).
contains(walletBindingRequest.getFormat()))
- throw new EsignetException(INVALID_CHALLENGE_FORMAT);
+ throw new EsignetException(INVALID_AUTH_FACTOR_TYPE_OR_CHALLENGE_FORMAT);
String publicKey = IdentityProviderUtil.getJWKString(walletBindingRequest.getPublicKey());
KeyBindingResult keyBindingResult;
diff --git a/binding-service-impl/src/main/java/io/mosip/esignet/services/PublicKeyRegistryServiceImpl.java b/binding-service-impl/src/main/java/io/mosip/esignet/services/PublicKeyRegistryServiceImpl.java
new file mode 100644
index 000000000..ea733c08c
--- /dev/null
+++ b/binding-service-impl/src/main/java/io/mosip/esignet/services/PublicKeyRegistryServiceImpl.java
@@ -0,0 +1,36 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.services;
+
+import io.mosip.esignet.core.dto.PublicKeyRegistry;
+import io.mosip.esignet.core.spi.PublicKeyRegistryService;
+import io.mosip.esignet.repository.PublicKeyRegistryRepository;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+
+@Slf4j
+@Service
+public class PublicKeyRegistryServiceImpl implements PublicKeyRegistryService {
+
+ @Autowired
+ private PublicKeyRegistryRepository publicKeyRegistryRepository;
+
+ @Override
+ public Optional findLatestPublicKeyByPsuTokenAndAuthFactor(String psuToken, String authFactor) {
+ Optional optionalPublicKeyRegistry = publicKeyRegistryRepository.findLatestByPsuTokenAndAuthFactor(psuToken,authFactor);
+ if(optionalPublicKeyRegistry.isPresent()) {
+ PublicKeyRegistry publicKeyRegistry = new PublicKeyRegistry();
+ publicKeyRegistry.setPublicKey(optionalPublicKeyRegistry.get().getPublicKey());
+ publicKeyRegistry.setPsuToken(optionalPublicKeyRegistry.get().getPsuToken());
+ publicKeyRegistry.setAuthFactor(optionalPublicKeyRegistry.get().getAuthFactor());
+ return Optional.of(publicKeyRegistry);
+ }
+ return Optional.empty();
+ }
+}
diff --git a/binding-service-impl/src/test/java/io/mosip/esignet/KeyBindingServiceTest.java b/binding-service-impl/src/test/java/io/mosip/esignet/KeyBindingServiceTest.java
index cd56a241d..21490d519 100644
--- a/binding-service-impl/src/test/java/io/mosip/esignet/KeyBindingServiceTest.java
+++ b/binding-service-impl/src/test/java/io/mosip/esignet/KeyBindingServiceTest.java
@@ -201,6 +201,7 @@ public void bindWallet_withUnsupportedFormat_thenFail() throws EsignetException,
AuthChallenge authChallenge = new AuthChallenge();
authChallenge.setAuthFactorType("OTP");
authChallenge.setChallenge("111111");
+ authChallenge.setFormat("alpha-numeric");
List authChallengeList = new ArrayList();
authChallengeList.add(authChallenge);
walletBindingRequest.setChallengeList(authChallengeList);
@@ -210,7 +211,7 @@ public void bindWallet_withUnsupportedFormat_thenFail() throws EsignetException,
Assert.assertNotNull(keyBindingService.bindWallet(walletBindingRequest, new HashMap<>()));
Assert.fail();
} catch (EsignetException e) {
- Assert.assertTrue(e.getErrorCode().equals(ErrorConstants.INVALID_CHALLENGE_FORMAT));
+ Assert.assertTrue(e.getErrorCode().equals(ErrorConstants.INVALID_AUTH_FACTOR_TYPE_OR_CHALLENGE_FORMAT));
}
}
@@ -230,8 +231,6 @@ public void bindWallet_withInvalidKeyBindingResult_thenFail() throws IOException
walletBindingRequest.setPublicKey(
(Map) objectMapper.readValue(clientJWK.toJSONString(), HashMap.class));
- when(mockKeyBindingWrapperService.doKeyBinding(Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.anyString(), Mockito.any()))
- .thenReturn(null);
try {
Assert.assertNotNull(keyBindingService.bindWallet(walletBindingRequest, new HashMap<>()));
Assert.fail();
diff --git a/client-management-service-impl/pom.xml b/client-management-service-impl/pom.xml
index 99a0449a8..3d4810278 100644
--- a/client-management-service-impl/pom.xml
+++ b/client-management-service-impl/pom.xml
@@ -6,7 +6,7 @@
io.mosip.esignetesignet-parent
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOTio.mosip.esignet
diff --git a/consent-service-impl/pom.xml b/consent-service-impl/pom.xml
new file mode 100644
index 000000000..60ba82662
--- /dev/null
+++ b/consent-service-impl/pom.xml
@@ -0,0 +1,36 @@
+
+
+
+ 4.0.0
+
+ io.mosip.esignet
+ esignet-parent
+ 1.1.0-SNAPSHOT
+
+
+ consent-service-impl
+
+
+ 11
+ 11
+ UTF-8
+ ${project.version}
+
+
+
+ io.mosip.esignet
+ esignet-core
+ ${esignet.core.version}
+
+
+
+ org.modelmapper
+ modelmapper
+ 3.1.1
+
+
+
\ No newline at end of file
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/config/ModelMapperConfig.java b/consent-service-impl/src/main/java/io/mosip/esignet/config/ModelMapperConfig.java
new file mode 100644
index 000000000..32c99cd43
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/config/ModelMapperConfig.java
@@ -0,0 +1,21 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.config;
+
+
+import org.modelmapper.ModelMapper;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ModelMapperConfig {
+
+ @Bean
+ public ModelMapper modelMapper() {
+ return new ModelMapper();
+ }
+
+}
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/entity/ConsentDetail.java b/consent-service-impl/src/main/java/io/mosip/esignet/entity/ConsentDetail.java
new file mode 100644
index 000000000..4f0073f51
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/entity/ConsentDetail.java
@@ -0,0 +1,82 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.entity;
+
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.time.LocalDateTime;
+import java.util.Objects;
+import java.util.UUID;
+
+import static io.mosip.esignet.core.constants.ErrorConstants.INVALID_CLAIM;
+import static io.mosip.esignet.core.constants.ErrorConstants.INVALID_CLIENT_ID;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Entity
+public class ConsentDetail {
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private UUID id;
+
+ @NotNull(message = INVALID_CLIENT_ID)
+ @Column(name = "client_id")
+ private String clientId;
+
+ @NotNull
+ @Column(name = "psu_token")
+ private String psuToken;
+
+ @NotNull(message = INVALID_CLAIM)
+ @Column(name = "claims")
+ private String claims;
+
+ /*
+ It stores the requested authorization scopes from the relying party in a json string
+ {
+ "scope" : "boolean" (essential or optional)
+ }
+ */
+ @NotNull
+ @Column(name = "authorization_scopes")
+ private String authorizationScopes;
+
+ @NotNull
+ @Column(name = "cr_dtimes")
+ private LocalDateTime createdtimes;
+
+ @Column(name = "expire_dtimes")
+ private LocalDateTime expiredtimes;
+
+ @Column(name = "signature")
+ private String signature;
+
+ @Column(name = "hash")
+ private String hash;
+
+ @Column(name = "accepted_claims")
+ private String acceptedClaims;
+
+ @Column(name = "permitted_scopes")
+ private String permittedScopes;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+ ConsentDetail consentDetail = (ConsentDetail) o;
+ return getId() != null && Objects.equals(getId(), consentDetail.getId());
+ }
+
+ @Override
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+}
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/entity/ConsentHistory.java b/consent-service-impl/src/main/java/io/mosip/esignet/entity/ConsentHistory.java
new file mode 100644
index 000000000..52823d34d
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/entity/ConsentHistory.java
@@ -0,0 +1,78 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.hibernate.Hibernate;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.time.LocalDateTime;
+import java.util.Objects;
+import java.util.UUID;
+
+import static io.mosip.esignet.core.constants.ErrorConstants.INVALID_CLAIM;
+import static io.mosip.esignet.core.constants.ErrorConstants.INVALID_CLIENT_ID;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Entity
+public class ConsentHistory {
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private UUID id;
+
+ @NotNull(message = INVALID_CLIENT_ID)
+ @Column(name = "client_id")
+ private String clientId;
+
+ @NotNull
+ @Column(name = "psu_token")
+ private String psuToken;
+
+ @NotNull(message = INVALID_CLAIM)
+ @Column(name = "claims")
+ private String claims;
+
+ @NotNull
+ @Column(name = "authorization_scopes")
+ private String authorizationScopes;
+
+ @NotNull
+ @Column(name = "cr_dtimes")
+ private LocalDateTime createdtimes;
+
+ @Column(name = "expire_dtimes")
+ private LocalDateTime expiredtimes;
+
+ @Column(name = "signature")
+ private String signature;
+
+ @Column(name = "hash")
+ private String hash;
+
+ @Column(name = "accepted_claims")
+ private String acceptedClaims;
+
+ @Column(name = "permitted_scopes")
+ private String permittedScopes;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+ ConsentHistory consentDetail = (ConsentHistory) o;
+ return getId() != null && Objects.equals(getId(), consentDetail.getId());
+ }
+
+ @Override
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+}
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/mapper/ConsentMapper.java b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/ConsentMapper.java
new file mode 100644
index 000000000..5c7ed9448
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/ConsentMapper.java
@@ -0,0 +1,50 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.mapper;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.mosip.esignet.core.dto.ConsentDetail;
+import io.mosip.esignet.core.dto.UserConsent;
+import io.mosip.esignet.entity.ConsentHistory;
+import io.mosip.esignet.mapper.converter.*;
+import org.modelmapper.ModelMapper;
+
+
+
+public class ConsentMapper {
+
+ private ConsentMapper(){}
+
+ private static final ModelMapper modelMapper = new ModelMapper();
+
+ static {
+ ObjectMapper objectMapper = new ObjectMapper();
+ modelMapper.addConverter(new ClaimsToStringConverter(objectMapper));
+ modelMapper.addConverter(new StringToClaimsConverter(objectMapper));
+ modelMapper.addConverter(new MapToStringConverter(objectMapper));
+ modelMapper.addConverter(new StringToMapConverter(objectMapper));
+ modelMapper.addConverter(new ListToStringConverter());
+ modelMapper.addConverter(new StringToListConverter());
+ modelMapper.addMappings(new CustomConsentRequestMapping());
+ modelMapper.addMappings(new CustomConsentHistoryMapping());
+ }
+
+ public static io.mosip.esignet.entity.ConsentDetail toEntity(ConsentDetail consentDetailDTo) {
+ return modelMapper.map(consentDetailDTo, io.mosip.esignet.entity.ConsentDetail.class);
+ }
+
+ public static io.mosip.esignet.entity.ConsentDetail toEntity(UserConsent userConsent) {
+ return modelMapper.map(userConsent, io.mosip.esignet.entity.ConsentDetail.class);
+ }
+
+ public static ConsentDetail toDto(io.mosip.esignet.entity.ConsentDetail consentDetail) {
+ return modelMapper.map(consentDetail, ConsentDetail.class);
+ }
+
+ public static ConsentHistory toConsentHistoryEntity(UserConsent userConsent){
+ return modelMapper.map(userConsent, ConsentHistory.class);
+ }
+}
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/mapper/CustomConsentHistoryMapping.java b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/CustomConsentHistoryMapping.java
new file mode 100644
index 000000000..6e1b5d1ad
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/CustomConsentHistoryMapping.java
@@ -0,0 +1,20 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.mapper;
+
+import io.mosip.esignet.core.dto.UserConsent;
+import io.mosip.esignet.entity.ConsentHistory;
+import org.modelmapper.PropertyMap;
+
+public class CustomConsentHistoryMapping extends PropertyMap {
+ @Override
+ protected void configure() {
+ // Skip the 'id' field when mapping
+ skip().setId(null);
+ }
+}
+
+
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/mapper/CustomConsentRequestMapping.java b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/CustomConsentRequestMapping.java
new file mode 100644
index 000000000..3de2f4f34
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/CustomConsentRequestMapping.java
@@ -0,0 +1,20 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.mapper;
+
+import io.mosip.esignet.core.dto.UserConsent;
+import io.mosip.esignet.entity.ConsentDetail;
+import org.modelmapper.PropertyMap;
+
+public class CustomConsentRequestMapping extends PropertyMap {
+ @Override
+ protected void configure() {
+ // Skip the 'id' field when mapping
+ skip().setId(null);
+ }
+}
+
+
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/ClaimsToStringConverter.java b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/ClaimsToStringConverter.java
new file mode 100644
index 000000000..961768890
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/ClaimsToStringConverter.java
@@ -0,0 +1,35 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.mapper.converter;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.mosip.esignet.api.dto.Claims;
+import io.mosip.esignet.core.exception.EsignetException;
+import lombok.extern.slf4j.Slf4j;
+import org.modelmapper.Converter;
+import org.modelmapper.spi.MappingContext;
+
+import static io.mosip.esignet.core.constants.ErrorConstants.INVALID_CLAIM;
+
+@Slf4j
+public class ClaimsToStringConverter implements Converter {
+ private final ObjectMapper objectMapper;
+
+ public ClaimsToStringConverter(ObjectMapper objectMapper) {
+ this.objectMapper = objectMapper;
+ }
+
+ @Override
+ public String convert(MappingContext context) {
+ Claims claims = context.getSource();
+ try {
+ return claims != null ? objectMapper.writeValueAsString(claims) : "";
+ } catch (JsonProcessingException e) {
+ throw new EsignetException(INVALID_CLAIM);
+ }
+ }
+}
\ No newline at end of file
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/ListToStringConverter.java b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/ListToStringConverter.java
new file mode 100644
index 000000000..ec9664ed5
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/ListToStringConverter.java
@@ -0,0 +1,19 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.mapper.converter;
+
+import org.modelmapper.Converter;
+import org.modelmapper.spi.MappingContext;
+
+import java.util.List;
+
+public class ListToStringConverter implements Converter, String> {
+ @Override
+ public String convert(MappingContext, String> context) {
+ List source = context.getSource();
+ return source == null ? "" : String.join(",", context.getSource());
+ }
+}
\ No newline at end of file
diff --git a/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/MapToStringConverter.java b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/MapToStringConverter.java
new file mode 100644
index 000000000..5e832d45d
--- /dev/null
+++ b/consent-service-impl/src/main/java/io/mosip/esignet/mapper/converter/MapToStringConverter.java
@@ -0,0 +1,35 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.mapper.converter;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.mosip.esignet.core.exception.EsignetException;
+import org.modelmapper.Converter;
+import org.modelmapper.spi.MappingContext;
+
+import java.util.Map;
+
+import static io.mosip.esignet.core.constants.ErrorConstants.INVALID_PERMITTED_SCOPE;
+
+public class MapToStringConverter implements Converter
+
+ **Note**: The Client Assertion JWT can contain other Claims. Any Claims used that are not understood WILL be ignored.
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ grant_type:
+ type: string
+ description: Authorization code grant type.
+ enum:
+ - authorization_code
+ code:
+ type: string
+ description: 'Authorization code, sent as query param in the client''s redirect URI.'
+ client_id:
+ type: string
+ description: Client Id of the OIDC client.
+ client_assertion_type:
+ type: string
+ enum:
+ - 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
+ description: Type of the client assertion part of this request.
+ client_assertion:
+ type: string
+ description: 'Private key signed JWT, This JWT payload structure is defined above as part of request description.'
+ redirect_uri:
+ type: string
+ description: Valid client redirect_uri. Must be same as the one sent in the authorize call.
+ required:
+ - grant_type
+ - code
+ - client_assertion_type
+ - client_assertion
+ - redirect_uri
+ description: ''
+ tags:
+ - OIDC
+ parameters: []
+ /oidc/userinfo:
+ get:
+ summary: UserInfo Endpoint
+ responses:
+ '200':
+ description: OK
+ content:
+ application/jwt:
+ schema:
+ type: string
+ format: jwt
+ description: 'The response is signed and then encrypted, with the result being a Nested JWT. Signed using the authentication system''s private key. Signed full JWT will then be encrypted using OIDC client''s public key.'
+ '401':
+ description: Unauthorized
+ headers:
+ WWW-AUTHENTICATE:
+ schema:
+ type: string
+ enum:
+ - invalid_token
+ - unknown_error
+ description: 'Bearer error=invalid_token, error_description=MOSIPIDP123: A user info request was made with an access token that was not recognized.'
+ operationId: get-userinfo
+ parameters: []
+ description: |-
+ Once the access token is received via the token endpoint, relying party backend application can call this OIDC compliant endpoint to request for the user claims.
+
+ Consented user claims will be returned as a JWT. This JWT will be a nested JWT which is a signed using JWS and then encrypted using JWE.
+
+
+ **Example**: Assuming the below are the requested claims by the relying party
+
+ name : { "essential" : true }
+
+ phone: { "essential" : true }
+
+ **Response 1**: When consent is provided for both name and phone number:
+
+ { "name" : "John Doe", "phone" : "033456743" }
+
+ **Response 2**: When consent is provided for only name:
+
+ { "name" : "John Doe" }
+
+ **Response 3**: When Claims are requested with claims_locales : "en fr"
+
+ { "name#en" : "John Doe", "name#fr" : "Jean Doe", "phone" : "033456743" }
+
+ **Supported User Info Claims**
+
+
sub - Partner Specific User Token (PSUT)
+
name
+
address
+
gender
+
birthdate
+
profile photo
+
email
+
phone
+
locale
+
Custom - individual_id (You share this claim as a system-level config and it can be UIN, perceptual VID or temporary VID)
+
+ tags:
+ - OIDC
+ security:
+ - Authorization-access_token: []
+ parameters: []
+ /binding/binding-otp:
+ post:
+ summary: Send Binding OTP Endpoint
+ operationId: post-binding-otp
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ responseTIme:
+ type: string
+ response:
+ type: object
+ properties:
+ maskedEmail:
+ type: string
+ description: Masked email id of the individualId user.
+ maskedMobile:
+ type: string
+ description: Masked mobile number of the individualId user.
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ errorCode:
+ type: string
+ enum:
+ - invalid_otp_channel
+ - unknown_error
+ - invalid_individual_id
+ - send_otp_failed
+ errorMessage:
+ type: string
+ required:
+ - responseTIme
+ parameters:
+ - schema:
+ type: string
+ in: header
+ name: partner-api-key
+ description: 'API key of the binding partner, this will be passed to binder implementation to interact with authentication system.'
+ - schema:
+ type: string
+ in: header
+ name: partner-id
+ description: 'Binding partner Identifier, this will be passed to binder implementation to interact with authentication system.'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ requestTime:
+ type: string
+ request:
+ type: object
+ required:
+ - individualId
+ - otpChannels
+ properties:
+ individualId:
+ type: string
+ description: User Id (UIN/VID)
+ otpChannels:
+ type: array
+ description: Channels to which OTP should be delivered.
+ items:
+ type: string
+ required:
+ - requestTime
+ - request
+ description: Send wallet binding OTP endpoint is invoked by Mimoto server.
+ security:
+ - Authorization-send_binding_otp: []
+ tags:
+ - binding-service
+ parameters: []
+ /binding/wallet-binding:
+ post:
+ summary: Wallet Binding Endpoint
+ operationId: post-wallet-binding
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ responseTime:
+ type: string
+ response:
+ type: object
+ properties:
+ walletUserId:
+ type: string
+ description: Unique identifier given to public-key and partner specific userId mapping.
+ certificate:
+ type: string
+ description: Key binder signed certificate.
+ expireDateTime:
+ type: string
+ description: Expire date time of the signed certificate.
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ errorCode:
+ type: string
+ enum:
+ - unsupported_challenge_format
+ - key_binding_failed
+ - invalid_public_key
+ - invalid_auth_challenge
+ - duplicate_public_key
+ errorMessage:
+ type: string
+ required:
+ - responseTime
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ requestTime:
+ type: string
+ request:
+ type: object
+ required:
+ - individualId
+ - authFactorType
+ - format
+ - challengeList
+ - publicKey
+ properties:
+ individualId:
+ type: string
+ description: User Id (UIN/VID).
+ authFactorType:
+ type: string
+ description: Auth factor type to be binded for the provided key.
+ format:
+ type: string
+ description: 'Format of the auth factor type supported in the wallet app.This is not stored, this value is only validated to check if its a supported format in the keybinder implementation.'
+ challengeList:
+ type: array
+ items:
+ $ref: '#/components/schemas/AuthChallenge'
+ publicKey:
+ type: object
+ description: key to be binded in JWK format.
+ required:
+ - requestTime
+ - request
+ description: |-
+ Wallet binding endpoint is invoked by Mimoto server.
+
+ 1. This request is invoked from wallet-app with authChallenge.
+ 2. Integrated keybinder implementation validates the authChallenge.
+ 3. Public key registry is updated with the key binding details for the provided individualId.
+ 4. Binded walletUserId (WUID) is returned with keybinder signed certificate.
+
+ **Note**: Binding entry uniqueness is combination of these 3 values -> (PSUT, public-key, auth-factor-type)
+ parameters:
+ - schema:
+ type: string
+ in: header
+ name: partner-api-key
+ description: 'API key of the Binding partner, this will be passed to binder implementation to interact with authentication system.'
+ - schema:
+ type: string
+ in: header
+ name: partner-id
+ description: 'Binding partner identifier, this will be passed to binder implementation to interact with authentication system.'
+ security:
+ - Authorization-wallet_binding: []
+ tags:
+ - binding-service
+ parameters: []
+ /.well-known/jwks.json:
+ get:
+ summary: JSON Web Key Set Endpoint
+ tags:
+ - OIDC
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ keys:
+ type: array
+ items:
+ type: object
+ properties:
+ kid:
+ type: string
+ description: The certificate's Key ID
+ use:
+ type: string
+ description: 'How the Key is used. Valid value: sig'
+ enum:
+ - sig
+ kty:
+ type: string
+ description: 'Cryptographic algorithm family for the certificate''s Key pair. Valid value: RSA'
+ enum:
+ - RSA
+ e:
+ type: string
+ description: RSA Key value (exponent) for Key blinding
+ 'n':
+ type: string
+ description: RSA modulus value
+ x5t#S256:
+ type: string
+ x-stoplight:
+ id: 52n5251u1kfap
+ description: SHA-256 thumbprint of the certificate.
+ x5c:
+ type: array
+ description: Certificate to validate the Oauth server trust.
+ items:
+ x-stoplight:
+ id: l0l1kpf2b9jcn
+ type: string
+ exp:
+ type: string
+ x-stoplight:
+ id: q4o4nzqtvb09p
+ description: Expire datetime of the key. Given in ISO format.
+ format: date-time
+ example: '2026-02-05T13:43:07.979Z'
+ required:
+ - kid
+ - use
+ - kty
+ - e
+ - 'n'
+ - x5t#S256
+ - x5c
+ - exp
+ operationId: get-certs
+ description: Endpoint to fetch all the public keys of the e-Signet server. Returns public key set in the JWKS format.
+ parameters: []
+ /.well-known/openid-configuration:
+ get:
+ summary: Configuration Endpoint
+ tags:
+ - OIDC
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ issuer:
+ type: string
+ description: URL using the https scheme with no query or fragment component that the RP asserts as its Issuer Identifier. This also MUST be identical to the iss Claim value in ID Tokens issued from this Issuer.
+ authorization_endpoint:
+ type: string
+ description: URL of the OAuth 2.0 Authorization Endpoint.
+ token_endpoint:
+ type: string
+ description: URL of the OAuth 2.0 Token Endpoint.
+ userinfo_endpoint:
+ type: string
+ description: URL of the OP's UserInfo Endpoint.
+ jwks_uri:
+ type: string
+ description: 'URL of the OP''s JSON Web Key Set [JWK] document.'
+ registration_endpoint:
+ type: string
+ description: URL of Client Registration Endpoint.
+ scopes_supported:
+ type: array
+ description: 'JSON array containing a list of the OAuth 2.0 [RFC6749] scope values that this server supports.'
+ enum:
+ - openid
+ items: {}
+ response_types_supported:
+ type: array
+ description: JSON array containing a list of the OAuth 2.0 response_type values that this OP supports.
+ enum:
+ - code
+ items: {}
+ acr_values_supported:
+ type: array
+ description: JSON array containing a list of the Authentication Context Class References that IDP supports.
+ items: {}
+ userinfo_signing_alg_values_supported:
+ type: array
+ description: 'JSON array containing a list of the JWS [JWS] signing algorithms.'
+ items: {}
+ userinfo_encryption_alg_values_supported:
+ type: array
+ description: 'JSON array containing a list of the JWE [JWE] encryption algorithms.'
+ items: {}
+ userinfo_encryption_enc_values_supported:
+ type: array
+ description: 'JSON array containing a list of the JWE encryption algorithms (enc values) [JWA] supported by the UserInfo Endpoint to encode the Claims in a JWT.'
+ items: {}
+ token_endpoint_auth_methods_supported:
+ type: array
+ description: JSON array containing a list of Client Authentication methods supported by this Token Endpoint.
+ enum:
+ - private_key_jwt
+ items: {}
+ display_values_supported:
+ type: array
+ description: JSON array containing a list of the display parameter values that the OpenID Provider supports.
+ items: {}
+ claim_types_supported:
+ type: array
+ description: JSON array containing a list of the Claim Types that the OpenID Provider supports.
+ enum:
+ - normal
+ - aggregated
+ - distributed
+ items: {}
+ claims_supported:
+ type: array
+ description: JSON array containing a list of the Claim Names of the Claims that the OpenID Provider MAY be able to supply values for.
+ items:
+ type: string
+ claims_locales_supported:
+ type: array
+ description: Languages and scripts supported for values in Claims being returned.
+ items:
+ type: string
+ ui_locales_supported:
+ type: array
+ description: Languages and scripts supported for the user interface.
+ items:
+ type: string
+ response_modes_supported:
+ type: array
+ description: Mechanism to be used for returning parameters from the Authorization Endpoint.
+ items:
+ type: string
+ enum:
+ - query
+ token_endpoint_auth_signing_alg_values_supported:
+ type: array
+ items:
+ type: string
+ enum:
+ - RS256
+ id_token_signing_alg_values_supported:
+ type: array
+ items:
+ type: string
+ enum:
+ - RS256
+ required:
+ - issuer
+ - authorization_endpoint
+ - token_endpoint
+ - userinfo_endpoint
+ - jwks_uri
+ - registration_endpoint
+ - scopes_supported
+ - response_types_supported
+ operationId: get-.well-known-openid-configuration
+ description: |-
+ Open ID Connect dynamic provider discovery is not supported currently, this endpoint is only for facilitating the OIDC provider details in a standard way.
+
+ **Reference**: https://openid.net/specs/openid-connect-discovery-1_0.html
+ parameters: []
+ /oauth/introspect:
+ get:
+ summary: Introspect Endpoint (Draft)
+ tags:
+ - OIDC
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ active:
+ type: boolean
+ '401':
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error:
+ type: string
+ error_description:
+ type: string
+ required:
+ - error
+ - error_description
+ operationId: get-introspect
+ description: |-
+ This endpoint takes an access token or ID token and returns a boolean that indicates whether it is active. If the token is active, additional data about the token is also returned. If the token is invalid, expired, or revoked, it is considered inactive.
+
+ **Reference**: https://www.rfc-editor.org/rfc/rfc7662.html
+ parameters:
+ - schema:
+ type: string
+ in: query
+ name: token
+ description: An access token or ID token
+ required: true
+ - schema:
+ type: string
+ enum:
+ - access_token
+ - id_token
+ in: query
+ name: token_type_hint
+ description: 'Indicates the type of token being passed. Valid values: access_token, id_token'
+ required: true
+ security:
+ - Authorization-Bearer: []
+ parameters: []
+components:
+ schemas:
+ Claim:
+ title: Claim
+ x-stoplight:
+ id: z7c32949w8qet
+ type: object
+ description: |
+ The userinfo and id_token members of the claims request both are JSON object. if null, Indicates that this Claim is being requested as Voluntary Claim.
+
+ Note: Unknown claim names either in userinfo or id_token are ignored.
+ properties:
+ userinfo:
+ type: object
+ properties:
+ name:
+ $ref: '#/components/schemas/ClaimDetail'
+ given_name:
+ $ref: '#/components/schemas/ClaimDetail'
+ email:
+ $ref: '#/components/schemas/ClaimDetail'
+ gender:
+ $ref: '#/components/schemas/ClaimDetail'
+ birthdate:
+ $ref: '#/components/schemas/ClaimDetail'
+ phone_number:
+ $ref: '#/components/schemas/ClaimDetail'
+ profile_photo:
+ $ref: '#/components/schemas/ClaimDetail'
+ address:
+ $ref: '#/components/schemas/ClaimDetail'
+ locale:
+ $ref: '#/components/schemas/ClaimDetail'
+ individual_id:
+ $ref: '#/components/schemas/ClaimDetail'
+ id_token:
+ type: object
+ properties:
+ name:
+ $ref: '#/components/schemas/ClaimDetail'
+ acrs:
+ $ref: '#/components/schemas/ClaimDetail'
+ locales:
+ type: array
+ items:
+ type: string
+ ClaimDetail:
+ title: ClaimDetail
+ x-stoplight:
+ id: kypheo15jidj9
+ type: object
+ properties:
+ essential:
+ type: boolean
+ description: |
+ Indicates whether the Claim being requested is an Essential Claim. If the value is true, this indicates that the Claim is an Essential Claim. The default is false.
+ value:
+ type: string
+ description: |-
+ Requests that the Claim be returned with a particular value. For instance the Claim request.
+
+ "sub": {"value": "248289761001"} can be used to specify that the request apply to the End-User with Subject Identifier 248289761001.
+ values:
+ type: array
+ description: 'Requests that the Claim be returned with one of a set of values, with the values appearing in order of preference.'
+ items:
+ type: string
+ AuthChallenge:
+ title: AuthChallenge
+ x-stoplight:
+ id: n3fy2qkg9r7h2
+ type: object
+ description: Model to take any type of challenge from the end user as part of authenticate request.
+ properties:
+ authFactorType:
+ type: string
+ description: Defines the type of auth challenge. It should be same as authfactor.type (oauth-details response).
+ enum:
+ - OTP
+ - BIO
+ - PIN
+ - WLA
+ challenge:
+ type: string
+ description: Actual challenge as string.
+ format:
+ type: string
+ description: Format of the challenge provided.
+ enum:
+ - alpha-numeric
+ - jwt
+ - encoded-json
+ - number
+ required:
+ - authFactorType
+ - challenge
+ - format
+ AuthFactor:
+ title: AuthFactor
+ x-stoplight:
+ id: m6lnp87wondln
+ type: object
+ properties:
+ type:
+ type: string
+ description: Name of the authentication method
+ enum:
+ - PIN
+ - OTP
+ - L1-bio-device
+ - Wallet
+ count:
+ type: integer
+ description: 'Applicable for biometric based authentication, number of bio segments to be captured for authentication.'
+ bioSubTypes:
+ type: array
+ description: Applicable for biometric based authentication. Can be more specific about which bio segments should be captured.
+ items:
+ type: string
+ required:
+ - type
+ securitySchemes:
+ Authorization-Bearer:
+ type: http
+ scheme: bearer
+ Authorization-add_oidc_client:
+ type: http
+ scheme: bearer
+ description: Valid JWT issued by a trusted IAM system with "**add_oidc_client**" scope.
+ Authorization-update_oidc_client:
+ type: http
+ scheme: bearer
+ description: Valid JWT issued by a trusted IAM system including "**update_oidc_client**" scope.
+ Authorization-access_token:
+ type: http
+ scheme: bearer
+ description: Access token received from /token endpoint
+ Authorization-send_binding_otp:
+ type: http
+ scheme: bearer
+ description: Valid JWT issued by a trusted IAM system with "send_binding_otp" scope.
+ Authorization-wallet_binding:
+ type: http
+ scheme: bearer
+ description: Valid JWT issued by a trusted IAM system with "**wallet_binding**" scope.
+tags:
+ - name: Management
+ description: Management level API's used for internal use.
+ - name: OIDC
+ description: API's that are supposed to be compliant to OIDC.
+ - name: UI
+ description: UI related API.
diff --git a/esignet-core/pom.xml b/esignet-core/pom.xml
index 1433838f7..413ee5534 100644
--- a/esignet-core/pom.xml
+++ b/esignet-core/pom.xml
@@ -9,7 +9,7 @@
io.mosip.esignetesignet-parent
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOTio.mosip.esignet
@@ -25,7 +25,7 @@
2.12.02.12.02.12.0
- 1.2.1-SNAPSHOT
+ 1.2.0.1-B23.27.0-GA4.13.22.22.0
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/constants/ErrorConstants.java b/esignet-core/src/main/java/io/mosip/esignet/core/constants/ErrorConstants.java
index c964c34eb..af25fbff1 100644
--- a/esignet-core/src/main/java/io/mosip/esignet/core/constants/ErrorConstants.java
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/constants/ErrorConstants.java
@@ -65,4 +65,6 @@ public class ErrorConstants {
public static final String FAILED_TO_GENERATE_HEADER_HASH = "failed_to_generate_header_hash";
public static final String FAILED_TO_VALIDATE_CAPTCHA = "failed_to_validate_captcha";
public static final String INVALID_CAPTCHA = "invalid_captcha";
+ public static final String INVALID_AUTH_FACTOR_TYPE_OR_CHALLENGE_FORMAT = "invalid_auth_factor_type_or_challenge_format";
+
}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/dto/AuthResponseV2.java b/esignet-core/src/main/java/io/mosip/esignet/core/dto/AuthResponseV2.java
new file mode 100644
index 000000000..8983230a6
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/dto/AuthResponseV2.java
@@ -0,0 +1,16 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.core.dto;
+
+import io.mosip.esignet.api.util.ConsentAction;
+import lombok.Data;
+
+@Data
+public class AuthResponseV2 {
+
+ private String transactionId;
+ private ConsentAction consentAction;
+}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/dto/ConsentDetail.java b/esignet-core/src/main/java/io/mosip/esignet/core/dto/ConsentDetail.java
new file mode 100644
index 000000000..4752b0b51
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/dto/ConsentDetail.java
@@ -0,0 +1,29 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.core.dto;
+
+import io.mosip.esignet.api.dto.Claims;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+@Data
+public class ConsentDetail {
+ private UUID id;
+ private String clientId;
+ private String psuToken;
+ private Claims claims;
+ Map authorizationScopes;
+ private LocalDateTime createdtimes;
+ private LocalDateTime expiredtimes;
+ private String signature;
+ private String hash;
+ private List acceptedClaims;
+ private List permittedScopes;
+}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/dto/LinkedConsentRequestV2.java b/esignet-core/src/main/java/io/mosip/esignet/core/dto/LinkedConsentRequestV2.java
new file mode 100644
index 000000000..bc3d66960
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/dto/LinkedConsentRequestV2.java
@@ -0,0 +1,31 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.core.dto;
+
+import io.mosip.esignet.core.constants.ErrorConstants;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.util.List;
+
+@Data
+public class LinkedConsentRequestV2 {
+
+ @NotBlank(message = ErrorConstants.INVALID_TRANSACTION_ID)
+ private String linkedTransactionId;
+
+ /**
+ * List of accepted claim names by end-user
+ */
+ private List acceptedClaims;
+
+ /**
+ * List of permitted authorize scopes
+ */
+ private List permittedAuthorizeScopes;
+
+ private String signature;
+}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/dto/LinkedKycAuthResponseV2.java b/esignet-core/src/main/java/io/mosip/esignet/core/dto/LinkedKycAuthResponseV2.java
new file mode 100644
index 000000000..436734f84
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/dto/LinkedKycAuthResponseV2.java
@@ -0,0 +1,15 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.core.dto;
+
+import io.mosip.esignet.api.util.ConsentAction;
+import lombok.Data;
+
+@Data
+public class LinkedKycAuthResponseV2 {
+ private String linkedTransactionId;
+ private ConsentAction consentAction;
+}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/dto/OIDCTransaction.java b/esignet-core/src/main/java/io/mosip/esignet/core/dto/OIDCTransaction.java
index 9b9a8ab4b..07e71a30d 100644
--- a/esignet-core/src/main/java/io/mosip/esignet/core/dto/OIDCTransaction.java
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/dto/OIDCTransaction.java
@@ -6,6 +6,7 @@
package io.mosip.esignet.core.dto;
import io.mosip.esignet.api.dto.Claims;
+import io.mosip.esignet.api.util.ConsentAction;
import io.mosip.esignet.core.util.LinkCodeQueue;
import lombok.Data;
@@ -16,10 +17,14 @@
@Data
public class OIDCTransaction implements Serializable {
+ String transactionId;
+
String clientId;
String relyingPartyId;
String redirectUri;
Claims requestedClaims;
+ List essentialClaims;
+ List voluntaryClaims;
List requestedAuthorizeScopes;
String[] claimsLocales;
String authTransactionId;
@@ -47,4 +52,5 @@ public class OIDCTransaction implements Serializable {
String individualId;
String oauthDetailsHash;
+ ConsentAction consentAction;
}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/dto/PublicKeyRegistry.java b/esignet-core/src/main/java/io/mosip/esignet/core/dto/PublicKeyRegistry.java
new file mode 100644
index 000000000..99ccfe159
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/dto/PublicKeyRegistry.java
@@ -0,0 +1,19 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.core.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class PublicKeyRegistry {
+ private String authFactor;
+ private String psuToken;
+ private String publicKey;
+}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/dto/UserConsent.java b/esignet-core/src/main/java/io/mosip/esignet/core/dto/UserConsent.java
new file mode 100644
index 000000000..558051b84
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/dto/UserConsent.java
@@ -0,0 +1,21 @@
+package io.mosip.esignet.core.dto;
+
+import io.mosip.esignet.api.dto.Claims;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class UserConsent {
+ String psuToken;
+ String clientId;
+ Claims Claims;
+ Map authorizationScopes;
+ LocalDateTime expirydtimes;
+ String signature;
+ String hash;
+ List acceptedClaims;
+ List permittedScopes;
+}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/dto/UserConsentRequest.java b/esignet-core/src/main/java/io/mosip/esignet/core/dto/UserConsentRequest.java
new file mode 100644
index 000000000..0cc018f09
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/dto/UserConsentRequest.java
@@ -0,0 +1,9 @@
+package io.mosip.esignet.core.dto;
+
+import lombok.Data;
+
+@Data
+public class UserConsentRequest {
+ String psuToken;
+ String clientId;
+}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/spi/AuthorizationService.java b/esignet-core/src/main/java/io/mosip/esignet/core/spi/AuthorizationService.java
index 1a8f6c980..46269a926 100644
--- a/esignet-core/src/main/java/io/mosip/esignet/core/spi/AuthorizationService.java
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/spi/AuthorizationService.java
@@ -7,7 +7,6 @@
import io.mosip.esignet.core.dto.*;
import io.mosip.esignet.core.exception.EsignetException;
-import io.mosip.esignet.core.dto.*;
public interface AuthorizationService {
@@ -33,6 +32,13 @@ public interface AuthorizationService {
*/
AuthResponse authenticateUser(AuthRequest authRequest) throws EsignetException;
+ /**
+ * Authentication request for the required auth-factors
+ * @param authRequest
+ * @return
+ */
+ AuthResponseV2 authenticateUserV2(AuthRequest authRequest) throws EsignetException;
+
/**
* Accepted claims are verified and KYC exchange is performed
* Redirects to requested redirect_uri
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/spi/ConsentService.java b/esignet-core/src/main/java/io/mosip/esignet/core/spi/ConsentService.java
new file mode 100644
index 000000000..029ed6a49
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/spi/ConsentService.java
@@ -0,0 +1,34 @@
+package io.mosip.esignet.core.spi;
+
+import io.mosip.esignet.core.dto.ConsentDetail;
+import io.mosip.esignet.core.dto.UserConsent;
+import io.mosip.esignet.core.dto.UserConsentRequest;
+import io.mosip.esignet.core.exception.EsignetException;
+
+import java.util.Optional;
+
+public interface ConsentService {
+ /**
+ * Api to get Latest User consent data from consent registry.
+ *
+ * @param userConsentRequest Consent Request object containing client_id and psu_token
+ * @return the Consent wrapped in an {@link Optional}
+ */
+ Optional getUserConsent(UserConsentRequest userConsentRequest);
+
+ /**
+ * Api to Add User Consent data in Consent Registry
+ *
+ * @param userConsent consentRequest Object
+ * @return {@link ConsentDetail} Consent Response Object after saving the consent to registry.
+ *
+ */
+ ConsentDetail saveUserConsent(UserConsent userConsent) throws EsignetException;
+
+ /**
+ * Api to delete user consent from Consent Registry
+ * @param psuToken
+ * @param clientId
+ */
+ void deleteUserConsent(String clientId, String psuToken);
+}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/spi/LinkedAuthorizationService.java b/esignet-core/src/main/java/io/mosip/esignet/core/spi/LinkedAuthorizationService.java
index ecfa72a6e..9ffaae048 100644
--- a/esignet-core/src/main/java/io/mosip/esignet/core/spi/LinkedAuthorizationService.java
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/spi/LinkedAuthorizationService.java
@@ -7,7 +7,6 @@
import io.mosip.esignet.core.dto.*;
import io.mosip.esignet.core.exception.EsignetException;
-import io.mosip.esignet.core.dto.*;
import org.springframework.web.context.request.async.DeferredResult;
public interface LinkedAuthorizationService {
@@ -55,6 +54,13 @@ public interface LinkedAuthorizationService {
*/
LinkedKycAuthResponse authenticateUser(LinkedKycAuthRequest linkedKycAuthRequest) throws EsignetException;
+ /**
+ * Authentication request for the required auth-factors
+ * @param linkedKycAuthRequest
+ * @return
+ */
+ LinkedKycAuthResponseV2 authenticateUserV2(LinkedKycAuthRequest linkedKycAuthRequest) throws EsignetException;
+
/**
* Accepted claims are verified and KYC exchange is performed
* Redirects to requested redirect_uri
@@ -62,4 +68,11 @@ public interface LinkedAuthorizationService {
*/
LinkedConsentResponse saveConsent(LinkedConsentRequest linkedConsentRequest) throws EsignetException;
+ /**
+ * Accepted claims are verified and KYC exchange is performed
+ * Redirects to requested redirect_uri
+ * @param linkedConsentRequest
+ */
+ LinkedConsentResponse saveConsentV2(LinkedConsentRequestV2 linkedConsentRequest) throws EsignetException;
+
}
diff --git a/esignet-core/src/main/java/io/mosip/esignet/core/spi/PublicKeyRegistryService.java b/esignet-core/src/main/java/io/mosip/esignet/core/spi/PublicKeyRegistryService.java
new file mode 100644
index 000000000..997e1f4c2
--- /dev/null
+++ b/esignet-core/src/main/java/io/mosip/esignet/core/spi/PublicKeyRegistryService.java
@@ -0,0 +1,16 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.esignet.core.spi;
+
+import io.mosip.esignet.core.dto.PublicKeyRegistry;
+
+import java.util.Optional;
+
+public interface PublicKeyRegistryService {
+
+ Optional findLatestPublicKeyByPsuTokenAndAuthFactor(String psuToken, String authFactor);
+
+}
diff --git a/esignet-integration-api/pom.xml b/esignet-integration-api/pom.xml
index 15d783be9..30a9104ec 100644
--- a/esignet-integration-api/pom.xml
+++ b/esignet-integration-api/pom.xml
@@ -6,12 +6,12 @@
io.mosip.esignetesignet-parent
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOTio.mosip.esignetesignet-integration-api
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOTesignet-integration-apie-Signet integration Library
diff --git a/esignet-integration-api/src/main/java/io/mosip/esignet/api/util/Action.java b/esignet-integration-api/src/main/java/io/mosip/esignet/api/util/Action.java
index 3f7c70172..1ca13f461 100644
--- a/esignet-integration-api/src/main/java/io/mosip/esignet/api/util/Action.java
+++ b/esignet-integration-api/src/main/java/io/mosip/esignet/api/util/Action.java
@@ -20,5 +20,9 @@ public enum Action {
LINK_AUTHENTICATE,
SAVE_CONSENT,
LINK_SEND_OTP,
- LINK_AUTH_CODE
+ LINK_AUTH_CODE,
+ GET_USER_CONSENT,
+ SAVE_USER_CONSENT,
+ UPDATE_USER_CONSENT,
+ DELETE_USER_CONSENT
}
diff --git a/esignet-integration-api/src/main/java/io/mosip/esignet/api/util/ConsentAction.java b/esignet-integration-api/src/main/java/io/mosip/esignet/api/util/ConsentAction.java
new file mode 100644
index 000000000..45869719d
--- /dev/null
+++ b/esignet-integration-api/src/main/java/io/mosip/esignet/api/util/ConsentAction.java
@@ -0,0 +1,6 @@
+package io.mosip.esignet.api.util;
+
+public enum ConsentAction {
+ CAPTURE,
+ NOCAPTURE,
+}
diff --git a/esignet-service/pom.xml b/esignet-service/pom.xml
index 88cad077e..e0c1744b4 100644
--- a/esignet-service/pom.xml
+++ b/esignet-service/pom.xml
@@ -8,12 +8,12 @@
io.mosip.esignetesignet-parent
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOTio.mosip.esignetesignet-service
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOTesignet-servicee-Signet OIDC Service
@@ -66,6 +66,11 @@
binding-service-impl${project.version}
+
+ io.mosip.esignet
+ consent-service-impl
+ ${project.version}
+
diff --git a/esignet-service/src/main/java/io/mosip/esignet/controllers/AuthorizationController.java b/esignet-service/src/main/java/io/mosip/esignet/controllers/AuthorizationController.java
index 59ff4bb9d..24f2cbcaa 100644
--- a/esignet-service/src/main/java/io/mosip/esignet/controllers/AuthorizationController.java
+++ b/esignet-service/src/main/java/io/mosip/esignet/controllers/AuthorizationController.java
@@ -85,4 +85,19 @@ public ResponseWrapper getAuthorizationCode(@Valid @RequestBod
}
return responseWrapper;
}
+
+ @PostMapping("/v2/authenticate")
+ public ResponseWrapper authenticateEndUserV2(@Valid @RequestBody RequestWrapper
+ requestWrapper) throws EsignetException {
+ ResponseWrapper responseWrapper = new ResponseWrapper<>();
+ responseWrapper.setResponseTime(IdentityProviderUtil.getUTCDateTime());
+ try {
+ AuthResponseV2 authResponse = authorizationService.authenticateUserV2(requestWrapper.getRequest());
+ responseWrapper.setResponse(authResponse);
+ } catch (EsignetException ex) {
+ auditWrapper.logAudit(Action.AUTHENTICATE, ActionStatus.ERROR, AuditHelper.buildAuditDto(requestWrapper.getRequest().getTransactionId(), null), ex);
+ throw ex;
+ }
+ return responseWrapper;
+ }
}
diff --git a/esignet-service/src/main/java/io/mosip/esignet/controllers/LinkedAuthorizationController.java b/esignet-service/src/main/java/io/mosip/esignet/controllers/LinkedAuthorizationController.java
index 398af0eb0..680ff3710 100644
--- a/esignet-service/src/main/java/io/mosip/esignet/controllers/LinkedAuthorizationController.java
+++ b/esignet-service/src/main/java/io/mosip/esignet/controllers/LinkedAuthorizationController.java
@@ -107,6 +107,20 @@ public ResponseWrapper authenticate(@Valid @RequestBody R
return responseWrapper;
}
+ @PostMapping("/v2/authenticate")
+ public ResponseWrapper authenticateV2(@Valid @RequestBody RequestWrapper
+ requestWrapper) throws EsignetException {
+ ResponseWrapper responseWrapper = new ResponseWrapper();
+ responseWrapper.setResponseTime(IdentityProviderUtil.getUTCDateTime());
+ try {
+ responseWrapper.setResponse(linkedAuthorizationService.authenticateUserV2(requestWrapper.getRequest()));
+ } catch (EsignetException ex) {
+ auditWrapper.logAudit(Action.LINK_AUTHENTICATE, ActionStatus.ERROR, AuditHelper.buildAuditDto(requestWrapper.getRequest().getLinkedTransactionId(), null), ex);
+ throw ex;
+ }
+ return responseWrapper;
+ }
+
@PostMapping("/consent")
public ResponseWrapper saveConsent(@Valid @RequestBody RequestWrapper
requestWrapper) throws EsignetException {
@@ -121,6 +135,20 @@ public ResponseWrapper saveConsent(@Valid @RequestBody Re
return responseWrapper;
}
+ @PostMapping("/v2/consent")
+ public ResponseWrapper saveConsentV2(@Valid @RequestBody RequestWrapper
+ requestWrapper) throws EsignetException {
+ ResponseWrapper responseWrapper = new ResponseWrapper();
+ responseWrapper.setResponseTime(IdentityProviderUtil.getUTCDateTime());
+ try {
+ responseWrapper.setResponse(linkedAuthorizationService.saveConsentV2(requestWrapper.getRequest()));
+ } catch (EsignetException ex) {
+ auditWrapper.logAudit(Action.SAVE_CONSENT, ActionStatus.ERROR, AuditHelper.buildAuditDto(requestWrapper.getRequest().getLinkedTransactionId(), null), ex);
+ throw ex;
+ }
+ return responseWrapper;
+ }
+
@PostMapping("/send-otp")
public ResponseWrapper sendOtp(@Valid @RequestBody RequestWrapper
requestWrapper) throws EsignetException {
diff --git a/esignet-service/src/main/resources/application-local.properties b/esignet-service/src/main/resources/application-local.properties
index ce5208ad7..9e91ab7a4 100644
--- a/esignet-service/src/main/resources/application-local.properties
+++ b/esignet-service/src/main/resources/application-local.properties
@@ -10,6 +10,7 @@ mosip.esignet.supported-id-regex=\\S*
mosip.esignet.id-token-expire-seconds=3600
mosip.esignet.access-token.expire.seconds=3600
mosip.esignet.link-code-expire-in-secs=60
+mosip.esignet.authentication-expire-in-secs=60
mosip.esignet.header-filter.paths-to-validate={'${server.servlet.path}/authorization/send-otp', \
'${server.servlet.path}/authorization/authenticate', \
@@ -135,10 +136,9 @@ spring.cache.type=simple
mosip.esignet.cache.key.hash.algorithm=SHA3-256
mosip.esignet.cache.size={'clientdetails' : 200, 'preauth': 200, 'authenticated': 200, 'authcodegenerated': 200, 'userinfo': 200, \
'linkcodegenerated' : 500, 'linked': 200 , 'linkedcode': 200, 'linkedauth' : 200 , 'consented' :200 }
-mosip.esignet.cache.expire-in-seconds={'clientdetails' : 86400, 'preauth': 180, 'authenticated': 120, 'authcodegenerated': 60, \
- 'userinfo': ${mosip.esignet.access-token.expire.seconds}, 'linkcodegenerated' : ${mosip.esignet.link-code-expire-in-secs}, \
- 'linked': 60 , 'linkedcode': ${mosip.esignet.link-code-expire-in-secs}, 'linkedauth' : 60, 'consented': 120 }
-
+mosip.esignet.cache.expire-in-seconds={'clientdetails' : 86400, 'preauth': 180, 'authenticated': ${mosip.esignet.authentication-expire-in-secs}, \
+ 'authcodegenerated': 60, 'userinfo': ${mosip.esignet.access-token.expire.seconds}, 'linkcodegenerated' : ${mosip.esignet.link-code-expire-in-secs}, \
+ 'linked': 60 , 'linkedcode': ${mosip.esignet.link-code-expire-in-secs}, 'linkedauth' : ${mosip.esignet.authentication-expire-in-secs}, 'consented': 120 }
## ------------------------------------------ Discovery openid-configuration -------------------------------------------
mosip.esignet.discovery.issuer-id=${mosipbox.public.url}${server.servlet.path}
@@ -235,4 +235,11 @@ crypto.PrependThumbprint.enable=true
mosip.esignet.ui.config.key-values={'sbi.env': 'Developer', 'sbi.timeout.DISC': 30, \
'sbi.timeout.DINFO': 30, 'sbi.timeout.CAPTURE': 30, 'sbi.capture.count.face': 1, 'sbi.capture.count.finger': 2, \
- 'sbi.capture.count.iris': 1, 'sbi.capture.score.face': 70, 'sbi.capture.score.finger':70, 'sbi.capture.score.iris':70 }
+ 'sbi.capture.count.iris': 1, 'sbi.capture.score.face': 70, 'sbi.capture.score.finger':70, 'sbi.capture.score.iris':70, 'wallet.logo-url': 'inji_logo.png', \
+ 'send.otp.channels':'email,phone', 'consent.screen.timeout-in-secs':${mosip.esignet.authentication-expire-in-secs}, \
+ 'consent.screen.timeout-buffer-in-secs': 5, 'sbi.port.range': 4501-4600, 'sbi.bio.subtypes.iris': 'UNKNOWN', 'sbi.bio.subtypes.finger': 'UNKNOWN', \
+ 'resend.otp.delay.secs': 120, 'captcha.enable': 'OTP', 'captcha.sitekey': '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', \
+ 'mosip.esignet.link-auth-code-expire-in-secs': 120, 'mosip.esignet.link-status-deferred-response-timeout-secs': 25, \
+ 'mosip.esignet.qr-code.deep-link-uri': 'inji://landing-page-name?linkCode=LINK_CODE&linkExpireDateTime=LINK_EXPIRE_DT', \
+ 'mosip.esignet.qr-code.download-uri': '#', 'mosip.esignet.qr-code.enable': 'true', 'auth.txnid.length': 10, \
+ 'otp.length': 6, 'password.regex': ''}
\ No newline at end of file
diff --git a/esignet-service/src/main/resources/messages.properties b/esignet-service/src/main/resources/messages.properties
index 3cda29a76..e323ad31a 100644
--- a/esignet-service/src/main/resources/messages.properties
+++ b/esignet-service/src/main/resources/messages.properties
@@ -67,3 +67,4 @@ binding_auth_failed=Key bound authentication (linked-wallet) failed.
captcha_validator_not_found=Failed to find captcha validator instance, Please check classpath.
invalid_captcha=Invalid captcha found.
invalid_bind_auth_factor_type=Invalid bind auth factor type.
+invalid_auth_factor_type_or_challenge_format=Invalid auth factor type or challenge format.
diff --git a/esignet-service/src/test/java/io/mosip/esignet/controllers/AuthorizationControllerTest.java b/esignet-service/src/test/java/io/mosip/esignet/controllers/AuthorizationControllerTest.java
index 29d98e245..cc39be3c4 100644
--- a/esignet-service/src/test/java/io/mosip/esignet/controllers/AuthorizationControllerTest.java
+++ b/esignet-service/src/test/java/io/mosip/esignet/controllers/AuthorizationControllerTest.java
@@ -6,19 +6,20 @@
package io.mosip.esignet.controllers;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.mosip.esignet.api.dto.AuthChallenge;
import io.mosip.esignet.api.spi.AuditPlugin;
-import io.mosip.esignet.core.dto.OAuthDetailRequest;
-import io.mosip.esignet.core.dto.OAuthDetailResponse;
-import io.mosip.esignet.core.dto.RequestWrapper;
+import io.mosip.esignet.core.dto.*;
import io.mosip.esignet.core.exception.EsignetException;
import io.mosip.esignet.core.spi.AuthorizationService;
import io.mosip.esignet.core.util.AuthenticationContextClassRefUtil;
import io.mosip.esignet.core.constants.ErrorConstants;
+import io.mosip.esignet.core.util.IdentityProviderUtil;
import io.mosip.esignet.services.AuthorizationHelperService;
import io.mosip.esignet.services.CacheUtilService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
@@ -29,7 +30,9 @@
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import static io.mosip.esignet.core.constants.Constants.UTC_DATETIME_PATTERN;
import static org.mockito.Mockito.when;
@@ -351,4 +354,113 @@ public void getOauthDetails_withAuthorizeAndOpenIdScope_returnSuccessResponse()
.andExpect(status().isOk())
.andExpect(jsonPath("$.response.transactionId").value("qwertyId"));
}
+
+ @Test
+ public void authenticateEndUser_withValidDetails_returnSuccessResponse() throws Exception {
+ AuthRequest authRequest = new AuthRequest();
+ authRequest.setIndividualId("1234567890");
+ authRequest.setTransactionId("quewertyId");
+
+ AuthChallenge authChallenge = new AuthChallenge();
+ authChallenge.setChallenge("12345");
+ authChallenge.setAuthFactorType("OTP");
+ authChallenge.setFormat("numeric");
+
+ List authChallengeList = new ArrayList<>();
+ authChallengeList.add(authChallenge);
+ authRequest.setChallengeList(authChallengeList);
+
+ RequestWrapper wrapper = new RequestWrapper<>();
+ wrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ wrapper.setRequest(authRequest);
+
+ AuthResponseV2 authResponseV2 = new AuthResponseV2();
+ authResponseV2.setTransactionId("quewertyId");
+ when(authorizationService.authenticateUserV2(authRequest)).thenReturn(authResponseV2);
+ mockMvc.perform(post("/authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(wrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.response.transactionId").value("quewertyId"));
+ }
+
+ @Test
+ public void authenticateEndUser_withInvalidTimestamp_returnErrorResponse() throws Exception {
+ AuthRequest authRequest = new AuthRequest();
+ authRequest.setIndividualId("1234567890");
+ authRequest.setTransactionId("1234567890");
+
+ AuthChallenge authChallenge = new AuthChallenge();
+ authChallenge.setChallenge("1234567890");
+ authChallenge.setAuthFactorType("OTP");
+ authChallenge.setFormat("alpha-numeric");
+
+ List authChallengeList = new ArrayList<>();
+ authChallengeList.add(authChallenge);
+
+ authRequest.setChallengeList(authChallengeList);
+
+ ZonedDateTime requestTime = ZonedDateTime.now(ZoneOffset.UTC);
+ requestTime = requestTime.plusMinutes(10);
+
+ RequestWrapper wrapper = new RequestWrapper<>();
+ wrapper.setRequestTime(requestTime.format(DateTimeFormatter.ofPattern(UTC_DATETIME_PATTERN)));
+ wrapper.setRequest(authRequest);
+ when(authorizationService.authenticateUserV2(authRequest)).thenReturn(new AuthResponseV2());
+ mockMvc.perform(post("/authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(wrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty())
+ .andExpect(jsonPath("$.errors[0].errorCode").value(ErrorConstants.INVALID_REQUEST))
+ .andExpect(jsonPath("$.errors[0].errorMessage").value("requestTime: invalid_request"));
+ }
+
+ @Test
+ public void authenticateEndUser_withInvalidTransectionId_returnErrorResponse() throws Exception {
+ AuthRequest authRequest = new AuthRequest();
+ authRequest.setIndividualId("1234567890");
+
+ AuthChallenge authChallenge = new AuthChallenge();
+ authChallenge.setChallenge("1234567890");
+ authChallenge.setAuthFactorType("PWD");
+ authChallenge.setFormat("alpha-numeric");
+
+ List authChallengeList = new ArrayList<>();
+ authChallengeList.add(authChallenge);
+ authRequest.setChallengeList(authChallengeList);
+
+ RequestWrapper wrapper = new RequestWrapper<>();
+ wrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ wrapper.setRequest(authRequest);
+
+
+ mockMvc.perform(post("/authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(wrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty())
+ .andExpect(jsonPath("$.errors[0].errorCode").value(ErrorConstants.INVALID_TRANSACTION_ID))
+ .andExpect(jsonPath("$.errors[0].errorMessage").value("request.transactionId: invalid_transaction_id"));
+ }
+
+ @Test
+ public void authenticateEndUser_withInvalidAuthChallenge_returnErrorResponse() throws Exception {
+ AuthRequest authRequest = new AuthRequest();
+ authRequest.setIndividualId("1234567890");
+ authRequest.setTransactionId("1234567890");
+
+
+ RequestWrapper wrapper = new RequestWrapper<>();
+ wrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ wrapper.setRequest(authRequest);
+
+ mockMvc.perform(post("/authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(wrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty())
+ .andExpect(jsonPath("$.errors[0].errorCode").value(ErrorConstants.INVALID_CHALLENGE_LIST))
+ .andExpect(jsonPath("$.errors[0].errorMessage").value("request.challengeList: invalid_no_of_challenges"));
+ }
}
diff --git a/esignet-service/src/test/java/io/mosip/esignet/controllers/LinkedAuthorizationControllerTest.java b/esignet-service/src/test/java/io/mosip/esignet/controllers/LinkedAuthorizationControllerTest.java
index 9311350f3..f22c8fad8 100644
--- a/esignet-service/src/test/java/io/mosip/esignet/controllers/LinkedAuthorizationControllerTest.java
+++ b/esignet-service/src/test/java/io/mosip/esignet/controllers/LinkedAuthorizationControllerTest.java
@@ -49,9 +49,11 @@
import io.mosip.esignet.core.dto.LinkTransactionRequest;
import io.mosip.esignet.core.dto.LinkTransactionResponse;
import io.mosip.esignet.core.dto.LinkedConsentRequest;
+import io.mosip.esignet.core.dto.LinkedConsentRequestV2;
import io.mosip.esignet.core.dto.LinkedConsentResponse;
import io.mosip.esignet.core.dto.LinkedKycAuthRequest;
import io.mosip.esignet.core.dto.LinkedKycAuthResponse;
+import io.mosip.esignet.core.dto.LinkedKycAuthResponseV2;
import io.mosip.esignet.core.dto.OtpRequest;
import io.mosip.esignet.core.dto.OtpResponse;
import io.mosip.esignet.core.dto.RequestWrapper;
@@ -565,4 +567,186 @@ public void getLinkAuthCode_withTimeout_thenFail() throws Exception {
.andExpect(jsonPath("$.errors").isNotEmpty())
.andExpect(jsonPath("$.errors[0].errorCode").value(RESPONSE_TIMEOUT));
}
+
+ @Test
+ public void authenticateV2_withValidRequest_thenPass() throws Exception {
+ RequestWrapper requestWrapper = new RequestWrapper<>();
+ requestWrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ LinkedKycAuthRequest linkedKycAuthRequest = new LinkedKycAuthRequest();
+ linkedKycAuthRequest.setLinkedTransactionId("link-transaction-id");
+ AuthChallenge authChallenge = new AuthChallenge();
+ authChallenge.setFormat("format");
+ authChallenge.setAuthFactorType("OTP");
+ authChallenge.setChallenge("challenge");
+ linkedKycAuthRequest.setChallengeList(Arrays.asList(authChallenge));
+ linkedKycAuthRequest.setIndividualId("individualId");
+ requestWrapper.setRequest(linkedKycAuthRequest);
+
+ Mockito.when(linkedAuthorizationService.authenticateUserV2(Mockito.any(LinkedKycAuthRequest.class))).thenReturn(new LinkedKycAuthResponseV2());
+
+ mockMvc.perform(post("/linked-authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.response").exists())
+ .andExpect(jsonPath("$.errors").isEmpty());
+ }
+
+ @Test
+ public void authenticateV2_withException_thenFail() throws Exception {
+ RequestWrapper requestWrapper = new RequestWrapper<>();
+ requestWrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ LinkedKycAuthRequest linkedKycAuthRequest = new LinkedKycAuthRequest();
+ linkedKycAuthRequest.setLinkedTransactionId("link-transaction-id");
+ AuthChallenge authChallenge = new AuthChallenge();
+ authChallenge.setFormat("format");
+ authChallenge.setAuthFactorType("OTP");
+ authChallenge.setChallenge("challenge");
+ linkedKycAuthRequest.setChallengeList(Arrays.asList(authChallenge));
+ linkedKycAuthRequest.setIndividualId("individualId");
+ requestWrapper.setRequest(linkedKycAuthRequest);
+
+ Mockito.when(linkedAuthorizationService.authenticateUserV2(Mockito.any(LinkedKycAuthRequest.class))).thenThrow(EsignetException.class);
+
+ mockMvc.perform(post("/linked-authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty());
+ }
+
+ @Test
+ public void authenticateV2_withInvalidTransactionId_thenFail() throws Exception {
+ RequestWrapper requestWrapper = new RequestWrapper<>();
+ requestWrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ LinkedKycAuthRequest linkedKycAuthRequest = new LinkedKycAuthRequest();
+ linkedKycAuthRequest.setLinkedTransactionId(" ");
+ AuthChallenge authChallenge = new AuthChallenge();
+ authChallenge.setFormat("format");
+ authChallenge.setAuthFactorType("OTP");
+ authChallenge.setChallenge("challenge");
+ linkedKycAuthRequest.setChallengeList(Arrays.asList(authChallenge));
+ linkedKycAuthRequest.setIndividualId("individualId");
+ requestWrapper.setRequest(linkedKycAuthRequest);
+
+ mockMvc.perform(post("/linked-authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty())
+ .andExpect(jsonPath("$.errors[0].errorCode").value(ErrorConstants.INVALID_TRANSACTION_ID));
+ }
+
+ @Test
+ public void authenticateV2_withInvalidIndividualId_thenFail() throws Exception {
+ RequestWrapper requestWrapper = new RequestWrapper<>();
+ requestWrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ LinkedKycAuthRequest linkedKycAuthRequest = new LinkedKycAuthRequest();
+ linkedKycAuthRequest.setLinkedTransactionId("txn-id");
+ AuthChallenge authChallenge = new AuthChallenge();
+ authChallenge.setFormat("format");
+ authChallenge.setAuthFactorType("OTP");
+ authChallenge.setChallenge("challenge");
+ linkedKycAuthRequest.setChallengeList(Arrays.asList(authChallenge));
+ linkedKycAuthRequest.setIndividualId("");
+ requestWrapper.setRequest(linkedKycAuthRequest);
+
+ mockMvc.perform(post("/linked-authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty())
+ .andExpect(jsonPath("$.errors[0].errorCode").value(ErrorConstants.INVALID_IDENTIFIER));
+ }
+
+ @Test
+ public void authenticateV2_withInvalidChallengeList_thenFail() throws Exception {
+ RequestWrapper requestWrapper = new RequestWrapper<>();
+ requestWrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ LinkedKycAuthRequest linkedKycAuthRequest = new LinkedKycAuthRequest();
+ linkedKycAuthRequest.setLinkedTransactionId("txn-id");
+ linkedKycAuthRequest.setIndividualId("individualId");
+ requestWrapper.setRequest(linkedKycAuthRequest);
+
+ mockMvc.perform(post("/linked-authorization/v2/authenticate")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty())
+ .andExpect(jsonPath("$.errors[0].errorCode").value(ErrorConstants.INVALID_CHALLENGE_LIST));
+
+ linkedKycAuthRequest.setChallengeList(new ArrayList<>());
+ mockMvc.perform(post("/linked-authorization/authenticate")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty())
+ .andExpect(jsonPath("$.errors[0].errorCode").value(ErrorConstants.INVALID_CHALLENGE_LIST));
+
+ AuthChallenge authChallenge = new AuthChallenge();
+ linkedKycAuthRequest.setChallengeList(Arrays.asList(authChallenge));
+ MvcResult mvcResult = mockMvc.perform(post("/linked-authorization/authenticate")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk()).andReturn();
+
+ List errorCodes = Arrays.asList(INVALID_AUTH_FACTOR_TYPE, INVALID_CHALLENGE, INVALID_CHALLENGE_FORMAT);
+ ResponseWrapper responseWrapper = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ResponseWrapper.class);
+ Assert.assertTrue(responseWrapper.getErrors().size() == 3);
+ Assert.assertTrue(errorCodes.contains(((Error)responseWrapper.getErrors().get(0)).getErrorCode()));
+ Assert.assertTrue(errorCodes.contains(((Error)responseWrapper.getErrors().get(1)).getErrorCode()));
+ Assert.assertTrue(errorCodes.contains(((Error)responseWrapper.getErrors().get(2)).getErrorCode()));
+ }
+
+ @Test
+ public void saveConsentV2_withValidRequest_thenPass() throws Exception {
+ RequestWrapper requestWrapper = new RequestWrapper<>();
+ requestWrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ LinkedConsentRequestV2 linkedConsentRequestV2 = new LinkedConsentRequestV2();
+ linkedConsentRequestV2.setLinkedTransactionId("link-transaction-id");
+ requestWrapper.setRequest(linkedConsentRequestV2);
+
+ LinkedConsentResponse linkedConsentResponse = new LinkedConsentResponse();
+ Mockito.when(linkedAuthorizationService.saveConsentV2(Mockito.any(LinkedConsentRequestV2.class))).thenReturn(linkedConsentResponse);
+
+ mockMvc.perform(post("/linked-authorization/v2/consent")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.response").exists())
+ .andExpect(jsonPath("$.errors").isEmpty());
+ }
+
+ @Test
+ public void saveConsentV2_withException_thenFail() throws Exception {
+ RequestWrapper requestWrapper = new RequestWrapper<>();
+ requestWrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ LinkedConsentRequestV2 linkedConsentRequestV2 = new LinkedConsentRequestV2();
+ linkedConsentRequestV2.setLinkedTransactionId("link-transaction-id");
+ requestWrapper.setRequest(linkedConsentRequestV2);
+
+ Mockito.when(linkedAuthorizationService.saveConsentV2(Mockito.any(LinkedConsentRequestV2.class))).thenThrow(EsignetException.class);
+
+ mockMvc.perform(post("/linked-authorization/v2/consent")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty());
+ }
+
+ @Test
+ public void saveConsentV2_withInvalidTransactionId_thenFail() throws Exception {
+ RequestWrapper requestWrapper = new RequestWrapper<>();
+ requestWrapper.setRequestTime(IdentityProviderUtil.getUTCDateTime());
+ LinkedConsentRequestV2 linkedConsentRequestV2 = new LinkedConsentRequestV2();
+ linkedConsentRequestV2.setLinkedTransactionId(" ");
+ requestWrapper.setRequest(linkedConsentRequestV2);
+
+ mockMvc.perform(post("/linked-authorization/v2/consent")
+ .content(objectMapper.writeValueAsString(requestWrapper))
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.errors").isNotEmpty())
+ .andExpect(jsonPath("$.errors[0].errorCode").value(INVALID_TRANSACTION_ID));
+ }
}
diff --git a/helm/delete-all.sh b/helm/delete-all.sh
index 9e12423d1..9132d9551 100755
--- a/helm/delete-all.sh
+++ b/helm/delete-all.sh
@@ -7,19 +7,33 @@ if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi
-ROOT_DIR=`pwd`
+function Deleting_All() {
+ ROOT_DIR=`pwd`
+ SOFTHSM_NS=softhsm
-declare -a module=("redis"
- "esignet"
- "oidc-ui"
- )
+ helm -n $SOFTHSM_NS delete softhsm-esignet
-echo Installing esignet services
+ declare -a module=("redis"
+ "esignet"
+ "oidc-ui"
+ )
-for i in "${module[@]}"
-do
- cd $ROOT_DIR/"$i"
- ./delete.sh
-done
+ echo Installing esignet services
-echo All esignet services deleted sucessfully.
+ for i in "${module[@]}"
+ do
+ cd $ROOT_DIR/"$i"
+ ./delete.sh
+ done
+
+ echo All esignet services deleted sucessfully.
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+Deleting_All # calling function
\ No newline at end of file
diff --git a/helm/esignet/Chart.yaml b/helm/esignet/Chart.yaml
index d82f2d013..37cb783b6 100644
--- a/helm/esignet/Chart.yaml
+++ b/helm/esignet/Chart.yaml
@@ -2,7 +2,7 @@ apiVersion: v2
name: esignet
description: A Helm chart for MOSIP esignet module
type: application
-version: 0.0.1
+version: 1.0.1
appVersion: ""
dependencies:
- name: common
diff --git a/helm/esignet/README.md b/helm/esignet/README.md
index 729a382cd..4c232ac38 100644
--- a/helm/esignet/README.md
+++ b/helm/esignet/README.md
@@ -11,7 +11,7 @@ $ helm install my-release mosip/esignet
## Introduction
-esignet is part of the esignet modules, but has a separate Helm chart so as to install and manage it in a completely indepedent namespace.
+esignet is part of the esignet modules, but has a separate Helm chart so as to install and manage it in a completely independent namespace.
## Prerequisites
@@ -23,8 +23,8 @@ esignet is part of the esignet modules, but has a separate Helm chart so as to i
## Overview
Refer [Commons](https://docs.mosip.io/1.2.0/modules/commons).
-## Initialize keycloak for IDP
-* To initialize keycloak for IDP, run below script.
+## Initialize keycloak for esignet
+* To initialize keycloak for esignet, run below script.
```sh
./keycloak-init.sh
```
@@ -33,6 +33,7 @@ Refer [Commons](https://docs.mosip.io/1.2.0/modules/commons).
```
./install.sh
```
+
## Uninstall
```
./delete.sh
diff --git a/helm/esignet/copy_cm.sh b/helm/esignet/copy_cm.sh
index 363653ac5..0feece1ab 100755
--- a/helm/esignet/copy_cm.sh
+++ b/helm/esignet/copy_cm.sh
@@ -1,11 +1,22 @@
-#!/bin/sh
+#!/bin/bash
# Copy configmaps from other namespaces
# DST_NS: Destination namespace
-COPY_UTIL=../copy_cm_func.sh
-DST_NS=esignet
+function copying_cm() {
+ COPY_UTIL=../copy_cm_func.sh
+ DST_NS=esignet
-$COPY_UTIL configmap global default $DST_NS
-$COPY_UTIL configmap artifactory-share artifactory $DST_NS
-$COPY_UTIL configmap config-server-share config-server $DST_NS
-$COPY_UTIL configmap softhsm-esignet-share softhsm $DST_NS
+ $COPY_UTIL configmap global default $DST_NS
+ $COPY_UTIL configmap artifactory-share artifactory $DST_NS
+ $COPY_UTIL configmap config-server-share config-server $DST_NS
+ $COPY_UTIL configmap softhsm-esignet-share softhsm $DST_NS
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+copying_cm # calling function
\ No newline at end of file
diff --git a/helm/esignet/copy_secrets.sh b/helm/esignet/copy_secrets.sh
new file mode 100755
index 000000000..4f470a2e4
--- /dev/null
+++ b/helm/esignet/copy_secrets.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Copy secrets from other namespaces
+# DST_NS: Destination namespace
+function copying_secrets() {
+ COPY_UTIL=../esignet/copy_cm_func.sh
+ #DST_NS=esignet
+ $COPY_UTIL secret esignet-captcha esignet config-server
+ return 0
+}
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+copying_secrets # calling function
\ No newline at end of file
diff --git a/helm/esignet/delete.sh b/helm/esignet/delete.sh
index 6c3ffafda..817422423 100755
--- a/helm/esignet/delete.sh
+++ b/helm/esignet/delete.sh
@@ -1,18 +1,31 @@
-#!/bin/sh
+#!/bin/bash
# Uninstalls all esignet helm charts
## Usage: ./delete.sh [kubeconfig]
if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi
-NS=esignet
-while true; do
- read -p "Are you sure you want to delete all esignet helm charts?(Y/n) " yn
- if [ $yn = "Y" ]
- then
- helm -n $NS delete esignet
- break
- else
- break
- fi
-done
+
+function Deleting_esignet() {
+ NS=esignet
+ while true; do
+ read -p "Are you sure you want to delete all esignet helm charts?(Y/n) " yn
+ if [ $yn = "Y" ]
+ then
+ helm -n $NS delete esignet
+ break
+ else
+ break
+ fi
+ done
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+Deleting_esignet # calling function
+
diff --git a/helm/esignet/install.sh b/helm/esignet/install.sh
index ec6318ee5..a6c3ca71e 100755
--- a/helm/esignet/install.sh
+++ b/helm/esignet/install.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Installs all esignet helm charts
## Usage: ./install.sh [kubeconfig]
@@ -7,16 +7,64 @@ if [ $# -ge 1 ] ; then
fi
NS=esignet
-CHART_VERSION=0.0.1
+CHART_VERSION=1.0.1
-./keycloak-init.sh
+ESIGNET_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-esignet-host})
-echo Copy configmaps
-./copy_cm.sh
+echo Create $NS namespace
+kubectl create ns $NS
-echo Installing esignet
-helm -n $NS install esignet . --version $CHART_VERSION
+function installing_esignet() {
+ helm repo update
-kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
+ ./keycloak-init.sh
-echo Installed esignet service
+ echo Please enter the recaptcha admin site key for domain $ESIGNET_HOST
+ read ESITE_KEY
+ echo Please enter the recaptcha admin secret key for domain $ESIGNET_HOST
+ read ESECRET_KEY
+
+ echo Setting up captcha secrets
+ kubectl -n $NS create secret generic esignet-captcha --from-literal=esignet-captcha-site-key=$ESITE_KEY --from-literal=esignet-captcha-secret-key=$ESECRET_KEY --dry-run=client -o yaml | kubectl apply -f -
+
+ echo Copy configmaps
+ ./copy_cm.sh
+
+ echo copy secrets
+ ./copy_secrets.sh
+
+ kubectl -n config-server set env --keys=esignet-captcha-site-key --from secret/esignet-captcha deployment/config-server --prefix=SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_
+ kubectl -n config-server set env --keys=esignet-captcha-secret-key --from secret/esignet-captcha deployment/config-server --prefix=SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_
+
+ kubectl -n config-server get deploy -o name | xargs -n1 -t kubectl -n config-server rollout status
+
+ echo "Do you have public domain & valid SSL? (Y/n) "
+ echo "Y: if you have public domain & valid ssl certificate"
+ echo "n: If you don't have a public domain and a valid SSL certificate. Note: It is recommended to use this option only in development environments."
+ read -p "" flag
+
+ if [ -z "$flag" ]; then
+ echo "'flag' was provided; EXITING;"
+ exit 1;
+ fi
+ ENABLE_INSECURE=''
+ if [ "$flag" = "n" ]; then
+ ENABLE_INSECURE='--set enable_insecure=true';
+ fi
+
+ echo Installing esignet
+ helm -n $NS install esignet mosip/esignet --version $CHART_VERSION $ENABLE_INSECURE
+
+ kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
+
+ echo Installed esignet service
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+installing_esignet # calling function
\ No newline at end of file
diff --git a/helm/esignet/restart.sh b/helm/esignet/restart.sh
index 2d60aa30b..a40af8bf7 100755
--- a/helm/esignet/restart.sh
+++ b/helm/esignet/restart.sh
@@ -1,13 +1,24 @@
-#!/bin/sh
+#!/bin/bash
# Restart the esignet services
if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi
-NS=esignet
-kubectl -n $NS rollout restart deploy esignet
+function Restarting_esignet() {
+ NS=esignet
+ kubectl -n $NS rollout restart deploy esignet
-kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
+ kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
-echo Retarted esignet services
+ echo Retarted esignet services
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+Restarting_esignet # calling function
\ No newline at end of file
diff --git a/helm/esignet/templates/deployment.yaml b/helm/esignet/templates/deployment.yaml
index 9fef2a1c9..ca588c994 100644
--- a/helm/esignet/templates/deployment.yaml
+++ b/helm/esignet/templates/deployment.yaml
@@ -70,7 +70,7 @@ spec:
- name: foo
mountPath: bar
{{- end }}
- {{- if .Values.initContainers }}
+ {{- if .Values.enable_insecure }}
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
@@ -130,6 +130,17 @@ spec:
{{- else if .Values.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
+ volumeMounts:
+ {{- if .Values.enable_insecure }}
+ - mountPath: /usr/local/openjdk-11/lib/security/cacerts
+ name: cacerts
+ subPath: cacerts
+ {{- end }}
{{- if .Values.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }}
{{- end }}
+ volumes:
+ {{- if .Values.enable_insecure }}
+ - name: cacerts
+ emptyDir: {}
+ {{- end }}
diff --git a/helm/esignet/values.yaml b/helm/esignet/values.yaml
index b6fa6351c..29213d153 100644
--- a/helm/esignet/values.yaml
+++ b/helm/esignet/values.yaml
@@ -52,8 +52,8 @@ service:
image:
registry: docker.io
- repository: mosipdev/esignet
- tag: develop
+ repository: mosipqa/esignet
+ tag: 1.0.0
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
@@ -272,7 +272,38 @@ extraVolumeMounts: []
## - name: portname
## containerPort: 1234
##
-initContainers: {}
+initContainers:
+ - command:
+ - /bin/bash
+ - -c
+ - if [ "$ENABLE_INSECURE" = "true" ]; then HOST=$( env | grep "mosip-api-internal-host"
+ |sed "s/mosip-api-internal-host=//g"); if [ -z "$HOST" ]; then echo "HOST
+ $HOST is empty; EXITING"; exit 1; fi; openssl s_client -servername "$HOST"
+ -connect "$HOST":443 > "$HOST.cer" 2>/dev/null & sleep 2 ; sed -i -ne '/-BEGIN
+ CERTIFICATE-/,/-END CERTIFICATE-/p' "$HOST.cer"; cat "$HOST.cer"; /usr/local/openjdk-11/bin/keytool
+ -delete -alias "$HOST" -keystore $JAVA_HOME/lib/security/cacerts -storepass
+ changeit; /usr/local/openjdk-11/bin/keytool -trustcacerts -keystore "$JAVA_HOME/lib/security/cacerts"
+ -storepass changeit -noprompt -importcert -alias "$HOST" -file "$HOST.cer"
+ ; if [ $? -gt 0 ]; then echo "Failed to add SSL certificate for host $host;
+ EXITING"; exit 1; fi; cp /usr/local/openjdk-11/lib/security/cacerts /cacerts;
+ fi
+ env:
+ - name: ENABLE_INSECURE
+ value: "true"
+ envFrom:
+ - configMapRef:
+ name: global
+ image: docker.io/openjdk:11-jre
+ imagePullPolicy: Always
+ name: cacerts
+ resources: {}
+ securityContext:
+ runAsUser: 0
+ terminationMessagePath: /dev/termination-log
+ terminationMessagePolicy: File
+ volumeMounts:
+ - mountPath: /cacerts
+ name: cacerts
## Add sidecars to the pods.
## Example:
@@ -421,3 +452,5 @@ istio:
- istio-system/public
- istio-system/internal
prefix: /v1/esignet/
+
+enable_insecure: false
diff --git a/helm/install-all.sh b/helm/install-all.sh
index db1cf0627..17937a226 100755
--- a/helm/install-all.sh
+++ b/helm/install-all.sh
@@ -15,37 +15,49 @@ SOFTHSM_CHART_VERSION=12.0.2
echo Create $SOFTHSM_NS namespace
kubectl create ns $SOFTHSM_NS
-echo Istio label
-kubectl label ns $SOFTHSM_NS istio-injection=enabled --overwrite
-helm repo add mosip https://mosip.github.io/mosip-helm
-helm repo update
-
-echo Installing Softhsm for esignet
-helm -n $SOFTHSM_NS install softhsm-esignet mosip/softhsm -f softhsm-values.yaml --version $SOFTHSM_CHART_VERSION --wait
-echo Installed Softhsm for esignet
-
-echo Copy configmaps
-./copy_cm_func.sh configmap global default config-server
-
-echo Copy secrets
-./copy_cm_func.sh secret softhsm-esignet softhsm config-server
-
-kubectl -n config-server set env --keys=mosip-esignet-host --from configmap/global deployment/config-server --prefix=SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_
-kubectl -n config-server set env --keys=security-pin --from secret/softhsm-esignet deployment/config-server --prefix=SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_SOFTHSM_ESIGNET_
-kubectl -n config-server get deploy -o name | xargs -n1 -t kubectl -n config-server rollout status
-
-
-declare -a module=("redis"
- "esignet"
- "oidc-ui"
- )
-
-echo Installing esignet services
-
-for i in "${module[@]}"
-do
- cd $ROOT_DIR/"$i"
- ./install.sh
-done
-
-echo All esignet services deployed sucessfully.
+function installing_All() {
+ echo Istio label
+ kubectl label ns $SOFTHSM_NS istio-injection=enabled --overwrite
+ helm repo add mosip https://mosip.github.io/mosip-helm
+ helm repo update
+
+ echo Installing Softhsm for esignet
+ helm -n $SOFTHSM_NS install softhsm-esignet mosip/softhsm -f softhsm-values.yaml --version $SOFTHSM_CHART_VERSION --wait
+ echo Installed Softhsm for esignet
+
+ echo Copy configmaps
+ ./copy_cm_func.sh configmap global default config-server
+
+ echo Copy secrets
+ ./copy_cm_func.sh secret softhsm-esignet softhsm config-server
+
+ kubectl -n config-server set env --keys=mosip-esignet-host --from configmap/global deployment/config-server --prefix=SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_
+ kubectl -n config-server set env --keys=security-pin --from secret/softhsm-esignet deployment/config-server --prefix=SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_SOFTHSM_ESIGNET_
+ kubectl -n config-server rollout restart deploy config-server
+ kubectl -n config-server get deploy -o name | xargs -n1 -t kubectl -n config-server rollout status
+
+
+ declare -a module=("redis"
+ "esignet"
+ "oidc-ui"
+ )
+
+ echo Installing esignet services
+
+ for i in "${module[@]}"
+ do
+ cd $ROOT_DIR/"$i"
+ ./install.sh
+ done
+
+ echo All esignet services deployed sucessfully.
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+installing_All # calling function
\ No newline at end of file
diff --git a/helm/oidc-ui/Chart.yaml b/helm/oidc-ui/Chart.yaml
index d8aa41cb5..9cf547c48 100644
--- a/helm/oidc-ui/Chart.yaml
+++ b/helm/oidc-ui/Chart.yaml
@@ -2,7 +2,7 @@ apiVersion: v2
name: oidc-ui
description: A Helm chart for MOSIP OIDC UI module
type: application
-version: 12.0.2
+version: 1.0.1
appVersion: ""
dependencies:
- name: common
diff --git a/helm/oidc-ui/copy_cm.sh b/helm/oidc-ui/copy_cm.sh
index 0234aa6f1..462711fa8 100755
--- a/helm/oidc-ui/copy_cm.sh
+++ b/helm/oidc-ui/copy_cm.sh
@@ -1,11 +1,22 @@
-#!/bin/sh
+#!/bin/bash
# Copy configmaps from other namespaces
# DST_NS: Destination namespace
-COPY_UTIL=./copy_cm_func.sh
-DST_NS=esignet
+function copying_cm() {
+ COPY_UTIL=./copy_cm_func.sh
+ DST_NS=esignet
-$COPY_UTIL configmap global default $DST_NS
-$COPY_UTIL configmap artifactory-share artifactory $DST_NS
-$COPY_UTIL configmap config-server-share config-server $DST_NS
-$COPY_UTIL configmap softhsm-esignet-share softhsm $DST_NS
+ $COPY_UTIL configmap global default $DST_NS
+ $COPY_UTIL configmap artifactory-share artifactory $DST_NS
+ $COPY_UTIL configmap config-server-share config-server $DST_NS
+ $COPY_UTIL configmap softhsm-esignet-share softhsm $DST_NS
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+copying_cm # calling function
\ No newline at end of file
diff --git a/helm/oidc-ui/delete.sh b/helm/oidc-ui/delete.sh
index 7b054a77f..10a831038 100755
--- a/helm/oidc-ui/delete.sh
+++ b/helm/oidc-ui/delete.sh
@@ -1,18 +1,30 @@
-#!/bin/sh
+#!/bin/bash
# Uninstalls oidc-ui helm charts
## Usage: ./delete.sh [kubeconfig]
if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi
-NS=esignet
-while true; do
- read -p "Are you sure you want to delete all esignet helm charts?(Y/n) " yn
- if [ $yn = "Y" ]
- then
- helm -n $NS delete oidc-ui
- break
- else
- break
- fi
-done
+
+function Deleting_oidc-ui() {
+ NS=esignet
+ while true; do
+ read -p "Are you sure you want to delete all esignet helm charts?(Y/n) " yn
+ if [ $yn = "Y" ]
+ then
+ helm -n $NS delete oidc-ui
+ break
+ else
+ break
+ fi
+ done
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+Deleting_oidc-ui # calling function
\ No newline at end of file
diff --git a/helm/oidc-ui/install.sh b/helm/oidc-ui/install.sh
index b0cdf4d7c..568cbadca 100755
--- a/helm/oidc-ui/install.sh
+++ b/helm/oidc-ui/install.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Installs oidc-ui helm charts
## Usage: ./install.sh [kubeconfig]
@@ -7,27 +7,40 @@ if [ $# -ge 1 ] ; then
fi
NS=esignet
-CHART_VERSION=0.0.1
+CHART_VERSION=1.0.1
echo Create $NS namespace
kubectl create ns $NS
-echo Istio label
-kubectl label ns $NS istio-injection=enabled --overwrite
-helm dependency build
+function installing_oidc-ui() {
+ echo Istio label
+ kubectl label ns $NS istio-injection=enabled --overwrite
-echo Copy configmaps
-./copy_cm.sh
+ helm repo add mosip https://mosip.github.io/mosip-helm
+ helm repo update
-ESIGNET_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-esignet-host})
+ echo Copy configmaps
+ ./copy_cm.sh
-echo "Create configmaps oidc-ui-cm, delete if exists"
-kubectl -n $NS delete --ignore-not-found=true configmap oidc-ui-cm
-kubectl -n $NS create configmap oidc-ui-cm --from-literal="REACT_APP_API_BASE_URL=http://esignet.$NS/v1/esignet" --from-literal="REACT_APP_SBI_DOMAIN_URI=http://esignet.$NS"
+ ESIGNET_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-esignet-host})
-echo Installing OIDC UI
-helm -n $NS install oidc-ui . --set istio.hosts\[0\]=$ESIGNET_HOST
+ echo "Create configmaps oidc-ui-cm, delete if exists"
+ kubectl -n $NS delete --ignore-not-found=true configmap oidc-ui-cm
+ kubectl -n $NS create configmap oidc-ui-cm --from-literal="REACT_APP_API_BASE_URL=http://esignet.$NS/v1/esignet" --from-literal="REACT_APP_SBI_DOMAIN_URI=http://esignet.$NS"
-kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
+ echo Installing OIDC UI
+ helm -n $NS install oidc-ui mosip/oidc-ui --set istio.hosts\[0\]=$ESIGNET_HOST
-echo Installed oidc-ui
+ kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
+
+ echo Installed oidc-ui
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+installing_oidc-ui # calling function
\ No newline at end of file
diff --git a/helm/oidc-ui/restart.sh b/helm/oidc-ui/restart.sh
index 3b47bc1fe..706a2a4c3 100755
--- a/helm/oidc-ui/restart.sh
+++ b/helm/oidc-ui/restart.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Restart the oidc-ui services
@@ -6,9 +6,20 @@ if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi
-NS=esignet
-kubectl -n $NS rollout restart deploy oidc-ui
+function Restarting_oidc-ui() {
+ NS=esignet
+ kubectl -n $NS rollout restart deploy oidc-ui
-kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
+ kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
-echo Retarted esignet services
+ echo Retarted esignet services
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+Restarting_oidc-ui # calling function
\ No newline at end of file
diff --git a/helm/oidc-ui/values.yaml b/helm/oidc-ui/values.yaml
index d6c472ea4..cd4b92633 100755
--- a/helm/oidc-ui/values.yaml
+++ b/helm/oidc-ui/values.yaml
@@ -51,8 +51,8 @@ service:
image:
registry: docker.io
- repository: mosipdev/oidc-ui
- tag: MOSIP-25524
+ repository: mosipqa/oidc-ui
+ tag: 1.0.0
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
diff --git a/helm/redis/delete.sh b/helm/redis/delete.sh
index cfdad0b1b..ba3679e18 100755
--- a/helm/redis/delete.sh
+++ b/helm/redis/delete.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Uninstalls kafka
## Usage: ./delete.sh [kubeconfig]
@@ -6,16 +6,26 @@ if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi
-NS=redis
-while true; do
- read -p "Are you sure you want to delete redis helm chart? Y/n ?" yn
- if [ $yn = "Y" ]
- then
- helm -n $NS delete redis
- echo Deleted Redis services.
- break
- else
- break
- fi
-done
+function Deleting_redis() {
+ NS=redis
+ while true; do
+ read -p "Are you sure you want to delete redis helm chart? Y/n ?" yn
+ if [ $yn = "Y" ]
+ then
+ helm -n $NS delete redis
+ echo Deleted Redis services.
+ break
+ else
+ break
+ fi
+ done
+ return 0
+}
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+Deleting_redis # calling function
diff --git a/helm/redis/install.sh b/helm/redis/install.sh
index 75675e755..1f557ad9c 100755
--- a/helm/redis/install.sh
+++ b/helm/redis/install.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Installs redis
## Usage: ./install.sh [kubeconfig]
@@ -12,18 +12,29 @@ CHART_VERSION=17.3.14
echo Create $NS namespace
kubectl create ns $NS
-echo Istio label
-kubectl label ns $NS istio-injection=enabled --overwrite
+function installing_redis() {
+ echo Istio label
+ kubectl label ns $NS istio-injection=enabled --overwrite
-echo Updating helm repos
-helm repo add bitnami https://charts.bitnami.com/bitnami
-helm repo update
+ echo Updating helm repos
+ helm repo add bitnami https://charts.bitnami.com/bitnami
+ helm repo update
-echo Installing redis
-helm -n $NS install redis bitnami/redis --wait --version $CHART_VERSION
+ echo Installing redis
+ helm -n $NS install redis bitnami/redis --wait --version $CHART_VERSION
-./copy_cm_func.sh secret redis redis config-server
+ ../copy_cm_func.sh secret redis redis config-server
-kubectl -n config-server set env --keys=redis-password --from secret/redis deployment/config-server --prefix=SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_
+ kubectl -n config-server set env --keys=redis-password --from secret/redis deployment/config-server --prefix=SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_
-echo Installed redis service
+ echo Installed redis service
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+installing_redis # calling function
\ No newline at end of file
diff --git a/helm/restart-all.sh b/helm/restart-all.sh
index bc62fb6ba..5bb0a8701 100755
--- a/helm/restart-all.sh
+++ b/helm/restart-all.sh
@@ -7,19 +7,30 @@ if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi
-ROOT_DIR=`pwd`
+function Restarting_All() {
+ ROOT_DIR=`pwd`
-declare -a module=("redis"
- "esignet"
- "oidc-ui"
- )
+ declare -a module=("redis"
+ "esignet"
+ "oidc-ui"
+ )
-echo restarting esignet services
+ echo restarting esignet services
-for i in "${module[@]}"
-do
- cd $ROOT_DIR/"$i"
- ./restart.sh
-done
+ for i in "${module[@]}"
+ do
+ cd $ROOT_DIR/"$i"
+ ./restart.sh
+ done
-echo All esignet services restarted sucessfully.
+ echo All esignet services restarted sucessfully.
+ return 0
+}
+
+# set commands for error handling.
+set -e
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errtrace # trace ERR through 'time command' and other functions
+set -o pipefail # trace ERR through pipes
+Restarting_All # calling function
\ No newline at end of file
diff --git a/oidc-service-impl/pom.xml b/oidc-service-impl/pom.xml
index d7d617e58..38ae7f778 100644
--- a/oidc-service-impl/pom.xml
+++ b/oidc-service-impl/pom.xml
@@ -6,7 +6,7 @@
io.mosip.esignetesignet-parent
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOTio.mosip.esignet
diff --git a/oidc-service-impl/src/main/java/io/mosip/esignet/services/AuthorizationHelperService.java b/oidc-service-impl/src/main/java/io/mosip/esignet/services/AuthorizationHelperService.java
index 9e14e7c5d..74993b7c9 100644
--- a/oidc-service-impl/src/main/java/io/mosip/esignet/services/AuthorizationHelperService.java
+++ b/oidc-service-impl/src/main/java/io/mosip/esignet/services/AuthorizationHelperService.java
@@ -189,18 +189,38 @@ protected KycAuthResult delegateAuthenticateRequest(String transactionId, String
return kycAuthResult;
}
+ /**
+ * This method is used to validate the requested claims against the accepted claims
+ *
+ *
Checks Performed
+ *
+ *
accepted Claims should be subset of requested claims
+ *
essential Claims should be a subset of accepted claims