Skip to content

Feature/credentials management #21

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

Merged
merged 12 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]: v0.7.0
- LEARCredential compliance.

## [Unreleased]: v0.6.0
- DOME profile compliance.

## [Unreleased]: v0.5.0
- Deferred credential emission.
- tx_code support for PIN.
Expand Down
303 changes: 154 additions & 149 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,210 +1,215 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.4'
id 'jacoco'
id 'org.sonarqube' version '5.0.0.4638'
id 'checkstyle'
id 'org.owasp.dependencycheck' version '9.1.0'
id 'com.github.ben-manes.versions' version "0.51.0"
id 'se.patrikerdes.use-latest-versions' version '0.2.18'
id 'java'
id 'org.springframework.boot' version '3.3.0'
id 'io.spring.dependency-management' version '1.1.5'
id 'jacoco'
id 'org.sonarqube' version '5.0.0.4638'
id 'checkstyle'
id 'org.owasp.dependencycheck' version '9.2.0'
id 'com.github.ben-manes.versions' version "0.51.0"
id 'se.patrikerdes.use-latest-versions' version '0.2.18'
}

group = 'es.in2'
version = '0.7.0'
version = '1.1.0'

java {
sourceCompatibility = '17'
sourceCompatibility = '17'
}

jacoco {
toolVersion = "0.8.11"
toolVersion = "0.8.11"
}

checkstyle {
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
}

checkstyleMain {
source ='src/main/java'
source = 'src/main/java'
}

checkstyleTest {
source ='src/test/java'
source = 'src/test/java'
}

sonar {
properties {
property "sonar.projectName", "Issuer API"
property "sonar.projectKey", "in2workspace_credential-issuer"
property "sonar.organization", "in2workspace"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.coverage.exclusions",
"src/main/java/es/in2/issuer/IssuerApiApplication.java, "
}
properties {
property "sonar.projectName", "Issuer API"
property "sonar.projectKey", "in2workspace_credential-issuer"
property "sonar.organization", "in2workspace"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.coverage.exclusions",
"src/main/java/es/in2/issuer/IssuerApiApplication.java, " +
"src/main/java/es/in2/desmos/infrastructure/config/FlywayConfig.java, " +
"src/main/java/es/in2/desmos/infrastructure/config/SecurityConfig.java, "

}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
mavenCentral()
}

ext {
set('springCloudVersion', "2023.0.0")
set('springCloudVersion', "2023.0.0")
}

