Skip to content

Commit

Permalink
Merge pull request #14 from muralibasani/kafkawize-pro
Browse files Browse the repository at this point in the history
Kafkawize pro
  • Loading branch information
muralibasani authored Feb 1, 2022
2 parents f768039 + 4ce43c7 commit b624b03
Show file tree
Hide file tree
Showing 22 changed files with 1,634 additions and 336 deletions.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# Kafkawize

Kafkawize is a Self service Apache Kafka Topic Management tool/portal. It is a web application which automates the process of creating and browsing Kafka topics, acls, avro schemas, connectors by introducing roles/authorizations to users of various teams of an organization.

KafkaWize ClusterApi application. It is required to run KafkaWize https://github.com/muralibasani/kafkawize before running this api.

This cluster api communicates with Kafka brokers with AdminClientApi and connects to UserInterfaceApi (kafkawize).
This cluster api communicates with Kafka brokers with AdminClientApi and connects to UserInterfaceApi (kafkawize).

[![Features](https://yt-embed.herokuapp.com/embed?v=i7nmi-lovgA)](https://www.youtube.com/watch?v=i7nmi-lovgA "Create a kafka topic")

## Built With

* [Maven](https://maven.apache.org/) - Dependency Management
* Java, Spring boot, Spring security, Kafka Admin client

## Versioning

For the versions available, see the [tags on this repository](https://github.com/muralibasani/kafkawizeclusterapi/tags).

## Authors

* **Muralidhar Basani** - [muralibasani](https://github.com/muralibasani)

## License

This project is licensed under the Apache License - see the [LICENSE.md](LICENSE.md) file for details.

## Architecture:

![Architecture](https://github.com/muralibasani/kafkawize/blob/master/screenshots/arch.png)

## Install

mvn clean install
Follow steps at https://kafkawize.readthedocs.io/en/latest
6 changes: 2 additions & 4 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Release Notes
5.0.0 changes

Kafkawizeclusterapi 4.4

1. Changes include initial load of Admin client connections
All changes of kafkawize pro
69 changes: 52 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<modelVersion>4.0.0</modelVersion>

<groupId>com.kafkamgt.clusterapi</groupId>
<artifactId>kafkawizeclusterapi</artifactId>
<version>4.5.1</version>
<artifactId>kafkawizeclusterapipro</artifactId>
<version>5.0.0</version>
<packaging>jar</packaging>

<name>kafkaclusterapi</name>
Expand All @@ -14,15 +14,20 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.11.RELEASE</version>
<version>2.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<kafkaclient.version>2.6.1</kafkaclient.version>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<kafka.client.version>2.8.0</kafka.client.version>
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>2.22.0</maven-failsafe-plugin.version>
<jasyptencrypt.version>3.0.4</jasyptencrypt.version>
</properties>

<dependencies>
Expand All @@ -44,23 +49,28 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<!--<exclusions>-->
<!--<exclusion>-->
<!--<artifactId>*</artifactId>-->
<!--<groupId>org.mockito</groupId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<!--Swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
Expand All @@ -70,26 +80,37 @@
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>${kafkaclient.version}</version>
<version>${kafka.client.version}</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>${jasyptencrypt.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<version>2.2.2.RELEASE</version>
<version>2.8.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.0</version>
<version>2.0.9</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0.1-jre</version>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.0</version>
<version>2.0.9</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -136,5 +157,19 @@
</plugins>
</build>

<!-- <distributionManagement>
<repository>
<id>${deployement-repo-id}</id>
<uniqueVersion>false</uniqueVersion>
<name>Release deployement repository from user settings</name>
<url>${deployement-repo-url}</url>
</repository>
<snapshotRepository>
<id>${snapshot-deployement-repo-id}</id>
<name>Snapshots deployement repository from user settings</name>
<url>${snapshot-deployement-repo-url}</url>
<uniqueVersion>true</uniqueVersion>
</snapshotRepository>
</distributionManagement> -->

</project>
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package com.kafkamgt.clusterapi;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

@SpringBootApplication
public class KafkaclusterapiApplication {

@Autowired
Environment env;

public static void main(String[] args) {
SpringApplication.run(KafkaclusterapiApplication.class, args);
}
Expand Down
46 changes: 23 additions & 23 deletions src/main/java/com/kafkamgt/clusterapi/config/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.kafkamgt.clusterapi.config;


import org.jasypt.util.text.BasicTextEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
Expand All @@ -11,25 +12,17 @@
import org.springframework.security.crypto.password.PasswordEncoder;

@EnableWebSecurity
@PropertySource(value= {"classpath:application.properties"})
public class SecurityConfig extends WebSecurityConfigurerAdapter{

@Value("${securityconfig.user1.username}")
@Value("${kafkawize.clusterapi.access.username}")
String user1_username;

@Value("${securityconfig.user1.pwd}")
@Value("${kafkawize.clusterapi.access.password}")
String user1_pwd;

@Value("${securityconfig.user1.role}")
String user1_role;

@Value("${securityconfig.user2.username}")
String user2_username;

@Value("${securityconfig.user2.pwd}")
String user2_pwd;

@Value("${securityconfig.user2.role}")
String user2_role;
@Value("${kafkawize.jasypt.encryptor.secretkey}")
String encryptorSecretKey;

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
Expand All @@ -39,19 +32,26 @@ public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception

auth.inMemoryAuthentication()
.passwordEncoder(encoder)
.withUser(user1_username).password(encoder.encode(user1_pwd)).roles(user1_role)
.and()
.withUser(user2_username).password(encoder.encode(user2_pwd)).roles(user2_role);
.withUser(user1_username).password(encoder.encode(decodePwd(user1_pwd))).roles("USER");
}

@Override
protected void configure (HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().anyRequest().permitAll()
.and()
http.csrf().disable()//.authorizeRequests().anyRequest().permitAll()
// .and()
.authorizeRequests()
.anyRequest()//.fullyAuthenticated()
//.and()
//.formLogin()
.permitAll();
.anyRequest().fullyAuthenticated()
.and()
.httpBasic();
}

private String decodePwd(String pwd){
if(pwd != null) {
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
textEncryptor.setPasswordCharArray(encryptorSecretKey.toCharArray());

return textEncryptor.decrypt(pwd);
}
return "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
@EnableSwagger2
public class SwaggerConfig {

//https://localhost:9343/swagger-ui.html

@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
Expand Down
Loading

0 comments on commit b624b03

Please sign in to comment.