-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add Certificate Revocation Endpoints (#141)
* Add Controller and DTO for DCC Revocation * Adapt to latest version of specification * Update Hash Types * Update API Endpoints * Add Persistence Model and DB Changelog * Update Controller * Update Format of Hash * Add Controller Logic for Upload and Delete * Add Download for Single Batches Add Download for BatchList Add Upload for Batches Add Delete for Batches Add Cleanup Job Update DB Schema Snapshot * Add Default Value to Config File * Checkstyle * Fix Dependencies * Update Spring Boot to 2.6.1 * Add Suppression for H2 CVE * Update DGC-Lib * Add Revocation Dto to Coverage Exclusion
- Loading branch information
Showing
24 changed files
with
2,853 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
src/main/java/eu/europa/ec/dgc/gateway/entity/RevocationBatchEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/*- | ||
* ---license-start | ||
* EU Digital Green Certificate Gateway Service / dgc-gateway | ||
* --- | ||
* Copyright (C) 2021 T-Systems International GmbH and all other contributors | ||
* --- | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ---license-end | ||
*/ | ||
|
||
package eu.europa.ec.dgc.gateway.entity; | ||
|
||
import java.time.ZonedDateTime; | ||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Index; | ||
import javax.persistence.Lob; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@Entity | ||
@Table(name = "revocation_batch", indexes = @Index(columnList = "batchId")) | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class RevocationBatchEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
/** | ||
* ID of the Batch. | ||
*/ | ||
@Column(name = "batchId", nullable = false, length = 36, unique = true) | ||
private String batchId; | ||
|
||
/** | ||
* ISO 3166 Alpha-2 Country Code. | ||
* (plus code "EU" for administrative European Union entries). | ||
*/ | ||
@Column(name = "country", nullable = false, length = 2) | ||
private String country; | ||
|
||
/** | ||
* Timestamp of the Batch when it was added or deleted. | ||
*/ | ||
@Column(name = "changed", nullable = false) | ||
private ZonedDateTime changed = ZonedDateTime.now(); | ||
|
||
/** | ||
* Timestamp when the Batch will expire. | ||
*/ | ||
@Column(name = "expires", nullable = false) | ||
private ZonedDateTime expires; | ||
|
||
/** | ||
* Flag that indicates whether this batch was already deleted. | ||
*/ | ||
@Column(name = "deleted", nullable = false) | ||
private Boolean deleted = false; | ||
|
||
/** | ||
* Type of Revocation Hashes. | ||
*/ | ||
@Column(name = "type", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private RevocationHashType type; | ||
|
||
/** | ||
* The KID of the Key used to sign the CMS. | ||
*/ | ||
@Column(name = "kid", length = 12) | ||
private String kid; | ||
|
||
/** | ||
* The Signed CMS with the batch. | ||
*/ | ||
@Column(name = "signed_batch", length = 1_024_000) | ||
@Lob | ||
private String signedBatch; | ||
|
||
/** | ||
* Available types of Hash. | ||
*/ | ||
public enum RevocationHashType { | ||
SIGNATURE, | ||
UCI, | ||
COUNTRYCODEUCI | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/eu/europa/ec/dgc/gateway/entity/RevocationBatchProjection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*- | ||
* ---license-start | ||
* EU Digital Green Certificate Gateway Service / dgc-gateway | ||
* --- | ||
* Copyright (C) 2021 T-Systems International GmbH and all other contributors | ||
* --- | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ---license-end | ||
*/ | ||
|
||
package eu.europa.ec.dgc.gateway.entity; | ||
|
||
import java.time.ZonedDateTime; | ||
|
||
public interface RevocationBatchProjection { | ||
|
||
String getBatchId(); | ||
|
||
String getCountry(); | ||
|
||
ZonedDateTime getChanged(); | ||
|
||
Boolean getDeleted(); | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/eu/europa/ec/dgc/gateway/model/RevocationBatchDownload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*- | ||
* ---license-start | ||
* EU Digital Green Certificate Gateway Service / dgc-gateway | ||
* --- | ||
* Copyright (C) 2021 T-Systems International GmbH and all other contributors | ||
* --- | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ---license-end | ||
*/ | ||
|
||
package eu.europa.ec.dgc.gateway.model; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class RevocationBatchDownload { | ||
|
||
private String batchId; | ||
|
||
private String signedCms; | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/eu/europa/ec/dgc/gateway/model/RevocationBatchList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*- | ||
* ---license-start | ||
* EU Digital Green Certificate Gateway Service / dgc-gateway | ||
* --- | ||
* Copyright (C) 2021 T-Systems International GmbH and all other contributors | ||
* --- | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ---license-end | ||
*/ | ||
|
||
package eu.europa.ec.dgc.gateway.model; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class RevocationBatchList { | ||
|
||
private Boolean more; | ||
|
||
private List<RevocationBatchListItem> batches; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public static class RevocationBatchListItem { | ||
|
||
private String batchId; | ||
|
||
private String country; | ||
|
||
private ZonedDateTime date; | ||
|
||
private Boolean deleted; | ||
} | ||
} |
Oops, something went wrong.