dependencies {
// Spring
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-mail:3.2.5'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:3.2.5'

// EUDI Wallet libraries
implementation 'eu.europa.ec.eudi:eudi-lib-jvm-openid4vci-kt:0.1.3'

// JSON
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.17.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.17.0'

// CBOR implementation
implementation 'com.upokecenter:cbor:4.5.2'
implementation 'com.augustcellars.cose:cose-java:1.1.0'
implementation 'org.apache.commons:commons-compress:1.26.1'
implementation 'io.github.ehn-digital-green-development:base45:0.0.3'

// Proof decoding
implementation 'io.github.novacrypto:Base58:2022.01.17'

// Persistence
implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
implementation 'org.springframework:spring-jdbc'
runtimeOnly 'org.postgresql:r2dbc-postgresql'
runtimeOnly 'org.postgresql:postgresql'
implementation 'org.flywaydb:flyway-core'

// In-Memory Persistence
implementation 'com.google.guava:guava:33.1.0-jre'

// DevTools
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation 'org.jetbrains:annotations:24.1.0'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

// Nimbus JWT
implementation 'com.nimbusds:nimbus-jose-jwt:9.38-rc3'
implementation 'io.jsonwebtoken:jjwt-api:0.12.3'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.5'

// AZURE
implementation('com.azure.spring:spring-cloud-azure-starter-appconfiguration:5.7.0')
implementation('com.azure.spring:spring-cloud-azure-starter-keyvault-secrets:5.7.0')

// Documentation
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.5.0'

// Logback
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'

// Monitoring
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'

// Resilience
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j'

// Unit Testing
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.boot:spring-boot-starter-aop'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'io.mockk:mockk:1.13.10'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.0-rc1'

// Integration Test
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation 'org.testcontainers:junit-jupiter'
// Spring
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-mail:3.3.0'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:3.3.0'

// EUDI Wallet libraries
implementation 'eu.europa.ec.eudi:eudi-lib-jvm-openid4vci-kt:0.1.3'

// JSON
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.17.1'
implementation 'com.fasterxml.jackson.core:jackson-core:2.17.1'

// CBOR implementation
implementation 'com.upokecenter:cbor:4.5.4'
implementation 'com.augustcellars.cose:cose-java:1.1.0'
implementation 'org.apache.commons:commons-compress:1.26.2'
implementation 'io.github.ehn-digital-green-development:base45:0.0.3'

// Proof decoding
implementation 'io.github.novacrypto:Base58:2022.01.17'

// Persistence
implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
implementation 'org.springframework:spring-jdbc'
runtimeOnly 'org.postgresql:r2dbc-postgresql'
runtimeOnly 'org.postgresql:postgresql'
implementation 'org.flywaydb:flyway-core'

// In-Memory Persistence
implementation 'com.google.guava:guava:33.2.1-jre'

// DevTools
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation 'org.jetbrains:annotations:24.1.0'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

// Nimbus JWT
implementation 'com.nimbusds:nimbus-jose-jwt:9.40'
implementation 'io.jsonwebtoken:jjwt-api:0.12.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.5'

// AZURE
implementation('com.azure.spring:spring-cloud-azure-starter-appconfiguration:5.7.0')
implementation('com.azure.spring:spring-cloud-azure-starter-keyvault-secrets:5.7.0')

// Documentation
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.5.0'

// Logback
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'

// Monitoring
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'

// Resilience
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j'

// Unit Testing
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.boot:spring-boot-starter-aop'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'io.mockk:mockk:1.13.11'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1'

// Integration Test
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation 'org.testcontainers:junit-jupiter'
}

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

configurations.configureEach {
exclude module: 'slf4j-simple'
exclude module: 'slf4j-simple'
}

tasks.named('compileJava') {
inputs.files(tasks.named('processResources'))
inputs.files(tasks.named('processResources'))
}

tasks.named('test') {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}

tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required.set(true)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml"))
}
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/IssuerApiApplication.class",
"**/IssuerVciBackendApplication**",
"**/CredentialResponseErrorCodes**",
"**/configurations/**",
"**/handler/**",
"**/**Serializer**/**",
"**/enums/**",
"**/Constants**"
])
}))
dependsOn(tasks.test)
reports {
xml.required.set(true)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml"))
}
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/IssuerApiApplication.class",
"**/IssuerVciBackendApplication**",
"**/CredentialResponseErrorCodes**",
"**/configurations/**",
"**/handler/**",
"**/**Serializer**/**",
"**/enums/**",
"**/Constants**",
"**/infrastructure/config/FlywayConfig.class",
"**/infrastructure/config/SecurityConfig.class"
])
}))
}

tasks.register('printVersion') {
doLast {
println version
}
doLast {
println version
}
}

tasks.register('printProjectName') {
doLast {
println rootProject.name
}
doLast {
println rootProject.name
}
}

def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}

tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version)
}
rejectVersionIf {
isNonStable(it.candidate.version)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public Mono<Void> updateSignedCredentials(SignedCredentials signedCredentials) {
// Parse the credential and extract the ID
JsonNode credentialNode = objectMapper.readTree(payload);
String credentialId = credentialNode.get("vc").get("id").asText();
String email = credentialNode.get("vc").get("credentialSubject").get("mandate").get("mandatee").get("email").toString();
String firstName = credentialNode.get("vc").get("credentialSubject").get("mandate").get("mandatee").get("first_name").toString();
String email = credentialNode.get("vc").get("credentialSubject").get("mandate").get("mandatee").get("email").asText();
String firstName = credentialNode.get("vc").get("credentialSubject").get("mandate").get("mandatee").get("first_name").asText();
// Update the credential in the database
return credentialProcedureService.updatedEncodedCredentialByCredentialId(jwt, credentialId)
.flatMap(procedureId -> deferredCredentialMetadataService.updateVcByProcedureId(jwt, procedureId))
Expand Down
Loading
Loading