Release v2.7.0

This commit is contained in:
Julien Dubois 2015-04-03 14:37:30 +02:00
parent 52068f33b4
commit 07c318eab6
17 changed files with 165 additions and 54 deletions

6
.gitignore vendored
View File

@ -116,3 +116,9 @@ Desktop.ini
*.*~
*~
.merge_file*
######################
# Gradle Wrapper
######################
!gradle/wrapper/gradle-wrapper.jar

View File

@ -1,4 +1,4 @@
// Generated on 2015-03-10 using generator-jhipster 2.6.0
// Generated on 2015-04-03 using generator-jhipster 2.7.0
'use strict';
var fs = require('fs');
@ -372,7 +372,7 @@ module.exports = function (grunt) {
},
dev: {
options: {
dest: 'src/main/webapp/scripts/app/app.constants.js',
dest: 'src/main/webapp/scripts/app/app.constants.js'
},
constants: {
ENV: 'dev',
@ -381,7 +381,7 @@ module.exports = function (grunt) {
},
prod: {
options: {
dest: '.tmp/scripts/app/app.constants.js',
dest: '.tmp/scripts/app/app.constants.js'
},
constants: {
ENV: 'prod',

View File

@ -41,7 +41,7 @@
"karma-requirejs": "0.2.2",
"karma-phantomjs-launcher": "0.1.4",
"karma": "0.12.32",
"generator-jhipster": "2.6.0",
"generator-jhipster": "2.7.0",
"lodash": "3.3.1",
"xml2js": "0.4.5",
"zeparser": "0.0.7",

17
pom.xml
View File

@ -5,7 +5,7 @@
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>1.2.2.RELEASE</version>
<version>1.2.3.RELEASE</version>
<relativePath/>
</parent>
@ -30,6 +30,8 @@
<gatling-maven-plugin.version>2.1.2</gatling-maven-plugin.version>
<hibernate.version>4.3.6.Final</hibernate.version>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<javax.inject.version>1</javax.inject.version>
<joda-time-hibernate.version>1.3</joda-time-hibernate.version>
<json-path.version>0.9.1</json-path.version>
@ -43,6 +45,7 @@
<metrics-spring.version>3.0.3</metrics-spring.version>
<run.addResources>false</run.addResources>
<sonar-maven-plugin.version>2.3</sonar-maven-plugin.version>
<spring-security.version>4.0.0.RELEASE</spring-security.version>
<swagger-springmvc.version>0.9.5</swagger-springmvc.version>
<usertype-core.version>3.2.0.GA</usertype-core.version>
</properties>
@ -331,6 +334,18 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-localconfig-connector</artifactId>
</dependency>
<!-- security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-data</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-messaging</artifactId>
<version>${spring-security.version}</version>
</dependency>
<!-- reporting -->
<dependency>
<groupId>fr.ippon.spark.metrics</groupId>
<artifactId>metrics-spark-reporter</artifactId>

View File

@ -7,7 +7,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
/**
* This is an helper Java class that provides an alternative to creating a web.xml.
* This is a helper Java class that provides an alternative to creating a web.xml.
*/
public class ApplicationWebXml extends SpringBootServletInitializer {

View File

@ -20,6 +20,8 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.csrf.CsrfFilter;
@ -27,6 +29,7 @@ import javax.inject.Inject;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Inject
@ -77,6 +80,9 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.ignoringAntMatchers("/websocket/**")
.and()
.addFilterAfter(new CsrfCookieGeneratorFilter(), CsrfFilter.class)
.exceptionHandling()
.authenticationEntryPoint(authenticationEntryPoint)
@ -102,50 +108,31 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
.headers()
.frameOptions()
.disable()
.and()
.authorizeRequests()
.antMatchers("/api/register").permitAll()
.antMatchers("/api/activate").permitAll()
.antMatchers("/api/authenticate").permitAll()
.antMatchers("/api/logs/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/api/**").authenticated()
.antMatchers("/metrics/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/health/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/trace/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/dump/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/shutdown/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/beans/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/configprops/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/info/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/autoconfig/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/env/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/trace/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/api-docs/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/protected/**").authenticated();
.antMatchers("/api/register").permitAll()
.antMatchers("/api/activate").permitAll()
.antMatchers("/api/authenticate").permitAll()
.antMatchers("/api/logs/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/api/**").authenticated()
.antMatchers("/metrics/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/health/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/trace/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/dump/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/shutdown/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/beans/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/configprops/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/info/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/autoconfig/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/env/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/trace/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/api-docs/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/protected/**").authenticated();
}
@EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true)
private static class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration {
}
/**
* This allows SpEL support in Spring Data JPA @Query definitions.
*
* See https://spring.io/blog/2014/07/15/spel-support-in-spring-data-jpa-query-definitions
*/
@Bean
EvaluationContextExtension securityExtension() {
return new EvaluationContextExtensionSupport() {
@Override
public String getExtensionId() {
return "security";
}
@Override
public SecurityExpressionRoot getRootObject() {
return new SecurityExpressionRoot(SecurityContextHolder.getContext().getAuthentication()) {};
}
};
public SecurityEvaluationContextExtension securityEvaluationContextExtension() {
return new SecurityEvaluationContextExtension();
}
}

View File

@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import java.util.List;
@ -49,7 +48,6 @@ public class UserResource {
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@RolesAllowed(AuthoritiesConstants.ADMIN)
ResponseEntity<User> getUser(@PathVariable String login) {
log.debug("REST request to get User : {}", login);
return userRepository.findOneByLogin(login)

View File

@ -70,11 +70,14 @@
<script src="scripts/app/app.constants.js"></script>
<script src="scripts/components/auth/auth.service.js"></script>
<script src="scripts/components/auth/principal.service.js"></script>
<script src="scripts/components/auth/authority.directive.js"></script>
<script src="scripts/components/auth/services/account.service.js"></script>
<script src="scripts/components/auth/services/activate.service.js"></script>
<script src="scripts/components/auth/services/password.service.js"></script>
<script src="scripts/components/auth/services/register.service.js"></script>
<script src="scripts/components/form/form.directive.js"></script>
<script src="scripts/components/form/pager.directive.js"></script>
<script src="scripts/components/form/pagination.directive.js"></script>
<script src="scripts/components/language/language.service.js"></script>
<script src="scripts/components/language/language.controller.js"></script>
<script src="scripts/components/admin/audits.service.js"></script>

View File

@ -13,9 +13,8 @@ angular.module('jhipsterApp')
// After the login the language will be changed to
// the language selected by the user during his registration
$translate.use(account.langKey);
deferred.resolve(data);
});
deferred.resolve(data);
return cb();
}).catch(function (err) {
this.logout();

View File

@ -0,0 +1,65 @@
'use strict';
angular.module('jhipsterApp')
.directive('hasAnyRole', ['Principal', function (Principal) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var setVisible = function () {
element.removeClass('hidden');
},
setHidden = function () {
element.addClass('hidden');
},
defineVisibility = function (reset) {
var result;
if (reset) {
setVisible();
}
result = Principal.isInAnyRole(roles);
if (result) {
setVisible();
} else {
setHidden();
}
},
roles = attrs.hasAnyRole.replace(/\s+/g, '').split(',');
if (roles.length > 0) {
defineVisibility(true);
}
}
};
}])
.directive('hasRole', ['Principal', function (Principal) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var setVisible = function () {
element.removeClass('hidden');
},
setHidden = function () {
element.addClass('hidden');
},
defineVisibility = function (reset) {
var result;
if (reset) {
setVisible();
}
result = Principal.isInRole(role);
if (result) {
setVisible();
} else {
setHidden();
}
},
role = attrs.hasRole.replace(/\s+/g, '');
if (role.length > 0) {
defineVisibility(true);
}
}
};
}]);

