Skip to content

Commit 9fc1c34

Browse files
Feature/2.1.0 (#180)
* udpate version * feat(CredentialIssuanceWorkflowImpl): send vc offer email to credential_owner_email * feat: for LEARCredentialMachine issuance, use credential owner email if present * add log * fix(CredentialIssuanceWorkflowImpl): send encoded credential to response uri, instead of decoded * test * update changelog * fix(CredentialIssuanceWorkflow): get encoded credential from udpated procedure
1 parent de71846 commit 9fc1c34

File tree

4 files changed

+603
-270
lines changed

4 files changed

+603
-270
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [v2.1.0](https://github.com/in2workspace/in2-issuer-api/releases/tag/v2.1.0)
8+
### Changed
9+
- If LEARCredentialMachine issuance presubmitted data contains credential_owner_email, use it to send the credential offer, instead of mandator email.
10+
11+
### Fixed
12+
- When sending Label Credential to VC URI, send it encoded.
13+
714
## [v2.0.0](https://github.com/in2workspace/in2-issuer-api/releases/tag/v2.0.0)
815
### Added
916
- Label credential issuance.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212

1313
group = 'es.in2'
1414

15-
version = '2.0.0'
15+
version = '2.1.0'
1616

1717
java {
1818
sourceCompatibility = '17'

src/main/java/es/in2/issuer/backend/shared/application/workflow/impl/CredentialIssuanceWorkflowImpl.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,13 @@ private CredentialOfferEmailNotificationInfo extractCredentialOfferEmailInfo(Pre
118118
yield new CredentialOfferEmailNotificationInfo(email, user, org);
119119
}
120120
case LEAR_CREDENTIAL_MACHINE -> {
121-
String email = payload.get(MANDATOR).get(EMAIL).asText();
121+
String email;
122+
if(preSubmittedCredentialDataRequest.credentialOwnerEmail() == null || preSubmittedCredentialDataRequest.credentialOwnerEmail().isBlank()) {
123+
email = payload.get(MANDATOR).get(EMAIL).asText();
124+
log.debug("No credential owner email found in presubmitted data. Using mandator email: {}", payload.get(MANDATOR).get(EMAIL).asText());
125+
} else {
126+
email = preSubmittedCredentialDataRequest.credentialOwnerEmail();
127+
}
122128
String org = payload.get(MANDATOR).get(ORGANIZATION).asText();
123129
String name = payload.get(MANDATOR).get(COMMON_NAME).asText();
124130
yield new CredentialOfferEmailNotificationInfo(email, name, org);
@@ -264,15 +270,24 @@ private Mono<CredentialResponse> handleOperationMode(
264270
Mono<Void> upd = !CredentialStatusEnum.PEND_SIGNATURE.toString().equals(status)
265271
? credentialProcedureService.updateCredentialProcedureCredentialStatusToValidByProcedureId(id)
266272
: Mono.empty();
267-
return upd.then(credentialProcedureService.getDecodedCredentialByProcedureId(id));
273+
return upd.then(credentialProcedureService.getDecodedCredentialByProcedureId(id)
274+
.zipWith(credentialProcedureService.getCredentialProcedureById(id)));
268275
})
269-
.flatMap(decoded -> {
276+
.flatMap(tuple -> {
277+
String decoded = tuple.getT1();
278+
CredentialProcedure updatedCredentialProcedure = tuple.getT2();
279+
270280
CredentialType typeEnum = CredentialType.valueOf(credentialProcedure.getCredentialType());
271281
if (typeEnum == CredentialType.LEAR_CREDENTIAL_EMPLOYEE) {
272282
return getMandatorOrganizationIdentifier(processId, decoded);
273283
}
274284

275285
if (deferred.getResponseUri() != null && !deferred.getResponseUri().isBlank()) {
286+
String encodedCredential = updatedCredentialProcedure.getCredentialEncoded();
287+
if (encodedCredential == null || encodedCredential.isBlank()) {
288+
return Mono.error(new IllegalStateException("Encoded credential not found for procedureId: " + updatedCredentialProcedure.getProcedureId()));
289+
}
290+
276291
log.info("Sending VC to response URI: {}", deferred.getResponseUri());
277292
return credentialProcedureService.getCredentialId(credentialProcedure)
278293
.doOnNext(credentialId -> log.debug("Using credentialId for delivery: {}", credentialId))
@@ -281,7 +296,7 @@ private Mono<CredentialResponse> handleOperationMode(
281296
.flatMap(tokenResponse ->
282297
credentialDeliveryService.sendVcToResponseUri(
283298
deferred.getResponseUri(),
284-
decoded,
299+
encodedCredential,
285300
credentialId,
286301
credentialProcedure.getOwnerEmail(),
287302
tokenResponse.accessToken()

0 commit comments

Comments
 (0)