Skip to content

Commit

Permalink
Merge pull request #138 from HermesGermany/next_minor
Browse files Browse the repository at this point in the history
Prepare Release 2.3.0
  • Loading branch information
PolatEmre-hg authored Feb 2, 2022
2 parents ca30278 + 5ac2783 commit e648033
Show file tree
Hide file tree
Showing 25 changed files with 621 additions and 148 deletions.
4 changes: 2 additions & 2 deletions application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ galapagos.kafka.environments[0].id=devtest
galapagos.kafka.environments[0].name=DEV/TEST
galapagos.kafka.environments[0].bootstrap-servers=${params.dev.bootstrapServer}
galapagos.kafka.environments[0].authenticationMode=certificates
galapagos.kafka.environments[0].certificates.certificatesWorkdir=file:${java.io.tmpdir}/galapagos
galapagos.kafka.environments[0].certificates.certificatesWorkdir=${java.io.tmpdir}/galapagos
galapagos.kafka.environments[0].certificates.caCertificateFile=file:./ca.cer
galapagos.kafka.environments[0].certificates.caKeyFile=file:./ca.key
galapagos.kafka.environments[0].certificates.applicationCertificateValidity=P730D
Expand All @@ -31,7 +31,7 @@ galapagos.kafka.environments[1].id=prod
galapagos.kafka.environments[1].name=PROD
galapagos.kafka.environments[1].bootstrap-servers=${params.prod.bootstrapServer}
galapagos.kafka.environments[1].authenticationMode=certificates
galapagos.kafka.environments[1].certificates.certificatesWorkdir=file:${java.io.tmpdir}/galapagos
galapagos.kafka.environments[1].certificates.certificatesWorkdir=${java.io.tmpdir}/galapagos
galapagos.kafka.environments[1].certificates.caCertificateFile=file:./ca.cer
galapagos.kafka.environments[1].certificates.caKeyFile=file:./ca.key
galapagos.kafka.environments[1].certificates.applicationCertificateValidity=P365D
Expand Down
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
</parent>
<groupId>com.hermesworld.ais</groupId>
<artifactId>galapagos</artifactId>
<version>2.2.0</version>
<version>2.3.0-SNAPSHOT</version>
<name>Galapagos</name>
<description>A self-service tool for managing Kafka Topics and associated JSON schemas.</description>

