Skip to content

Commit

Permalink
Merge pull request #17 from mraible/stormpath-from-module
Browse files Browse the repository at this point in the history
Integrate Stormpath using 'yo jhipster-stormpath'
  • Loading branch information
mraible committed Oct 31, 2016
2 parents b582fde + 5d53f87 commit d62e67f
Show file tree
Hide file tree
Showing 87 changed files with 459 additions and 2,873 deletions.
56 changes: 34 additions & 22 deletions .travis.yml
@@ -1,37 +1,49 @@
os:
- linux
- linux
services:
- docker
- docker
language: java
node_js:
- "4.5.0"
- 4.5.0
jdk:
- oraclejdk8
- oraclejdk8
sudo: false
cache:
directories:
- node
- node_modules
- $HOME/.m2
- node
- node_modules
- "$HOME/.m2"
env:
matrix:
- NODE_VERSION=4.5.0
global:
- secure: L9c/3p5dK/W04L0ZRJArocudsRV6f0BL/EduUw6cVSv0wnuEN5bgWphyrDJ62i57ak8JWrx8NvlMAypb37/tGm5YLmRx8gn9+hrHY9xrhwTQlHO84dVwAWuuwWCKGMcxY+dPJbnumaBtjekVxsw6OFSJ+4LlI2MyAJ1Tvca/5uKXlraXcrkaUEnuJqLVMHBb0CcE7IFOo6PQ+YnBc5FXykprNFpqryXeRE/5DVDmd8c7rx/r9Z96ulQbAYFelCAkK5vLfCaHyf17U5FygZObGOvF/f1kOJ0BNy0t/Vs1z5r8pVIcByj6qgZoqPduIjhjgMtp6SnXM/Fw3e1wJ9MBzETni5BlAQcDEyMbSHEUbf9sZOemOq9i6hUWAUCK6tnGiMsvl34iptv4CGE9uDv9Qn/bsLmdLtwxKEE2E0bcSsrcB2Ve6ntpgfWExGYoqve6z1WFgnkHp+/LbRCAYQsJzJx+qZB1GGapXAz47j9gVuPWYk7ri8wq8CBGB8OLRky99/pbq986BqHCivssBPcJdFbGrSxAL7rS49txLN4ErHvw+tJQldUp3jBzgx9yzrjUfWUIuIGU+rntrvOQEQY2TQcXzOBw4GC8Sm8vMbyzE/KZISXLC2H5sq0eTkxrjbUGLgfNEtQTJql3v6ZOKm8tmvSzeev5UmU5gRMkreMrcRg=
- secure: ssxhcqo40amZGlF/Vt7I01QMEFbz45CTeuZJVZNgpR4lLmb6VEiosHe2RjSPE2ZypWPuedZRFXdJpyTRFyIGqYveeB776uvkBsA6XS1zJxzwgSecvo5C7S48yFQhKDj3TyWpJSgAtngLafDlLcDKndk7nGCKgJEqine47uCDFLaVsE7/v0uhe3SAFchazGSTjTyURki/3rR508HMZUbe3MKYGGZUZeG4e6GF19haqGfSZUqrXP67K8Oo4vcOVIQSfpS/8xEy39tdmD3u48QPyraVU2Yr/gm56Ru62Zrvl0m8RtA1Z70srufMjTwrG6z95vU8PiM2qmLc5Yb7qR2rmmwri98vMKnAByakjDV0p5n6JdDHL5HszZRHhGa4FK8Q7LElIMYZY9I+re+UW/ZR3xsNZRd06kbnYvnds584JiGwPejXwphx+cuGgDSe2LBF2QHJwfoM2OC3LzcNyQR0hx9MYeT+Ecoq+L8aNxsYDgNmmZ/H2guTkmiVQsrKFUalaL5YtyuMKGUMpn8v4MJdwQP1rOfFidV6dfwh7OJamEioN8q+fb/a5/CjFE/T6Nzr9e+vuojpS+sYdabYSn626lza3Cs8BPq6mIQ5h+c3QapM7bBi7/ptjkb+UALr7XsJ5rGm9fjhQnJ2heMehP/QJDtRWvWeL5E7rjY4CYs8dK8=
before_install:
- nvm install $NODE_VERSION
- npm install -g npm
- npm install -g bower gulp-cli
- node -v
- npm -v
- bower -v
- gulp -v
- java -version
- nvm install $NODE_VERSION
- npm install -g npm
- npm install -g bower gulp-cli
- node -v
- npm -v
- bower -v
- gulp -v
- java -version
install: npm install
script:
- ./mvnw clean
- ./mvnw test
- gulp test
- ./mvnw package -Pprod -DskipTests
- ./mvnw clean
- ./mvnw test
- gulp test
- mkdir -p target/reports/e2e/screenshots/
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- mvn spring-boot:run &
- bootPid=$!
- sleep 90s
- gulp itest
- kill $bootPid
- ./mvnw package -Pprod -DskipTests
notifications:
webhooks:
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
on_success: change
on_failure: always
on_start: false
5 changes: 4 additions & 1 deletion .yo-rc.json
Expand Up @@ -32,5 +32,8 @@
"de"
],
"serviceDiscoveryType": false
},
"generator-jhipster-stormpath": {
"authenticationType": "stormpath"
}
}
}
3 changes: 2 additions & 1 deletion bower.json
Expand Up @@ -30,7 +30,8 @@
"ngInfiniteScroll": "1.3.0",
"sockjs-client": "1.1.1",
"stomp-websocket": "2.3.4",
"swagger-ui": "2.1.5"
"swagger-ui": "2.1.5",
"stormpath-sdk-angularjs": "1.1.1"
},
"devDependencies": {
"angular-mocks": "1.5.8"
Expand Down
6 changes: 5 additions & 1 deletion gulp/serve.js
Expand Up @@ -19,7 +19,11 @@ module.exports = function () {
'/management',
'/swagger-resources',
'/v2/api-docs',
'/h2-console'
'/forgot',
'/login',
'/logout',
'/me',
'/register'
];

var requireTrailingSlash = proxyRoutes.filter(function (r) {
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -400,6 +400,11 @@
<artifactId>metrics-spark-reporter</artifactId>
<version>${metrics-spark-reporter.version}</version>
</dependency>
<dependency>
<groupId>com.stormpath.spring</groupId>
<artifactId>stormpath-spring-security-webmvc-spring-boot-starter</artifactId>
<version>1.1.2</version>
</dependency>
<!-- jhipster-needle-maven-add-dependency -->
</dependencies>
<build>
Expand Down
Expand Up @@ -2,12 +2,10 @@

import com.stormpath.example.security.*;
import com.stormpath.example.security.jwt.*;

import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
Expand All @@ -16,12 +14,14 @@
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.password.PasswordEncoder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;

import javax.inject.Inject;

import static com.stormpath.spring.config.StormpathWebSecurityConfigurer.stormpath;

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
Expand All @@ -46,7 +46,7 @@ public void configureGlobal(AuthenticationManagerBuilder auth) {
try {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoder());
.passwordEncoder(passwordEncoder());
} catch (Exception e) {
throw new BeanInitializationException("Security configuration failed", e);
}
Expand All @@ -68,6 +68,8 @@ public void configure(WebSecurity web) throws Exception {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.apply(stormpath())
.and()
.exceptionHandling()
.authenticationEntryPoint(authenticationEntryPoint)
.and()
Expand All @@ -81,11 +83,7 @@ protected void configure(HttpSecurity http) throws Exception {
.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("/**").permitAll()
.antMatchers("/api/profile-info").permitAll()
.antMatchers("/api/**").authenticated()
.antMatchers("/websocket/tracker").hasAuthority(AuthoritiesConstants.ADMIN)
Expand All @@ -96,7 +94,6 @@ protected void configure(HttpSecurity http) throws Exception {
.antMatchers("/swagger-ui/index.html").hasAuthority(AuthoritiesConstants.ADMIN)
.and()
.apply(securityConfigurerAdapter());

}

private JWTConfigurer securityConfigurerAdapter() {
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/config/application.yml
Expand Up @@ -75,3 +75,11 @@ jhipster:
ribbon:
# comma seperated list of profiles to show a ribbon on the GUI
displayOnActiveProfiles: dev

# Stormpath configuration
stormpath:
web:
me:
expand:
groups: true
customData: true
16 changes: 15 additions & 1 deletion src/main/resources/ehcache.xml
Expand Up @@ -36,6 +36,20 @@
<cache name="com.stormpath.example.domain.User.persistentTokens"
timeToLiveSeconds="3600">
</cache>


<!-- Stormpath cache entries -->
<cache name="com.stormpath.sdk.tenant.Tenant" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.application.Application" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.application.ApplicationAccountStoreMapping" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.directory.Directory" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.servlet.nonces" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.oauth.AccessToken" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.provider.Provider" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.account.Account" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.group.Group" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.group.GroupMembership" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.directory.CustomData" timeToLiveSeconds="3600"/>
<cache name="com.stormpath.sdk.oauth.RefreshToken" timeToLiveSeconds="3600"/>

<!-- jhipster-needle-ehcache-add-entry -->
</ehcache>
1 change: 1 addition & 0 deletions src/main/resources/logback-spring.xml
Expand Up @@ -24,6 +24,7 @@

<logger name="com.stormpath.example" level="#logback.loglevel#"/>

<logger name="com.stormpath" level="WARN"/>
<logger name="javax.activation" level="WARN"/>
<logger name="javax.mail" level="WARN"/>
<logger name="javax.xml.bind" level="WARN"/>
Expand Down
23 changes: 0 additions & 23 deletions src/main/webapp/app/account/activate/activate.controller.js

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/webapp/app/account/activate/activate.html

This file was deleted.

33 changes: 0 additions & 33 deletions src/main/webapp/app/account/activate/activate.state.js

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions src/main/webapp/app/account/change-password/change-password.js

This file was deleted.

10 changes: 6 additions & 4 deletions src/main/webapp/app/account/forgot-password/forgot-password.html
@@ -1,6 +1,8 @@
<div class="container">
<div class="row">
<h3>Forgot Password</h3>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1 data-translate="reset.request.title">Reset your password</h1>

<div class="form-forgot-password"
sp-password-reset-request-form template-url="app/stormpath/password-reset.tpl.html"></div>
</div>
<div sp-password-reset-request-form template-url="app/stormpath/password-reset.tpl.html"></div>
</div>
@@ -1,4 +1,4 @@
(function() {
(function () {
'use strict';

angular.module('stormtrooperApp')
Expand All @@ -21,7 +21,7 @@
},
resolve: {
translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
$translatePartialLoader.addPart('forgot-password');
$translatePartialLoader.addPart('reset');
return $translate.refresh();
}]
}
Expand Down

0 comments on commit d62e67f

Please sign in to comment.