Compare commits

...

24 Commits

Author SHA1 Message Date
Fabio Formosa
aecc1cab68 Update README.md 2021-02-07 13:22:32 +01:00
Fabio Formosa
4e63e0a833 Create .travis.yml 2021-02-07 13:19:14 +01:00
Fabio Formosa
4540165157 Update README.md 2021-02-07 13:10:59 +01:00
Fabio Formosa
a56f5284d1 Update README.md 2021-02-06 19:33:45 +01:00
Fabio Formosa
eb675f59a3 Update README.md 2021-02-06 19:30:53 +01:00
Fabio Formosa
35f8b6b52a Update README.md 2021-02-06 19:22:31 +01:00
Fabio Formosa
6c76f0a067 Update README.md 2021-02-06 19:12:15 +01:00
Fabio Formosa
48b626c08e Merge pull request #34 from fabioformosa/develop
#32 Renamed modules
2021-02-06 17:14:23 +01:00
fabio.formosa
b2f796cf73 [maven-release-plugin] prepare for next development iteration 2021-02-06 15:56:27 +01:00
fabio.formosa
b01f4b99e4 [maven-release-plugin] prepare release quartz-manager-parent-3.0.1 2021-02-06 15:56:24 +01:00
fabio.formosa
d11089c451 #32 Renamed maven modules 2021-02-06 15:50:27 +01:00
Fabio Formosa
8ecdb4f5a6 Merge pull request #33 from fabioformosa/develop
Released 3.0.0
2021-02-05 00:42:19 +01:00
fabio.formosa
86c2e86a12 [maven-release-plugin] prepare for next development iteration 2021-02-05 00:01:47 +01:00
fabio.formosa
54662a1b8a [maven-release-plugin] prepare release quartz-manager-parent-3.0.0 2021-02-05 00:01:45 +01:00
fabio.formosa
6cdee3ba5d #32 added details to release 2021-02-04 23:42:37 +01:00
fabio.formosa
c6df1e2093 Merge branch 'develop' of git@github.com:fabioformosa/quartz-manager.git into develop 2021-02-04 23:33:27 +01:00
fabio.formosa
663b3f4e09 #32 clean up 2021-02-04 23:33:20 +01:00
Fabio Formosa
2b6dadd5f1 Update README.md 2021-02-03 00:06:47 +01:00
Fabio Formosa
bce1be698c Merge pull request #31 from fabioformosa/develop
Refactored project structure for pluggability
2021-02-03 00:01:46 +01:00
Fabio Formosa
c29af8c593 Update README.md 2021-02-02 23:57:16 +01:00
Fabio Formosa
a7a86f960a Update README.md 2021-02-02 23:55:05 +01:00
Fabio Formosa
56c81caf05 Update README.md 2021-02-02 23:49:20 +01:00
Fabio Formosa
b7d152a42a Merge pull request #29 from fabioformosa/develop
Develop
2020-12-26 17:56:56 +01:00
Fabio Formosa
25a5e808f2 Update README.md 2020-10-21 00:02:24 +02:00
69 changed files with 755 additions and 880 deletions

3
.travis.yml Normal file
View File

@@ -0,0 +1,3 @@
language: java
jdk: openjdk8
before_script: cd quartz-manager-parent

189
README.md
View File