View File

@ -0,0 +1,9 @@
/* globals $ */
'use strict';
angular.module('jhipsterApp')
.directive('jhipsterAppPager', function() {
return {
templateUrl: 'scripts/components/form/pager.html'
};
});

View File

@ -0,0 +1,8 @@
<nav>
<ul class="jhipsterApp-pager">
<li ng-show="links['first']" ng-click="loadPage(links['first'])"><a href="#">&lt;&lt;</a></li>
<li ng-show="links['prev']" ng-click="loadPage(links['prev'])"><a href="#">&lt;</a></li>
<li ng-show="links['next']" ng-click="loadPage(links['next'])"><a href="#">&gt;</a></li>
<li ng-show="links['last']" ng-click="loadPage(links['last'])"><a href="#">&gt;&gt;</a></li>
</ul>
</nav>

View File

@ -0,0 +1,9 @@
/* globals $ */
'use strict';
angular.module('jhipsterApp')
.directive('jhipsterAppPagination', function() {
return {
templateUrl: 'scripts/components/form/pagination.html'
};
});

View File

@ -0,0 +1,13 @@
<nav>
<ul class="jhipsterApp-pagination">
<li ng-show="links['first']" ng-click="loadPage(links['first'])"><a>&lt;&lt;</a></li>
<li ng-show="links['prev']" ng-click="loadPage(links['prev'])"><a>&lt;</a></li>
<li ng-show="page > 2" ng-click="loadPage(page - 2)"><a>{{page - 2}}</a></li>
<li ng-show="page > 1" ng-click="loadPage(page - 1)"><a>{{page - 1}}</a></li>
<li class="active"><a>{{page}}</a></li>
<li ng-show="page < links['last']" ng-click="loadPage(page + 1)"><a>{{page + 1}}</a></li>
<li ng-show="page < links['last'] - 1" ng-click="loadPage(page + 2)"><a>{{page + 2}}</a></li>
<li ng-show="links['next']" ng-click="loadPage(links['next'])"><a>&gt;</a></li>
<li ng-show="links['last']" ng-click="loadPage(links['last'])"><a>&gt;&gt;</a></li>
</ul>
</nav>