<properties>
<java.version>11</java.version>
<keycloak.version>8.0.2</keycloak.version>
<keycloak.version>13.0.0</keycloak.version>
<lombok.version>1.18.12</lombok.version>
<kafka.version>2.5.0</kafka.version>
<kafka.version>2.7.2</kafka.version>
<sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
<sonar.sources>src/main/java</sonar.sources>
<sonar.exclusions>src/main/resources/*</sonar.exclusions>
Expand Down Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.11</version>
<version>6.3</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
Expand Down Expand Up @@ -112,8 +112,8 @@

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.62</version>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.68</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
Expand All @@ -136,7 +136,7 @@
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.3.0</version>
<version>3.8.3</version>
</dependency>

<dependency>
Expand All @@ -151,7 +151,7 @@
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.12.1</version>
<version>1.14.2</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.hermesworld.ais.galapagos.adminjobs.impl;

import com.hermesworld.ais.galapagos.adminjobs.AdminJob;
import com.hermesworld.ais.galapagos.devcerts.DeveloperCertificateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.stereotype.Component;

@Component
public class CleanupDeveloperCertificatesJob implements AdminJob {

private final DeveloperCertificateService developerCertificateService;

@Autowired
public CleanupDeveloperCertificatesJob(DeveloperCertificateService developerCertificateService) {
this.developerCertificateService = developerCertificateService;
}

@Override
public String getJobName() {
return "cleanup-developer-certificates";
}

@Override
public void run(ApplicationArguments allArguments) throws Exception {
System.out.println();
System.out.println(
"========================= Starting Cleanup of expired Developer Certificates on all Kafka clusters ========================");
System.out.println();

System.out.println("========================= Cleanup of total "
+ developerCertificateService.clearExpiredDeveloperCertificatesOnAllClusters().get()
+ " expired Developer Certificates on all Kafka clusters was successful ========================");
}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.hermesworld.ais.galapagos.adminjobs.impl;

import java.time.Duration;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import org.apache.kafka.clients.admin.*;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.common.*;
import org.apache.kafka.common.acl.AclBinding;
import org.apache.kafka.common.acl.AclBindingFilter;
import org.apache.kafka.common.config.ConfigResource;
import org.apache.kafka.common.quota.ClientQuotaAlteration;
import org.apache.kafka.common.quota.ClientQuotaFilter;

import java.time.Duration;
import java.util.*;
import java.util.concurrent.TimeUnit;

/**
* Helper class used by admin jobs providing a "dry run". This class wraps an existing Kafka AdminClient and throws an
Expand Down Expand Up @@ -398,6 +397,71 @@ public ListOffsetsResult listOffsets(Map<TopicPartition, OffsetSpec> topicPartit
return delegate.listOffsets(topicPartitionOffsets, options);
}

@Override
public DescribeClientQuotasResult describeClientQuotas(ClientQuotaFilter filter) {
return delegate.describeClientQuotas(filter);
}

@Override
public DescribeClientQuotasResult describeClientQuotas(ClientQuotaFilter clientQuotaFilter,
DescribeClientQuotasOptions describeClientQuotasOptions) {
return delegate.describeClientQuotas(clientQuotaFilter, describeClientQuotasOptions);
}

@Override
public AlterClientQuotasResult alterClientQuotas(Collection<ClientQuotaAlteration> entries) {
throw new UnsupportedOperationException();
}

@Override
public AlterClientQuotasResult alterClientQuotas(Collection<ClientQuotaAlteration> collection,
AlterClientQuotasOptions alterClientQuotasOptions) {
throw new UnsupportedOperationException();
}

@Override
public DescribeUserScramCredentialsResult describeUserScramCredentials() {
return delegate.describeUserScramCredentials();
}

@Override
public DescribeUserScramCredentialsResult describeUserScramCredentials(List<String> users) {
return delegate.describeUserScramCredentials(users);
}

@Override
public DescribeUserScramCredentialsResult describeUserScramCredentials(List<String> list,
DescribeUserScramCredentialsOptions describeUserScramCredentialsOptions) {
return delegate.describeUserScramCredentials(list, describeUserScramCredentialsOptions);
}

@Override
public AlterUserScramCredentialsResult alterUserScramCredentials(List<UserScramCredentialAlteration> alterations) {
throw new UnsupportedOperationException();
}

@Override
public AlterUserScramCredentialsResult alterUserScramCredentials(List<UserScramCredentialAlteration> list,
AlterUserScramCredentialsOptions alterUserScramCredentialsOptions) {
throw new UnsupportedOperationException();
}

@Override
public DescribeFeaturesResult describeFeatures() {
return delegate.describeFeatures();
}

@Override
public DescribeFeaturesResult describeFeatures(DescribeFeaturesOptions describeFeaturesOptions) {
return delegate.describeFeatures(describeFeaturesOptions);
}

@Override
public UpdateFeaturesResult updateFeatures(Map<String, FeatureUpdate> map,
UpdateFeaturesOptions updateFeaturesOptions) {
throw new UnsupportedOperationException();
}

@Override
public Map<MetricName, ? extends Metric> metrics() {
return delegate.metrics();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,6 @@ public ApplicationPrefixesDto getApplicationPrefixes(@PathVariable String enviro
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND));
}

@GetMapping(value = "/api/certificates/{applicationId}")
public List<ApplicationCertificateDto> getApplicationCertificates(@PathVariable String applicationId) {
return kafkaClusters.getEnvironmentsMetadata().stream()
.map(env -> applicationsService.getApplicationMetadata(env.getId(), applicationId)
.map(meta -> toAppCertDto(env.getId(), meta)).orElse(null))
.filter(dto -> dto != null).collect(Collectors.toList());
}

@PostMapping(value = "/api/certificates/{applicationId}/{environmentId}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public CertificateResponseDto updateApplicationCertificate(@PathVariable String applicationId,
@PathVariable String environmentId, @RequestBody CertificateRequestDto request) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hermesworld.ais.galapagos.devcerts;

import javax.annotation.CheckReturnValue;
import java.io.OutputStream;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
Expand All @@ -8,7 +9,11 @@ public interface DeveloperCertificateService {

Optional<DevCertificateMetadata> getDeveloperCertificateOfCurrentUser(String environmentId);

@CheckReturnValue
CompletableFuture<Void> createDeveloperCertificateForCurrentUser(String environmentId,
OutputStream p12OutputStream);

@CheckReturnValue
CompletableFuture<Integer> clearExpiredDeveloperCertificatesOnAllClusters();

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.hermesworld.ais.galapagos.devcerts.controller;

import java.time.Instant;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat.Shape;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;

import java.time.Instant;

@JsonSerialize
@Getter
public class DeveloperCertificateInfoDto {

private String dn;
private final String dn;

@JsonFormat(shape = Shape.STRING)
private Instant expiresAt;
private final Instant expiresAt;

public DeveloperCertificateInfoDto(String dn, Instant expiresAt) {
this.dn = dn;
Expand Down
Loading

0 comments on commit e648033

Please sign in to comment.