mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-23 03:43:48 +01:00
Compare commits
No commits in common. "a69256b793a906da48d3dc9bfc96a3d0459d1bf9" and "03a6c0ef8b6078fd224e1888cfe6ced3d3f5d876" have entirely different histories.
a69256b793
...
03a6c0ef8b
@ -1 +1 @@
|
|||||||
#
# Command: mysql -u root -p < create_schemas.sql
#
USE wisemapping;
CREATE TABLE COLLABORATOR (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(255)
CHARACTER SET utf8 NOT NULL UNIQUE,
creation_date DATE
)
CHARACTER SET utf8;
CREATE TABLE USER (
colaborator_id INTEGER NOT NULL PRIMARY KEY,
authentication_type CHAR(1)
CHARACTER SET utf8 NOT NULL,
authenticator_uri VARCHAR(255)
CHARACTER SET utf8,
firstname VARCHAR(255) CHARACTER SET utf8 NOT NULL,
lastname VARCHAR(255) CHARACTER SET utf8 NOT NULL,
password VARCHAR(255) CHARACTER SET utf8 NOT NULL,
activation_code BIGINT(20) NOT NULL,
activation_date DATE,
allow_send_email CHAR(1) CHARACTER SET utf8 NOT NULL DEFAULT 0,
locale VARCHAR(5),
google_sync BOOL,
sync_code VARCHAR(255),
google_token VARCHAR(255),
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE MINDMAP (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
description VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
xml MEDIUMBLOB NOT NULL,
public BOOL NOT NULL DEFAULT 0,
creation_date DATETIME,
edition_date DATETIME,
creator_id INTEGER NOT NULL,
last_editor_id INTEGER NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(30)
CHARACTER SET utf8 NOT NULL,
creator_id INTEGER NOT NULL,
parent_label_id INTEGER,
color VARCHAR(7) NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id),
FOREIGN KEY (parent_label_id) REFERENCES LABEL (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE R_LABEL_MINDMAP (
mindmap_id INTEGER NOT NULL,
label_id INTEGER NOT NULL,
PRIMARY KEY (mindmap_id, label_id),
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id),
FOREIGN KEY (label_id) REFERENCES LABEL (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE MINDMAP_HISTORY
(id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
xml MEDIUMBLOB NOT NULL,
mindmap_id INTEGER NOT NULL,
creation_date DATETIME,
editor_id INTEGER NOT NULL,
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE COLLABORATION_PROPERTIES (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
starred BOOL NOT NULL DEFAULT 0,
mindmap_properties VARCHAR(512)
CHARACTER SET utf8
)
CHARACTER SET utf8;
CREATE TABLE COLLABORATION (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
colaborator_id INTEGER NOT NULL,
properties_id INTEGER NOT NULL,
mindmap_id INTEGER NOT NULL,
role_id INTEGER NOT NULL,
UNIQUE KEY UC_ROLE (mindmap_id,colaborator_id),
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id),
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE ACCESS_AUDITORY (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
login_date DATE,
user_id INTEGER NOT NULL,
FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
COMMIT;
|
#
# Command: mysql -u root -p < create_schemas.sql
#
USE wisemapping;
CREATE TABLE COLLABORATOR (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(255)
CHARACTER SET utf8 NOT NULL UNIQUE,
creation_date DATE
)
CHARACTER SET utf8;
CREATE TABLE USER (
colaborator_id INTEGER NOT NULL PRIMARY KEY,
authentication_type CHAR(1)
CHARACTER SET utf8 NOT NULL,
authenticator_uri VARCHAR(255)
CHARACTER SET utf8,
firstname VARCHAR(255) CHARACTER SET utf8 NOT NULL,
lastname VARCHAR(255) CHARACTER SET utf8 NOT NULL,
password VARCHAR(255) CHARACTER SET utf8 NOT NULL,
activation_code BIGINT(20) NOT NULL,
activation_date DATE,
allow_send_email CHAR(1) CHARACTER SET utf8 NOT NULL DEFAULT 0,
locale VARCHAR(5),
google_sync BOOL,
sync_code VARCHAR(255),
google_token VARCHAR(255),
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE MINDMAP (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
description VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
xml MEDIUMBLOB NOT NULL,
public BOOL NOT NULL DEFAULT 0,
creation_date DATETIME,
edition_date DATETIME,
creator_id INTEGER NOT NULL,
last_editor_id INTEGER NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(30)
CHARACTER SET utf8 NOT NULL,
creator_id INTEGER NOT NULL,
parent_label_id INTEGER,
color VARCHAR(7) NOT NULL,
iconName VARCHAR(50) NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id),
FOREIGN KEY (parent_label_id) REFERENCES LABEL (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE R_LABEL_MINDMAP (
mindmap_id INTEGER NOT NULL,
label_id INTEGER NOT NULL,
PRIMARY KEY (mindmap_id, label_id),
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id),
FOREIGN KEY (label_id) REFERENCES LABEL (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE MINDMAP_HISTORY
(id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
xml MEDIUMBLOB NOT NULL,
mindmap_id INTEGER NOT NULL,
creation_date DATETIME,
editor_id INTEGER NOT NULL,
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE COLLABORATION_PROPERTIES (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
starred BOOL NOT NULL DEFAULT 0,
mindmap_properties VARCHAR(512)
CHARACTER SET utf8
)
CHARACTER SET utf8;
CREATE TABLE COLLABORATION (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
colaborator_id INTEGER NOT NULL,
properties_id INTEGER NOT NULL,
mindmap_id INTEGER NOT NULL,
role_id INTEGER NOT NULL,
UNIQUE KEY UC_ROLE (mindmap_id,colaborator_id),
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id),
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE ACCESS_AUDITORY (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
login_date DATE,
user_id INTEGER NOT NULL,
FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
COMMIT;
|
@ -27,6 +27,7 @@ CREATE TABLE "LABEL" (
|
|||||||
creator_id INTEGER NOT NULL,
|
creator_id INTEGER NOT NULL,
|
||||||
parent_label_id INTEGER,
|
parent_label_id INTEGER,
|
||||||
color VARCHAR(7) NOT NULL,
|
color VARCHAR(7) NOT NULL,
|
||||||
|
iconName VARCHAR(50) NOT NULL,
|
||||||
FOREIGN KEY (creator_id) REFERENCES "USER" (colaborator_id)
|
FOREIGN KEY (creator_id) REFERENCES "USER" (colaborator_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
5
wise-webapp/db/wisemapping.properties
Normal file
5
wise-webapp/db/wisemapping.properties
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#HSQL Database Engine 2.7.1
|
||||||
|
#Mon Nov 27 22:17:59 PST 2023
|
||||||
|
modified=yes
|
||||||
|
tx_timestamp=270
|
||||||
|
version=2.7.1
|
46
wise-webapp/db/wisemapping.script
Normal file
46
wise-webapp/db/wisemapping.script
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
SET DATABASE UNIQUE NAME HSQLDB8C147822D0
|
||||||
|
SET DATABASE DEFAULT RESULT MEMORY ROWS 0
|
||||||
|
SET DATABASE EVENT LOG LEVEL 0
|
||||||
|
SET DATABASE TRANSACTION CONTROL LOCKS
|
||||||
|
SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED
|
||||||
|
SET DATABASE TRANSACTION ROLLBACK ON CONFLICT TRUE
|
||||||
|
SET DATABASE TEXT TABLE DEFAULTS ''
|
||||||
|
SET DATABASE SQL NAMES FALSE
|
||||||
|
SET DATABASE SQL RESTRICT EXEC FALSE
|
||||||
|
SET DATABASE SQL REFERENCES FALSE
|
||||||
|
SET DATABASE SQL SIZE TRUE
|
||||||
|
SET DATABASE SQL TYPES FALSE
|
||||||
|
SET DATABASE SQL TDC DELETE TRUE
|
||||||
|
SET DATABASE SQL TDC UPDATE TRUE
|
||||||
|
SET DATABASE SQL SYS INDEX NAMES TRUE
|
||||||
|
SET DATABASE SQL CONCAT NULLS TRUE
|
||||||
|
SET DATABASE SQL UNIQUE NULLS TRUE
|
||||||
|
SET DATABASE SQL CONVERT TRUNCATE TRUE
|
||||||
|
SET DATABASE SQL AVG SCALE 0
|
||||||
|
SET DATABASE SQL DOUBLE NAN TRUE
|
||||||
|
SET FILES WRITE DELAY 500 MILLIS
|
||||||
|
SET FILES BACKUP INCREMENT TRUE
|
||||||
|
SET FILES CACHE SIZE 10000
|
||||||
|
SET FILES CACHE ROWS 50000
|
||||||
|
SET FILES SCALE 32
|
||||||
|
SET FILES LOB SCALE 32
|
||||||
|
SET FILES DEFRAG 0
|
||||||
|
SET FILES NIO TRUE
|
||||||
|
SET FILES NIO SIZE 256
|
||||||
|
SET FILES LOG TRUE
|
||||||
|
SET FILES LOG SIZE 50
|
||||||
|
SET FILES CHECK 270
|
||||||
|
SET DATABASE COLLATION "SQL_TEXT" PAD SPACE
|
||||||
|
CREATE USER SA PASSWORD DIGEST 'd41d8cd98f00b204e9800998ecf8427e'
|
||||||
|
ALTER USER SA SET LOCAL TRUE
|
||||||
|
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
|
||||||
|
ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1
|
||||||
|
SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC
|
||||||
|
GRANT DBA TO SA
|
||||||
|
SET SCHEMA SYSTEM_LOBS
|
||||||
|
INSERT INTO BLOCKS VALUES(0,2147483647,0)
|
@ -1,20 +1,17 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<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/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>wise-webapp</artifactId>
|
||||||
|
<name>WiseMapping Webapp</name>
|
||||||
|
<url>http://www.wisemapping.org</url>
|
||||||
|
<version>5.1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.2.1</version>
|
<version>3.1.2</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>org.wisemapping</groupId>
|
|
||||||
<artifactId>wise-webapp</artifactId>
|
|
||||||
<version>5.1.0-SNAPSHOT</version>
|
|
||||||
|
|
||||||
<name>WiseMapping Webapp</name>
|
|
||||||
<url>http://www.wisemapping.org</url>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<com.wisemapping.version>5.1.0-SNAPSHOT</com.wisemapping.version>
|
<com.wisemapping.version>5.1.0-SNAPSHOT</com.wisemapping.version>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
@ -45,35 +42,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-test</artifactId>
|
|
||||||
<version>6.1.3</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
|
||||||
<version>5.9.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
|
||||||
<version>5.9.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
@ -86,6 +54,13 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-mail</artifactId>
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.testng</groupId>
|
||||||
|
<artifactId>testng</artifactId>
|
||||||
|
<version>7.7.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.intellij</groupId>
|
<groupId>com.intellij</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
@ -103,6 +78,18 @@
|
|||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<version>42.5.4</version>
|
<version>42.5.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.springframework</groupId>-->
|
||||||
|
<!-- <artifactId>spring-beans</artifactId>-->
|
||||||
|
<!-- <version>${org.springframework.version}</version>-->
|
||||||
|
<!-- <scope>compile</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.springframework</groupId>-->
|
||||||
|
<!-- <artifactId>spring-tx</artifactId>-->
|
||||||
|
<!-- <version>${org.springframework.version}</version>-->
|
||||||
|
<!-- <scope>compile</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-taglibs</artifactId>
|
<artifactId>spring-security-taglibs</artifactId>
|
||||||
@ -212,10 +199,6 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
@ -256,6 +239,118 @@
|
|||||||
</webResources>
|
</webResources>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jacoco</groupId>
|
||||||
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
|
<version>0.8.10</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>default-prepare-agent</id>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-agent</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>default-prepare-agent-integration</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-agent-integration</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/*Test*</exclude>
|
||||||
|
</excludes>
|
||||||
|
<propertyName>integrationTestArgLine</propertyName>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
|
||||||
|
<execution>
|
||||||
|
<id>default-check</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<rules>
|
||||||
|
<rule>
|
||||||
|
<element>BUNDLE</element>
|
||||||
|
<limits>
|
||||||
|
<limit>
|
||||||
|
<counter>COMPLEXITY</counter>
|
||||||
|
<value>COVEREDRATIO</value>
|
||||||
|
<minimum>0.10</minimum>
|
||||||
|
</limit>
|
||||||
|
</limits>
|
||||||
|
</rule>
|
||||||
|
</rules>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>default-report</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>report</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<version>11.0.15</version>
|
||||||
|
<configuration>
|
||||||
|
<httpConnector>
|
||||||
|
<port>8080</port>
|
||||||
|
</httpConnector>
|
||||||
|
<jvmArgs>-Ddatabase.base.url=${project.build.directory} -Djetty.port=8080</jvmArgs>
|
||||||
|
<stopPort>9999</stopPort>
|
||||||
|
<deployMode>FORK</deployMode>
|
||||||
|
<stopKey>foo</stopKey>
|
||||||
|
<webApp>
|
||||||
|
<war>${project.build.directory}/wisemapping.war</war>
|
||||||
|
<overrideDescriptor>${project.basedir}/webdefault.xml</overrideDescriptor>
|
||||||
|
</webApp>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>run-forked</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start-war</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<useTestScope>true</useTestScope>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-jetty</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
@ -1,9 +1,5 @@
|
|||||||
package com.wisemapping.config;
|
package com.wisemapping.config;
|
||||||
|
|
||||||
import com.wisemapping.config.common.CommonConfig;
|
|
||||||
import com.wisemapping.config.common.HibernateConfig;
|
|
||||||
import com.wisemapping.config.common.InterceptorsConfig;
|
|
||||||
import com.wisemapping.config.common.SecurityConfig;
|
|
||||||
import com.wisemapping.config.mvc.MvcAppConfig;
|
import com.wisemapping.config.mvc.MvcAppConfig;
|
||||||
import com.wisemapping.config.mvc.MvcSecurityConfig;
|
import com.wisemapping.config.mvc.MvcSecurityConfig;
|
||||||
import com.wisemapping.config.rest.ServletConfig;
|
import com.wisemapping.config.rest.ServletConfig;
|
||||||
@ -12,6 +8,8 @@ import org.springframework.boot.WebApplicationType;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.ImportResource;
|
||||||
import org.springframework.security.web.firewall.StrictHttpFirewall;
|
import org.springframework.security.web.firewall.StrictHttpFirewall;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ -20,9 +18,9 @@ public class Application {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
new SpringApplicationBuilder()
|
new SpringApplicationBuilder()
|
||||||
.parent(HibernateConfig.class, ServletConfig.class, CommonConfig.class, SecurityConfig.class).web(WebApplicationType.NONE)
|
.parent(MethodSecurityConfig.class, HibernateConfig.class).web(WebApplicationType.NONE)
|
||||||
// .child(MvcAppConfig.class, MvcSecurityConfig.class, SecurityConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET)
|
// .child(MvcAppConfig.class, MvcSecurityConfig.class).web(WebApplicationType.SERVLET)
|
||||||
.child(RestAppConfig.class, ServletConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET)
|
.child(RestAppConfig.class, ServletConfig.class).web(WebApplicationType.SERVLET)
|
||||||
.run(args);
|
.run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.wisemapping.config.common;
|
package com.wisemapping.config;
|
||||||
|
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
|||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
@EnableJpaRepositories(basePackages={"com.wisemapping.dao","com.wisemapping.service"})
|
@EnableJpaRepositories(basePackages={"com.wisemapping.dao"})
|
||||||
@EntityScan(basePackageClasses= User.class)
|
@EntityScan(basePackageClasses= User.class)
|
||||||
public class HibernateConfig {
|
public class HibernateConfig {
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.wisemapping.config;
|
||||||
|
|
||||||
|
import com.wisemapping.security.MapAccessPermissionEvaluation;
|
||||||
|
import com.wisemapping.security.ReadSecurityAdvise;
|
||||||
|
import com.wisemapping.security.UpdateSecurityAdvise;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.ImportResource;
|
||||||
|
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;
|
||||||
|
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableMethodSecurity(
|
||||||
|
securedEnabled = true,
|
||||||
|
jsr250Enabled = true)
|
||||||
|
@ImportResource(value = {"classpath:spring/wisemapping-service.xml"})
|
||||||
|
@ComponentScan({"com.wisemapping.security", "com.wisemapping.service", "com.wisemapping.dao", "com.wisemapping.util", "com.wisemapping.model"})
|
||||||
|
public class MethodSecurityConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReadSecurityAdvise readAdvice;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UpdateSecurityAdvise updateAdvice;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
protected MethodSecurityExpressionHandler createExpressionHandler() {
|
||||||
|
DefaultMethodSecurityExpressionHandler expressionHandler =
|
||||||
|
new DefaultMethodSecurityExpressionHandler();
|
||||||
|
|
||||||
|
final MapAccessPermissionEvaluation permissionEvaluator = new MapAccessPermissionEvaluation(readAdvice, updateAdvice);
|
||||||
|
expressionHandler.setPermissionEvaluator(permissionEvaluator);
|
||||||
|
return expressionHandler;
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +0,0 @@
|
|||||||
package com.wisemapping.config.common;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.ImportResource;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ImportResource(value = {"classpath:spring/wisemapping-mail.xml"})
|
|
||||||
@ComponentScan({"com.wisemapping.security", "com.wisemapping.service", "com.wisemapping.dao", "com.wisemapping.util", "com.wisemapping.model"})
|
|
||||||
public class CommonConfig {
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright [2022] [wisemapping]
|
|
||||||
*
|
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the license at
|
|
||||||
*
|
|
||||||
* http://www.wisemapping.org/license
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
package com.wisemapping.config.common;
|
|
||||||
|
|
||||||
import com.wisemapping.filter.RequestPropertiesInterceptor;
|
|
||||||
import com.wisemapping.filter.UserLocaleInterceptor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@ComponentScan("com.wisemapping.filter")
|
|
||||||
public class InterceptorsConfig implements WebMvcConfigurer {
|
|
||||||
@Autowired
|
|
||||||
private UserLocaleInterceptor userLocaleInterceptor;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RequestPropertiesInterceptor requestPropertiesInterceptor;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInterceptors(@NotNull final InterceptorRegistry registry) {
|
|
||||||
registry.addInterceptor(userLocaleInterceptor);
|
|
||||||
registry.addInterceptor(requestPropertiesInterceptor);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
package com.wisemapping.config.common;
|
|
||||||
|
|
||||||
import com.wisemapping.security.*;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;
|
|
||||||
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;
|
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
|
||||||
import org.springframework.security.authentication.AuthenticationProvider;
|
|
||||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
||||||
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableWebSecurity
|
|
||||||
@EnableMethodSecurity(
|
|
||||||
securedEnabled = true,
|
|
||||||
jsr250Enabled = true)
|
|
||||||
public class SecurityConfig {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ReadSecurityAdvise readAdvice;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UpdateSecurityAdvise updateAdvice;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserDetailsService userDetailsService;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
protected MethodSecurityExpressionHandler createExpressionHandler() {
|
|
||||||
DefaultMethodSecurityExpressionHandler expressionHandler =
|
|
||||||
new DefaultMethodSecurityExpressionHandler();
|
|
||||||
|
|
||||||
final MapAccessPermissionEvaluation permissionEvaluator = new MapAccessPermissionEvaluation(readAdvice, updateAdvice);
|
|
||||||
expressionHandler.setPermissionEvaluator(permissionEvaluator);
|
|
||||||
return expressionHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public PasswordEncoder passwordEncoder() {
|
|
||||||
return DefaultPasswordEncoderFactories.createDelegatingPasswordEncoder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public AuthenticationProvider googleAuthenticationProvider() {
|
|
||||||
return new GoogleAuthenticationProvider(userDetailsService);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public AuthenticationProvider dbAuthenticationProvider() {
|
|
||||||
final com.wisemapping.security.AuthenticationProvider provider =
|
|
||||||
new com.wisemapping.security.AuthenticationProvider();
|
|
||||||
provider.setEncoder(passwordEncoder());
|
|
||||||
provider.setUserDetailsService(userDetailsService);
|
|
||||||
return provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public AuthenticationManager authenticationManager(@NotNull HttpSecurity http)
|
|
||||||
throws Exception {
|
|
||||||
final AuthenticationManagerBuilder builder = http.getSharedObject(AuthenticationManagerBuilder.class);
|
|
||||||
builder.userDetailsService(userDetailsService)
|
|
||||||
.passwordEncoder(passwordEncoder());
|
|
||||||
|
|
||||||
builder.authenticationProvider(dbAuthenticationProvider());
|
|
||||||
builder.authenticationProvider(googleAuthenticationProvider());
|
|
||||||
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,6 +16,7 @@ import org.springframework.web.servlet.view.JstlView;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
|
@ImportResource(value = {"classpath:spring/wisemapping-servlet.xml"})
|
||||||
@ComponentScan("com.wisemapping.webmvc")
|
@ComponentScan("com.wisemapping.webmvc")
|
||||||
public class MvcAppConfig implements WebMvcConfigurer {
|
public class MvcAppConfig implements WebMvcConfigurer {
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,18 +11,21 @@ import org.springframework.security.web.SecurityFilterChain;
|
|||||||
import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher;
|
import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher;
|
||||||
import org.springframework.web.servlet.handler.HandlerMappingIntrospector;
|
import org.springframework.web.servlet.handler.HandlerMappingIntrospector;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
public class MvcSecurityConfig {
|
public class MvcSecurityConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Order(1)
|
@Order(1)
|
||||||
public SecurityFilterChain embeddedDisabledXOrigin(@NotNull final HttpSecurity http, @NotNull final MvcRequestMatcher.Builder mvc) throws Exception {
|
public SecurityFilterChain embeddedDisabledXOrigin(@NotNull final HttpSecurity http, @NotNull final HandlerMappingIntrospector introspector) throws Exception {
|
||||||
|
final MvcRequestMatcher.Builder matcher = new MvcRequestMatcher.Builder(introspector);
|
||||||
|
|
||||||
http
|
http
|
||||||
.securityMatchers((matchers) ->
|
.securityMatchers((matchers) ->
|
||||||
matchers.requestMatchers(mvc.pattern("/c/maps/*/embed")))
|
matchers.requestMatchers(matcher.pattern("c/maps/*/embed")))
|
||||||
.authorizeHttpRequests(
|
.authorizeHttpRequests(
|
||||||
(auth) -> auth.requestMatchers(mvc.pattern(("/c/maps/*/embed"))).permitAll())
|
(auth) -> auth.requestMatchers(matcher.pattern(("c/maps/*/embed"))).permitAll())
|
||||||
.headers((header -> header.frameOptions()
|
.headers((header -> header.frameOptions()
|
||||||
.disable()
|
.disable()
|
||||||
))
|
))
|
||||||
@ -31,31 +34,27 @@ public class MvcSecurityConfig {
|
|||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
MvcRequestMatcher.Builder mvc(HandlerMappingIntrospector introspector) {
|
|
||||||
return new MvcRequestMatcher.Builder(introspector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Order(2)
|
@Order(2)
|
||||||
public SecurityFilterChain mvcFilterChain(@NotNull final HttpSecurity http, @NotNull final MvcRequestMatcher.Builder mvc) throws Exception {
|
public SecurityFilterChain mvcFilterChain(@NotNull final HttpSecurity http, @NotNull final HandlerMappingIntrospector introspector) throws Exception {
|
||||||
|
final MvcRequestMatcher.Builder matcher = new MvcRequestMatcher.Builder(introspector);
|
||||||
http
|
http
|
||||||
.securityMatchers((matchers) ->
|
.securityMatchers((matchers) ->
|
||||||
matchers.requestMatchers(mvc.pattern("/c/**")))
|
matchers.requestMatchers(matcher.pattern("/c/**")))
|
||||||
.authorizeHttpRequests(
|
.authorizeHttpRequests(
|
||||||
(auth) ->
|
(auth) ->
|
||||||
auth
|
auth
|
||||||
.requestMatchers(mvc.pattern("/c/login")).permitAll()
|
.requestMatchers(matcher.pattern("/c/login")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/c/logout")).permitAll()
|
.requestMatchers(matcher.pattern("/c/logout")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/c/registration")).permitAll()
|
.requestMatchers(matcher.pattern("/c/registration")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/c/registration-success")).permitAll()
|
.requestMatchers(matcher.pattern("/c/registration-success")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/c/registration-google")).permitAll()
|
.requestMatchers(matcher.pattern("/c/registration-google")).permitAll()
|
||||||
|
|
||||||
.requestMatchers(mvc.pattern("/c/forgot-password")).permitAll()
|
.requestMatchers(matcher.pattern("/c/forgot-password")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/c/forgot-password-success")).permitAll()
|
.requestMatchers(matcher.pattern("/c/forgot-password-success")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/c/maps/*/try")).permitAll()
|
.requestMatchers(matcher.pattern("/c/maps/*/try")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/c/maps/*/public")).permitAll()
|
.requestMatchers(matcher.pattern("/c/maps/*/public")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/c/**")).hasAnyRole("USER", "ADMIN")
|
.requestMatchers(matcher.pattern("/c/**")).hasAnyRole("USER", "ADMIN")
|
||||||
.anyRequest().authenticated())
|
.anyRequest().authenticated())
|
||||||
.formLogin((loginForm) ->
|
.formLogin((loginForm) ->
|
||||||
loginForm.loginPage("/c/login")
|
loginForm.loginPage("/c/login")
|
||||||
@ -78,24 +77,25 @@ public class MvcSecurityConfig {
|
|||||||
.disable()
|
.disable()
|
||||||
))
|
))
|
||||||
.csrf((csrf) ->
|
.csrf((csrf) ->
|
||||||
csrf.ignoringRequestMatchers(mvc.pattern("/c/logout")));
|
csrf.ignoringRequestMatchers(matcher.pattern("/c/logout")));
|
||||||
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Order(3)
|
@Order(3)
|
||||||
public SecurityFilterChain shareResourcesFilterChain(@NotNull final HttpSecurity http, @NotNull final MvcRequestMatcher.Builder mvc) throws Exception {
|
public SecurityFilterChain shareResourcesFilterChain(@NotNull final HttpSecurity http, @NotNull final HandlerMappingIntrospector introspector) throws Exception {
|
||||||
|
final MvcRequestMatcher.Builder matcher = new MvcRequestMatcher.Builder(introspector);
|
||||||
|
|
||||||
return http.authorizeHttpRequests(
|
return http.authorizeHttpRequests(
|
||||||
(auth) ->
|
(auth) ->
|
||||||
auth.requestMatchers(mvc.pattern("/static/**")).permitAll().
|
auth.requestMatchers(matcher.pattern("/static/**")).permitAll().
|
||||||
requestMatchers(mvc.pattern("/css/**")).permitAll().
|
requestMatchers(matcher.pattern("/css/**")).permitAll().
|
||||||
requestMatchers(mvc.pattern("/js/**")).permitAll().
|
requestMatchers(matcher.pattern("/js/**")).permitAll().
|
||||||
// @todo: Why this is required ...
|
// @todo: Wht this is required ...
|
||||||
requestMatchers(mvc.pattern("/WEB-INF/jsp/*.jsp")).permitAll().
|
requestMatchers(matcher.pattern("/WEB-INF/jsp/*.jsp")).permitAll().
|
||||||
requestMatchers(mvc.pattern("/images/**")).permitAll().
|
requestMatchers(matcher.pattern("/images/**")).permitAll().
|
||||||
requestMatchers(mvc.pattern("/*")).permitAll()
|
requestMatchers(matcher.pattern("/*")).permitAll()
|
||||||
|
|
||||||
).build();
|
).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,10 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.ImportResource;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||||
@ -17,27 +21,38 @@ import static org.springframework.security.config.Customizer.withDefaults;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
|
@ImportResource(value = {"classpath:spring/wisemapping-service.xml"})
|
||||||
@ComponentScan({"com.wisemapping.rest"})
|
@ComponentScan({"com.wisemapping.rest"})
|
||||||
public class RestAppConfig {
|
public class RestAppConfig {
|
||||||
@Bean
|
@Bean
|
||||||
MvcRequestMatcher.Builder mvc(HandlerMappingIntrospector introspector) {
|
@Order(2)
|
||||||
return new MvcRequestMatcher.Builder(introspector);
|
SecurityFilterChain apiSecurityFilterChain(@NotNull final HttpSecurity http, @NotNull final HandlerMappingIntrospector introspector) throws Exception {
|
||||||
}
|
// final MvcRequestMatcher.Builder matcher = new MvcRequestMatcher.Builder(introspector).servletPath("**");
|
||||||
@Bean
|
// return http
|
||||||
SecurityFilterChain apiSecurityFilterChain(@NotNull final HttpSecurity http, @NotNull final MvcRequestMatcher.Builder mvc) throws Exception {
|
// .securityMatchers((matchers) ->
|
||||||
return http
|
// matchers.requestMatchers(matcher.pattern(("/**"))))
|
||||||
.csrf(AbstractHttpConfigurer::disable)
|
// .authorizeHttpRequests(auth -> auth
|
||||||
.authorizeHttpRequests(auth -> auth
|
// .requestMatchers(matcher.pattern("api/restfull/users/")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/api/restfull/users/")).permitAll()
|
// .requestMatchers(matcher.pattern("api/restfull/users/resetPassword")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/api/restfull/users/resetPassword")).permitAll()
|
// .requestMatchers(matcher.pattern("api/restfull/oauth2/googlecallback")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/api/restfull/oauth2/googlecallback")).permitAll()
|
// .requestMatchers(matcher.pattern("api/restfull/oauth2/confirmaccountsync")).permitAll()
|
||||||
.requestMatchers(mvc.pattern("/api/restfull/oauth2/confirmaccountsync")).permitAll()
|
// .requestMatchers(matcher.pattern("api/restfull/admin/**")).hasAnyRole("ADMIN")
|
||||||
.requestMatchers(mvc.pattern("/api/restfull/admin/**")).hasAnyRole("ADMIN")
|
// .requestMatchers(matcher.pattern("/**"))
|
||||||
.requestMatchers(mvc.pattern("/**")).hasAnyRole("USER", "ADMIN")
|
// .authenticated()
|
||||||
.anyRequest().authenticated()
|
//// .hasAnyRole("USER", "ADMIN")
|
||||||
)
|
// )
|
||||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
// .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||||
.httpBasic(withDefaults())
|
// .httpBasic(withDefaults())
|
||||||
.build();
|
// .csrf(AbstractHttpConfigurer::disable)
|
||||||
|
// .build();
|
||||||
|
|
||||||
|
http.csrf().disable()
|
||||||
|
.authorizeHttpRequests()
|
||||||
|
.anyRequest()
|
||||||
|
.authenticated()
|
||||||
|
.and()
|
||||||
|
.httpBasic(withDefaults());
|
||||||
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class LabelManagerImpl
|
|||||||
final TypedQuery<Label> query = entityManager.createQuery("from com.wisemapping.model.Label wisemapping where title=:title and creator=:creator", Label.class);
|
final TypedQuery<Label> query = entityManager.createQuery("from com.wisemapping.model.Label wisemapping where title=:title and creator=:creator", Label.class);
|
||||||
query.setParameter("title", title);
|
query.setParameter("title", title);
|
||||||
query.setParameter("creator", user);
|
query.setParameter("creator", user);
|
||||||
return query.getResultList().stream().findFirst().orElse(null);
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,14 +20,12 @@ package com.wisemapping.filter;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class RequestPropertiesInterceptor implements HandlerInterceptor {
|
public class RequestPropertiesInterceptor implements HandlerInterceptor {
|
||||||
@Value("${google.analytics.enabled}")
|
@Value("${google.analytics.enabled}")
|
||||||
private Boolean analyticsEnabled;
|
private Boolean analyticsEnabled;
|
||||||
@ -53,6 +51,9 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor {
|
|||||||
@Value("${site.baseurl:}")
|
@Value("${site.baseurl:}")
|
||||||
private String siteUrl;
|
private String siteUrl;
|
||||||
|
|
||||||
|
@Value("${security.type}")
|
||||||
|
private String securityType;
|
||||||
|
|
||||||
@Value("${security.oauth2.google.url}")
|
@Value("${security.oauth2.google.url}")
|
||||||
private String googleOauth2Url;
|
private String googleOauth2Url;
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor {
|
|||||||
request.setAttribute("site.homepage", siteHomepage);
|
request.setAttribute("site.homepage", siteHomepage);
|
||||||
request.setAttribute("site.static.js.url", siteStaticUrl);
|
request.setAttribute("site.static.js.url", siteStaticUrl);
|
||||||
|
|
||||||
request.setAttribute("security.type", "db");
|
request.setAttribute("security.type", securityType);
|
||||||
|
|
||||||
// If the property could not be resolved, try to infer one from the request...
|
// If the property could not be resolved, try to infer one from the request...
|
||||||
if (siteUrl.isBlank()) {
|
if (siteUrl.isBlank()) {
|
||||||
|
@ -21,7 +21,6 @@ package com.wisemapping.filter;
|
|||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@Component
|
|
||||||
public class UserLocaleInterceptor implements HandlerInterceptor {
|
public class UserLocaleInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,6 +39,8 @@ public class Label implements Serializable {
|
|||||||
private String title;
|
private String title;
|
||||||
@NotNull
|
@NotNull
|
||||||
private String color;
|
private String color;
|
||||||
|
@Nullable
|
||||||
|
private String iconName;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "creator_id", nullable = true, unique = true)
|
@JoinColumn(name = "creator_id", nullable = true, unique = true)
|
||||||
@ -94,6 +96,14 @@ public class Label implements Serializable {
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getIconName() {
|
||||||
|
return iconName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIconName(@NotNull String iconName) {
|
||||||
|
this.iconName = iconName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
|
@ -53,7 +53,7 @@ public class AccountController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LabelService labelService;
|
private LabelService labelService;
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/account/password", consumes = {"text/plain"})
|
@RequestMapping(method = RequestMethod.PUT, value = "account/password", consumes = {"text/plain"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void changePassword(@RequestBody String password) throws PasswordTooLongException {
|
public void changePassword(@RequestBody String password) throws PasswordTooLongException {
|
||||||
if (password == null) {
|
if (password == null) {
|
||||||
@ -69,13 +69,13 @@ public class AccountController extends BaseController {
|
|||||||
userService.changePassword(user);
|
userService.changePassword(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/account", produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.GET, value = "/account", produces = {"application/json"})
|
||||||
public RestUser fetchAccount() {
|
public RestUser fetchAccount() {
|
||||||
final User user = Utils.getUser(true);
|
final User user = Utils.getUser(true);
|
||||||
return new RestUser(user);
|
return new RestUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/account/firstname", consumes = {"text/plain"})
|
@RequestMapping(method = RequestMethod.PUT, value = "account/firstname", consumes = {"text/plain"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void changeFirstname(@RequestBody String firstname) {
|
public void changeFirstname(@RequestBody String firstname) {
|
||||||
if (firstname == null) {
|
if (firstname == null) {
|
||||||
@ -87,7 +87,7 @@ public class AccountController extends BaseController {
|
|||||||
userService.updateUser(user);
|
userService.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/account/lastname", consumes = {"text/plain"})
|
@RequestMapping(method = RequestMethod.PUT, value = "account/lastname", consumes = {"text/plain"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void changeLastName(@RequestBody String lastname) {
|
public void changeLastName(@RequestBody String lastname) {
|
||||||
if (lastname == null) {
|
if (lastname == null) {
|
||||||
@ -99,7 +99,7 @@ public class AccountController extends BaseController {
|
|||||||
userService.updateUser(user);
|
userService.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/account/locale", consumes = {"text/plain"})
|
@RequestMapping(method = RequestMethod.PUT, value = "account/locale", consumes = {"text/plain"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void changeLanguage(@RequestBody String language) {
|
public void changeLanguage(@RequestBody String language) {
|
||||||
if (language == null) {
|
if (language == null) {
|
||||||
@ -112,8 +112,8 @@ public class AccountController extends BaseController {
|
|||||||
userService.updateUser(user);
|
userService.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.DELETE, value = "account")
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/account")
|
|
||||||
public void deleteUser() throws WiseMappingException {
|
public void deleteUser() throws WiseMappingException {
|
||||||
// Delete collaborations ...
|
// Delete collaborations ...
|
||||||
final User user = Utils.getUser(true);
|
final User user = Utils.getUser(true);
|
||||||
|
@ -49,7 +49,7 @@ public class AdminController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MindmapService mindmapService;
|
private MindmapService mindmapService;
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/admin/users/{id}", produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.GET, value = "admin/users/{id}", produces = {"application/json"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public RestUser getUserById(@PathVariable int id) throws IOException {
|
public RestUser getUserById(@PathVariable int id) throws IOException {
|
||||||
final User userBy = userService.getUserBy(id);
|
final User userBy = userService.getUserBy(id);
|
||||||
@ -59,7 +59,7 @@ public class AdminController extends BaseController {
|
|||||||
return new RestUser(userBy);
|
return new RestUser(userBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/admin/users/email/{email:.+}", produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email:.+}", produces = {"application/json"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public RestUser getUserByEmail(@PathVariable String email) throws IOException {
|
public RestUser getUserByEmail(@PathVariable String email) throws IOException {
|
||||||
final User user = userService.getUserBy(email);
|
final User user = userService.getUserBy(email);
|
||||||
@ -69,7 +69,7 @@ public class AdminController extends BaseController {
|
|||||||
return new RestUser(user);
|
return new RestUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/api/restfull/admin/users", consumes = {"application/json"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.POST, value = "admin/users", consumes = {"application/json"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.CREATED)
|
@ResponseStatus(value = HttpStatus.CREATED)
|
||||||
public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws WiseMappingException {
|
public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws WiseMappingException {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
@ -103,10 +103,10 @@ public class AdminController extends BaseController {
|
|||||||
// Finally create the user ...
|
// Finally create the user ...
|
||||||
delegated.setAuthenticationType(AuthenticationType.DATABASE);
|
delegated.setAuthenticationType(AuthenticationType.DATABASE);
|
||||||
userService.createUser(delegated, false, true);
|
userService.createUser(delegated, false, true);
|
||||||
response.setHeader("Location", "/api/restfull/admin/users/" + user.getId());
|
response.setHeader("Location", "/service/admin/users/" + user.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/admin/users/{id}/password", consumes = {"text/plain"})
|
@RequestMapping(method = RequestMethod.PUT, value = "admin/users/{id}/password", consumes = {"text/plain"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void changePassword(@RequestBody String password, @PathVariable int id) throws WiseMappingException {
|
public void changePassword(@RequestBody String password, @PathVariable int id) throws WiseMappingException {
|
||||||
if (password == null) {
|
if (password == null) {
|
||||||
@ -121,7 +121,7 @@ public class AdminController extends BaseController {
|
|||||||
userService.changePassword(user);
|
userService.changePassword(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/admin/users/{id}")
|
@RequestMapping(method = RequestMethod.DELETE, value = "admin/users/{id}")
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void deleteUserByEmail(@PathVariable int id) throws WiseMappingException {
|
public void deleteUserByEmail(@PathVariable int id) throws WiseMappingException {
|
||||||
final User user = userService.getUserBy(id);
|
final User user = userService.getUserBy(id);
|
||||||
|
@ -49,7 +49,7 @@ public class LabelController extends BaseController {
|
|||||||
private LabelService labelService;
|
private LabelService labelService;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/api/restfull/labels", consumes = {"application/json"})
|
@RequestMapping(method = RequestMethod.POST, value = "/labels", consumes = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.CREATED)
|
@ResponseStatus(value = HttpStatus.CREATED)
|
||||||
public void createLabel(@RequestBody RestLabel restLabel, @NotNull HttpServletResponse response, @RequestParam(required = false) String title) throws WiseMappingException {
|
public void createLabel(@RequestBody RestLabel restLabel, @NotNull HttpServletResponse response, @RequestParam(required = false) String title) throws WiseMappingException {
|
||||||
// Overwrite title if it was specified by parameter.
|
// Overwrite title if it was specified by parameter.
|
||||||
@ -63,11 +63,11 @@ public class LabelController extends BaseController {
|
|||||||
final Label label = createLabel(restLabel);
|
final Label label = createLabel(restLabel);
|
||||||
|
|
||||||
// Return the new created label ...
|
// Return the new created label ...
|
||||||
response.setHeader("Location", "/api/restfull/labels/" + label.getId());
|
response.setHeader("Location", "/service/labels/" + label.getId());
|
||||||
response.setHeader("ResourceId", Long.toString(label.getId()));
|
response.setHeader("ResourceId", Long.toString(label.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/labels/", produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.GET, value = "/labels/", produces = {"application/json"})
|
||||||
public RestLabelList retrieveList() {
|
public RestLabelList retrieveList() {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
assert user != null;
|
assert user != null;
|
||||||
@ -75,7 +75,7 @@ public class LabelController extends BaseController {
|
|||||||
return new RestLabelList(all);
|
return new RestLabelList(all);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/labels/{id}")
|
@RequestMapping(method = RequestMethod.DELETE, value = "/labels/{id}")
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void deleteLabelById(@PathVariable int id) throws WiseMappingException {
|
public void deleteLabelById(@PathVariable int id) throws WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
|
@ -71,7 +71,7 @@ public class MindmapController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/{id}", produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.GET, value = "api/restfull/maps/{id}", produces = {"application/json"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public RestMindmap retrieve(@PathVariable int id) throws WiseMappingException {
|
public RestMindmap retrieve(@PathVariable int id) throws WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
@ -80,7 +80,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/", produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.GET, value = "api/restfull/maps/", produces = {"application/json"})
|
||||||
public RestMindmapList retrieveList(@RequestParam(required = false) String q) {
|
public RestMindmapList retrieveList(@RequestParam(required = false) String q) {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/{id}/history/", produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.GET, value = "api/restfull/maps/{id}/history/", produces = {"application/json"})
|
||||||
public RestMindmapHistoryList fetchHistory(@PathVariable int id) {
|
public RestMindmapHistoryList fetchHistory(@PathVariable int id) {
|
||||||
final List<MindMapHistory> histories = mindmapService.findMindmapHistory(id);
|
final List<MindMapHistory> histories = mindmapService.findMindmapHistory(id);
|
||||||
final RestMindmapHistoryList result = new RestMindmapHistoryList();
|
final RestMindmapHistoryList result = new RestMindmapHistoryList();
|
||||||
@ -104,7 +104,7 @@ public class MindmapController extends BaseController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/document", consumes = {"application/json"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.PUT, value = "api/restfull/maps/{id}/document", consumes = {"application/json"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(value = "/api/restfull/maps/{id}/history/{hid}", method = RequestMethod.POST)
|
@RequestMapping(value = "api/restfull/maps/{id}/history/{hid}", method = RequestMethod.POST)
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException {
|
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException {
|
||||||
final Mindmap mindmap = findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
@ -156,7 +156,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("permitAll()")
|
@PreAuthorize("permitAll()")
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/api/restfull/maps/{id}/document/xml", "/api/restfull/maps/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
|
@RequestMapping(method = RequestMethod.GET, value = {"api/restfull/maps/{id}/document/xml", "api/restfull/maps/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public byte[] retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
public byte[] retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
||||||
final Mindmap mindmap = findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
@ -166,7 +166,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = {"/api/restfull/maps/{id}/document/xml"}, consumes = {"text/plain"})
|
@RequestMapping(method = RequestMethod.PUT, value = {"api/restfull/maps/{id}/document/xml"}, consumes = {"text/plain"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public void updateDocument(@PathVariable int id, @RequestBody String xmlDoc) throws WiseMappingException, IOException {
|
public void updateDocument(@PathVariable int id, @RequestBody String xmlDoc) throws WiseMappingException, IOException {
|
||||||
final Mindmap mindmap = findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
@ -178,7 +178,7 @@ public class MindmapController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/api/restfull/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
|
@RequestMapping(method = RequestMethod.GET, value = {"api/restfull/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
||||||
final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid);
|
final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid);
|
||||||
@ -190,7 +190,7 @@ public class MindmapController extends BaseController {
|
|||||||
* The intention of this method is the update of several properties at once ...
|
* The intention of this method is the update of several properties at once ...
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}", consumes = {"application/json"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.PUT, value = "api/restfull/maps/{id}", consumes = {"application/json"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateProperties(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
|
public void updateProperties(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/title", consumes = {"text/plain"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.PUT, value = "api/restfull/maps/{id}/title", consumes = {"text/plain"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateTitle(@RequestBody String title, @PathVariable int id) throws WiseMappingException {
|
public void updateTitle(@RequestBody String title, @PathVariable int id) throws WiseMappingException {
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/api/restfull/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.POST, value = "api/restfull/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions {
|
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions {
|
||||||
final Mindmap mindMap = findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
@ -314,7 +314,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.PUT, value = "api/restfull/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void addCollab(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions, OwnerCannotChangeException {
|
public void addCollab(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions, OwnerCannotChangeException {
|
||||||
final Mindmap mindMap = findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
@ -382,7 +382,7 @@ public class MindmapController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/{id}/collabs", produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.GET, value = "api/restfull/maps/{id}/collabs", produces = {"application/json"})
|
||||||
public RestCollaborationList retrieveList(@PathVariable int id) throws MapCouldNotFoundException, AccessDeniedSecurityException {
|
public RestCollaborationList retrieveList(@PathVariable int id) throws MapCouldNotFoundException, AccessDeniedSecurityException {
|
||||||
final Mindmap mindMap = findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/description", consumes = {"text/plain"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.PUT, value = "api/restfull/maps/{id}/description", consumes = {"text/plain"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException {
|
public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException {
|
||||||
final Mindmap mindmap = findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
@ -408,7 +408,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.PUT, value = "api/restfull/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updatePublishState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
public void updatePublishState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/maps/{id}")
|
@RequestMapping(method = RequestMethod.DELETE, value = "api/restfull/maps/{id}")
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void deleteMapById(@PathVariable int id) throws IOException, WiseMappingException {
|
public void deleteMapById(@PathVariable int id) throws IOException, WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
@ -435,7 +435,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/maps/{id}/collabs")
|
@RequestMapping(method = RequestMethod.DELETE, value = "api/restfull/maps/{id}/collabs")
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void deleteCollabByEmail(@PathVariable int id, @RequestParam(required = false) String email) throws IOException, WiseMappingException {
|
public void deleteCollabByEmail(@PathVariable int id, @RequestParam(required = false) String email) throws IOException, WiseMappingException {
|
||||||
logger.debug("Deleting permission for email:" + email);
|
logger.debug("Deleting permission for email:" + email);
|
||||||
@ -467,7 +467,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/starred", consumes = {"text/plain"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.PUT, value = "api/restfull/maps/{id}/starred", consumes = {"text/plain"}, produces = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateStarredState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
public void updateStarredState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/{id}/starred", produces = {"text/plain"})
|
@RequestMapping(method = RequestMethod.GET, value = "api/restfull/maps/{id}/starred", produces = {"text/plain"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String fetchStarred(@PathVariable int id) throws WiseMappingException {
|
public String fetchStarred(@PathVariable int id) throws WiseMappingException {
|
||||||
final Mindmap mindmap = findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
@ -501,7 +501,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/maps/batch")
|
@RequestMapping(method = RequestMethod.DELETE, value = "api/restfull/maps/batch")
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void batchDelete(@RequestParam() String ids) throws IOException, WiseMappingException {
|
public void batchDelete(@RequestParam() String ids) throws IOException, WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
@ -519,7 +519,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/api/restfull/maps", consumes = {"application/xml", "application/json"})
|
@RequestMapping(method = RequestMethod.POST, value = "/maps", consumes = {"application/xml", "application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.CREATED)
|
@ResponseStatus(value = HttpStatus.CREATED)
|
||||||
public void createMap(@RequestBody(required = false) String mapXml, @NotNull HttpServletResponse response, @RequestParam(required = false) String title, @RequestParam(required = false) String description) throws IOException, WiseMappingException {
|
public void createMap(@RequestBody(required = false) String mapXml, @NotNull HttpServletResponse response, @RequestParam(required = false) String title, @RequestParam(required = false) String description) throws IOException, WiseMappingException {
|
||||||
|
|
||||||
@ -550,12 +550,12 @@ public class MindmapController extends BaseController {
|
|||||||
mindmapService.addMindmap(mindmap, user);
|
mindmapService.addMindmap(mindmap, user);
|
||||||
|
|
||||||
// Return the new created map ...
|
// Return the new created map ...
|
||||||
response.setHeader("Location", "/api/restfull/maps/" + mindmap.getId());
|
response.setHeader("Location", "/serviceapi/restfull/maps/" + mindmap.getId());
|
||||||
response.setHeader("ResourceId", Integer.toString(mindmap.getId()));
|
response.setHeader("ResourceId", Integer.toString(mindmap.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/api/restfull/maps/{id}", consumes = {"application/json"}, produces = {"application/json", "text/plain"})
|
@RequestMapping(method = RequestMethod.POST, value = "api/restfull/maps/{id}", consumes = {"application/json"}, produces = {"application/json", "text/plain"})
|
||||||
@ResponseStatus(value = HttpStatus.CREATED)
|
@ResponseStatus(value = HttpStatus.CREATED)
|
||||||
public void createDuplicate(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
|
public void createDuplicate(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
|
||||||
// Validate ...
|
// Validate ...
|
||||||
@ -578,13 +578,13 @@ public class MindmapController extends BaseController {
|
|||||||
mindmapService.addMindmap(clonedMap, user);
|
mindmapService.addMindmap(clonedMap, user);
|
||||||
|
|
||||||
// Return the new created map ...
|
// Return the new created map ...
|
||||||
response.setHeader("Location", "/api/restfull/maps/" + clonedMap.getId());
|
response.setHeader("Location", "/serviceapi/restfull/maps/" + clonedMap.getId());
|
||||||
response.setHeader("ResourceId", Integer.toString(clonedMap.getId()));
|
response.setHeader("ResourceId", Integer.toString(clonedMap.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/maps/{id}/labels/{lid}")
|
@RequestMapping(method = RequestMethod.DELETE, value = "api/restfull/maps/{id}/labels/{lid}")
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void removeLabelFromMap(@PathVariable int id, @PathVariable int lid) throws WiseMappingException {
|
public void removeLabelFromMap(@PathVariable int id, @PathVariable int lid) throws WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
@ -600,7 +600,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/api/restfull/maps/{id}/labels", consumes = {"application/json"})
|
@RequestMapping(method = RequestMethod.POST, value = "api/restfull/maps/{id}/labels", consumes = {"application/json"})
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
public void updateLabel(@PathVariable int id, @RequestBody int lid) throws WiseMappingException {
|
public void updateLabel(@PathVariable int id, @RequestBody int lid) throws WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
@ -615,7 +615,7 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/lock", consumes = {"text/plain"}, produces = {"application/json"})
|
@RequestMapping(method = RequestMethod.PUT, value = "api/restfull/maps/{id}/lock", consumes = {"text/plain"}, produces = {"application/json"})
|
||||||
public ResponseEntity<RestLockInfo> lockMindmap(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
public ResponseEntity<RestLockInfo> lockMindmap(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
final LockManager lockManager = mindmapService.getLockManager();
|
final LockManager lockManager = mindmapService.getLockManager();
|
||||||
|
@ -60,10 +60,18 @@ public class RestLabel {
|
|||||||
label.setColor(color);
|
label.setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIconName(@NotNull final String iconName) {
|
||||||
|
label.setIconName(iconName);
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable public String getColor() {
|
@Nullable public String getColor() {
|
||||||
return label.getColor();
|
return label.getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable public String getIconName() {
|
||||||
|
return label.getIconName();
|
||||||
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public Label getDelegated() {
|
public Label getDelegated() {
|
||||||
return label;
|
return label;
|
||||||
|
@ -28,7 +28,7 @@ public class DefaultPasswordEncoderFactories {
|
|||||||
|
|
||||||
public static final String ENCODING_ID = "bcrypt";
|
public static final String ENCODING_ID = "bcrypt";
|
||||||
|
|
||||||
public static PasswordEncoder createDelegatingPasswordEncoder() {
|
static PasswordEncoder createDelegatingPasswordEncoder() {
|
||||||
|
|
||||||
final Map<String, PasswordEncoder> encoders = new HashMap<>();
|
final Map<String, PasswordEncoder> encoders = new HashMap<>();
|
||||||
encoders.put(ENCODING_ID, new BCryptPasswordEncoder(12));
|
encoders.put(ENCODING_ID, new BCryptPasswordEncoder(12));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.wisemapping.security;
|
package com.wisemapping.security;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
@ -12,13 +11,17 @@ public class GoogleAuthenticationProvider implements org.springframework.securit
|
|||||||
|
|
||||||
private UserDetailsService userDetailsService;
|
private UserDetailsService userDetailsService;
|
||||||
|
|
||||||
public GoogleAuthenticationProvider(@NotNull UserDetailsService userDetailsService) {
|
public UserDetailsService getUserDetailsService() {
|
||||||
|
return userDetailsService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserDetailsService(UserDetailsService userDetailsService) {
|
||||||
this.userDetailsService = userDetailsService;
|
this.userDetailsService = userDetailsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authenticate the given PreAuthenticatedAuthenticationToken.
|
* Authenticate the given PreAuthenticatedAuthenticationToken.
|
||||||
* <p>
|
*
|
||||||
* If the principal contained in the authentication object is null, the request will
|
* If the principal contained in the authentication object is null, the request will
|
||||||
* be ignored to allow other providers to authenticate it.
|
* be ignored to allow other providers to authenticate it.
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ public final class MailerService {
|
|||||||
|
|
||||||
//~ Instance fields ......................................................................................
|
//~ Instance fields ......................................................................................
|
||||||
|
|
||||||
// @Autowired
|
@Autowired
|
||||||
private JavaMailSender mailSender;
|
private JavaMailSender mailSender;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -54,6 +54,7 @@ public class LabelValidator implements Validator {
|
|||||||
private void validateLabel(@NotNull final Label label, @NotNull final Errors errors) {
|
private void validateLabel(@NotNull final Label label, @NotNull final Errors errors) {
|
||||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", Messages.FIELD_REQUIRED);
|
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", Messages.FIELD_REQUIRED);
|
||||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "color", Messages.FIELD_REQUIRED);
|
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "color", Messages.FIELD_REQUIRED);
|
||||||
|
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "iconName", Messages.FIELD_REQUIRED);
|
||||||
final String title = label.getTitle();
|
final String title = label.getTitle();
|
||||||
ValidatorUtils.rejectIfExceeded(
|
ValidatorUtils.rejectIfExceeded(
|
||||||
errors,
|
errors,
|
||||||
|
@ -7,7 +7,6 @@ spring.datasource.initialize=true
|
|||||||
spring.main.allow-circular-references=true
|
spring.main.allow-circular-references=true
|
||||||
|
|
||||||
spring.jpa.open-in-view=true
|
spring.jpa.open-in-view=true
|
||||||
spring.jpa.hibernate.ddl-auto=none
|
|
||||||
spring.jpa.properties.hibernate.current_session_context_class=thread
|
spring.jpa.properties.hibernate.current_session_context_class=thread
|
||||||
spring.jpa.properties.hibernate.format_sql=true
|
spring.jpa.properties.hibernate.format_sql=true
|
||||||
spring.sql.init.mode=always
|
spring.sql.init.mode=always
|
||||||
@ -93,6 +92,32 @@ google.analytics.account=UA-XXXX
|
|||||||
##################################################################################
|
##################################################################################
|
||||||
google.ads.enabled=false
|
google.ads.enabled=false
|
||||||
|
|
||||||
|
#######################################################################################
|
||||||
|
# Authentication Configuration Section
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
# Two type of security are supported:
|
||||||
|
# - db: User are stored in the database. Registration is required in advance.
|
||||||
|
# - ldap: Authentication takes place using a LDAP. In this case, security.ldap.* must be configured.
|
||||||
|
security.type=db
|
||||||
|
|
||||||
|
# LDAP Configuration properties.
|
||||||
|
security.ldap.server=ldap://localhost:389
|
||||||
|
|
||||||
|
# If anonymous password is required, change the wisemapping-security-ldap.xml removing the
|
||||||
|
security.ldap.server.user=cn=pveiga,dc=wisemapping,dc=com
|
||||||
|
security.ldap.server.password=password
|
||||||
|
security.ldap.basedn=dc=wisemapping,dc=com
|
||||||
|
|
||||||
|
# This will be concatenated as part of the DN. In this case, I will be "ou=people".
|
||||||
|
# In case this need to be changed, modify the wisemapping-security-ldap.xml.
|
||||||
|
security.ldap.subDn=ou=people
|
||||||
|
|
||||||
|
# Attribute used as authentication login (Eg: in this case, the user email will be used)
|
||||||
|
security.ldap.auth.attribute=mail
|
||||||
|
security.ldap.lastName.attribute=sn
|
||||||
|
security.ldap.firstName.attribute=givenName
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
# Google OAuth Authentication
|
# Google OAuth Authentication
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
@ -125,7 +150,6 @@ security.oauth2.google.url=https//review
|
|||||||
# Database Configuration
|
# Database Configuration
|
||||||
##################################################################################
|
##################################################################################
|
||||||
|
|
||||||
spring.datasource.platform=hsqldb
|
|
||||||
database.base.url=/Users/veigap/
|
database.base.url=/Users/veigap/
|
||||||
spring.datasource.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping
|
spring.datasource.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping
|
||||||
spring.datasource.username=sa
|
spring.datasource.username=sa
|
||||||
|
@ -1 +1 @@
|
|||||||
CREATE TABLE COLLABORATOR (
id INTEGER NOT NULL IDENTITY,
email VARCHAR(255) NOT NULL UNIQUE,
creation_date DATE
);
CREATE TABLE USER (
colaborator_id INTEGER NOT NULL IDENTITY,
authentication_type CHAR(1) NOT NULL,
authenticator_uri VARCHAR(255) NULL,
firstname VARCHAR(255) NOT NULL,
lastname VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
activation_code BIGINT NOT NULL,
activation_date DATE,
allow_send_email CHAR(1) NOT NULL,
locale VARCHAR(5),
google_sync BOOLEAN,
sync_code VARCHAR(255),
google_token VARCHAR(255),
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id)
);
CREATE TABLE MINDMAP (
id INTEGER NOT NULL IDENTITY,
title VARCHAR(255) NOT NULL,
description VARCHAR(255),
xml LONGVARBINARY NOT NULL,
public BOOLEAN NOT NULL,
creation_date DATETIME,
edition_date DATETIME,
creator_id INTEGER NOT NULL,
last_editor_id INTEGER NOT NULL
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
);
CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY IDENTITY,
title VARCHAR(30),
creator_id INTEGER NOT NULL,
parent_label_id INTEGER,
color VARCHAR(7) NOT NULL,
--FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
);
CREATE TABLE R_LABEL_MINDMAP (
mindmap_id INTEGER NOT NULL,
label_id INTEGER NOT NULL,
PRIMARY KEY (mindmap_id, label_id),
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id),
FOREIGN KEY (label_id) REFERENCES LABEL (id) ON DELETE CASCADE ON UPDATE NO ACTION
);
CREATE TABLE MINDMAP_HISTORY (
id INTEGER NOT NULL IDENTITY,
xml LONGVARBINARY NOT NULL,
mindmap_id INTEGER NOT NULL,
creation_date DATETIME,
editor_id INTEGER NOT NULL,
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)
);
CREATE TABLE COLLABORATION_PROPERTIES (
id INTEGER NOT NULL IDENTITY,
starred BOOLEAN NOT NULL,
mindmap_properties VARCHAR(512)
);
CREATE TABLE COLLABORATION (
id INTEGER NOT NULL IDENTITY,
colaborator_id INTEGER NOT NULL,
properties_id INTEGER NOT NULL,
mindmap_id INTEGER NOT NULL,
role_id INTEGER NOT NULL,
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id),
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id),
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
);
CREATE TABLE ACCESS_AUDITORY (
id INTEGER NOT NULL IDENTITY,
user_id INTEGER NOT NULL,
login_date DATE,
FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
COMMIT;
|
CREATE TABLE COLLABORATOR (
id INTEGER NOT NULL IDENTITY,
email VARCHAR(255) NOT NULL UNIQUE,
creation_date DATE
);
CREATE TABLE USER (
colaborator_id INTEGER NOT NULL IDENTITY,
authentication_type CHAR(1) NOT NULL,
authenticator_uri VARCHAR(255) NULL,
firstname VARCHAR(255) NOT NULL,
lastname VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
activation_code BIGINT NOT NULL,
activation_date DATE,
allow_send_email CHAR(1) NOT NULL,
locale VARCHAR(5),
google_sync BOOLEAN,
sync_code VARCHAR(255),
google_token VARCHAR(255),
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id)
);
CREATE TABLE MINDMAP (
id INTEGER NOT NULL IDENTITY,
title VARCHAR(255) NOT NULL,
description VARCHAR(255),
xml LONGVARBINARY NOT NULL,
public BOOLEAN NOT NULL,
creation_date DATETIME,
edition_date DATETIME,
creator_id INTEGER NOT NULL,
last_editor_id INTEGER NOT NULL
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
);
CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY IDENTITY,
title VARCHAR(30),
creator_id INTEGER NOT NULL,
parent_label_id INTEGER,
color VARCHAR(7) NOT NULL,
iconName VARCHAR(50) NOT NULL
--FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
);
CREATE TABLE R_LABEL_MINDMAP (
mindmap_id INTEGER NOT NULL,
label_id INTEGER NOT NULL,
PRIMARY KEY (mindmap_id, label_id),
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id),
FOREIGN KEY (label_id) REFERENCES LABEL (id) ON DELETE CASCADE ON UPDATE NO ACTION
);
CREATE TABLE MINDMAP_HISTORY (
id INTEGER NOT NULL IDENTITY,
xml LONGVARBINARY NOT NULL,
mindmap_id INTEGER NOT NULL,
creation_date DATETIME,
editor_id INTEGER NOT NULL,
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)
);
CREATE TABLE COLLABORATION_PROPERTIES (
id INTEGER NOT NULL IDENTITY,
starred BOOLEAN NOT NULL,
mindmap_properties VARCHAR(512)
);
CREATE TABLE COLLABORATION (
id INTEGER NOT NULL IDENTITY,
colaborator_id INTEGER NOT NULL,
properties_id INTEGER NOT NULL,
mindmap_id INTEGER NOT NULL,
role_id INTEGER NOT NULL,
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id),
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id),
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
);
CREATE TABLE ACCESS_AUDITORY (
id INTEGER NOT NULL IDENTITY,
user_id INTEGER NOT NULL,
login_date DATE,
FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
COMMIT;
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
||||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
|
|
||||||
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
|
|
||||||
<property name="defaultEncoding" value="UTF-8"/>
|
|
||||||
<property name="basenames">
|
|
||||||
<list>
|
|
||||||
<value>messages</value>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
</beans>
|
|
@ -49,13 +49,4 @@
|
|||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
|
|
||||||
<property name="defaultEncoding" value="UTF-8"/>
|
|
||||||
<property name="basenames">
|
|
||||||
<list>
|
|
||||||
<value>messages</value>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
</beans>
|
</beans>
|
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:sec="http://www.springframework.org/schema/security"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/security
|
||||||
|
http://www.springframework.org/schema/security/spring-security.xsd">
|
||||||
|
|
||||||
|
<bean id="passwordEncoder" class="com.wisemapping.security.DefaultPasswordEncoderFactories" factory-method="createDelegatingPasswordEncoder"/>
|
||||||
|
|
||||||
|
<sec:authentication-manager alias="authenticationManager">
|
||||||
|
<sec:authentication-provider ref="dbAuthenticationProvider" />
|
||||||
|
<sec:authentication-provider ref="googleAuthenticationProvider" />
|
||||||
|
<sec:authentication-provider user-service-ref="userDetailsService"/>
|
||||||
|
</sec:authentication-manager>
|
||||||
|
|
||||||
|
<bean id="dbAuthenticationProvider" class="com.wisemapping.security.AuthenticationProvider">
|
||||||
|
<property name="userDetailsService" ref="userDetailsService"/>
|
||||||
|
<property name="encoder" ref="passwordEncoder"/>
|
||||||
|
</bean>
|
||||||
|
<bean id="googleAuthenticationProvider" class="com.wisemapping.security.GoogleAuthenticationProvider">
|
||||||
|
<property name="userDetailsService" ref="userDetailsService"/>
|
||||||
|
</bean>
|
||||||
|
</beans>
|
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:sec="http://www.springframework.org/schema/security"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/security
|
||||||
|
http://www.springframework.org/schema/security/spring-security.xsd">
|
||||||
|
|
||||||
|
<bean id="passwordEncoder" class="com.wisemapping.security.DefaultPasswordEncoderFactories" factory-method="createDelegatingPasswordEncoder"/>
|
||||||
|
|
||||||
|
<sec:authentication-manager>
|
||||||
|
<sec:authentication-provider ref="ldapAuthProvider"/>
|
||||||
|
</sec:authentication-manager>
|
||||||
|
|
||||||
|
<!-- ================================================== -->
|
||||||
|
<!-- LDAP Connection settings -->
|
||||||
|
<!-- ================================================== -->
|
||||||
|
|
||||||
|
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
|
||||||
|
<property name="url" value="${security.ldap.server}"/>
|
||||||
|
<property name="userDn" value="${security.ldap.server.user}"/>
|
||||||
|
<property name="password" value="${security.ldap.server.password}"/>
|
||||||
|
<property name="base" value="${security.ldap.basedn}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- ================================================== -->
|
||||||
|
<!-- Authentication and Authorization Handlers -->
|
||||||
|
<!-- ================================================== -->
|
||||||
|
<bean id="ldapAuthProvider"
|
||||||
|
class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
|
||||||
|
<constructor-arg>
|
||||||
|
<bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
|
||||||
|
<constructor-arg ref="contextSource"/>
|
||||||
|
<property name="userSearch" ref="ldapUserSearch"/>
|
||||||
|
</bean>
|
||||||
|
</constructor-arg>
|
||||||
|
<property name="userDetailsContextMapper" ref="userDetailsContextMapper"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="userDetailsContextMapper" class="com.wisemapping.security.ldap.LdapUserDetailsContextMapper">
|
||||||
|
<property name="userService" ref="userService"/>
|
||||||
|
<property name="ldapAttributeFirstName" value="${security.ldap.firstName.attribute}"/>
|
||||||
|
<property name="ldapAttributeLastName" value="${security.ldap.lastName.attribute}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="ldapUserSearch"
|
||||||
|
class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
|
||||||
|
<constructor-arg index="0" value="${security.ldap.subDn}"/>
|
||||||
|
<constructor-arg index="1" value="(${security.ldap.auth.attribute}={0})"/>
|
||||||
|
<constructor-arg index="2" ref="contextSource"/>
|
||||||
|
<property name="searchSubtree" value="true"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
@ -28,4 +28,6 @@
|
|||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<import resource="wisemapping-security-${security.type:db}.xml"/>
|
||||||
</beans>
|
</beans>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/mvc
|
||||||
|
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
||||||
|
|
||||||
|
<!-- Interceptors Registration -->
|
||||||
|
<mvc:interceptors>
|
||||||
|
<bean id="userLocaleInterceptor" class="com.wisemapping.filter.UserLocaleInterceptor"/>
|
||||||
|
<bean id="requestInterceptor" class="com.wisemapping.filter.RequestPropertiesInterceptor"/>
|
||||||
|
</mvc:interceptors>
|
||||||
|
|
||||||
|
<!-- <bean id="localeResolver"-->
|
||||||
|
<!-- class="org.springframework.web.servlet.i18n.SessionLocaleResolver">-->
|
||||||
|
<!-- </bean>-->
|
||||||
|
|
||||||
|
</beans>
|
19
wise-webapp/src/main/webapp/WEB-INF/log4j2-stdout.xml
Normal file
19
wise-webapp/src/main/webapp/WEB-INF/log4j2-stdout.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Configuration status="warn">
|
||||||
|
<Appenders>
|
||||||
|
<Console name="LogToConsole" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
|
||||||
|
</Console>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Logger name="com.wisemapping" level="warn">
|
||||||
|
<AppenderRef ref="LogToConsole"/>
|
||||||
|
</Logger>
|
||||||
|
<Logger name="org.springframework" level="warn">
|
||||||
|
<AppenderRef ref="LogToConsole"/>
|
||||||
|
</Logger>
|
||||||
|
<Root level="warn">
|
||||||
|
<AppenderRef ref="LogToConsole"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
131
wise-webapp/src/main/webapp/WEB-INF/web.xml
Normal file
131
wise-webapp/src/main/webapp/WEB-INF/web.xml
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<!--<?xml version="1.0" encoding="UTF-8"?>-->
|
||||||
|
|
||||||
|
<!--<web-app version="5.0"-->
|
||||||
|
<!-- xmlns="https://jakarta.ee/xml/ns/jakartaee"-->
|
||||||
|
<!-- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"-->
|
||||||
|
<!-- xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd">-->
|
||||||
|
|
||||||
|
<!-- <filter>-->
|
||||||
|
<!-- <filter-name>charsetFilter</filter-name>-->
|
||||||
|
<!-- <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>-->
|
||||||
|
<!-- <init-param>-->
|
||||||
|
<!-- <param-name>encoding</param-name>-->
|
||||||
|
<!-- <param-value>UTF-8</param-value>-->
|
||||||
|
<!-- </init-param>-->
|
||||||
|
<!-- </filter>-->
|
||||||
|
|
||||||
|
<!-- <distributable/>-->
|
||||||
|
|
||||||
|
<!-- <context-param>-->
|
||||||
|
<!-- <param-name>jakarta.servlet.jsp.jstl.fmt.localizationContext</param-name>-->
|
||||||
|
<!-- <param-value>messages</param-value>-->
|
||||||
|
<!-- </context-param>-->
|
||||||
|
|
||||||
|
<!-- <context-param>-->
|
||||||
|
<!-- <param-name>contextConfigLocation</param-name>-->
|
||||||
|
<!-- <param-value>-->
|
||||||
|
<!-- classpath:spring/wisemapping-common.xml-->
|
||||||
|
<!-- </param-value>-->
|
||||||
|
<!-- </context-param>-->
|
||||||
|
|
||||||
|
<!-- <context-param>-->
|
||||||
|
<!-- <param-name>contextInitializerClasses</param-name>-->
|
||||||
|
<!-- <param-value>com.wisemapping.webmvc.ApplicationContextInitializer</param-value>-->
|
||||||
|
<!-- </context-param>-->
|
||||||
|
<!-- -->
|
||||||
|
<!-- <!–-->
|
||||||
|
<!-- - Loads the root application context of this web app at startup.-->
|
||||||
|
<!-- - The application context is then available via-->
|
||||||
|
<!-- - WebApplicationContextUtils.getWebApplicationContext(servletContext).-->
|
||||||
|
<!-- –>-->
|
||||||
|
|
||||||
|
<!-- <listener>-->
|
||||||
|
<!-- <listener-class>com.wisemapping.listener.UnlockOnExpireListener</listener-class>-->
|
||||||
|
<!-- </listener>-->
|
||||||
|
|
||||||
|
<!-- <filter>-->
|
||||||
|
<!-- <filter-name>hibernate</filter-name>-->
|
||||||
|
<!-- <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class>-->
|
||||||
|
<!-- <init-param>-->
|
||||||
|
<!-- <param-name>singleSession</param-name>-->
|
||||||
|
<!-- <param-value>true</param-value>-->
|
||||||
|
<!-- </init-param>-->
|
||||||
|
<!-- <init-param>-->
|
||||||
|
<!-- <param-name>sessionFactoryBeanName</param-name>-->
|
||||||
|
<!-- <param-value>sessionFactory</param-value>-->
|
||||||
|
<!-- </init-param>-->
|
||||||
|
<!-- </filter>-->
|
||||||
|
|
||||||
|
<!-- <filter>-->
|
||||||
|
<!-- <filter-name>springSecurityFilterChain</filter-name>-->
|
||||||
|
<!-- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>-->
|
||||||
|
<!-- </filter>-->
|
||||||
|
|
||||||
|
<!-- <filter-mapping>-->
|
||||||
|
<!-- <filter-name>springSecurityFilterChain</filter-name>-->
|
||||||
|
<!-- <url-pattern>/*</url-pattern>-->
|
||||||
|
<!-- </filter-mapping>-->
|
||||||
|
|
||||||
|
<!-- <filter-mapping>-->
|
||||||
|
<!-- <filter-name>hibernate</filter-name>-->
|
||||||
|
<!-- <url-pattern>/*</url-pattern>-->
|
||||||
|
<!-- </filter-mapping>-->
|
||||||
|
|
||||||
|
<!-- <filter-mapping>-->
|
||||||
|
<!-- <filter-name>charsetFilter</filter-name>-->
|
||||||
|
<!-- <url-pattern>/*</url-pattern>-->
|
||||||
|
<!-- </filter-mapping>-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <listener>-->
|
||||||
|
<!-- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>-->
|
||||||
|
<!-- </listener>-->
|
||||||
|
|
||||||
|
<!-- <servlet>-->
|
||||||
|
<!-- <servlet-name>mvc-servlet</servlet-name>-->
|
||||||
|
<!-- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>-->
|
||||||
|
<!-- <init-param>-->
|
||||||
|
<!-- <param-name>contextConfigLocation</param-name>-->
|
||||||
|
<!-- <param-value>-->
|
||||||
|
<!-- classpath:spring/wisemapping-servlet.xml-->
|
||||||
|
<!-- </param-value>-->
|
||||||
|
<!-- </init-param>-->
|
||||||
|
<!-- <load-on-startup>1</load-on-startup>-->
|
||||||
|
<!-- </servlet>-->
|
||||||
|
|
||||||
|
<!-- <servlet>-->
|
||||||
|
<!-- <servlet-name>mvc-rest</servlet-name>-->
|
||||||
|
<!-- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>-->
|
||||||
|
<!-- <init-param>-->
|
||||||
|
<!-- <param-name>contextConfigLocation</param-name>-->
|
||||||
|
<!-- <param-value>-->
|
||||||
|
<!-- classpath:spring/wisemapping-rest.xml-->
|
||||||
|
<!-- </param-value>-->
|
||||||
|
<!-- </init-param>-->
|
||||||
|
<!-- <load-on-startup>1</load-on-startup>-->
|
||||||
|
<!-- </servlet>-->
|
||||||
|
|
||||||
|
<!-- <servlet-mapping>-->
|
||||||
|
<!-- <servlet-name>mvc-servlet</servlet-name>-->
|
||||||
|
<!-- <url-pattern>/c/*</url-pattern>-->
|
||||||
|
<!-- </servlet-mapping>-->
|
||||||
|
|
||||||
|
<!-- <servlet-mapping>-->
|
||||||
|
<!-- <servlet-name>mvc-rest</servlet-name>-->
|
||||||
|
<!-- <url-pattern>/service/*</url-pattern>-->
|
||||||
|
<!-- </servlet-mapping>-->
|
||||||
|
|
||||||
|
<!-- <servlet-mapping>-->
|
||||||
|
<!-- <servlet-name>mvc-rest</servlet-name>-->
|
||||||
|
<!-- <url-pattern>/c/restful/*</url-pattern>-->
|
||||||
|
<!-- </servlet-mapping>-->
|
||||||
|
|
||||||
|
<!-- <welcome-file-list>-->
|
||||||
|
<!-- <welcome-file>-->
|
||||||
|
<!-- index.jsp-->
|
||||||
|
<!-- </welcome-file>-->
|
||||||
|
<!-- </welcome-file-list>-->
|
||||||
|
<!-- <session-config>-->
|
||||||
|
<!-- <session-timeout>1440</session-timeout>-->
|
||||||
|
<!-- </session-config>-->
|
||||||
|
<!--</web-app>-->
|
@ -15,8 +15,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class RestHelper {
|
public class RestHelper {
|
||||||
|
|
||||||
public static final String HOST_PORT = "http://localhost:8081";
|
public static final String HOST_PORT = "http://localhost:8080";
|
||||||
public static final String BASE_REST_URL = HOST_PORT + "/api/restfull";
|
public static final String BASE_REST_URL = HOST_PORT + "/service";
|
||||||
public static final String ADMIN_CREDENTIALS = "admin@wisemapping.org" + ":" + "test";
|
public static final String ADMIN_CREDENTIALS = "admin@wisemapping.org" + ":" + "test";
|
||||||
public static final String COLOR = "#000000";
|
public static final String COLOR = "#000000";
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ public class RestLabelITCase {
|
|||||||
|
|
||||||
private String userEmail;
|
private String userEmail;
|
||||||
private static final String COLOR = "#000000";
|
private static final String COLOR = "#000000";
|
||||||
|
private static final String ICON = "glyphicon glyphicon-tag";
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
void createUser() {
|
void createUser() {
|
||||||
@ -36,17 +37,17 @@ public class RestLabelITCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||||
public void createLabel(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
public void createLabel(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||||
final HttpHeaders requestHeaders = RestHelper.createHeaders(mediaType);
|
final HttpHeaders requestHeaders = RestHelper.createHeaders(mediaType);
|
||||||
final RestTemplate template = RestHelper.createTemplate(userEmail + ":" + "admin");
|
final RestTemplate template = RestHelper.createTemplate(userEmail + ":" + "admin");
|
||||||
|
|
||||||
// Create a new label
|
// Create a new label
|
||||||
final String title1 = "Label 1 - " + mediaType;
|
final String title1 = "Label 1 - " + mediaType.toString();
|
||||||
addNewLabel(requestHeaders, template, title1, COLOR);
|
addNewLabel(requestHeaders, template, title1, COLOR, ICON);
|
||||||
|
|
||||||
// Create a new label
|
// Create a new label
|
||||||
final String title2 = "Label 2 - " + mediaType;
|
final String title2 = "Label 2 - " + mediaType.toString();
|
||||||
addNewLabel(requestHeaders, template, title2, COLOR);
|
addNewLabel(requestHeaders, template, title2, COLOR, ICON);
|
||||||
|
|
||||||
// Check that the label has been created ...
|
// Check that the label has been created ...
|
||||||
final RestLabelList restLabelList = getLabels(requestHeaders, template);
|
final RestLabelList restLabelList = getLabels(requestHeaders, template);
|
||||||
@ -75,13 +76,13 @@ public class RestLabelITCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||||
public void createLabelWithoutRequiredField(final @NotNull MediaType mediaType) throws IOException {
|
public void createLabelWithoutRequiredField(final @NotNull MediaType mediaType) throws IOException, WiseMappingException {
|
||||||
final HttpHeaders requestHeaders = RestHelper.createHeaders(mediaType);
|
final HttpHeaders requestHeaders = RestHelper.createHeaders(mediaType);
|
||||||
requestHeaders.set(HttpHeaders.ACCEPT_LANGUAGE, "en");
|
requestHeaders.set(HttpHeaders.ACCEPT_LANGUAGE, "en");
|
||||||
final RestTemplate template = RestHelper.createTemplate(userEmail + ":" + "admin");
|
final RestTemplate template = RestHelper.createTemplate(userEmail + ":" + "admin");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
addNewLabel(requestHeaders, template, null, COLOR);
|
addNewLabel(requestHeaders, template, null, COLOR, ICON);
|
||||||
fail("Wrong response");
|
fail("Wrong response");
|
||||||
} catch (HttpClientErrorException e) {
|
} catch (HttpClientErrorException e) {
|
||||||
final String responseBodyAsString = e.getResponseBodyAsString();
|
final String responseBodyAsString = e.getResponseBodyAsString();
|
||||||
@ -89,7 +90,7 @@ public class RestLabelITCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
addNewLabel(requestHeaders, template, "title12345", null);
|
addNewLabel(requestHeaders, template, "title12345", null, ICON);
|
||||||
fail("Wrong response");
|
fail("Wrong response");
|
||||||
} catch (HttpClientErrorException e) {
|
} catch (HttpClientErrorException e) {
|
||||||
final String responseBodyAsString = e.getResponseBodyAsString();
|
final String responseBodyAsString = e.getResponseBodyAsString();
|
||||||
@ -97,7 +98,7 @@ public class RestLabelITCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
addNewLabel(requestHeaders, template, "title12345", COLOR);
|
addNewLabel(requestHeaders, template, "title12345", COLOR, null);
|
||||||
fail("Wrong response");
|
fail("Wrong response");
|
||||||
} catch (HttpClientErrorException e) {
|
} catch (HttpClientErrorException e) {
|
||||||
final String responseBodyAsString = e.getResponseBodyAsString();
|
final String responseBodyAsString = e.getResponseBodyAsString();
|
||||||
@ -106,17 +107,17 @@ public class RestLabelITCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||||
public void validateLabelsUserIsolation() { // Configure media types ...
|
public void validateLabelsUserIsolation(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||||
throw new SkipException("missing test: labels belong to users");
|
throw new SkipException("missing test: labels belong to users");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||||
public void deleteLabel(final @NotNull MediaType mediaType) throws IOException {
|
public void deleteLabel(final @NotNull MediaType mediaType) throws IOException, WiseMappingException {
|
||||||
final HttpHeaders requestHeaders = RestHelper.createHeaders(mediaType);
|
final HttpHeaders requestHeaders = RestHelper.createHeaders(mediaType);
|
||||||
final RestTemplate template = RestHelper.createTemplate(userEmail + ":" + "admin");
|
final RestTemplate template = RestHelper.createTemplate(userEmail + ":" + "admin");
|
||||||
|
|
||||||
final String title = "title to delete";
|
final String title = "title to delete";
|
||||||
final URI resourceUri = addNewLabel(requestHeaders, template, title, COLOR);
|
final URI resourceUri = addNewLabel(requestHeaders, template, title, COLOR, ICON);
|
||||||
|
|
||||||
// Now remove it ...
|
// Now remove it ...
|
||||||
template.delete(RestHelper.HOST_PORT + resourceUri.toString());
|
template.delete(RestHelper.HOST_PORT + resourceUri.toString());
|
||||||
@ -130,7 +131,7 @@ public class RestLabelITCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static URI addNewLabel(@NotNull HttpHeaders requestHeaders, @NotNull RestTemplate template, @Nullable String title, @Nullable String color) throws IOException {
|
static URI addNewLabel(@NotNull HttpHeaders requestHeaders, @NotNull RestTemplate template, @Nullable String title, @Nullable String color, @Nullable String icon) throws IOException, WiseMappingException {
|
||||||
final RestLabel restLabel = new RestLabel();
|
final RestLabel restLabel = new RestLabel();
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
restLabel.setTitle(title);
|
restLabel.setTitle(title);
|
||||||
@ -138,6 +139,9 @@ public class RestLabelITCase {
|
|||||||
if (color != null) {
|
if (color != null) {
|
||||||
restLabel.setColor(color);
|
restLabel.setColor(color);
|
||||||
}
|
}
|
||||||
|
if (icon != null) {
|
||||||
|
restLabel.setIconName(icon);
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new label ...
|
// Create a new label ...
|
||||||
HttpEntity<RestLabel> createUserEntity = new HttpEntity<RestLabel>(restLabel, requestHeaders);
|
HttpEntity<RestLabel> createUserEntity = new HttpEntity<RestLabel>(restLabel, requestHeaders);
|
||||||
|
@ -33,6 +33,7 @@ import static org.testng.Assert.*;
|
|||||||
public class RestMindmapITCase {
|
public class RestMindmapITCase {
|
||||||
|
|
||||||
private String userEmail = "admin@wisemapping.com";
|
private String userEmail = "admin@wisemapping.com";
|
||||||
|
private static final String ICON = "glyphicon glyphicon-tag";
|
||||||
final RestAdminITCase restAdminITCase = new RestAdminITCase();
|
final RestAdminITCase restAdminITCase = new RestAdminITCase();
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
@ -493,15 +494,15 @@ public class RestMindmapITCase {
|
|||||||
|
|
||||||
// Create a new label
|
// Create a new label
|
||||||
final String titleLabel = "removeLabelFromMindmap";
|
final String titleLabel = "removeLabelFromMindmap";
|
||||||
final URI labelUri = RestLabelITCase.addNewLabel(requestHeaders, template, titleLabel, COLOR);
|
final URI labelUri = RestLabelITCase.addNewLabel(requestHeaders, template, titleLabel, COLOR, ICON);
|
||||||
|
|
||||||
// Create a sample map ...
|
// Create a sample map ...
|
||||||
final String mapTitle = "removeLabelFromMindmap";
|
final String mapTitle = "removeLabelFromMindmap";
|
||||||
final URI mindmapUri = addNewMap(template, mapTitle);
|
final URI mindmapUri = addNewMap(template, mapTitle);
|
||||||
final String mapId = mindmapUri.getPath().replace("/api/restfull/maps/", "");
|
final String mapId = mindmapUri.getPath().replace("/service/maps/", "");
|
||||||
|
|
||||||
// Assign label to map ...
|
// Assign label to map ...
|
||||||
String labelId = labelUri.getPath().replace("/api/restfull/labels/", "");
|
String labelId = labelUri.getPath().replace("/service/labels/", "");
|
||||||
HttpEntity<String> labelEntity = new HttpEntity<>(labelId, requestHeaders);
|
HttpEntity<String> labelEntity = new HttpEntity<>(labelId, requestHeaders);
|
||||||
template.postForLocation(BASE_REST_URL + "/maps/" + mapId + "/labels", labelEntity);
|
template.postForLocation(BASE_REST_URL + "/maps/" + mapId + "/labels", labelEntity);
|
||||||
|
|
||||||
@ -536,15 +537,15 @@ public class RestMindmapITCase {
|
|||||||
|
|
||||||
// Create a new label
|
// Create a new label
|
||||||
final String titleLabel = "Label 1 - " + mediaType;
|
final String titleLabel = "Label 1 - " + mediaType;
|
||||||
final URI labelUri = RestLabelITCase.addNewLabel(requestHeaders, template, titleLabel, COLOR);
|
final URI labelUri = RestLabelITCase.addNewLabel(requestHeaders, template, titleLabel, COLOR, ICON);
|
||||||
|
|
||||||
// Create a sample map ...
|
// Create a sample map ...
|
||||||
final String mapTitle = "Maps 1 - " + mediaType;
|
final String mapTitle = "Maps 1 - " + mediaType;
|
||||||
final URI mindmapUri = addNewMap(template, mapTitle);
|
final URI mindmapUri = addNewMap(template, mapTitle);
|
||||||
final String mapId = mindmapUri.getPath().replace("/api/restfull/maps/", "");
|
final String mapId = mindmapUri.getPath().replace("/service/maps/", "");
|
||||||
|
|
||||||
// Assign label to map ...
|
// Assign label to map ...
|
||||||
String labelId = labelUri.getPath().replace("/api/restfull/labels/", "");
|
String labelId = labelUri.getPath().replace("/service/labels/", "");
|
||||||
HttpEntity<String> labelEntity = new HttpEntity<>(labelId, requestHeaders);
|
HttpEntity<String> labelEntity = new HttpEntity<>(labelId, requestHeaders);
|
||||||
template.postForLocation(BASE_REST_URL + "/maps/" + mapId + "/labels", labelEntity);
|
template.postForLocation(BASE_REST_URL + "/maps/" + mapId + "/labels", labelEntity);
|
||||||
|
|
||||||
@ -663,7 +664,7 @@ public class RestMindmapITCase {
|
|||||||
// Create a sample map ...
|
// Create a sample map ...
|
||||||
final String mapTitle = "updatePublishState";
|
final String mapTitle = "updatePublishState";
|
||||||
final URI mindmapUri = addNewMap(template, mapTitle);
|
final URI mindmapUri = addNewMap(template, mapTitle);
|
||||||
final String mapId = mindmapUri.getPath().replace("/api/restfull/maps/", "");
|
final String mapId = mindmapUri.getPath().replace("/service/maps/", "");
|
||||||
|
|
||||||
// Change map status ...
|
// Change map status ...
|
||||||
requestHeaders.setContentType(MediaType.TEXT_PLAIN);
|
requestHeaders.setContentType(MediaType.TEXT_PLAIN);
|
||||||
@ -671,11 +672,11 @@ public class RestMindmapITCase {
|
|||||||
final HttpEntity<String> updateEntity = new HttpEntity<>(Boolean.TRUE.toString(), requestHeaders);
|
final HttpEntity<String> updateEntity = new HttpEntity<>(Boolean.TRUE.toString(), requestHeaders);
|
||||||
template.put(HOST_PORT + mindmapUri + "/publish", updateEntity);
|
template.put(HOST_PORT + mindmapUri + "/publish", updateEntity);
|
||||||
|
|
||||||
// //fetch public view
|
//fetch public view
|
||||||
// final HttpEntity findMapEntity = new HttpEntity(requestHeaders);
|
final HttpEntity findMapEntity = new HttpEntity(requestHeaders);
|
||||||
// ResponseEntity<String> publicView = template.exchange(HOST_PORT + mapId + "/public", HttpMethod.GET, findMapEntity, String.class);
|
ResponseEntity<String> publicView = template.exchange(HOST_PORT + "/c/" + mapId + "/public", HttpMethod.GET, findMapEntity, String.class);
|
||||||
// assertNotNull(publicView.getBody());
|
assertNotNull(publicView.getBody());
|
||||||
// assertEquals(publicView.getStatusCodeValue(), 200);
|
assertEquals(publicView.getStatusCodeValue(), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package com.wisemapping.test.rest;
|
|
||||||
|
|
||||||
|
|
||||||
import com.wisemapping.config.Application;
|
|
||||||
import com.wisemapping.rest.MindmapController;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
|
||||||
|
|
||||||
|
|
||||||
@SpringBootTest(classes = Application.class)
|
|
||||||
@ExtendWith(SpringExtension.class)
|
|
||||||
|
|
||||||
class SmokeTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MindmapController controller;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void contextLoads() throws Exception {
|
|
||||||
if(controller==null) throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user