@@ -1,39 +1,182 @@
[![Build Status](https://travis-ci.org/fabioformosa/quartz-manager.svg?branch=master)](https://travis-ci.org/fabioformosa/quartz-manager)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/it.fabioformosa.quartz-manager/quartz-manager-starter-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/it.fabioformosa.quartz-manager/quartz-manager-starter-api)
[![Gitter](https://badges.gitter.im/quartz-manager/community.svg)](https://gitter.im/quartz-manager/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
# QUARTZ MANAGER
UI Manager for Quartz Scheduler.
Quartz Manager is a library you can import in your spring webapp to easily enable the [Quartz Scheduler](http://www.quartz-scheduler.org/) and to control it by REST APIs or by a UI Manager Panel (angular-based).
Through this webapp you can launch and control your scheduled job. The UI Console is composed by a management panel to set trigger, start/stop scheduler and a log panel with a progress bar to display the job output.
Your Spring Webapp should provide the java class of the job you want schedule. Importing the Quartz Manager your project will have the REST API and (optionally) the UI to launch and control the job.
The UI Dashboard is composed by a management panel to set the quartz trigger, to start/stop the scheduler and a log panel with a progress bar to display the job output.
![](https://github.com/fabioformosa/quartz-manager/blob/master/quartz-manager-api/src/main/resources/quartz-manager-2-screenshot_800.PNG)
![](https://github.com/fabioformosa/quartz-manager/blob/master/quartz-manager-parent/quartz-manager-web-showcase/src/main/resources/quartz-manager-2-screenshot_800.PNG)
## HOW IT WORKS
* Set up the trigger into the left sidebar in terms of: daily frequency and and max occurrences.
* Press the start button
* The GUI manager updates the progress bar and reports all logs of your quartz job.
## ROADMAP
Open the [Project Roadmap](https://github.com/fabioformosa/quartz-manager/projects) to take a look at the plan of Quartz Manager.
Currently this project might be useful to look how to import Quartz Library in a spring boot application. For this purpose, browse the folder `quartz-manager-parent/quartz-manager-api`.
We're just working to create a library, from project `quartz-manager-parent/quartz-manager-api`, to be imported in your spring boot where you have your job to be scheduled.
The project `quartz-manager-parent/quartz-manager-web` is an example of how-to:
* import the library
* set the application.yml
* add secure layer
## QUICK START
* **Requirements**
Java 8+
* **add the dependency**
MAVEN
```
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- OPTIONALLY -->
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-ui</artifactId>
<version>3.0.1</version>
</dependency>
```
GRADLE
```
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-api', version: '3.0.1'
//optionally
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-ui', version: '3.0.1'
```
Import `quartz-manager-starter-ui` as well, if you want use the Quartz Manager API by the angular frontend.
* **add a `quartz.properties` file in the classpath (`src/main/resources`)**
```
org.quartz.scheduler.instanceName=example
org.quartz.scheduler.instanceId=AUTO
org.quartz.threadPool.threadCount=1
```
* **Create the job class that you want to schedule**
```
public class SampleJob extends AbstractLoggingJob {
@Override
public LogRecord doIt(JobExecutionContext jobExecutionContext) {
return new LogRecord(LogType.INFO, "Hello from QuartManagerDemo!");
}
}
```
Extend the super-class `AbstractLoggingJob`
* **Enable quartz-manager adding into the application.yml**
```
quartz:
enabled: true
job:
frequency: 4000
repeatCount: 19
quartz-manager:
jobClass: <QUALIFIED NAME OF THE YOUR JOB CLASS>
```
* **REST API**
You can access the REST API, through the swagger-ui. Open the URL:
[http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)
(Change the port and the contextPath accordingly with the setup of your webapp)
* **Frontend**
If you've imported the `quartz-manager-starter-ui` you can open the UI at URL:
[http://localhost:8080/quartz-manager-ui/index.html](http://localhost:8080/quartz-manager-ui/index.html)
(Change the port and the contextPath accordingly with the setup of your webapp)
* **Security**
If you want enable a security layer and allow the access to the REST API and to the UI only to authenticated users, add the dependency:
MAVEN
```
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-security</artifactId>
<version>3.0.1</version>
</dependency>
```
GRADLE
```
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-security', version: '3.0.1'
```
and in your application.yml:
```
quartz-manager:
security:
login-model:
form-login-enabled: true
userpwd-filter-enabled : false
jwt:
enabled: true
secret: "PLEASE_TYPE_HERE_A_SECRET"
expiration-in-sec: 28800 # 8 hours
header-strategy:
enabled: false
header: "Authorization"
cookie-strategy:
enabled: true
cookie: AUTH-TOKEN
accounts:
in-memory:
enabled: true
users:
- name: admin
password: admin
roles:
- ADMIN
```
* **DEMO**
Take a loot to the project [Quartz-Manager Demo](https://github.com/fabioformosa/quartz-manager-demo), it is an example of how-to:
* import the quartz-manager-api library in your webapp
* include the quartz-manager frontend (angular based) through a webjar
* set properties into the application.yml
* add a secure layer to allow the API only to logged users
* schedule a custom job (a dummy `hello world`)
## PROJECT STRUCTURE
* **quartz-parent/quartz-manager-api** is the library that can be imported in webapp to have the quartz-manager API.
* **quartz-parent/quartz-manager-web** is an example of webapp that imports quartz-manager-api. It adds a secure layer and a custom job to be scheduled.
* **quartz-frontend** is the angular app that interacts with the Quartz Manager API.
## ROADMAP
Open the [Project Roadmap](https://github.com/fabioformosa/quartz-manager/projects) to take a look at the plan of Quartz Manager.
Next steps in the roadmap are:
* to simplify the customization of the job through plugins
* to add CI/CD pipeline to ease the deploy pulling a docker container
* to add a complete setup UI panel for quartz, in term of cronjobs and multiple jobs
* to add a persistent layer to save all job logs.
* to add a persistent layer to save all job setup.
* to add a complete setup UI panel for quartz, in term of cronjobs and multiple jobs.
* to add CI/CD pipeline to ease the deploy pulling a docker container.
* Enabling adapters for integrations: kafka, etc.
## QUICK START
## HOW-TO CONTRIBUTE
### PROJECT STRUCTURE
* **quartz-parent/quartz-manager-starter-api** is the library that can be imported in webapp to have the quartz-manager API.
* **quartz-parent/quartz-manager-starter-ui** is a maven module to build and package the angular frontend in a webjar.
* **quartz-parent/quartz-manager-starter-security** is ther library that can be imported in a webapp to have a security layer (login) over the quartz-manager API.
* **quartz-parent/quartz-manager-web-showcase** is an example of webapp that imports quartz-manager-api. Useful to develop the frontend started locally with the webpack dev server.
* **quartz-frontend** is the angular app that interacts with the Quartz Manager API.
### PROJECT DETAILS
**[requirements]** Make sure you have installed
* [Java 8](https://java.com/download/) or greater
* [Maven](https://maven.apache.org/)
@@ -46,7 +189,9 @@ To build&run quartz-manager in your machine:
git clone https://github.com/fabioformosa/quartz-manager.git
# START QUARTZ-MANAGER-WEB
cd quartz-manager/quartz-parent/quartz-manager-web
cd quartz-manager/quartz-parent
mvn install
cd quartz-manager/quartz-parent/quartz-manager-web-showcase
mvn spring-boot:run
# START QUARTZ-MANAGER-FRONTEND
@@ -63,7 +208,7 @@ If you are not confident with maven CLI, you can start it by your IDE. For more
## HOW TO RUN YOUR SCHEDULED JOB
By default, quartz-manager-web executes the dummy job that logs "hello world!".
By default, `quartz-manager-web-showcase` executes the dummy job that logs "hello world!".
Replace the dummy job (class: `it.fabioformosa.quartzmanager.jobs.SampleJob`) with yours. Follow these steps:
1. Extend the super class `it.fabioformosa.quartzmanager.jobs.AbstractLoggingJob`

View File

@@ -1,6 +1,4 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -11,14 +9,40 @@
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-parent</artifactId>
<version>2.2.2-SNAPSHOT</version>
<version>3.0.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Quartz Manager</name>
<description>API and UI Manager for Quartz Scheduler</description>
<url>https://github.com/fabioformosa/quartz-manager</url>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>https://github.com/fabioformosa/quartz-manager/blob/master/LICENSE</url>
</license>
</licenses>
<scm>
<connection>scm:git:git://github.com/fabioformosa/quartz-manager.git</connection>
<developerConnection>scm:git:git@github.com:fabioformosa/quartz-manager.git</developerConnection>
<url>https://github.com/fabioformosa/quartz-manager</url>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<name>Fabio Formosa</name>
<url>https://github.com/fabioformosa</url>
</developer>
</developers>
<modules>
<module>quartz-manager-api</module>
<module>quartz-manager-ui-webjar</module>
<module>quartz-manager-security</module>
<module>quartz-manager-starter-api</module>
<module>quartz-manager-starter-ui</module>
<module>quartz-manager-starter-security</module>
<module>quartz-manager-web-showcase</module>
</modules>
@@ -26,20 +50,134 @@
<dependencies>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-api</artifactId>
<version>2.2.2-SNAPSHOT</version>
<artifactId>quartz-manager-starter-api</artifactId>
<version>3.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-security</artifactId>
<version>2.2.2-SNAPSHOT</version>
<artifactId>quartz-manager-starter-security</artifactId>
<version>3.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-ui-webjar</artifactId>
<version>2.2.2-SNAPSHOT</version>
<artifactId>quartz-manager-starter-ui</artifactId>
<version>3.0.2-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/
</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<preparationGoals>clean</preparationGoals>
<releaseProfiles>build-webjar</releaseProfiles>
<localCheckout>true</localCheckout>
<pushChanges>false</pushChanges>
<mavenExecutorId>forked-path</mavenExecutorId>
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<doclint>none</doclint>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- GPG Signature on release -->
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -1,82 +0,0 @@
package it.fabioformosa.quartzmanager.security.controllers;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import it.fabioformosa.quartzmanager.security.helpers.impl.JwtTokenHelper;
import it.fabioformosa.quartzmanager.security.models.UserTokenState;
import it.fabioformosa.quartzmanager.security.services.impl.CustomUserDetailsService;
/**
* JWT Temporary disabled
*
* @author Fabio.Formosa
*
*/
//@RestController
//@RequestMapping( value = "/api", produces = MediaType.APPLICATION_JSON_VALUE )
public class AuthenticationController {
static class PasswordChanger {
public String oldPassword;
public String newPassword;
}
@Autowired
private CustomUserDetailsService userDetailsService;
@Autowired
JwtTokenHelper tokenHelper;
@Value("${quartz-manager.security.jwt.expiration-in-sec}")
private int EXPIRES_IN_SEC;
@Value("${quartz-manager.security.jwt.cookie-strategy-cookie}")
private String TOKEN_COOKIE;
@RequestMapping(value = "/changePassword", method = RequestMethod.POST)
@PreAuthorize("hasRole('USER')")
public ResponseEntity<?> changePassword(@RequestBody PasswordChanger passwordChanger) {
userDetailsService.changePassword(passwordChanger.oldPassword, passwordChanger.newPassword);
Map<String, String> result = new HashMap<>();
result.put( "result", "success" );
return ResponseEntity.accepted().body(result);
}
@RequestMapping(value = "/refresh", method = RequestMethod.GET)
public ResponseEntity<?> refreshAuthenticationToken(HttpServletRequest request, HttpServletResponse response) {
String authToken = tokenHelper.retrieveToken( request );
if (authToken != null && tokenHelper.canTokenBeRefreshed(authToken)) {
// TODO check user password last update
String refreshedToken = tokenHelper.refreshToken(authToken);
Cookie authCookie = new Cookie( TOKEN_COOKIE, refreshedToken );
authCookie.setPath( "/quartz-manager" );
authCookie.setHttpOnly( true );
authCookie.setMaxAge( EXPIRES_IN_SEC );
// Add cookie to response
response.addCookie( authCookie );
UserTokenState userTokenState = new UserTokenState(refreshedToken, EXPIRES_IN_SEC);
return ResponseEntity.ok(userTokenState);
} else {
UserTokenState userTokenState = new UserTokenState();
return ResponseEntity.accepted().body(userTokenState);
}
}
}

View File

@@ -1,35 +0,0 @@
package it.fabioformosa.quartzmanager.security.helpers.impl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
//@Component
//@ConditionalOnProperty(prefix = "quartz-manager.security.login-model", name = "form-login-enabled", havingValue = "true", matchIfMissing = true)
public class AuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
private final JwtAuthenticationSuccessHandler jwtAuthenticationSuccessHandler;
// @Autowired
public AuthenticationSuccessHandler(JwtAuthenticationSuccessHandler jwtAuthenticationSuccessHandler) {
super();
this.jwtAuthenticationSuccessHandler = jwtAuthenticationSuccessHandler;
}
public String cookieMustBeDeletedAtLogout() {
return jwtAuthenticationSuccessHandler.cookieMustBeDeletedAtLogout();
}
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication ) throws IOException, ServletException {
clearAuthenticationAttributes(request);
jwtAuthenticationSuccessHandler.onLoginSuccess(authentication, response);
}
}

View File

@@ -1,33 +0,0 @@
package it.fabioformosa.quartzmanager.security.helpers.impl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import org.springframework.stereotype.Component;
@Component
public class ComboEntryPoint extends LoginUrlAuthenticationEntryPoint {
private static final String LOGIN_FORM_URL = "/login";
public ComboEntryPoint() {
super(LOGIN_FORM_URL);
}
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
if (RESTRequestMatcher.isRestRequest(request)
|| WebsocketRequestMatcher.isWebsocketConnectionRequest(request))
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
else
super.commence(request, response, authException);
}
}

View File

@@ -1,57 +0,0 @@
package it.fabioformosa.quartzmanager.security.helpers.impl;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.LogoutConfigurer;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import it.fabioformosa.quartzmanager.security.helpers.LoginConfigurer;
/**
* It wraps the httpSecurity to provide new function as login and logout
*
*/
public class QuartzManagerHttpSecurity extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
public static QuartzManagerHttpSecurity from(HttpSecurity httpSecurity){
QuartzManagerHttpSecurity newInstance = new QuartzManagerHttpSecurity(httpSecurity);
newInstance.setBuilder(httpSecurity);
return newInstance;
}
private HttpSecurity httpSecurity;
private LoginConfigurer loginConfigurer;
private LogoutSuccess logoutSuccess;
public QuartzManagerHttpSecurity(HttpSecurity httpSecurity) {
this.httpSecurity = httpSecurity;
// applicationContext = httpSecurity.getSharedObject(ApplicationContext.class);
}
public QuartzManagerHttpSecurity login(String loginPath, AuthenticationManager authenticationManager) throws Exception {
if(loginConfigurer == null || logoutSuccess == null)
throw new IllegalStateException("QuartzManagerHttpSecurity requires to be set loginConfigurer and logoutSuccess!");
httpSecurity = loginConfigurer.login(loginPath, httpSecurity, authenticationManager);
return this;
}
public LogoutConfigurer<HttpSecurity> logout(String logoutPath) throws Exception {
LogoutConfigurer<HttpSecurity> logoutConfigurer = httpSecurity.logout().logoutRequestMatcher(new AntPathRequestMatcher(logoutPath))
.logoutSuccessHandler(logoutSuccess);
String cookie = loginConfigurer.cookieMustBeDeletedAtLogout();
if(cookie != null)
logoutConfigurer.deleteCookies(cookie);
return logoutConfigurer;
}
public QuartzManagerHttpSecurity withLoginConfigurer(LoginConfigurer loginConfigurer, LogoutSuccess logoutSuccess) {
this.loginConfigurer = loginConfigurer;
this.logoutSuccess = logoutSuccess;
return this;
}
}

View File

@@ -1,26 +0,0 @@
package it.fabioformosa.quartzmanager.security.helpers.impl;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.web.util.matcher.ELRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
public class RESTRequestMatcher {
static private final Logger log = LoggerFactory.getLogger(RESTRequestMatcher.class);
static public RequestMatcher matcherRequestedWith = new ELRequestMatcher(
"hasHeader('X-Requested-With','XMLHttpRequest')");
static public RequestMatcher matcherAccept = new ELRequestMatcher(
"hasHeader('accept','application/json, text/plain, */*')");
static public boolean isRestRequest(HttpServletRequest request) {
log.trace("Detecting if it's an AJAX Request: " + request.getRequestURL() + " accept: "
+ request.getHeader("accept") + " " + " X-Requested-With: "
+ request.getHeader("X-Requested-With"));
return matcherRequestedWith.matches(request) || matcherAccept.matches(request);
}
}

View File

@@ -1,18 +0,0 @@
package it.fabioformosa.quartzmanager.security.helpers.impl;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WebsocketRequestMatcher {
static private final Logger log = LoggerFactory.getLogger(WebsocketRequestMatcher.class);
static public boolean isWebsocketConnectionRequest(HttpServletRequest request) {
log.trace("Detecting if it's a Websocket Connection Request: " + request.getRequestURL());
return request.getServletPath().equals("/progress/info")
|| request.getServletPath().equals("/logs/info");
}
}

View File

@@ -1,53 +0,0 @@
package it.fabioformosa.quartzmanager.security.models;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import org.springframework.security.core.GrantedAuthority;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* Temporary enabled only inMemoryAuthentication
*
* @author Fabio.Formosa
*
*/
//@Entity
//@Table(name="Authority")
public class Authority implements GrantedAuthority {
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
@Column(name="name")
String name;
@Override
public String getAuthority() {
return name;
}
@JsonIgnore
public Long getId() {
return id;
}
@JsonIgnore
public String getName() {
return name;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
}

View File

@@ -1,133 +0,0 @@
package it.fabioformosa.quartzmanager.security.models;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* Temporary enabled only inMemoryAuthentication
*
* @author Fabio.Formosa
*
*/
//@Entity
//@Table(name = "USER")
public class User implements UserDetails, Serializable {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "username")
private String username;
@JsonIgnore
@Column(name = "password")
private String password;
@Column(name = "firstname")
private String firstname;
@Column(name = "lastname")
private String lastname;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name = "user_authority",
joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "authority_id", referencedColumnName = "id"))
private List<Authority> authorities;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return authorities;
}
public String getFirstname() {
return firstname;
}
public Long getId() {
return id;
}
public String getLastname() {
return lastname;
}
@Override
public String getPassword() {
return password;
}
@Override
public String getUsername() {
return username;
}
// We can add the below fields in the users table.
// For now, they are hardcoded.
@JsonIgnore
@Override
public boolean isAccountNonExpired() {
return true;
}
@JsonIgnore
@Override
public boolean isAccountNonLocked() {
return true;
}
@JsonIgnore
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@JsonIgnore
@Override
public boolean isEnabled() {
return true;
}
public void setAuthorities(List<Authority> authorities) {
this.authorities = authorities;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public void setId(Long id) {
this.id = id;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public void setPassword(String password) {
this.password = password;
}
public void setUsername(String username) {
this.username = username;
}
}

View File

@@ -1,13 +0,0 @@
package it.fabioformosa.quartzmanager.security.repositories;
/**
* Temporary disabled
*
* @author Fabio
*
*/
//public interface AuthorityRepository extends JpaRepository<Authority, Long> {
// Authority findByName(String name);
//}
public interface AuthorityRepository {
}

View File

@@ -1,11 +0,0 @@
package it.fabioformosa.quartzmanager.security.repositories;
import it.fabioformosa.quartzmanager.security.models.User;
public interface UserRepository {
User findByUsername( String username );
}
//public interface UserRepository extends JpaRepository<User, Long> {
// User findByUsername( String username );
//}

View File

@@ -1,13 +0,0 @@
package it.fabioformosa.quartzmanager.security.services;
/**
* temporary disabled
* @author Fabio
*
*/
public interface AuthorityService {
// List<Authority> findById(Long id);
//
// List<Authority> findByname(String name);
}

View File

@@ -1,18 +0,0 @@
package it.fabioformosa.quartzmanager.security.services;
import java.util.List;
import it.fabioformosa.quartzmanager.security.models.User;
import it.fabioformosa.quartzmanager.security.models.UserRequest;
public interface UserService {
List<User> findAll();
User findById(Long id);
User findByUsername(String username);
void resetCredentials();
User save(UserRequest user);
}

View File

@@ -1,33 +0,0 @@
package it.fabioformosa.quartzmanager.security.services.impl;
import it.fabioformosa.quartzmanager.security.services.AuthorityService;
/**
* Temporary disabled
* @author Fabio
*
*/
//@Service
public class AuthorityServiceImpl implements AuthorityService {
// @Autowired
// private AuthorityRepository authorityRepository;
//
// @Override
// public List<Authority> findById(Long id) {
// Authority auth = this.authorityRepository.getOne(id);
// List<Authority> auths = new ArrayList<>();
// auths.add(auth);
// return auths;
// }
//
// @Override
// public List<Authority> findByname(String name) {
// Authority auth = this.authorityRepository.findByName(name);
// List<Authority> auths = new ArrayList<>();
// auths.add(auth);
// return auths;
// }
}

View File

@@ -1,67 +0,0 @@
package it.fabioformosa.quartzmanager.security.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import it.fabioformosa.quartzmanager.security.models.User;
import it.fabioformosa.quartzmanager.security.repositories.UserRepository;
/**
* Temporary disabled
* @author Fabio
*
*/
//@Service
public class CustomUserDetailsService implements UserDetailsService {
protected final Log LOGGER = LogFactory.getLog(getClass());
@Autowired
private UserRepository userRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private AuthenticationManager authenticationManager;
public void changePassword(String oldPassword, String newPassword) {
// Authentication currentUser = SecurityContextHolder.getContext().getAuthentication();
// String username = currentUser.getName();
//
// if (authenticationManager != null) {
// LOGGER.debug("Re-authenticating user '"+ username + "' for password change request.");
//
// authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, oldPassword));
// } else {
// LOGGER.debug("No authentication manager set. can't change Password!");
//
// return;
// }
//
// LOGGER.debug("Changing password for user '"+ username + "'");
//
// User user = (User) loadUserByUsername(username);
//
// user.setPassword(passwordEncoder.encode(newPassword));
// userRepository.save(user);
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User user = userRepository.findByUsername(username);
if (user == null)
throw new UsernameNotFoundException(String.format("No user found with username '%s'.", username));
else
return user;
}
}

View File

@@ -1,79 +0,0 @@
package it.fabioformosa.quartzmanager.security.services.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import it.fabioformosa.quartzmanager.security.models.User;
import it.fabioformosa.quartzmanager.security.models.UserRequest;
import it.fabioformosa.quartzmanager.security.repositories.UserRepository;
import it.fabioformosa.quartzmanager.security.services.AuthorityService;
import it.fabioformosa.quartzmanager.security.services.UserService;
/**
* Temporary disabled
* @author Fabio
*
*/
//@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private AuthorityService authService;
@Override
@PreAuthorize("hasRole('ADMIN')")
public List<User> findAll() throws AccessDeniedException {
// List<User> result = userRepository.findAll();
// return result;
return null;
}
@Override
@PreAuthorize("hasRole('ADMIN')")
public User findById(Long id) throws AccessDeniedException {
// User u = userRepository.getOne(id);
// return u;
return null;
}
@Override
// @PreAuthorize("hasRole('USER')")
public User findByUsername(String username) throws UsernameNotFoundException {
User u = userRepository.findByUsername(username);
return u;
}
@Override
public void resetCredentials() {
// List<User> users = userRepository.findAll();
// for (User user : users) {
// user.setPassword(passwordEncoder.encode("123"));
// userRepository.save(user);
// }
}
@Override
public User save(UserRequest userRequest) {
User user = new User();
// user.setUsername(userRequest.getUsername());
// user.setPassword(passwordEncoder.encode(userRequest.getPassword()));
// user.setFirstname(userRequest.getFirstname());
// user.setLastname(userRequest.getLastname());
// List<Authority> auth = authService.findByname("ROLE_USER");
// user.setAuthorities(auth);
// this.userRepository.save(user);
return user;
}
}

View File

@@ -4,13 +4,13 @@
<parent>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-parent</artifactId>
<version>2.2.2-SNAPSHOT</version>
<version>3.0.2-SNAPSHOT</version>
</parent>
<artifactId>quartz-manager-api</artifactId>
<artifactId>quartz-manager-starter-api</artifactId>
<name>Quartz Manager API</name>
<description>A library to manage your scheduled job by API</description>
<name>Quartz Manager Starter API</name>
<description>REST API layer for your scheduler and triggered jobs, to be included in your spring webapp</description>
<url>https://github.com/fabioformosa/quartz-manager</url>
<properties>

View File

@@ -3,13 +3,13 @@
<parent>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-parent</artifactId>
<version>2.2.2-SNAPSHOT</version>
<version>3.0.2-SNAPSHOT</version>
</parent>
<artifactId>quartz-manager-security</artifactId>
<artifactId>quartz-manager-starter-security</artifactId>
<name>Quartz Manager Security</name>
<description>Security Layer for Quartz Manager</description>
<name>Quartz Manager Starter Security</name>
<description>Security Layer for Quartz Manager. Import it in your spring webapp</description>
<url>https://github.com/fabioformosa/quartz-manager</url>
<properties>

View File

@@ -0,0 +1,32 @@
package it.fabioformosa.quartzmanager.security.helpers.impl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
public class AuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
private final JwtAuthenticationSuccessHandler jwtAuthenticationSuccessHandler;
public AuthenticationSuccessHandler(JwtAuthenticationSuccessHandler jwtAuthenticationSuccessHandler) {
super();
this.jwtAuthenticationSuccessHandler = jwtAuthenticationSuccessHandler;
}
public String cookieMustBeDeletedAtLogout() {
return jwtAuthenticationSuccessHandler.cookieMustBeDeletedAtLogout();
}
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication ) throws IOException, ServletException {
clearAuthenticationAttributes(request);
jwtAuthenticationSuccessHandler.onLoginSuccess(authentication, response);
}
}

View File

@@ -33,15 +33,12 @@ public class JwtTokenHelper {
return Base64.getEncoder().encodeToString(secretKey.getBytes(StandardCharsets.UTF_8));
}
// @Value("${app.name}")
private final String appName;
// @Autowired
private final JwtSecurityProperties jwtSecurityProps;
private SignatureAlgorithm SIGNATURE_ALGORITHM = SignatureAlgorithm.HS512;
// @Autowired
public JwtTokenHelper(String appName, JwtSecurityProperties jwtSecurityProps) {
super();
this.appName = appName;

View File

@@ -0,0 +1,56 @@
package it.fabioformosa.quartzmanager.security.helpers.impl;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.LogoutConfigurer;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import it.fabioformosa.quartzmanager.security.helpers.LoginConfigurer;
/**
* It wraps the httpSecurity to provide new function as login and logout
*
*/
public class QuartzManagerHttpSecurity extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
public static QuartzManagerHttpSecurity from(HttpSecurity httpSecurity){
QuartzManagerHttpSecurity newInstance = new QuartzManagerHttpSecurity(httpSecurity);
newInstance.setBuilder(httpSecurity);
return newInstance;
}
private HttpSecurity httpSecurity;
private LoginConfigurer loginConfigurer;
private LogoutSuccess logoutSuccess;
public QuartzManagerHttpSecurity(HttpSecurity httpSecurity) {
this.httpSecurity = httpSecurity;
}
public QuartzManagerHttpSecurity login(String loginPath, AuthenticationManager authenticationManager) throws Exception {
if(loginConfigurer == null || logoutSuccess == null)
throw new IllegalStateException("QuartzManagerHttpSecurity requires to be set loginConfigurer and logoutSuccess!");
httpSecurity = loginConfigurer.login(loginPath, httpSecurity, authenticationManager);
return this;
}
public LogoutConfigurer<HttpSecurity> logout(String logoutPath) throws Exception {
LogoutConfigurer<HttpSecurity> logoutConfigurer = httpSecurity.logout().logoutRequestMatcher(new AntPathRequestMatcher(logoutPath))
.logoutSuccessHandler(logoutSuccess);
String cookie = loginConfigurer.cookieMustBeDeletedAtLogout();
if(cookie != null)
logoutConfigurer.deleteCookies(cookie);
return logoutConfigurer;
}
public QuartzManagerHttpSecurity withLoginConfigurer(LoginConfigurer loginConfigurer, LogoutSuccess logoutSuccess) {
this.loginConfigurer = loginConfigurer;
this.logoutSuccess = logoutSuccess;
return this;
}
}

View File

@@ -0,0 +1,55 @@
package it.fabioformosa.quartzmanager.security.models;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import org.springframework.security.core.GrantedAuthority;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* Temporary enabled only inMemoryAuthentication
*
* @author Fabio.Formosa
*
*/
//@Entity
//@Table(name="Authority")
public class Authority implements GrantedAuthority {
private static final long serialVersionUID = 1L;
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
@Column(name="name")
String name;
@Override
public String getAuthority() {
return name;
}
@JsonIgnore
public Long getId() {
return id;
}
@JsonIgnore
public String getName() {
return name;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
}

View File

@@ -0,0 +1,132 @@
package it.fabioformosa.quartzmanager.security.models;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* Temporary enabled only inMemoryAuthentication
*
* @author Fabio.Formosa
*
*/
//@Entity
//@Table(name = "USER")
public class User implements UserDetails, Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "username")
private String username;
@JsonIgnore
@Column(name = "password")
private String password;
@Column(name = "firstname")
private String firstname;
@Column(name = "lastname")
private String lastname;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name = "user_authority", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "authority_id", referencedColumnName = "id"))
private List<Authority> authorities;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return authorities;
}
public String getFirstname() {
return firstname;
}
public Long getId() {
return id;
}
public String getLastname() {
return lastname;
}
@Override
public String getPassword() {
return password;
}
@Override
public String getUsername() {
return username;
}
// We can add the below fields in the users table.
// For now, they are hardcoded.
@JsonIgnore
@Override
public boolean isAccountNonExpired() {
return true;
}
@JsonIgnore
@Override
public boolean isAccountNonLocked() {
return true;
}
@JsonIgnore
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@JsonIgnore
@Override
public boolean isEnabled() {
return true;
}
public void setAuthorities(List<Authority> authorities) {
this.authorities = authorities;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public void setId(Long id) {
this.id = id;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public void setPassword(String password) {
this.password = password;
}
public void setUsername(String username) {
this.username = username;
}
}

View File

@@ -4,13 +4,13 @@
<parent>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-parent</artifactId>
<version>2.2.2-SNAPSHOT</version>
<version>3.0.2-SNAPSHOT</version>
</parent>
<artifactId>quartz-manager-ui-webjar</artifactId>
<artifactId>quartz-manager-starter-ui</artifactId>
<name>Quartz Manager UI webjar</name>
<description>webjar builder for quartz-manager frontend</description>
<description>Webjar to import the quartz-manager frontend in your spring webapp</description>
<url>https://github.com/fabioformosa/quartz-manager</url>
<properties>
@@ -118,11 +118,11 @@
<phase>process-resources</phase>
<configuration>
<target>
<delete dir="${project.build.outputDirectory}/META-INF/resources/quartz-manager-ui"/>
<delete dir="${project.build.outputDirectory}/META-INF/resources/quartz-manager-ui" />
<move todir="${project.build.outputDirectory}/META-INF/resources/quartz-manager-ui">
<fileset dir="${project.build.directory}/tmp/dist"/>
<fileset dir="${project.build.directory}/tmp/dist" />
</move>
<delete dir="${project.build.directory}/tmp"/>
<delete dir="${project.build.directory}/tmp" />
</target>
</configuration>
<goals>

View File

@@ -1,145 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-parent</artifactId>
<version>2.2.2-SNAPSHOT</version>
</parent>
<artifactId>quartz-manager-web-showcase</artifactId>
<packaging>war</packaging>
<name>Quartz Manager Web Showcase</name>
<description>A webapp that imports Quartz Manager API lib and the frontend webjar</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<springfox.version>2.9.2</springfox.version>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-api</artifactId>
</dependency>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-ui-webjar</artifactId>
</dependency>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-security</artifactId>
</dependency>
<!-- SPRING -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- MISC -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>spring-mock-mvc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
</parent>
<artifactId>quartz-manager-web-showcase</artifactId>
<packaging>war</packaging>
<name>Quartz Manager Web Showcase</name>
<description>A webapp that imports Quartz Manager API lib and the frontend webjar</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<springfox.version>2.9.2</springfox.version>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-api</artifactId>
</dependency>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-ui</artifactId>
</dependency>
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-security</artifactId>
</dependency>
<!-- SPRING -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- MISC -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>spring-mock-mvc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@@ -1,11 +0,0 @@
-- the password hash is generated by BCrypt Calculator Generator(https://www.dailycred.com/article/bcrypt-calculator)
INSERT INTO user (id, username, password, firstname, lastname) VALUES (1, 'user', '{bcrypt}$2a$04$Vbug2lwwJGrvUXTj6z7ff.97IzVBkrJ1XfApfGNl.Z695zqcnPYra', 'John', 'Doe');
INSERT INTO user (id, username, password, firstname, lastname) VALUES (2, 'admin', '{bcrypt}$2a$04$Vbug2lwwJGrvUXTj6z7ff.97IzVBkrJ1XfApfGNl.Z695zqcnPYra', 'Admin', 'Admin');
INSERT INTO authority (id, name) VALUES (1, 'ROLE_USER');
INSERT INTO authority (id, name) VALUES (2, 'ROLE_ADMIN');
INSERT INTO user_authority (user_id, authority_id) VALUES (1, 1);
INSERT INTO user_authority (user_id, authority_id) VALUES (2, 1);
INSERT INTO user_authority (user_id, authority_id) VALUES (2, 2);