View File

@ -3,7 +3,6 @@
angular.module('jhipsterApp')
.controller('NavbarController', function ($scope, $location, $state, Auth, Principal) {
$scope.isAuthenticated = Principal.isAuthenticated;
$scope.isInRole = Principal.isInRole;
$scope.$state = $state;
$scope.logout = function () {

View File

@ -7,7 +7,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><span translate="global.title">jhipster</span> <span class="navbar-version">v{{VERSION}}</span></a>
<a class="navbar-brand" href="#/"><span translate="global.title">jhipster</span> <span class="navbar-version">v{{VERSION}}</span></a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse" ng-switch="isAuthenticated()">
<ul class="nav navbar-nav nav-pills navbar-right">
@ -57,7 +57,7 @@
&#xA0;<span translate="global.menu.account.register">Register</span></a></li>
</ul>
</li>
<li ng-class="{active: $state.includes('admin')}" ng-switch-when="true" ng-show="isInRole('ROLE_ADMIN')" class="dropdown pointer">
<li ng-class="{active: $state.includes('admin')}" ng-switch-when="true" has-role="ROLE_ADMIN" class="dropdown pointer">
<a class="dropdown-toggle" data-toggle="dropdown" href="">
<span>
<span class="glyphicon glyphicon-tower"></span>

View File

@ -32,7 +32,7 @@ module.exports = function (config) {
// endbower
'main/webapp/scripts/app/app.js',
'main/webapp/scripts/app/**/*.js',
'main/webapp/scripts/components/**/*.js',
'main/webapp/scripts/components/**/*.{js,html}',
'test/javascript/**/!(karma.conf).js'
],