Skip to content

Commit

Permalink
Updated the empty claim value as null
Browse files Browse the repository at this point in the history
Signed-off-by: Mohanachandran S <[email protected]>
  • Loading branch information
mohanachandran-s committed Jan 2, 2025
2 parents 50752bf + fbddc3a commit e305927
Show file tree
Hide file tree
Showing 162 changed files with 7,482 additions and 2,729 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,3 @@ jobs:
ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }}
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

sonar_analysis_apitest_esignet:
needs: build-maven-apitest-esignet
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
with:
SERVICE_LOCATION: ./api-test
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
ORG_KEY: ${{ secrets.ORG_KEY }}
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_esignet&id=mosip_esignet&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_esignet)
# eSignet Project
## Overview

eSignet offers a seamless and straightforward solution for incorporating an existing trusted identity database into the digital realm via plugins.

This repository contains limited OpenId protocol implementation with:
* OAuth 2.0 RFC 6749 - Authorization code flow support
* OAuth 2.0 RFC 7636 - PKCE security extension
* OAuth 2.0 RFC 7523 - JWT profile for client authentication
* RFC 7519 - ID token and access token as JWT
* OpenID Connect Discovery 1.0 - /.well-known/openid-configuration
* RFC 5785 - Followed for both openid and oauth well-knowns
* Identity assurance 1.0
* Identity Assurance 1.0

## High level overview of eSignet with external systems

![esignet-architecture-overview.png](docs/esignet-architecture-overview.png)
![esignet-overview.png](docs/esignet-overview.png)

