Skip to content

Commit

Permalink
automatic project update
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubois committed Sep 8, 2017
1 parent 4822080 commit ed3068d
Show file tree
Hide file tree
Showing 69 changed files with 1,197 additions and 1,133 deletions.
6 changes: 3 additions & 3 deletions .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"prodDatabaseType": "mysql",
"useCompass": false,
"buildTool": "maven",
"rememberMeKey": "5c37379956bd1242f5636c8cb322c2966ad81277",
"searchEngine": false,
"enableTranslation": true,
"applicationType": "monolith",
Expand All @@ -31,6 +30,7 @@
"messageBroker": false,
"serviceDiscoveryType": false,
"clientPackageManager": "yarn",
"clientFramework": "angular1"
"clientFramework": "angular1",
"jwtSecretKey": "07a00779cfd8d372c73b40631b62c81503e1b18e"
}
}
}
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# jhipsterSampleApplication
This application was generated using JHipster 4.7.0, you can find documentation and help at [https://jhipster.github.io/documentation-archive/v4.7.0](https://jhipster.github.io/documentation-archive/v4.7.0).
This application was generated using JHipster 4.7.0, you can find documentation and help at [http://www.jhipster.tech/documentation-archive/v4.7.0](http://www.jhipster.tech/documentation-archive/v4.7.0).

## Development

Expand Down Expand Up @@ -32,6 +32,7 @@ Add the `-h` flag on any command to see how you can use it. For example, `bower
For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][].



## Building for production

To optimize the jhipsterSampleApplication application for production, run:
Expand Down Expand Up @@ -83,7 +84,7 @@ To stop it and remove the container, run:
You can also fully dockerize your application and all the services that it depends on.
To achieve this, first build a docker image of your app by running:

./mvnw package -Pprod docker:build
./mvnw package -Pprod dockerfile:build

Then run:

Expand All @@ -95,14 +96,14 @@ For more information refer to [Using Docker and Docker-Compose][], this page als

To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.

[JHipster Homepage and latest documentation]: https://jhipster.github.io
[JHipster 4.7.0 archive]: https://jhipster.github.io/documentation-archive/v4.7.0
[JHipster Homepage and latest documentation]: http://www.jhipster.tech
[JHipster 4.7.0 archive]: http://www.jhipster.tech/documentation-archive/v4.7.0

[Using JHipster in development]: https://jhipster.github.io/documentation-archive/v4.7.0/development/
[Using Docker and Docker-Compose]: https://jhipster.github.io/documentation-archive/v4.7.0/docker-compose
[Using JHipster in production]: https://jhipster.github.io/documentation-archive/v4.7.0/production/
[Running tests page]: https://jhipster.github.io/documentation-archive/v4.7.0/running-tests/
[Setting up Continuous Integration]: https://jhipster.github.io/documentation-archive/v4.7.0/setting-up-ci/
[Using JHipster in development]: http://www.jhipster.tech/documentation-archive/v4.7.0/development/
[Using Docker and Docker-Compose]: http://www.jhipster.tech/documentation-archive/v4.7.0/docker-compose
[Using JHipster in production]: http://www.jhipster.tech/documentation-archive/v4.7.0/production/
[Running tests page]: http://www.jhipster.tech/documentation-archive/v4.7.0/running-tests/
[Setting up Continuous Integration]: http://www.jhipster.tech/documentation-archive/v4.7.0/setting-up-ci/

[Gatling]: http://gatling.io/
[Node.js]: https://nodejs.org/
Expand Down
3 changes: 3 additions & 0 deletions gulp/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ function parseVersion() {
var version = null;
var pomXml = fs.readFileSync('pom.xml', 'utf8');
parseString(pomXml, function (err, result) {
if (err) {
throw new Error('Failed to parse pom.xml: ' + err);
}
if (result.project.version && result.project.version[0]) {
version = result.project.version[0];
} else if (result.project.parent && result.project.parent[0] && result.project.parent[0].version && result.project.parent[0].version[0]) {
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated on 2017-08-23 using generator-jhipster 4.7.0
// Generated on 2017-09-08 using generator-jhipster 4.7.0
'use strict';

var gulp = require('gulp'),
Expand Down
73 changes: 60 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@
<awaitility.version>2.0.0</awaitility.version>
<commons-io.version>2.5</commons-io.version>
<commons-lang.version>3.5</commons-lang.version>
<docker-maven-plugin.version>0.4.13</docker-maven-plugin.version>
<dockerfile-maven-plugin.version>1.3.4</dockerfile-maven-plugin.version>
<!-- Overridden to get metrics-jcache -->
<dropwizard-metrics.version>3.2.2</dropwizard-metrics.version>
<frontend-maven-plugin.version>1.4</frontend-maven-plugin.version>
<gatling.version>2.2.5</gatling.version>
<gatling-maven-plugin.version>2.2.4</gatling-maven-plugin.version>
<hibernate.version>5.2.8.Final</hibernate.version>
<hibernate.version>5.2.10.Final</hibernate.version>
<hikaricp.version>2.6.0</hikaricp.version>
<jacoco-maven-plugin.version>0.7.9</jacoco-maven-plugin.version>
<java.version>1.8</java.version>
<jcache.version>1.0.0</jcache.version>
<jzlib.version>1.1.3</jzlib.version>
<jhipster.server.version>1.1.9</jhipster.server.version>
<jjwt.version>0.7.0</jjwt.version>
<liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
<logstash-logback-encoder.version>4.11</logstash-logback-encoder.version>
Expand Down Expand Up @@ -342,6 +343,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
<!-- Spring Cloud -->
<dependency>
<groupId>net.logstash.logback</groupId>
Expand Down Expand Up @@ -480,6 +486,25 @@
</resources>
</configuration>
</execution>
<execution>
<id>docker-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target/</outputDirectory>
<resources>
<resource>
<directory>src/main/docker/</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.yml</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down Expand Up @@ -577,18 +602,24 @@
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker-maven-plugin.version}</version>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile-maven-plugin.version}</version>
<!--
Uncomment the section below to build the docker image with mvn package and and push it with mvn deploy
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
-->
<configuration>
<imageName>jhipstersampleapplication</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.war</include>
</resource>
</resources>
<repository>${project.artifactId}</repository>
<tag>latest</tag>
<contextDirectory>${project.build.directory}</contextDirectory>
</configuration>
</plugin>
<!-- jhipster-needle-maven-add-plugin -->
Expand Down Expand Up @@ -683,6 +714,14 @@
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>src/main/webapp/</warSourceDirectory>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/**</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -719,6 +758,14 @@
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>target/www/</warSourceDirectory>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/**</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
Expand Down
5 changes: 5 additions & 0 deletions src/main/docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://docs.docker.com/engine/reference/builder/#dockerignore-file
# by default ignore everything except the jar file
**/*
!*.jar
!*.war
3 changes: 1 addition & 2 deletions src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
JHIPSTER_SLEEP=0 \
JAVA_OPTS=""

# add directly the war
ADD *.war /app.war
ADD @project.build.finalName@.war /app.war

EXPOSE 8080
CMD echo "The application will start in ${JHIPSTER_SLEEP}s..." && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public JhipsterSampleApplicationApp(Environment env) {
* <p>
* Spring profiles can be configured with a program arguments --spring.profiles.active=your-active-profile
* <p>
* You can find more information on how profiles work with JHipster on <a href="https://jhipster.github.io/profiles/">https://jhipster.github.io/profiles/</a>.
* You can find more information on how profiles work with JHipster on <a href="http://www.jhipster.tech/profiles/">http://www.jhipster.tech/profiles/</a>.
*/
@PostConstruct
public void initApplication() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ public CacheConfiguration(JHipsterProperties jHipsterProperties) {
@Bean
public JCacheManagerCustomizer cacheManagerCustomizer() {
return cm -> {
cm.createCache("users", jcacheConfiguration);
cm.createCache(io.github.jhipster.sample.domain.User.class.getName(), jcacheConfiguration);
cm.createCache(io.github.jhipster.sample.domain.Authority.class.getName(), jcacheConfiguration);
cm.createCache(io.github.jhipster.sample.domain.User.class.getName() + ".authorities", jcacheConfiguration);
cm.createCache(io.github.jhipster.sample.domain.PersistentToken.class.getName(), jcacheConfiguration);
cm.createCache(io.github.jhipster.sample.domain.User.class.getName() + ".persistentTokens", jcacheConfiguration);
cm.createCache(io.github.jhipster.sample.domain.BankAccount.class.getName(), jcacheConfiguration);
cm.createCache(io.github.jhipster.sample.domain.BankAccount.class.getName() + ".operations", jcacheConfiguration);
cm.createCache(io.github.jhipster.sample.domain.Label.class.getName(), jcacheConfiguration);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.jhipster.sample.config;

import io.github.jhipster.sample.security.*;
import io.github.jhipster.sample.security.jwt.*;

import io.github.jhipster.config.JHipsterProperties;
import io.github.jhipster.security.*;

import org.springframework.beans.factory.BeanInitializationException;
Expand All @@ -15,12 +15,11 @@
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.filter.CorsFilter;

Expand All @@ -35,20 +34,17 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

private final UserDetailsService userDetailsService;

private final JHipsterProperties jHipsterProperties;

private final RememberMeServices rememberMeServices;
private final TokenProvider tokenProvider;

private final CorsFilter corsFilter;

public SecurityConfiguration(AuthenticationManagerBuilder authenticationManagerBuilder, UserDetailsService userDetailsService,
JHipsterProperties jHipsterProperties, RememberMeServices rememberMeServices,
TokenProvider tokenProvider,
CorsFilter corsFilter) {

this.authenticationManagerBuilder = authenticationManagerBuilder;
this.userDetailsService = userDetailsService;
this.jHipsterProperties = jHipsterProperties;
this.rememberMeServices = rememberMeServices;
this.tokenProvider = tokenProvider;
this.corsFilter = corsFilter;
}

Expand All @@ -63,21 +59,6 @@ public void init() {
}
}

@Bean
public AjaxAuthenticationSuccessHandler ajaxAuthenticationSuccessHandler() {
return new AjaxAuthenticationSuccessHandler();
}

@Bean
public AjaxAuthenticationFailureHandler ajaxAuthenticationFailureHandler() {
return new AjaxAuthenticationFailureHandler();
}

@Bean
public AjaxLogoutSuccessHandler ajaxLogoutSuccessHandler() {
return new AjaxLogoutSuccessHandler();
}

@Bean
public Http401UnauthorizedEntryPoint http401UnauthorizedEntryPoint() {
return new Http401UnauthorizedEntryPoint();
Expand All @@ -104,49 +85,39 @@ public void configure(WebSecurity web) throws Exception {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.and()
.addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class)
.exceptionHandling()
.authenticationEntryPoint(http401UnauthorizedEntryPoint())
.and()
.rememberMe()
.rememberMeServices(rememberMeServices)
.rememberMeParameter("remember-me")
.key(jHipsterProperties.getSecurity().getRememberMe().getKey())
.and()
.formLogin()
.loginProcessingUrl("/api/authentication")
.successHandler(ajaxAuthenticationSuccessHandler())
.failureHandler(ajaxAuthenticationFailureHandler())
.usernameParameter("j_username")
.passwordParameter("j_password")
.permitAll()
.and()
.logout()
.logoutUrl("/api/logout")
.logoutSuccessHandler(ajaxLogoutSuccessHandler())
.permitAll()
.and()
.csrf()
.disable()
.headers()
.frameOptions()
.disable()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/api/register").permitAll()
.antMatchers("/api/activate").permitAll()
.antMatchers("/api/authenticate").permitAll()
.antMatchers("/api/account/reset_password/init").permitAll()
.antMatchers("/api/account/reset_password/finish").permitAll()
.antMatchers("/api/account/reset-password/init").permitAll()
.antMatchers("/api/account/reset-password/finish").permitAll()
.antMatchers("/api/profile-info").permitAll()
.antMatchers("/api/**").authenticated()
.antMatchers("/management/health").permitAll()
.antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/v2/api-docs/**").permitAll()
.antMatchers("/swagger-resources/configuration/ui").permitAll()
.antMatchers("/swagger-ui/index.html").hasAuthority(AuthoritiesConstants.ADMIN);
.antMatchers("/swagger-ui/index.html").hasAuthority(AuthoritiesConstants.ADMIN)
.and()
.apply(securityConfigurerAdapter());

}

private JWTConfigurer securityConfigurerAdapter() {
return new JWTConfigurer(tokenProvider);
}

@Bean
Expand Down
Loading

0 comments on commit ed3068d

Please sign in to comment.