Skip to content

Commit

Permalink
ES-1043 (#716)
Browse files Browse the repository at this point in the history
* ES-1043

Signed-off-by: ase-101 <sunkadaeanusha@gmail.com>

* ES-1043

Signed-off-by: ase-101 <sunkadaeanusha@gmail.com>

---------

Signed-off-by: ase-101 <sunkadaeanusha@gmail.com>
  • Loading branch information
ase-101 authored May 23, 2024
1 parent 2a591a2 commit c91a723
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.mosip.esignet.api.dto;

import lombok.Data;

@Data
public class ClaimMetadata {

private String trustFramework;
private String assuranceLevel;
private String verificationProcessName;
private long verificationCompletedOn;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;


@Data
@AllArgsConstructor
Expand All @@ -17,4 +20,5 @@ public class KycAuthResult {

private String kycToken;
private String partnerSpecificUserToken;
private Map<String, List<ClaimMetadata>> claimsMetadata;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 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.api.dto;

import lombok.Data;

import java.util.List;
import java.util.Map;

@Data
public class VerifiedKycExchangeDto extends KycExchangeDto {

private Map<String, ClaimMetadata> acceptedVerifiedClaims;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@
package io.mosip.esignet.api.spi;

import java.util.List;
import java.util.Map;

import io.mosip.esignet.api.dto.KycAuthDto;
import io.mosip.esignet.api.dto.KycAuthResult;
import io.mosip.esignet.api.dto.KycExchangeDto;
import io.mosip.esignet.api.dto.KycExchangeResult;
import io.mosip.esignet.api.dto.KycSigningCertificateData;
import io.mosip.esignet.api.dto.SendOtpDto;
import io.mosip.esignet.api.dto.SendOtpResult;
import io.mosip.esignet.api.dto.*;
import io.mosip.esignet.api.exception.KycAuthException;
import io.mosip.esignet.api.exception.KycExchangeException;
import io.mosip.esignet.api.exception.KycSigningCertificateException;
Expand Down Expand Up @@ -66,4 +61,26 @@ SendOtpResult sendOtp(String relyingPartyId, String clientId, SendOtpDto sendOtp
*/
List<KycSigningCertificateData> getAllKycSigningCertificates() throws KycSigningCertificateException;

/**
* Authenticate and return individual's claims metadata if requested
* @param relyingPartyId
* @param clientId
* @param claimsMetadataRequired
* @param kycAuthDto
* @return
* @throws KycAuthException
*/
KycAuthResult doKycAuth(String relyingPartyId, String clientId, boolean claimsMetadataRequired, KycAuthDto kycAuthDto)
throws KycAuthException;

/**
* Providioned to return verified userinfo based on the provided verification requirement
* @param relyingPartyId
* @param clientId
* @param kycExchangeDto
* @return
* @throws KycExchangeException
*/
KycExchangeResult doVerifiedKycExchange(String relyingPartyId, String clientId, VerifiedKycExchangeDto kycExchangeDto)
throws KycExchangeException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,16 @@ public List<KycSigningCertificateData> getAllKycSigningCertificates() {
return certs;
}

@Override
public KycAuthResult doKycAuth(String relyingPartyId, String clientId, boolean claimsMetadataRequired, KycAuthDto kycAuthDto) throws KycAuthException {
return null;
}

@Override
public KycExchangeResult doVerifiedKycExchange(String relyingPartyId, String clientId, VerifiedKycExchangeDto kycExchangeDto) throws KycExchangeException {
return null;
}

private boolean authenticateUser(String transactionId, String individualId, AuthChallenge authChallenge) {
switch (authChallenge.getAuthFactorType()) {
case "PIN" :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private String getAuthCode(String transactionId,String state, String nonce) thro
}

private ResponseWrapper<AuthResponse> authenticate(String transactionId) throws Exception {
KycAuthDto kycAuthDto = new KycAuthDto();
AuthRequest kycAuthDto = new AuthRequest();
kycAuthDto.setIndividualId("8267411571");
AuthChallenge authChallenge = new AuthChallenge();
authChallenge.setAuthFactorType("PIN");
Expand All @@ -287,7 +287,7 @@ private ResponseWrapper<AuthResponse> authenticate(String transactionId) throws
kycAuthDto.setChallengeList(Arrays.asList(authChallenge));
kycAuthDto.setTransactionId(transactionId);

RequestWrapper<KycAuthDto> wrapper = new RequestWrapper<>();
RequestWrapper<AuthRequest> wrapper = new RequestWrapper<>();
wrapper.setRequestTime(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern(UTC_DATETIME_PATTERN)));
wrapper.setRequest(kycAuthDto);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ private ResponseWrapper<AuthCodeResponse> getAuthCodeWithInvalidClaim(String tra
}

private ResponseWrapper<AuthResponse> authenticateWithInvalidPin(String transactionId) throws Exception {
KycAuthDto kycAuthDto = new KycAuthDto();
AuthRequest kycAuthDto = new AuthRequest();
kycAuthDto.setIndividualId("8267411571");
AuthChallenge authChallenge = new AuthChallenge();
authChallenge.setAuthFactorType("PIN");
Expand All @@ -407,7 +407,7 @@ private ResponseWrapper<AuthResponse> authenticateWithInvalidPin(String transact
kycAuthDto.setChallengeList(Arrays.asList(authChallenge));
kycAuthDto.setTransactionId(transactionId);

RequestWrapper<KycAuthDto> wrapper = new RequestWrapper<>();
RequestWrapper<AuthRequest> wrapper = new RequestWrapper<>();
wrapper.setRequestTime(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern(UTC_DATETIME_PATTERN)));
wrapper.setRequest(kycAuthDto);

Expand All @@ -423,7 +423,7 @@ private ResponseWrapper<AuthResponse> authenticateWithInvalidPin(String transact
}

private ResponseWrapper<AuthResponse> authenticate(String transactionId) throws Exception {
KycAuthDto kycAuthDto = new KycAuthDto();
AuthRequest kycAuthDto = new AuthRequest();
kycAuthDto.setIndividualId("8267411571");
AuthChallenge authChallenge = new AuthChallenge();
authChallenge.setAuthFactorType("PIN");
Expand All @@ -432,7 +432,7 @@ private ResponseWrapper<AuthResponse> authenticate(String transactionId) throws
kycAuthDto.setChallengeList(Arrays.asList(authChallenge));
kycAuthDto.setTransactionId(transactionId);

RequestWrapper<KycAuthDto> wrapper = new RequestWrapper<>();
RequestWrapper<AuthRequest> wrapper = new RequestWrapper<>();
wrapper.setRequestTime(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern(UTC_DATETIME_PATTERN)));
wrapper.setRequest(kycAuthDto);

Expand Down

0 comments on commit c91a723

Please sign in to comment.