Convert the project into a multi-module structure
We are moving to a multi-module structure so that different parts of the codebase can be exposed to the public while others can remain private. Using pf4j for plugin framework. Also adding a build script `build.sh` which compiles the code and creates the `dist` folder for distribution purposes. Now we can build the code via ``` $ ./build.sh -DskipTests ```
This commit is contained in:
parent
57f98d7581
commit
b3c987a9f9
3
app/server/.gitignore
vendored
3
app/server/.gitignore
vendored
|
|
@ -1,3 +1,6 @@
|
|||
dist/**
|
||||
target/**
|
||||
.idea/**
|
||||
**/.idea
|
||||
**/target
|
||||
**/dist
|
||||
|
|
|
|||
|
|
@ -1,3 +1,24 @@
|
|||
# internal-tools-server
|
||||
# Appsmith Server
|
||||
|
||||
This is the server-side repo for the internal tools framework
|
||||
This is the server-side repo for the Appsmith framework.
|
||||
|
||||
### How to build
|
||||
```bash
|
||||
$ ./build.sh <arguments>
|
||||
```
|
||||
|
||||
For example:
|
||||
```$bash
|
||||
$ ./build.sh -DskipTests
|
||||
```
|
||||
|
||||
This will
|
||||
1. Compile the code
|
||||
2. Generate the jars for server & plugins
|
||||
3. Copy them into the `dist` directory
|
||||
|
||||
### How to run
|
||||
```
|
||||
$ cd ./dist
|
||||
$ java -jar -Dspring.profiles.active=$env server-1.0-SNAPSHOT.jar
|
||||
```
|
||||
|
|
|
|||
97
app/server/appsmith-interfaces/pom.xml
Normal file
97
app/server/appsmith-interfaces/pom.xml
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>integrated</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>interfaces</artifactId>
|
||||
<version>${project.version}</version>
|
||||
|
||||
<name>interfaces</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>11</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.pf4j</groupId>
|
||||
<artifactId>pf4j</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-core</artifactId>
|
||||
<version>3.2.6.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
|
||||
<plugins>
|
||||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
15
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/CommandParams.java
vendored
Normal file
15
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/CommandParams.java
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package com.appsmith.external.models;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CommandParams {
|
||||
List<Param> queryParams;
|
||||
|
||||
List<Param> headerParams;
|
||||
}
|
||||
|
||||
13
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Param.java
vendored
Normal file
13
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Param.java
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package com.appsmith.external.models;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class Param {
|
||||
|
||||
String key;
|
||||
|
||||
String value;
|
||||
}
|
||||
12
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/BasePlugin.java
vendored
Normal file
12
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/BasePlugin.java
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package com.appsmith.external.plugins;
|
||||
|
||||
import org.pf4j.Plugin;
|
||||
import org.pf4j.PluginWrapper;
|
||||
|
||||
public abstract class BasePlugin extends Plugin {
|
||||
|
||||
public BasePlugin(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
10
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java
vendored
Normal file
10
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package com.appsmith.external.plugins;
|
||||
|
||||
import com.appsmith.external.models.CommandParams;
|
||||
import org.pf4j.ExtensionPoint;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
public interface PluginExecutor extends ExtensionPoint {
|
||||
|
||||
Flux<Object> execute(String command, CommandParams params);
|
||||
}
|
||||
21
app/server/appsmith-plugins/pom.xml
Normal file
21
app/server/appsmith-plugins/pom.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>integrated</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>appsmith-plugins</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>postgresPlugin</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
79
app/server/appsmith-plugins/postgresPlugin/pom.xml
Normal file
79
app/server/appsmith-plugins/postgresPlugin/pom.xml
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.external.plugins</groupId>
|
||||
<artifactId>postgresPlugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<name>postgresPlugin</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>11</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<plugin.id>postgres-plugin</plugin.id>
|
||||
<plugin.class>com.external.plugins.PostgresPlugin</plugin.class>
|
||||
<plugin.version>0.0.1</plugin.version>
|
||||
<plugin.provider>Arpit Mohan</plugin.provider>
|
||||
<plugin.dependencies />
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.pf4j</groupId>
|
||||
<artifactId>pf4j-spring</artifactId>
|
||||
<version>0.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>interfaces</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Plugin-Id>${plugin.id}</Plugin-Id>
|
||||
<Plugin-Class>${plugin.class}</Plugin-Class>
|
||||
<Plugin-Version>${plugin.version}</Plugin-Version>
|
||||
<Plugin-Provider>${plugin.provider}</Plugin-Provider>
|
||||
<Plugin-Dependencies>${plugin.dependencies}</Plugin-Dependencies>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
101
app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java
vendored
Normal file
101
app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
package com.external.plugins;
|
||||
|
||||
import com.appsmith.external.models.CommandParams;
|
||||
import com.appsmith.external.plugins.BasePlugin;
|
||||
import com.appsmith.external.plugins.PluginExecutor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.pf4j.Extension;
|
||||
import org.pf4j.PluginException;
|
||||
import org.pf4j.PluginWrapper;
|
||||
import org.springframework.util.Assert;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Slf4j
|
||||
public class PostgresPlugin extends BasePlugin {
|
||||
static String JDBC_DRIVER="org.postgresql.Driver";
|
||||
|
||||
static String DB_URL="jdbc:postgresql://localhost/mobtools";
|
||||
|
||||
// Database credentials
|
||||
static String DB_USER="root";
|
||||
|
||||
static String DB_PASS="root";
|
||||
|
||||
static Connection conn = null;
|
||||
|
||||
public PostgresPlugin(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws PluginException {
|
||||
log.debug("Going to initialize the PostgresDBPlugin");
|
||||
try {
|
||||
// Load the class into JVM
|
||||
Class.forName(JDBC_DRIVER);
|
||||
log.debug("Got the jdbc url as {}", DB_URL);
|
||||
// Create the connection
|
||||
conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PASS);
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.error("", e);
|
||||
} catch (SQLException e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws PluginException {
|
||||
log.debug("PostgresPlugin.stop()");
|
||||
try {
|
||||
if(conn != null) {
|
||||
conn.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error("", e);
|
||||
throw new PluginException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Slf4j
|
||||
@Extension
|
||||
public static class PostgresPluginExecutor implements PluginExecutor {
|
||||
|
||||
@Override
|
||||
public Flux<Object> execute(String command, CommandParams commandParams) {
|
||||
log.debug("In the PostgresPlugin execute with command: {}", command);
|
||||
Assert.notNull(conn);
|
||||
|
||||
ArrayList list = new ArrayList(50);
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
|
||||
ResultSet resultSet = statement.executeQuery(command);
|
||||
ResultSetMetaData metaData = resultSet.getMetaData();
|
||||
Integer colCount = metaData.getColumnCount();
|
||||
while (resultSet.next()) {
|
||||
HashMap row = new HashMap(colCount);
|
||||
for (int i = 1; i <= colCount; i++) {
|
||||
row.put(metaData.getColumnName(i), resultSet.getObject(i));
|
||||
}
|
||||
list.add(row);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error("", e);
|
||||
}
|
||||
list.forEach(System.out::println);
|
||||
|
||||
return Flux.fromIterable(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.external.plugins;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class PostgresPluginTest
|
||||
{
|
||||
/**
|
||||
* Rigorous Test :-)
|
||||
*/
|
||||
@Test
|
||||
public void shouldAnswerWithTrue()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
||||
5
app/server/appsmith-server/auth-notes
Normal file
5
app/server/appsmith-server/auth-notes
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
ReactiveAuthenticationManager - default: OAuth2AuthorizationCodeReactiveAuthenticationManager
|
||||
AuthenticationWebFilter - #authenticate function is called after you select the google account on the UI.
|
||||
OAuth2LoginAuthenticationWebFilter (extends AuthenticationWebFilter) : onAuthenticationSuccess called after the login with Google is a success
|
||||
|
||||
ClientUserRepository : This is a custom Appsmith class that saves the AuthorizedClient object in-memory
|
||||
142
app/server/appsmith-server/pom.xml
Normal file
142
app/server/appsmith-server/pom.xml
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>integrated</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>server</name>
|
||||
<description>This is the API server for the Appsmith project</description>
|
||||
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jboss-maven2-release-repository</id>
|
||||
<name>JBoss Spring Repository</name>
|
||||
<url>https://repository.jboss.org/nexus/content/repositories/public/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-oauth2-client</artifactId>
|
||||
<version>5.1.4.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-oauth2-jose</artifactId>
|
||||
<version>5.1.4.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-config</artifactId>
|
||||
<version>5.1.4.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>6.0.17.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>javax.el</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.spullara.mustache.java</groupId>
|
||||
<artifactId>compiler</artifactId>
|
||||
<version>0.9.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Plugin dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.pf4j</groupId>
|
||||
<artifactId>pf4j-spring</artifactId>
|
||||
<version>0.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Appsmith dependencies -->
|
||||
<dependency>
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>interfaces</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-test</artifactId>
|
||||
<version>3.2.11.RELEASE</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.appsmith.server.configurations;
|
||||
|
||||
import org.springframework.security.authentication.ReactiveAuthenticationManager;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.oauth2.client.authentication.OAuth2AuthorizationCodeReactiveAuthenticationManager;
|
||||
import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest;
|
||||
import org.springframework.security.oauth2.client.endpoint.ReactiveOAuth2AccessTokenResponseClient;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
//@Component
|
||||
public class CustomReactiveAuthenticationManager
|
||||
extends OAuth2AuthorizationCodeReactiveAuthenticationManager
|
||||
implements ReactiveAuthenticationManager {
|
||||
|
||||
public CustomReactiveAuthenticationManager(
|
||||
ReactiveOAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient) {
|
||||
super(accessTokenResponseClient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Authentication> authenticate(Authentication authentication) {
|
||||
boolean val = true;
|
||||
if(val) {
|
||||
return Mono.error(new Exception("something"));
|
||||
}
|
||||
return super.authenticate(authentication);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.appsmith.server.configurations;
|
||||
|
||||
import org.pf4j.spring.SpringPluginManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class PluginConfiguration {
|
||||
|
||||
@Bean
|
||||
public SpringPluginManager pluginManager() {
|
||||
return new SpringPluginManager();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ package com.appsmith.server.plugins;
|
|||
|
||||
import com.appsmith.server.domains.Query;
|
||||
import com.appsmith.server.dtos.CommandQueryParams;
|
||||
import com.appsmith.server.services.PluginExecutor;
|
||||
import com.appsmith.server.services.OldPluginExecutor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -19,7 +19,7 @@ import java.util.HashMap;
|
|||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PostgresDBPluginExecutor extends PluginExecutor {
|
||||
public class PostgresDBOldPluginExecutor extends OldPluginExecutor {
|
||||
|
||||
// JDBC driver name and database URL
|
||||
@Value("${jdbc.postgres.driver}")
|
||||
|
|
@ -3,7 +3,7 @@ package com.appsmith.server.plugins;
|
|||
import com.appsmith.server.domains.Property;
|
||||
import com.appsmith.server.domains.Query;
|
||||
import com.appsmith.server.dtos.CommandQueryParams;
|
||||
import com.appsmith.server.services.PluginExecutor;
|
||||
import com.appsmith.server.services.OldPluginExecutor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.minidev.json.JSONObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
|
@ -22,7 +22,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RestTemplatePluginExecutor extends PluginExecutor {
|
||||
public class RestTemplateOldPluginExecutor extends OldPluginExecutor {
|
||||
|
||||
final String PROP_URL = "url";
|
||||
final String PROP_HTTP_METHOD = "method";
|
||||
|
|
@ -15,7 +15,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class PluginExecutor {
|
||||
public abstract class OldPluginExecutor {
|
||||
|
||||
/**
|
||||
* This function executes the command against a backend datasource.
|
||||
|
|
@ -16,7 +16,7 @@ public interface PluginService extends CrudService<Plugin, String> {
|
|||
* @param className
|
||||
* @return PluginExecutor
|
||||
*/
|
||||
PluginExecutor getPluginExecutor(PluginType pluginType, String className);
|
||||
OldPluginExecutor getPluginExecutor(PluginType pluginType, String className);
|
||||
|
||||
public Mono<Organization> installPlugin(PluginOrgDTO plugin);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user