`Note: Kindly refer `[eSignet signup repository](https://github.com/mosip/esignet-signup)` for more details on eSignet signup module.`

eSignet repository contains following:

Expand Down Expand Up @@ -43,7 +45,7 @@ Refer to [SQL scripts](db_scripts).
The project requires JDK 11.
1. Build:
```
$ mvn clean install -Dgpg.skip=true
$ mvn clean install -Dgpg.skip=true -Dmaven.gitcommitid.skip=true
```
## [Deployment in K8 cluster](deploy/README.md)
Expand Down
29 changes: 24 additions & 5 deletions api-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,30 @@

The **eSignet API Test Rig** is designed for the execution of module-wise automation API tests for the eSignet service. This test rig utilizes **Java REST Assured** and **TestNG** frameworks to automate testing of the eSignet API functionalities. The key focus is to validate the authentication, signature generation, and related functionalities provided by the eSignet module.

---

## Test Categories

- **Smoke**: Contains only positive test scenarios for quick verification.
- **Regression**: Includes all test scenarios, covering both positive and negative cases.

---

## Coverage

This test rig covers only **external API endpoints** exposed by the eSignet module.

---

## Pre-requisites

Before running the automation tests, ensure the following software is installed on the machine:

- **Java 21** (or a compatible version)
- **Maven 3.9.6** (or higher)
- **Lombok** (Refer to [Lombok Project](https://projectlombok.org/))
- **setting.xml** ([download here](https://github.com/mosip/mosip-functional-tests/blob/master/settings.xml))
- **apitest-commons** library should be cloned and the JAR should be built. Refer to ([README](https://github.com/mosip/mosip-functional-tests/blob/release-1.3.0/apitest-commons/README.md))

### For Windows

Expand All @@ -32,6 +40,8 @@ Before running the automation tests, ensure the following software is installed
- In the regular Maven configuration folder (`/conf`)
- Under `/usr/local/maven/conf/`

---

## Access Test Automation Code

You can access the test automation code using either of the following methods:
Expand All @@ -51,6 +61,8 @@ You can access the test automation code using either of the following methods:
git clone https://github.com/mosip/esignet
```

---

## Build Test Automation Code

Once the repository is cloned or downloaded, follow these steps to build and install the test automation code:
Expand All @@ -67,6 +79,8 @@ Once the repository is cloned or downloaded, follow these steps to build and ins

This will download the required dependencies and prepare the test suite for execution.

---

## Execute Test Automation Suite

You can execute the test automation code using either of the following methods:
Expand Down Expand Up @@ -130,23 +144,28 @@ To execute the tests using Eclipse IDE, use the following steps:
## 6. **View Test Results**
- After the tests are executed, you can view the detailed results in the `api-test\testng-report` directory.
- Two reports will gets generated
- First report is for pre-requisite testcases
- Second report is for core testcases
### Details of Arguments Used
---
## Details of Arguments Used
- **env.user**: Replace `<env_name>` with the appropriate environment name (e.g., `dev`, `qa`, etc.).
- **env.endpoint**: The environment where the application under test is deployed. Replace `<base_env>` with the correct base URL for the environment (e.g., `https://api-internal.<env_name>.mosip.net`).
- **env.testLevel**: Set this to `smoke` to run only smoke test cases, or `smokeAndRegression` to run both smoke and regression tests.
- **jar**: Specify the name of the JAR file to execute. The version will change according to the development code version. For example, the current version may look like `apitest-esignet-1.2.1-SNAPSHOT-jar-with-dependencies.jar`.
## Build and Run
### Build and Run Info
To run the tests for both **Smoke** and **Regression**:
1. Ensure the correct environment and test level parameters are set.
2. Execute the tests as shown in the command above to validate eSignet's API functionalities.
---
## License
This project is licensed under the terms of the [Mozilla Public License 2.0]
This project is licensed under the terms of the [Mozilla Public License 2.0](https://github.com/mosip/mosip-platform/blob/master/LICENSE)
6 changes: 3 additions & 3 deletions api-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<name>apitest-esignet</name>
<description>Parent project of MOSIP Esignet apitests</description>
<url>https://github.com/mosip/esignet</url>
<version>1.2.1-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>

<licenses>
<license>
Expand Down Expand Up @@ -49,14 +49,14 @@
<maven.source.plugin.version>2.2.1</maven.source.plugin.version>

<git.commit.id.plugin.version>3.0.1</git.commit.id.plugin.version>
<fileName>apitest-esignet-1.2.1-SNAPSHOT-jar-with-dependencies</fileName>
<fileName>apitest-esignet-1.5.1-SNAPSHOT-jar-with-dependencies</fileName>
</properties>

<dependencies>
<dependency>
<groupId>io.mosip.testrig.apitest.commons</groupId>
<artifactId>apitest-commons</artifactId>
<version>1.3.1-SNAPSHOT</version>
<version>1.3.0</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,24 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad

identityRequest = getJsonFromTemplate(identityReqJson.toString(), identityRequestTemplate);
if (identityRequest.contains("$DOMAINURI$")) {
String domainUrl = ApplnURI.replace("api-internal", GlobalConstants.ESIGNET);
String domainUrl = EsignetConfigManager.getEsignetBaseUrl();
identityRequest = identityRequest.replace("$DOMAINURI$", domainUrl);
}

logger.info("identityRequest = " + identityRequest);
String encryptedIdentityReq = null;
try {
encryptedIdentityReq = bioDataUtil.constractBioIdentityRequest(identityRequest,
getResourcePath() + properties.getProperty("bioValueEncryptionTemplate"), testCaseName, isInternal);

logger.info("encryptedIdentityReq = " + encryptedIdentityReq);

if (encryptedIdentityReq == null)
throw new AdminTestException("bioDataUtil.constractBioIdentityRequest is null");

JSONObject encryptedIdentityReqObject = new JSONObject(encryptedIdentityReq);

logger.info(encryptedIdentityReqObject);
logger.info("encryptedIdentityReqObject = " + encryptedIdentityReqObject);
JSONArray arrayBiometrics = encryptedIdentityReqObject.getJSONArray(GlobalConstants.BIOMETRICS);

String bioData = arrayBiometrics.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,12 @@ public void test(TestCaseDTO testCaseDTO)


if (testCaseDTO.getTestCaseName().contains("VID") || testCaseDTO.getTestCaseName().contains("Vid")) {





if (!BaseTestCase.getSupportedIdTypesValue().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValue().contains("vid")) {
throw new SkipException(GlobalConstants.VID_FEATURE_NOT_SUPPORTED);
}
}

String inputJson = testCaseDTO.getInput().toString();
JSONObject req = new JSONObject(testCaseDTO.getInput());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ public static String isTestCaseValidForExecution(TestCaseDTO testCaseDTO) {
} else if (getIdentityPluginNameFromEsignetActuator().toLowerCase().contains("idaauthenticatorimpl")) {
// Let run test cases eSignet & MOSIP API calls --- both UIN and VID

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

logger.info("supportedIdType = " + supportedIdType);

String endpoint = testCaseDTO.getEndPoint();
if (endpoint.contains("/v1/signup/") == true || endpoint.contains("/mock-identity-system/") == true
Expand Down Expand Up @@ -247,4 +250,4 @@ public static String replaceKeywordValue(String jsonString, String keyword, Stri
throw new SkipException("Marking testcase as skipped as required fields are empty " + keyword);
}

}
}
6 changes: 3 additions & 3 deletions api-test/src/main/resources/config/esignet.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ tokenEndpoint=/v1/esignet/oauth/token
validateBindingEndpoint=ida-binding
esignetWellKnownEndPoint=/v1/esignet/oidc/.well-known/openid-configuration
signupSettingsEndPoint=/v1/signup/settings
esignetActuatorPropertySection=application-default.properties
esignetActuatorPropertySection=classpath:/application-default.properties
# uncomment below property while executing on camdgc env locally
servicesNotDeployed=resident,ridgenerator,admin,hotlist,preregistration,registrationprocessor,hub,print,packetcreator,packetmanager,mock-abis-service,mockmv,sunbirdrc
servicesNotDeployed=sunbirdrc
# uncomment below property while executing on non camdgc env locally
#servicesNotDeployed=
esignetMockBaseURL=esignet-insurance.
Expand All @@ -17,4 +17,4 @@ sunBirdBaseURL=https://registry.dev1.mosip.net

#------------------------- Need to check if these are used or not ------------------------#
OTPTimeOut = 181
attempt = 10
attempt = 10
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ AuthenticateUser:
restMethod: post
checkErrorsOnlyInResponse: true
validityCheckRequired: true
allowedErrorCodes: invalid_challenge_length,invalid_auth_factor_type
inputTemplate: esignet/AuthenticateUser/AuthenticateUser
outputTemplate: esignet/error
input: '{
Expand All @@ -1759,7 +1760,7 @@ AuthenticateUser:
output: '{
"errors": [
{
"errorCode": "invalid_challenge_length",
"errorCode": "invalid_auth_factor_type",
"errorMessage": "$IGNORE$"
}
],
Expand Down Expand Up @@ -1857,7 +1858,7 @@ AuthenticateUser:
description: Authenticate user with Null in AuthFactorType VID
role: resident
restMethod: post
allowedErrorCodes: invalid_challenge_length
allowedErrorCodes: invalid_challenge_length,invalid_auth_factor_type
checkErrorsOnlyInResponse: true
validityCheckRequired: true
inputTemplate: esignet/AuthenticateUser/AuthenticateUser
Expand All @@ -1882,7 +1883,7 @@ AuthenticateUser:
output: '{
"errors": [
{
"errorCode": "invalid_challenge_length",
"errorCode": "invalid_auth_factor_type",
"errorMessage": "$IGNORE$"
}
],
Expand All @@ -1898,7 +1899,7 @@ AuthenticateUser:
description: Authenticate user with different AuthFactorType VID
role: resident
restMethod: post
allowedErrorCodes: invalid_challenge_length,invalid_auth_factor_type_format
allowedErrorCodes: invalid_challenge_length,invalid_auth_factor_type_format,invalid_challenge_format
checkErrorsOnlyInResponse: true
validityCheckRequired: true
inputTemplate: esignet/AuthenticateUser/AuthenticateUser
Expand All @@ -1923,7 +1924,7 @@ AuthenticateUser:
output: '{
"errors": [
{
"errorCode": "invalid_challenge_length",
"errorCode": "invalid_challenge_format",
"errorMessage": "$IGNORE$"
}
],
Expand Down Expand Up @@ -1963,7 +1964,7 @@ AuthenticateUser:
output: '{
"errors": [
{
"errorCode": "invalid_challenge_length",
"errorCode": "invalid_challenge",
"errorMessage": "$IGNORE$"
}
],
Expand Down Expand Up @@ -2061,7 +2062,7 @@ AuthenticateUser:
description: Authenticate user with Null in challenge VID
role: resident
restMethod: post
allowedErrorCodes: invalid_challenge_length
allowedErrorCodes: invalid_challenge_length,invalid_challenge
checkErrorsOnlyInResponse: true
validityCheckRequired: true
inputTemplate: esignet/AuthenticateUser/AuthenticateUser
Expand All @@ -2086,7 +2087,7 @@ AuthenticateUser:
output: '{
"errors": [
{
"errorCode": "invalid_challenge_length",
"errorCode": "invalid_challenge",
"errorMessage": "$IGNORE$"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type": "{{type}}"
},
"domainUri": "$DOMAINURI$",
"env": "Developer",
"env": "Staging",
"purpose": "AUTH",
"qualityScore": 70,
"requestedScore": 70,
Expand Down
4 changes: 2 additions & 2 deletions api-test/src/main/resources/esignet/BioAuthIdp/BioNonAuth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ BioNonAuth:
output: '{
"errors": [
{
"errorCode": "invalid_challenge_length",
"errorCode": "auth_factor_mismatch",
"errorMessage": "$IGNORE$"
}
]
Expand Down Expand Up @@ -965,7 +965,7 @@ BioNonAuth:
output: '{
"errors": [
{
"errorCode": "invalid_challenge_length",
"errorCode": "auth_factor_mismatch",
"errorMessage": "$IGNORE$"
}
]
Expand Down
Loading

0 comments on commit e305927

Please sign in to comment.