Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ES-180] #283

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
44e5b9b
[ES-180]
jainhitesh9998 Jul 26, 2023
bfd8a21
Updated develop version to 1.2.0-SNAPSHOT (#282)
ase-101 Jul 26, 2023
1838aba
[ES-21] QRCode buffer configuration added (#274)
anshulv1401 Jul 26, 2023
6486b6c
ES-35 test case failures and removed code duplication (#284)
ase-101 Jul 26, 2023
2a732a9
Modified the version
pvsaidurga Jul 27, 2023
6bc14a1
Dependabot changes (#285)
anshulv1401 Jul 27, 2023
10633e5
Modified the version (#288)
pvsaidurga Jul 27, 2023
5de1f10
default language for dropdown is corrected
YaswanthNagarjuna Jul 27, 2023
4a33c0d
[ADDED] readme for postman collection
jainhitesh9998 Jul 27, 2023
3a65d81
default language for dropdown is corrected
YaswanthNagarjuna Jul 27, 2023
7e0fc84
Merge pull request #290 from YaswanthNagarjuna/ES-162
anshulv1401 Jul 27, 2023
8de3bd9
Loading the previous language is corrected
YaswanthNagarjuna Jul 27, 2023
a5851d5
Loading the previous language is corrected
YaswanthNagarjuna Jul 28, 2023
0e935a2
Added configuration for the number of qrCode auto refresh before show…
YaswanthNagarjuna Aug 2, 2023
d305805
[DSD-3180] Added new env variable & restructured the deployment scrip…
syedsalman3753 Aug 2, 2023
3a25ed4
changed the button name from allow to continue
YaswanthNagarjuna Aug 2, 2023
7518b18
ES-218 (#296)
jainhitesh9998 Aug 2, 2023
040deb0
ES-218 (#296)
jainhitesh9998 Aug 2, 2023
e886988
Merge pull request #289 from YaswanthNagarjuna/ES-169
gsasikumar Aug 3, 2023
c013beb
Merge branch 'mosip:develop' into develop
kaifk468 Aug 3, 2023
af6c586
[BUGFIX] remove consent in linked consent when openid is only the scope
jainhitesh9998 Aug 3, 2023
e8b23d2
Merge branch 'develop' of https://github.com/Infosys/esignet into dev…
jainhitesh9998 Aug 3, 2023
4cf8c6c
Merge pull request #304 from Infosys/develop
vishwa-vyom Aug 3, 2023
84726c3
Added configuration for the number of qrCode auto refresh before show…
YaswanthNagarjuna Aug 7, 2023
3de6439
Merge pull request #300 from YaswanthNagarjuna/ES-215
gsasikumar Aug 9, 2023
ace7e61
Merge pull request #299 from YaswanthNagarjuna/ES-206
gsasikumar Aug 9, 2023
ed37daf
[ES-204] version updated for SBi-integrator
YaswanthNagarjuna Aug 9, 2023
659a1c2
Merge pull request #306 from YaswanthNagarjuna/ES-204
anshulv1401 Aug 9, 2023
f384ff9
[ES-206] naming corrected in .env file
YaswanthNagarjuna Aug 10, 2023
ac029ca
Merge pull request #309 from YaswanthNagarjuna/develop
anshulv1401 Aug 10, 2023
2c1ae72
Merge branch 'develop' of https://github.com/Infosys/esignet into dev…
kaifk468 Aug 10, 2023
7ea6390
Merge branch 'develop' of https://github.com/Infosys/esignet into fea…
jainhitesh9998 Aug 17, 2023
09037d3
[Removed] unnecessary api's
jainhitesh9998 Aug 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/push_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- 1.*
- develop
- main
- bugfix-ES-177

jobs:
call-workflow-codeql-analysis:
Expand Down
2 changes: 1 addition & 1 deletion binding-service-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.mosip.esignet</groupId>
<artifactId>esignet-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</parent>

<groupId>io.mosip.esignet</groupId>
Expand Down
2 changes: 1 addition & 1 deletion client-management-service-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.mosip.esignet</groupId>
<artifactId>esignet-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</parent>

<groupId>io.mosip.esignet</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
import io.mosip.esignet.api.util.ActionStatus;
import io.mosip.esignet.core.constants.Constants;
import io.mosip.esignet.core.constants.ErrorConstants;
import io.mosip.esignet.core.dto.ClientDetailCreateRequest;
import io.mosip.esignet.core.dto.ClientDetailResponse;
import io.mosip.esignet.core.dto.ClientDetailUpdateRequest;
import io.mosip.esignet.core.dto.ClientDetailCreateV2Request;
import io.mosip.esignet.core.dto.ClientDetailUpdateV2Request;
import io.mosip.esignet.core.dto.*;
import io.mosip.esignet.core.dto.ClientDetailCreateRequestV2;
import io.mosip.esignet.core.exception.EsignetException;
import io.mosip.esignet.core.exception.InvalidClientException;
import io.mosip.esignet.core.spi.ClientManagementService;
Expand All @@ -37,10 +34,7 @@

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;

import static io.mosip.esignet.core.constants.Constants.CLIENT_ACTIVE_STATUS;

Expand Down Expand Up @@ -122,7 +116,7 @@ private ClientDetailResponse getClientDetailResponse(ClientDetail clientDetail)
}

private String getClientNameLanguageMapAsJsonString(Map<String, String> clientNameMap, String clientName) {
clientNameMap.put("@none", clientName);
clientNameMap.put(Constants.NONE_LANG_KEY, clientName);
JSONObject clientNameObject = new JSONObject(clientNameMap);
return clientNameObject.toString();
}
Expand Down Expand Up @@ -179,7 +173,13 @@ public io.mosip.esignet.core.dto.ClientDetail getClientDetails(String clientId)

io.mosip.esignet.core.dto.ClientDetail dto = new io.mosip.esignet.core.dto.ClientDetail();
dto.setId(clientId);
dto.setName(result.get().getName());
try {
dto.setName(objectMapper.readValue(result.get().getName(), new TypeReference<Map<String, String>>() {}));
} catch (Exception e) {
log.error("Failed to parse client name as json falling back to @none");
dto.setName(new HashMap<>());
dto.getName().put(Constants.NONE_LANG_KEY, result.get().getName());
}
dto.setRpId(result.get().getRpId());
dto.setLogoUri(result.get().getLogoUri());
dto.setStatus(result.get().getStatus());
Expand All @@ -199,20 +199,20 @@ public io.mosip.esignet.core.dto.ClientDetail getClientDetails(String clientId)
return dto;
}

@CacheEvict(value = Constants.CLIENT_DETAIL_CACHE, key = "#clientDetailCreateV2Request.getClientId()")
@CacheEvict(value = Constants.CLIENT_DETAIL_CACHE, key = "#clientDetailCreateRequestV2.getClientId()")
@Override
public ClientDetailResponse createOIDCClientV2(ClientDetailCreateV2Request clientDetailCreateV2Request) throws EsignetException {
Optional<ClientDetail> result = clientDetailRepository.findById(clientDetailCreateV2Request.getClientId());
public ClientDetailResponse createOIDCClientV2(ClientDetailCreateRequestV2 clientDetailCreateRequestV2) throws EsignetException {
Optional<ClientDetail> result = clientDetailRepository.findById(clientDetailCreateRequestV2.getClientId());
if (result.isPresent()) {
log.error("Duplicate Client Id : {}", ErrorConstants.DUPLICATE_CLIENT_ID);
throw new EsignetException(ErrorConstants.DUPLICATE_CLIENT_ID);
}

ClientDetail clientDetail = buildClientDetailEntity(clientDetailCreateV2Request);
ClientDetail clientDetail = buildClientDetailEntity(clientDetailCreateRequestV2);

String clientName = getClientNameLanguageMapAsJsonString(
clientDetailCreateV2Request.getClientNameLangMap(),
clientDetailCreateV2Request.getClientName()
clientDetailCreateRequestV2.getClientNameLangMap(),
clientDetailCreateRequestV2.getClientName()
);
clientDetail.setName(clientName);

Expand All @@ -224,25 +224,25 @@ public ClientDetailResponse createOIDCClientV2(ClientDetailCreateV2Request clien
}

auditWrapper.logAudit(AuditHelper.getClaimValue(SecurityContextHolder.getContext(), claimName),
Action.OIDC_CLIENT_CREATE, ActionStatus.SUCCESS, AuditHelper.buildAuditDto(clientDetailCreateV2Request.getClientId()), null);
Action.OIDC_CLIENT_CREATE, ActionStatus.SUCCESS, AuditHelper.buildAuditDto(clientDetailCreateRequestV2.getClientId()), null);

return getClientDetailResponse(clientDetail);
}

@CacheEvict(value = Constants.CLIENT_DETAIL_CACHE, key = "#clientId")
@Override
public ClientDetailResponse updateOIDCClientV2(String clientId, ClientDetailUpdateV2Request clientDetailUpdateV2Request) throws EsignetException {
public ClientDetailResponse updateOIDCClientV2(String clientId, ClientDetailUpdateRequestV2 clientDetailUpdateRequestV2) throws EsignetException {
Optional<ClientDetail> result = clientDetailRepository.findById(clientId);
if (!result.isPresent()) {
log.error("Invalid Client Id : {}", ErrorConstants.INVALID_CLIENT_ID);
throw new EsignetException(ErrorConstants.INVALID_CLIENT_ID);
}

ClientDetail clientDetail = buildClientDetailEntity(result.get(), clientDetailUpdateV2Request);
ClientDetail clientDetail = buildClientDetailEntity(result.get(), clientDetailUpdateRequestV2);

String clientName = getClientNameLanguageMapAsJsonString(
clientDetailUpdateV2Request.getClientNameLangMap(),
clientDetailUpdateV2Request.getClientName()
clientDetailUpdateRequestV2.getClientNameLangMap(),
clientDetailUpdateRequestV2.getClientName()
);
clientDetail.setName(clientName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void createClient_withExistingClientId_thenFail() {

@Test
public void createClientV2_withValidDetail_thenPass() throws Exception {
ClientDetailCreateV2Request clientCreateV2ReqDto = new ClientDetailCreateV2Request();
ClientDetailCreateRequestV2 clientCreateV2ReqDto = new ClientDetailCreateRequestV2();
Map<String, String> clientnameLangMap = new HashMap<>();
clientnameLangMap.put("eng", "client_name_v1");
clientCreateV2ReqDto.setClientId("mock_id_v1");
Expand Down Expand Up @@ -125,7 +125,7 @@ public void createClientV2_withValidDetail_thenPass() throws Exception {
@Test
public void createClientV2_withExistingClientId_thenFail() {
Mockito.when(clientDetailRepository.findById("client_id_v1")).thenReturn(Optional.of(new ClientDetail()));
ClientDetailCreateV2Request clientCreateV2ReqDto = new ClientDetailCreateV2Request();
ClientDetailCreateRequestV2 clientCreateV2ReqDto = new ClientDetailCreateRequestV2();
clientCreateV2ReqDto.setClientId("client_id_v1");
try {
clientManagementService.createOIDCClientV2(clientCreateV2ReqDto);
Expand Down Expand Up @@ -199,7 +199,7 @@ public void updateClientV2_withValidClientId_thenPass() throws EsignetException
clientDetail.setRedirectUris("[\"https://service.com/home\",\"https://service.com/dashboard\", \"v1/idp\"]");
Mockito.when(clientDetailRepository.findById("client_id_v1")).thenReturn(Optional.of(clientDetail));

ClientDetailUpdateV2Request updateV2Request = new ClientDetailUpdateV2Request();
ClientDetailUpdateRequestV2 updateV2Request = new ClientDetailUpdateRequestV2();
updateV2Request.setClientNameLangMap(new HashMap<>());
updateV2Request.setClientName("client_name_v1");
updateV2Request.setLogoUri("http://service.com/logo.png");
Expand Down
6 changes: 5 additions & 1 deletion consent-service-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
<parent>
<groupId>io.mosip.esignet</groupId>
<artifactId>esignet-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</parent>

<groupId>io.mosip.esignet</groupId>
<artifactId>consent-service-impl</artifactId>
<version>${project.parent.version}</version>
<name>consent-service-impl</name>
<description>e-Signet Consent service Implementation</description>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public class ConsentDetail {
@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;
Expand Down
2 changes: 1 addition & 1 deletion db_scripts/mosip_esignet/ddl/esignet-consent.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ COMMENT ON COLUMN consent_detail.id IS 'UUID : Unique id associated with each co
COMMENT ON COLUMN consent_detail.client_id IS 'Client_id: associated with relying party';
COMMENT ON COLUMN consent_detail.psu_token IS 'PSU token associated with user consent';
COMMENT ON COLUMN consent_detail.claims IS 'Json of requested and user accepted claims';
COMMENT ON COLUMN consent_detail.authorization_scopes IS 'Json string of user accepted authorization scope';
COMMENT ON COLUMN consent_detail.authorization_scopes IS 'Json string of requested authorization scope';
COMMENT ON COLUMN consent_detail.cr_dtimes IS 'Consent creation date';
COMMENT ON COLUMN consent_detail.expire_dtimes IS 'Expiration date';
COMMENT ON COLUMN consent_detail.signature IS 'Signature of consent object ';
Expand Down
2 changes: 1 addition & 1 deletion db_scripts/mosip_esignet/ddl/esignet-consent_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ COMMENT ON COLUMN consent_history.id IS 'UUID : Unique id associated with each c
COMMENT ON COLUMN consent_history.client_id IS 'Client_id: associated with relying party';
COMMENT ON COLUMN consent_history.psu_token IS 'PSU token associated with user consent';
COMMENT ON COLUMN consent_history.claims IS 'Json of requested and user accepted claims';
COMMENT ON COLUMN consent_history.authorization_scopes IS 'Json string of user accepted authorization scope';
COMMENT ON COLUMN consent_history.authorization_scopes IS 'Json string of requested authorization scope';
COMMENT ON COLUMN consent_history.cr_dtimes IS 'Consent creation date';
COMMENT ON COLUMN consent_history.expire_dtimes IS 'Expiration date';
COMMENT ON COLUMN consent_history.signature IS 'Signature of consent object ';
Expand Down
44 changes: 44 additions & 0 deletions docs/postman-collections/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# [eSignet](https://docs.esignet.io/overview) Collection

This folder contains Postman collection with requests for creating and updating OIDC clients, performing authentication using oidc flow or wallet flow using esignet.

## Usage

One can [import](https://learning.postman.com/docs/getting-started/importing-and-exporting/importing-and-exporting-overview/ "Postman Docs") the following collections and the corresponding environment files in postman

Mock Ida flow:

* [Esignet Collection](./esignet-OIDC-flow-with-mock.postman_collection.json "Postman Collection")
* [Esignet Environment](./esignet-OIDC-flow-with-mock.postman_environment.json "Environment")

Real Ida Flow

* [Esignet Collection](./esignet-OIDC-flow-with-real-ida.postman_collection.json "Postman Collection")
* [Esignet Environment](./esignet-OIDC-flow-with-real-ida.postman_environment.json "Environment")


## Prerequisites for Real Ida Flow
For the client creation in the above flow the user is expected to have the following details handy

* relayingPartyId
* policyId

## Crypto Operations

This collection utilizes the [postman util lib](https://joolfe.github.io/postman-util-lib/ "Postman Util Library") for performing crypto operations like

* Key Pair Generation
* Signing
* Thumbprint Computation x5t#s256
* Client Assertion


## Overview

Overview regarding esignet is [here](../../README.md "readme")

## Contributing

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.
Loading