├── .angular-cli.json ├── .editorconfig ├── .gitattributes ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .yo-rc.json ├── README.md ├── gulp ├── build.js ├── config.js ├── copy.js ├── handle-errors.js ├── handleErrors.js ├── inject.js ├── serve.js └── utils.js ├── mvnw ├── mvnw.cmd ├── package.json ├── pom.xml ├── proxy.conf.json ├── src ├── main │ ├── docker │ │ ├── .dockerignore │ │ ├── Dockerfile │ │ ├── app.yml │ │ ├── mysql.yml │ │ └── sonar.yml │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── jhipster │ │ │ └── sample │ │ │ ├── ApplicationWebXml.java │ │ │ ├── JhipsterJwtSampleApplicationApp.java │ │ │ ├── aop │ │ │ └── logging │ │ │ │ └── LoggingAspect.java │ │ │ ├── config │ │ │ ├── ApplicationProperties.java │ │ │ ├── AsyncConfiguration.java │ │ │ ├── CacheConfiguration.java │ │ │ ├── CloudDatabaseConfiguration.java │ │ │ ├── Constants.java │ │ │ ├── DatabaseConfiguration.java │ │ │ ├── DateTimeFormatConfiguration.java │ │ │ ├── DefaultProfileUtil.java │ │ │ ├── JacksonConfiguration.java │ │ │ ├── LocaleConfiguration.java │ │ │ ├── LoggingAspectConfiguration.java │ │ │ ├── LoggingConfiguration.java │ │ │ ├── MetricsConfiguration.java │ │ │ ├── SecurityConfiguration.java │ │ │ ├── ThymeleafConfiguration.java │ │ │ ├── WebConfigurer.java │ │ │ ├── audit │ │ │ │ ├── AuditEventConverter.java │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ │ ├── domain │ │ │ ├── AbstractAuditingEntity.java │ │ │ ├── Authority.java │ │ │ ├── PersistentAuditEvent.java │ │ │ ├── User.java │ │ │ └── package-info.java │ │ │ ├── repository │ │ │ ├── AuthorityRepository.java │ │ │ ├── CustomAuditEventRepository.java │ │ │ ├── PersistenceAuditEventRepository.java │ │ │ ├── UserRepository.java │ │ │ └── package-info.java │ │ │ ├── security │ │ │ ├── AuthoritiesConstants.java │ │ │ ├── DomainUserDetailsService.java │ │ │ ├── SecurityUtils.java │ │ │ ├── SpringSecurityAuditorAware.java │ │ │ ├── UserNotActivatedException.java │ │ │ ├── jwt │ │ │ │ ├── JWTConfigurer.java │ │ │ │ ├── JWTFilter.java │ │ │ │ └── TokenProvider.java │ │ │ └── package-info.java │ │ │ ├── service │ │ │ ├── AuditEventService.java │ │ │ ├── MailService.java │ │ │ ├── UserService.java │ │ │ ├── dto │ │ │ │ ├── UserDTO.java │ │ │ │ └── package-info.java │ │ │ ├── mapper │ │ │ │ ├── UserMapper.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── util │ │ │ │ └── RandomUtil.java │ │ │ └── web │ │ │ └── rest │ │ │ ├── AccountResource.java │ │ │ ├── AuditResource.java │ │ │ ├── LogsResource.java │ │ │ ├── ProfileInfoResource.java │ │ │ ├── UserJWTController.java │ │ │ ├── UserResource.java │ │ │ ├── errors │ │ │ ├── BadRequestAlertException.java │ │ │ ├── CustomParameterizedException.java │ │ │ ├── EmailAlreadyUsedException.java │ │ │ ├── EmailNotFoundException.java │ │ │ ├── ErrorConstants.java │ │ │ ├── ExceptionTranslator.java │ │ │ ├── FieldErrorVM.java │ │ │ ├── InternalServerErrorException.java │ │ │ ├── InvalidPasswordException.java │ │ │ ├── LoginAlreadyUsedException.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── util │ │ │ ├── HeaderUtil.java │ │ │ └── PaginationUtil.java │ │ │ └── vm │ │ │ ├── KeyAndPasswordVM.java │ │ │ ├── LoggerVM.java │ │ │ ├── LoginVM.java │ │ │ ├── ManagedUserVM.java │ │ │ └── package-info.java │ ├── resources │ │ ├── .h2.server.properties │ │ ├── banner.txt │ │ ├── config │ │ │ ├── application-dev.yml │ │ │ ├── application-prod.yml │ │ │ ├── application.yml │ │ │ └── liquibase │ │ │ │ ├── authorities.csv │ │ │ │ ├── changelog │ │ │ │ └── 00000000000000_initial_schema.xml │ │ │ │ ├── master.xml │ │ │ │ ├── users.csv │ │ │ │ └── users_authorities.csv │ │ ├── i18n │ │ │ ├── messages.properties │ │ │ └── messages_en.properties │ │ ├── logback-spring.xml │ │ ├── mails │ │ │ ├── activationEmail.html │ │ │ ├── creationEmail.html │ │ │ └── passwordResetEmail.html │ │ └── templates │ │ │ └── error.html │ └── webapp │ │ ├── 404.html │ │ ├── app │ │ ├── account │ │ │ ├── account.module.ts │ │ │ ├── account.route.ts │ │ │ ├── activate │ │ │ │ ├── activate.component.html │ │ │ │ ├── activate.component.ts │ │ │ │ ├── activate.route.ts │ │ │ │ └── activate.service.ts │ │ │ ├── index.ts │ │ │ ├── password-reset │ │ │ │ ├── finish │ │ │ │ │ ├── password-reset-finish.component.html │ │ │ │ │ ├── password-reset-finish.component.ts │ │ │ │ │ ├── password-reset-finish.route.ts │ │ │ │ │ └── password-reset-finish.service.ts │ │ │ │ └── init │ │ │ │ │ ├── password-reset-init.component.html │ │ │ │ │ ├── password-reset-init.component.ts │ │ │ │ │ ├── password-reset-init.route.ts │ │ │ │ │ └── password-reset-init.service.ts │ │ │ ├── password │ │ │ │ ├── password-strength-bar.component.ts │ │ │ │ ├── password-strength-bar.css │ │ │ │ ├── password.component.html │ │ │ │ ├── password.component.ts │ │ │ │ ├── password.route.ts │ │ │ │ └── password.service.ts │ │ │ ├── register │ │ │ │ ├── register.component.html │ │ │ │ ├── register.component.ts │ │ │ │ ├── register.route.ts │ │ │ │ └── register.service.ts │ │ │ └── settings │ │ │ │ ├── settings.component.html │ │ │ │ ├── settings.component.ts │ │ │ │ └── settings.route.ts │ │ ├── admin │ │ │ ├── admin.module.ts │ │ │ ├── admin.route.ts │ │ │ ├── audits │ │ │ │ ├── audit-data.model.ts │ │ │ │ ├── audit.model.ts │ │ │ │ ├── audits.component.html │ │ │ │ ├── audits.component.ts │ │ │ │ ├── audits.route.ts │ │ │ │ └── audits.service.ts │ │ │ ├── configuration │ │ │ │ ├── configuration.component.html │ │ │ │ ├── configuration.component.ts │ │ │ │ ├── configuration.route.ts │ │ │ │ └── configuration.service.ts │ │ │ ├── docs │ │ │ │ ├── docs.component.html │ │ │ │ ├── docs.component.ts │ │ │ │ └── docs.route.ts │ │ │ ├── health │ │ │ │ ├── health-modal.component.html │ │ │ │ ├── health-modal.component.ts │ │ │ │ ├── health.component.html │ │ │ │ ├── health.component.ts │ │ │ │ ├── health.route.ts │ │ │ │ └── health.service.ts │ │ │ ├── index.ts │ │ │ ├── logs │ │ │ │ ├── log.model.ts │ │ │ │ ├── logs.component.html │ │ │ │ ├── logs.component.ts │ │ │ │ ├── logs.route.ts │ │ │ │ └── logs.service.ts │ │ │ ├── metrics │ │ │ │ ├── metrics-modal.component.html │ │ │ │ ├── metrics-modal.component.ts │ │ │ │ ├── metrics.component.html │ │ │ │ ├── metrics.component.ts │ │ │ │ ├── metrics.route.ts │ │ │ │ └── metrics.service.ts │ │ │ └── user-management │ │ │ │ ├── user-management-delete-dialog.component.html │ │ │ │ ├── user-management-delete-dialog.component.ts │ │ │ │ ├── user-management-detail.component.html │ │ │ │ ├── user-management-detail.component.ts │ │ │ │ ├── user-management-dialog.component.html │ │ │ │ ├── user-management-dialog.component.ts │ │ │ │ ├── user-management.component.html │ │ │ │ ├── user-management.component.ts │ │ │ │ ├── user-management.route.ts │ │ │ │ └── user-modal.service.ts │ │ ├── app-routing.module.ts │ │ ├── app.constants.ts │ │ ├── app.main.ts │ │ ├── app.module.ts │ │ ├── app.route.ts │ │ ├── blocks │ │ │ ├── config │ │ │ │ ├── prod.config.ts │ │ │ │ └── uib-pagination.config.ts │ │ │ └── interceptor │ │ │ │ ├── auth-expired.interceptor.ts │ │ │ │ ├── auth.interceptor.ts │ │ │ │ ├── errorhandler.interceptor.ts │ │ │ │ ├── http.provider.ts │ │ │ │ └── notification.interceptor.ts │ │ ├── entities │ │ │ └── entity.module.ts │ │ ├── home │ │ │ ├── home.component.html │ │ │ ├── home.component.ts │ │ │ ├── home.css │ │ │ ├── home.module.ts │ │ │ ├── home.route.ts │ │ │ └── index.ts │ │ ├── layouts │ │ │ ├── error │ │ │ │ ├── error.component.html │ │ │ │ ├── error.component.ts │ │ │ │ └── error.route.ts │ │ │ ├── footer │ │ │ │ ├── footer.component.html │ │ │ │ └── footer.component.ts │ │ │ ├── index.ts │ │ │ ├── main │ │ │ │ ├── main.component.html │ │ │ │ └── main.component.ts │ │ │ ├── navbar │ │ │ │ ├── active-menu.directive.ts │ │ │ │ ├── navbar.component.html │ │ │ │ ├── navbar.component.ts │ │ │ │ ├── navbar.css │ │ │ │ └── navbar.route.ts │ │ │ └── profiles │ │ │ │ ├── page-ribbon.component.ts │ │ │ │ ├── page-ribbon.css │ │ │ │ ├── profile-info.model.ts │ │ │ │ └── profile.service.ts │ │ ├── polyfills.ts │ │ ├── shared │ │ │ ├── alert │ │ │ │ ├── alert-error.component.ts │ │ │ │ └── alert.component.ts │ │ │ ├── auth │ │ │ │ ├── account.service.ts │ │ │ │ ├── auth-jwt.service.ts │ │ │ │ ├── csrf.service.ts │ │ │ │ ├── has-any-authority.directive.ts │ │ │ │ ├── principal.service.ts │ │ │ │ ├── state-storage.service.ts │ │ │ │ └── user-route-access-service.ts │ │ │ ├── constants │ │ │ │ ├── error.constants.ts │ │ │ │ └── pagination.constants.ts │ │ │ ├── index.ts │ │ │ ├── language │ │ │ │ ├── find-language-from-key.pipe.ts │ │ │ │ ├── language.constants.ts │ │ │ │ └── language.helper.ts │ │ │ ├── login │ │ │ │ ├── login-modal.service.ts │ │ │ │ ├── login.component.html │ │ │ │ ├── login.component.ts │ │ │ │ └── login.service.ts │ │ │ ├── model │ │ │ │ ├── base-entity.ts │ │ │ │ ├── request-util.ts │ │ │ │ └── response-wrapper.model.ts │ │ │ ├── shared-common.module.ts │ │ │ ├── shared-libs.module.ts │ │ │ ├── shared.module.ts │ │ │ └── user │ │ │ │ ├── account.model.ts │ │ │ │ ├── user.model.ts │ │ │ │ └── user.service.ts │ │ └── vendor.ts │ │ ├── content │ │ ├── css │ │ │ ├── documentation.css │ │ │ ├── global.css │ │ │ └── vendor.css │ │ └── images │ │ │ ├── hipster.png │ │ │ ├── hipster2x.png │ │ │ └── logo-jhipster.png │ │ ├── favicon.ico │ │ ├── i18n │ │ └── en │ │ │ ├── activate.json │ │ │ ├── audits.json │ │ │ ├── configuration.json │ │ │ ├── error.json │ │ │ ├── gateway.json │ │ │ ├── global.json │ │ │ ├── health.json │ │ │ ├── home.json │ │ │ ├── login.json │ │ │ ├── logs.json │ │ │ ├── metrics.json │ │ │ ├── password.json │ │ │ ├── register.json │ │ │ ├── reset.json │ │ │ ├── sessions.json │ │ │ ├── settings.json │ │ │ └── user-management.json │ │ ├── index.html │ │ ├── manifest.webapp │ │ ├── robots.txt │ │ └── swagger-ui │ │ ├── dist │ │ └── images │ │ │ └── throbber.gif │ │ └── index.html └── test │ ├── gatling │ └── conf │ │ ├── gatling.conf │ │ └── logback.xml │ ├── java │ └── io │ │ └── github │ │ └── jhipster │ │ └── sample │ │ ├── config │ │ ├── WebConfigurerTest.java │ │ └── WebConfigurerTestController.java │ │ ├── repository │ │ └── CustomAuditEventRepositoryIntTest.java │ │ ├── security │ │ ├── SecurityUtilsUnitTest.java │ │ └── jwt │ │ │ ├── JWTFilterTest.java │ │ │ └── TokenProviderTest.java │ │ ├── service │ │ ├── MailServiceIntTest.java │ │ └── UserServiceIntTest.java │ │ └── web │ │ └── rest │ │ ├── AccountResourceIntTest.java │ │ ├── AuditResourceIntTest.java │ │ ├── LogsResourceIntTest.java │ │ ├── ProfileInfoResourceIntTest.java │ │ ├── TestUtil.java │ │ ├── UserJWTControllerIntTest.java │ │ ├── UserResourceIntTest.java │ │ ├── errors │ │ ├── ExceptionTranslatorIntTest.java │ │ └── ExceptionTranslatorTestController.java │ │ └── util │ │ └── PaginationUtilUnitTest.java │ ├── javascript │ ├── e2e │ │ ├── account │ │ │ └── account.spec.ts │ │ ├── admin │ │ │ └── administration.spec.ts │ │ └── page-objects │ │ │ └── jhi-page-objects.ts │ ├── karma.conf.js │ ├── protractor.conf.js │ └── spec │ │ ├── app │ │ ├── account │ │ │ ├── activate │ │ │ │ └── activate.component.spec.ts │ │ │ ├── password-reset │ │ │ │ ├── finish │ │ │ │ │ └── password-reset-finish.component.spec.ts │ │ │ │ └── init │ │ │ │ │ └── password-reset-init.component.spec.ts │ │ │ ├── password │ │ │ │ ├── password-strength-bar.component.spec.ts │ │ │ │ └── password.component.spec.ts │ │ │ ├── register │ │ │ │ └── register.component.spec.ts │ │ │ └── settings │ │ │ │ └── settings.component.spec.ts │ │ ├── admin │ │ │ ├── audits │ │ │ │ └── audits.component.spec.ts │ │ │ ├── health │ │ │ │ └── health.component.spec.ts │ │ │ └── user-management │ │ │ │ ├── user-management-delete-dialog.component.spec.ts │ │ │ │ ├── user-management-detail.component.spec.ts │ │ │ │ ├── user-management-dialog.component.spec.ts │ │ │ │ └── user-management.component.spec.ts │ │ └── shared │ │ │ ├── login │ │ │ └── login.component.spec.ts │ │ │ └── user │ │ │ └── user.service.spec.ts │ │ ├── entry.ts │ │ ├── helpers │ │ ├── mock-account.service.ts │ │ ├── mock-active-modal.service.ts │ │ ├── mock-event-manager.service.ts │ │ ├── mock-language.service.ts │ │ ├── mock-login.service.ts │ │ ├── mock-principal.service.ts │ │ ├── mock-route.service.ts │ │ ├── mock-state-storage.service.ts │ │ └── spyobject.ts │ │ └── test.module.ts │ └── resources │ ├── config │ └── application.yml │ ├── i18n │ └── messages_en.properties │ ├── logback.xml │ └── mails │ └── testEmail.html ├── tsconfig-aot.json ├── tsconfig.json ├── tslint.json ├── webpack ├── logo-jhipster.png ├── utils.js ├── webpack.common.js ├── webpack.dev.js ├── webpack.prod.js └── webpack.test.js └── yarn.lock /.angular-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "project": { 4 | "name": "jhipster-jwt-sample-application" 5 | }, 6 | "apps": [{ 7 | "root": "src/main/webapp", 8 | "outDir": "target/www/app", 9 | "assets": [ 10 | "content", 11 | "i18n", 12 | "favicon.ico" 13 | ], 14 | "index": "index.html", 15 | "main": "app/app.main.ts", 16 | "polyfills": "app/polyfills.ts", 17 | "test": "src/test/javascript/spec/entry.ts", 18 | "tsconfig": "../../../tsconfig.json", 19 | "prefix": "jhi", 20 | "mobile": false, 21 | "styles": [ 22 | "content/css/vendor.css", 23 | "content/css/global.css" 24 | ], 25 | "scripts": [] 26 | }], 27 | "e2e": { 28 | "protractor": { 29 | "config": "src/test/javascript/protractor.conf.js" 30 | } 31 | }, 32 | "lint": [{ 33 | "project": "../../../tsconfig.json" 34 | }, 35 | { 36 | "project": "../../../tsconfig-aot.json" 37 | } 38 | ], 39 | "test": { 40 | "karma": { 41 | "config": "src/test/javascript/karma.conf.js" 42 | } 43 | }, 44 | "defaults": { 45 | "styleExt": "css", 46 | "prefixInterfaces": false, 47 | "component" : { 48 | "inlineStyle" : true, 49 | "inlineTemplate": false, 50 | "spec": false 51 | }, 52 | "directive" : { 53 | "spec": false 54 | }, 55 | "guard" : { 56 | "spec": false 57 | }, 58 | "pipe" : { 59 | "spec": false 60 | }, 61 | "service" : { 62 | "spec": false 63 | } 64 | }, 65 | "packageManager": "yarn" 66 | } 67 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # Change these settings to your own preference 10 | indent_style = space 11 | indent_size = 4 12 | 13 | # We recommend you to keep these unchanged 14 | end_of_line = lf 15 | charset = utf-8 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | [*.md] 20 | trim_trailing_whitespace = false 21 | 22 | [{package,bower}.json] 23 | indent_style = space 24 | indent_size = 2 25 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhipster/jhipster-sample-app-token/a13248b0ce65ac8f85ad00ba4b5a1f6e9a6fdd87/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "generator-jhipster": { 3 | "baseName": "jhipsterJwtSampleApplication", 4 | "packageName": "io.github.jhipster.sample", 5 | "packageFolder": "io/github/jhipster/sample", 6 | "authenticationType": "jwt", 7 | "hibernateCache": "ehcache", 8 | "clusteredHttpSession": false, 9 | "websocket": false, 10 | "databaseType": "sql", 11 | "devDatabaseType": "h2Memory", 12 | "prodDatabaseType": "mysql", 13 | "searchEngine": false, 14 | "useCompass": false, 15 | "buildTool": "maven", 16 | "enableTranslation": true, 17 | "applicationType": "monolith", 18 | "testFrameworks": [ 19 | "gatling", 20 | "protractor" 21 | ], 22 | "languages": [ 23 | "en" 24 | ], 25 | "serverPort": 8080, 26 | "jhipsterVersion": "4.12.0", 27 | "enableSocialSignIn": false, 28 | "jwtSecretKey": "042e7d536354d3cdfab490925c55022efcb42bae", 29 | "useSass": false, 30 | "jhiPrefix": "jhi", 31 | "messageBroker": false, 32 | "serviceDiscoveryType": false, 33 | "clientPackageManager": "yarn", 34 | "clientFramework": "angularX" 35 | } 36 | } -------------------------------------------------------------------------------- /gulp/build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var fs = require('fs'), 4 | gulp = require('gulp'), 5 | lazypipe = require('lazypipe'), 6 | footer = require('gulp-footer'), 7 | sourcemaps = require('gulp-sourcemaps'), 8 | rev = require('gulp-rev'), 9 | htmlmin = require('gulp-htmlmin'), 10 | ngAnnotate = require('gulp-ng-annotate'), 11 | prefix = require('gulp-autoprefixer'), 12 | cssnano = require('gulp-cssnano'), 13 | uglify = require('gulp-uglify'), 14 | useref = require("gulp-useref"), 15 | revReplace = require("gulp-rev-replace"), 16 | plumber = require('gulp-plumber'), 17 | gulpIf = require('gulp-if'), 18 | handleErrors = require('./handle-errors'); 19 | 20 | var config = require('./config'); 21 | 22 | var initTask = lazypipe() 23 | .pipe(sourcemaps.init); 24 | var jsTask = lazypipe() 25 | .pipe(ngAnnotate) 26 | .pipe(uglify); 27 | var cssTask = lazypipe() 28 | .pipe(prefix) 29 | .pipe(cssnano); 30 | 31 | module.exports = function() { 32 | var templates = fs.readFileSync(config.tmp + '/templates.js'); 33 | var manifest = gulp.src(config.revManifest); 34 | 35 | return gulp.src([config.app + '**/*.html', 36 | '!' + config.app + 'app/**/*.html', 37 | '!' + config.app + 'swagger-ui/**/*', 38 | '!' + config.bower + '**/*.html']) 39 | .pipe(plumber({errorHandler: handleErrors})) 40 | //init sourcemaps and prepend semicolon 41 | .pipe(useref({}, initTask)) 42 | //append html templates 43 | .pipe(gulpIf('**/app.js', footer(templates))) 44 | .pipe(gulpIf('*.js', jsTask())) 45 | .pipe(gulpIf('*.css', cssTask())) 46 | .pipe(gulpIf('*.html', htmlmin({collapseWhitespace: true}))) 47 | .pipe(gulpIf('**/*.!(html)', rev())) 48 | .pipe(revReplace({manifest: manifest})) 49 | .pipe(sourcemaps.write('.')) 50 | .pipe(gulp.dest(config.dist)); 51 | }; 52 | -------------------------------------------------------------------------------- /gulp/config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | app: 'src/main/webapp/', 5 | dist: 'target/www/', 6 | swaggerDist: 'target/www/swagger-ui/', 7 | test: 'src/test/javascript/', 8 | bower: 'src/main/webapp/bower_components/', 9 | tmp: 'target/tmp', 10 | revManifest: 'target/tmp/rev-manifest.json', 11 | port: 9000, 12 | apiPort: 8080, 13 | liveReloadPort: 35729, 14 | uri: 'http://localhost:', 15 | constantTemplate: 16 | '(function () {\n' + 17 | ' \'use strict\';\n' + 18 | ' // DO NOT EDIT THIS FILE, EDIT THE GULP TASK NGCONSTANT SETTINGS INSTEAD WHICH GENERATES THIS FILE\n' + 19 | ' angular\n' + 20 | ' .module(\'<%- moduleName %>\')\n' + 21 | '<% constants.forEach(function(constant) { %> .constant(\'<%- constant.name %>\', <%= constant.value %>)\n<% }) %>;\n' + 22 | '})();\n' 23 | }; 24 | -------------------------------------------------------------------------------- /gulp/handle-errors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var notify = require("gulp-notify"); 4 | var argv = require('yargs').argv; 5 | 6 | module.exports = function() { 7 | 8 | var args = Array.prototype.slice.call(arguments); 9 | var notification = argv.notification === undefined ? true : argv.notification; 10 | // Send error to notification center with gulp-notify 11 | if(notification) { 12 | notify.onError({ 13 | title: "JHipster Gulp Build", 14 | subtitle: "Failure!", 15 | message: "Error: <%= error.message %>", 16 | sound: "Beep" 17 | }).apply(this, args); 18 | } 19 | // Keep gulp from hanging on this task 20 | this.emit('end'); 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /gulp/handleErrors.js: -------------------------------------------------------------------------------- 1 | var notify = require("gulp-notify"); 2 | var argv = require('yargs').argv; 3 | 4 | module.exports = function() { 5 | 6 | var args = Array.prototype.slice.call(arguments); 7 | var notification = argv.notification === undefined ? true : argv.notification; 8 | // Send error to notification center with gulp-notify 9 | if(notification) { 10 | notify.onError({ 11 | title: "JHipster Gulp Build", 12 | subtitle: "Failure!", 13 | message: "Error: <%= error.message %>", 14 | sound: "Beep" 15 | }).apply(this, args); 16 | } 17 | // Keep gulp from hanging on this task 18 | this.emit('end'); 19 | 20 | }; 21 | -------------------------------------------------------------------------------- /gulp/serve.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var gulp = require('gulp'), 4 | util = require('./utils'), 5 | url = require('url'), 6 | browserSync = require('browser-sync'), 7 | proxy = require('proxy-middleware'); 8 | 9 | var config = require('./config'); 10 | 11 | module.exports = function () { 12 | var baseUri = config.uri + config.apiPort; 13 | // Routes to proxy to the backend. Routes ending with a / will setup 14 | // a redirect so that if accessed without a trailing slash, will 15 | // redirect. This is required for some endpoints for proxy-middleware 16 | // to correctly handle them. 17 | var proxyRoutes = [ 18 | '/api', 19 | '/management', 20 | '/swagger-resources', 21 | '/v2/api-docs', 22 | '/h2-console' 23 | ]; 24 | 25 | var requireTrailingSlash = proxyRoutes.filter(function (r) { 26 | return util.endsWith(r, '/'); 27 | }).map(function (r) { 28 | // Strip trailing slash so we can use the route to match requests 29 | // with non trailing slash 30 | return r.substr(0, r.length - 1); 31 | }); 32 | 33 | var proxies = [ 34 | // Ensure trailing slash in routes that require it 35 | function (req, res, next) { 36 | requireTrailingSlash.forEach(function (route){ 37 | if (url.parse(req.url).path === route) { 38 | res.statusCode = 301; 39 | res.setHeader('Location', route + '/'); 40 | res.end(); 41 | } 42 | }); 43 | 44 | next(); 45 | } 46 | ] 47 | .concat( 48 | // Build a list of proxies for routes: [route1_proxy, route2_proxy, ...] 49 | proxyRoutes.map(function (r) { 50 | var options = url.parse(baseUri + r); 51 | options.route = r; 52 | options.preserveHost = true; 53 | return proxy(options); 54 | })); 55 | 56 | browserSync({ 57 | open: true, 58 | port: config.port, 59 | server: { 60 | baseDir: config.app, 61 | middleware: proxies 62 | } 63 | }); 64 | 65 | gulp.start('watch'); 66 | }; 67 | -------------------------------------------------------------------------------- /gulp/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var fs = require('fs'); 4 | 5 | module.exports = { 6 | endsWith : endsWith, 7 | parseVersion : parseVersion, 8 | isLintFixed : isLintFixed 9 | }; 10 | 11 | function endsWith(str, suffix) { 12 | return str.indexOf('/', str.length - suffix.length) !== -1; 13 | } 14 | 15 | var parseString = require('xml2js').parseString; 16 | // return the version number from `pom.xml` file 17 | function parseVersion() { 18 | var version = null; 19 | var pomXml = fs.readFileSync('pom.xml', 'utf8'); 20 | parseString(pomXml, function (err, result) { 21 | if (err) { 22 | throw new Error('Failed to parse pom.xml: ' + err); 23 | } 24 | if (result.project.version && result.project.version[0]) { 25 | version = result.project.version[0]; 26 | } else if (result.project.parent && result.project.parent[0] && result.project.parent[0].version && result.project.parent[0].version[0]) { 27 | version = result.project.parent[0].version[0]; 28 | } 29 | }); 30 | if (version === null) { 31 | throw new Error('pom.xml is malformed. No version is defined'); 32 | } 33 | return version; 34 | } 35 | 36 | function isLintFixed(file) { 37 | // Has ESLint fixed the file contents? 38 | return file.eslint !== null && file.eslint.fixed; 39 | } 40 | -------------------------------------------------------------------------------- /proxy.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "target": "http://localhost:8080", 4 | "secure": false, 5 | "loglevel": "debug" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/docker/.dockerignore: -------------------------------------------------------------------------------- 1 | # https://docs.docker.com/engine/reference/builder/#dockerignore-file 2 | # by default ignore everything except the jar file 3 | **/* 4 | !*.jar 5 | !*.war 6 | -------------------------------------------------------------------------------- /src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-alpine 2 | 3 | ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ 4 | JHIPSTER_SLEEP=0 \ 5 | JAVA_OPTS="" 6 | 7 | CMD echo "The application will start in ${JHIPSTER_SLEEP}s..." && \ 8 | sleep ${JHIPSTER_SLEEP} && \ 9 | java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.war 10 | 11 | EXPOSE 8080 12 | 13 | ADD *.war /app.war 14 | -------------------------------------------------------------------------------- /src/main/docker/app.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | jhipsterjwtsampleapplication-app: 4 | image: jhipsterjwtsampleapplication 5 | environment: 6 | - SPRING_PROFILES_ACTIVE=prod,swagger 7 | - SPRING_DATASOURCE_URL=jdbc:mysql://jhipsterjwtsampleapplication-mysql:3306/jhipsterjwtsampleapplication?useUnicode=true&characterEncoding=utf8&useSSL=false 8 | - JHIPSTER_SLEEP=10 # gives time for the database to boot before the application 9 | ports: 10 | - 8080:8080 11 | jhipsterjwtsampleapplication-mysql: 12 | extends: 13 | file: mysql.yml 14 | service: jhipsterjwtsampleapplication-mysql 15 | -------------------------------------------------------------------------------- /src/main/docker/mysql.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | jhipsterjwtsampleapplication-mysql: 4 | image: mysql:5.7.20 5 | # volumes: 6 | # - ~/volumes/jhipster/jhipsterJwtSampleApplication/mysql/:/var/lib/mysql/ 7 | environment: 8 | - MYSQL_USER=root 9 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 10 | - MYSQL_DATABASE=jhipsterjwtsampleapplication 11 | ports: 12 | - 3306:3306 13 | command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8 --explicit_defaults_for_timestamp 14 | -------------------------------------------------------------------------------- /src/main/docker/sonar.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | jhipsterjwtsampleapplication-sonar: 4 | image: sonarqube:6.5-alpine 5 | ports: 6 | - 9000:9000 7 | - 9092:9092 8 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/ApplicationWebXml.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample; 2 | 3 | import io.github.jhipster.sample.config.DefaultProfileUtil; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.boot.web.support.SpringBootServletInitializer; 6 | 7 | /** 8 | * This is a helper Java class that provides an alternative to creating a web.xml. 9 | * This will be invoked only when the application is deployed to a servlet container like Tomcat, JBoss etc. 10 | */ 11 | public class ApplicationWebXml extends SpringBootServletInitializer { 12 | 13 | @Override 14 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 15 | /** 16 | * set a default to use when no profile is configured. 17 | */ 18 | DefaultProfileUtil.addDefaultProfile(application.application()); 19 | return application.sources(JhipsterJwtSampleApplicationApp.class); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/ApplicationProperties.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | /** 6 | * Properties specific to Jhipster Jwt Sample Application. 7 | *

8 | * Properties are configured in the application.yml file. 9 | * See {@link io.github.jhipster.config.JHipsterProperties} for a good example. 10 | */ 11 | @ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) 12 | public class ApplicationProperties { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/AsyncConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor; 4 | import io.github.jhipster.config.JHipsterProperties; 5 | 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; 9 | import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; 10 | import org.springframework.context.annotation.Bean; 11 | import org.springframework.context.annotation.Configuration; 12 | import org.springframework.scheduling.annotation.*; 13 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 14 | 15 | import java.util.concurrent.Executor; 16 | 17 | @Configuration 18 | @EnableAsync 19 | @EnableScheduling 20 | public class AsyncConfiguration implements AsyncConfigurer { 21 | 22 | private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); 23 | 24 | private final JHipsterProperties jHipsterProperties; 25 | 26 | public AsyncConfiguration(JHipsterProperties jHipsterProperties) { 27 | this.jHipsterProperties = jHipsterProperties; 28 | } 29 | 30 | @Override 31 | @Bean(name = "taskExecutor") 32 | public Executor getAsyncExecutor() { 33 | log.debug("Creating Async Task Executor"); 34 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 35 | executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize()); 36 | executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize()); 37 | executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity()); 38 | executor.setThreadNamePrefix("jhipster-jwt-sample-application-Executor-"); 39 | return new ExceptionHandlingAsyncTaskExecutor(executor); 40 | } 41 | 42 | @Override 43 | public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { 44 | return new SimpleAsyncUncaughtExceptionHandler(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/CloudDatabaseConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import io.github.jhipster.config.JHipsterConstants; 4 | 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.cloud.config.java.AbstractCloudConfig; 8 | import org.springframework.context.annotation.*; 9 | 10 | import javax.sql.DataSource; 11 | 12 | @Configuration 13 | @Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) 14 | public class CloudDatabaseConfiguration extends AbstractCloudConfig { 15 | 16 | private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); 17 | 18 | @Bean 19 | public DataSource dataSource() { 20 | log.info("Configuring JDBC datasource from a cloud provider"); 21 | return connectionFactory().dataSource(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/Constants.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | /** 4 | * Application constants. 5 | */ 6 | public final class Constants { 7 | 8 | // Regex for acceptable logins 9 | public static final String LOGIN_REGEX = "^[_'.@A-Za-z0-9-]*$"; 10 | 11 | public static final String SYSTEM_ACCOUNT = "system"; 12 | public static final String ANONYMOUS_USER = "anonymoususer"; 13 | public static final String DEFAULT_LANGUAGE = "en"; 14 | 15 | private Constants() { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/DateTimeFormatConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.format.FormatterRegistry; 5 | import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 7 | 8 | @Configuration 9 | public class DateTimeFormatConfiguration extends WebMvcConfigurerAdapter { 10 | 11 | @Override 12 | public void addFormatters(FormatterRegistry registry) { 13 | DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); 14 | registrar.setUseIsoFormat(true); 15 | registrar.registerFormatters(registry); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/DefaultProfileUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import io.github.jhipster.config.JHipsterConstants; 4 | 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.core.env.Environment; 7 | 8 | import java.util.*; 9 | 10 | /** 11 | * Utility class to load a Spring profile to be used as default 12 | * when there is no spring.profiles.active set in the environment or as command line argument. 13 | * If the value is not available in application.yml then dev profile will be used as default. 14 | */ 15 | public final class DefaultProfileUtil { 16 | 17 | private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default"; 18 | 19 | private DefaultProfileUtil() { 20 | } 21 | 22 | /** 23 | * Set a default to use when no profile is configured. 24 | * 25 | * @param app the Spring application 26 | */ 27 | public static void addDefaultProfile(SpringApplication app) { 28 | Map defProperties = new HashMap<>(); 29 | /* 30 | * The default profile to use when no other profiles are defined 31 | * This cannot be set in the application.yml file. 32 | * See https://github.com/spring-projects/spring-boot/issues/1219 33 | */ 34 | defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); 35 | app.setDefaultProperties(defProperties); 36 | } 37 | 38 | /** 39 | * Get the profiles that are applied else get default profiles. 40 | * 41 | * @param env spring environment 42 | * @return profiles 43 | */ 44 | public static String[] getActiveProfiles(Environment env) { 45 | String[] profiles = env.getActiveProfiles(); 46 | if (profiles.length == 0) { 47 | return env.getDefaultProfiles(); 48 | } 49 | return profiles; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/JacksonConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; 4 | import com.fasterxml.jackson.module.afterburner.AfterburnerModule; 5 | 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.zalando.problem.ProblemModule; 9 | import org.zalando.problem.validation.ConstraintViolationProblemModule; 10 | 11 | @Configuration 12 | public class JacksonConfiguration { 13 | 14 | /* 15 | * Support for Hibernate types in Jackson. 16 | */ 17 | @Bean 18 | public Hibernate5Module hibernate5Module() { 19 | return new Hibernate5Module(); 20 | } 21 | 22 | /* 23 | * Jackson Afterburner module to speed up serialization/deserialization. 24 | */ 25 | @Bean 26 | public AfterburnerModule afterburnerModule() { 27 | return new AfterburnerModule(); 28 | } 29 | 30 | /* 31 | * Module for serialization/deserialization of RFC7807 Problem. 32 | */ 33 | @Bean 34 | ProblemModule problemModule() { 35 | return new ProblemModule(); 36 | } 37 | 38 | /* 39 | * Module for serialization/deserialization of ConstraintViolationProblem. 40 | */ 41 | @Bean 42 | ConstraintViolationProblemModule constraintViolationProblemModule() { 43 | return new ConstraintViolationProblemModule(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/LocaleConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import io.github.jhipster.config.locale.AngularCookieLocaleResolver; 4 | 5 | import org.springframework.context.EnvironmentAware; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.core.env.Environment; 9 | import org.springframework.web.servlet.LocaleResolver; 10 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 11 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 12 | import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; 13 | 14 | @Configuration 15 | public class LocaleConfiguration extends WebMvcConfigurerAdapter implements EnvironmentAware { 16 | 17 | @Override 18 | public void setEnvironment(Environment environment) { 19 | // unused 20 | } 21 | 22 | @Bean(name = "localeResolver") 23 | public LocaleResolver localeResolver() { 24 | AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver(); 25 | cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY"); 26 | return cookieLocaleResolver; 27 | } 28 | 29 | @Override 30 | public void addInterceptors(InterceptorRegistry registry) { 31 | LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); 32 | localeChangeInterceptor.setParamName("language"); 33 | registry.addInterceptor(localeChangeInterceptor); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/LoggingAspectConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import io.github.jhipster.sample.aop.logging.LoggingAspect; 4 | 5 | import io.github.jhipster.config.JHipsterConstants; 6 | 7 | import org.springframework.context.annotation.*; 8 | import org.springframework.core.env.Environment; 9 | 10 | @Configuration 11 | @EnableAspectJAutoProxy 12 | public class LoggingAspectConfiguration { 13 | 14 | @Bean 15 | @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) 16 | public LoggingAspect loggingAspect(Environment env) { 17 | return new LoggingAspect(env); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/ThymeleafConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import org.apache.commons.lang3.CharEncoding; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.context.annotation.*; 7 | import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; 8 | 9 | @Configuration 10 | public class ThymeleafConfiguration { 11 | 12 | @SuppressWarnings("unused") 13 | private final Logger log = LoggerFactory.getLogger(ThymeleafConfiguration.class); 14 | 15 | @Bean 16 | @Description("Thymeleaf template resolver serving HTML 5 emails") 17 | public ClassLoaderTemplateResolver emailTemplateResolver() { 18 | ClassLoaderTemplateResolver emailTemplateResolver = new ClassLoaderTemplateResolver(); 19 | emailTemplateResolver.setPrefix("mails/"); 20 | emailTemplateResolver.setSuffix(".html"); 21 | emailTemplateResolver.setTemplateMode("HTML5"); 22 | emailTemplateResolver.setCharacterEncoding(CharEncoding.UTF_8); 23 | emailTemplateResolver.setOrder(1); 24 | return emailTemplateResolver; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/audit/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Audit specific code. 3 | */ 4 | package io.github.jhipster.sample.config.audit; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/config/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Spring Framework configuration files. 3 | */ 4 | package io.github.jhipster.sample.config; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/domain/Authority.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.domain; 2 | 3 | import org.hibernate.annotations.Cache; 4 | import org.hibernate.annotations.CacheConcurrencyStrategy; 5 | import javax.persistence.Entity; 6 | import javax.persistence.Id; 7 | import javax.persistence.Table; 8 | import javax.persistence.Column; 9 | import javax.validation.constraints.NotNull; 10 | import javax.validation.constraints.Size; 11 | import java.io.Serializable; 12 | 13 | /** 14 | * An authority (a security role) used by Spring Security. 15 | */ 16 | @Entity 17 | @Table(name = "jhi_authority") 18 | @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 19 | 20 | public class Authority implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | @NotNull 25 | @Size(max = 50) 26 | @Id 27 | @Column(length = 50) 28 | private String name; 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | public void setName(String name) { 35 | this.name = name; 36 | } 37 | 38 | @Override 39 | public boolean equals(Object o) { 40 | if (this == o) { 41 | return true; 42 | } 43 | if (o == null || getClass() != o.getClass()) { 44 | return false; 45 | } 46 | 47 | Authority authority = (Authority) o; 48 | 49 | return !(name != null ? !name.equals(authority.name) : authority.name != null); 50 | } 51 | 52 | @Override 53 | public int hashCode() { 54 | return name != null ? name.hashCode() : 0; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return "Authority{" + 60 | "name='" + name + '\'' + 61 | "}"; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/domain/PersistentAuditEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.domain; 2 | 3 | import javax.persistence.*; 4 | import javax.validation.constraints.NotNull; 5 | import java.io.Serializable; 6 | import java.time.Instant; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | /** 11 | * Persist AuditEvent managed by the Spring Boot actuator. 12 | * 13 | * @see org.springframework.boot.actuate.audit.AuditEvent 14 | */ 15 | @Entity 16 | @Table(name = "jhi_persistent_audit_event") 17 | public class PersistentAuditEvent implements Serializable { 18 | 19 | @Id 20 | @GeneratedValue(strategy = GenerationType.IDENTITY) 21 | @Column(name = "event_id") 22 | private Long id; 23 | 24 | @NotNull 25 | @Column(nullable = false) 26 | private String principal; 27 | 28 | @Column(name = "event_date") 29 | private Instant auditEventDate; 30 | 31 | @Column(name = "event_type") 32 | private String auditEventType; 33 | 34 | @ElementCollection 35 | @MapKeyColumn(name = "name") 36 | @Column(name = "value") 37 | @CollectionTable(name = "jhi_persistent_audit_evt_data", joinColumns=@JoinColumn(name="event_id")) 38 | private Map data = new HashMap<>(); 39 | 40 | public Long getId() { 41 | return id; 42 | } 43 | 44 | public void setId(Long id) { 45 | this.id = id; 46 | } 47 | 48 | public String getPrincipal() { 49 | return principal; 50 | } 51 | 52 | public void setPrincipal(String principal) { 53 | this.principal = principal; 54 | } 55 | 56 | public Instant getAuditEventDate() { 57 | return auditEventDate; 58 | } 59 | 60 | public void setAuditEventDate(Instant auditEventDate) { 61 | this.auditEventDate = auditEventDate; 62 | } 63 | 64 | public String getAuditEventType() { 65 | return auditEventType; 66 | } 67 | 68 | public void setAuditEventType(String auditEventType) { 69 | this.auditEventType = auditEventType; 70 | } 71 | 72 | public Map getData() { 73 | return data; 74 | } 75 | 76 | public void setData(Map data) { 77 | this.data = data; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/domain/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * JPA domain objects. 3 | */ 4 | package io.github.jhipster.sample.domain; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/repository/AuthorityRepository.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.repository; 2 | 3 | import io.github.jhipster.sample.domain.Authority; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | 7 | /** 8 | * Spring Data JPA repository for the Authority entity. 9 | */ 10 | public interface AuthorityRepository extends JpaRepository { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/repository/PersistenceAuditEventRepository.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.repository; 2 | 3 | import io.github.jhipster.sample.domain.PersistentAuditEvent; 4 | import org.springframework.data.domain.Page; 5 | import org.springframework.data.domain.Pageable; 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | 8 | import java.time.Instant; 9 | import java.util.List; 10 | 11 | /** 12 | * Spring Data JPA repository for the PersistentAuditEvent entity. 13 | */ 14 | public interface PersistenceAuditEventRepository extends JpaRepository { 15 | 16 | List findByPrincipal(String principal); 17 | 18 | List findByAuditEventDateAfter(Instant after); 19 | 20 | List findByPrincipalAndAuditEventDateAfter(String principal, Instant after); 21 | 22 | List findByPrincipalAndAuditEventDateAfterAndAuditEventType(String principle, Instant after, String type); 23 | 24 | Page findAllByAuditEventDateBetween(Instant fromDate, Instant toDate, Pageable pageable); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.repository; 2 | 3 | import io.github.jhipster.sample.domain.User; 4 | import org.springframework.cache.annotation.Cacheable; 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.data.jpa.repository.EntityGraph; 8 | import org.springframework.data.jpa.repository.JpaRepository; 9 | import org.springframework.stereotype.Repository; 10 | import java.util.List; 11 | import java.util.Optional; 12 | import java.time.Instant; 13 | 14 | /** 15 | * Spring Data JPA repository for the User entity. 16 | */ 17 | @Repository 18 | public interface UserRepository extends JpaRepository { 19 | 20 | Optional findOneByActivationKey(String activationKey); 21 | 22 | List findAllByActivatedIsFalseAndCreatedDateBefore(Instant dateTime); 23 | 24 | Optional findOneByResetKey(String resetKey); 25 | 26 | Optional findOneByEmailIgnoreCase(String email); 27 | 28 | Optional findOneByLogin(String login); 29 | 30 | @EntityGraph(attributePaths = "authorities") 31 | Optional findOneWithAuthoritiesById(Long id); 32 | 33 | @EntityGraph(attributePaths = "authorities") 34 | @Cacheable(cacheNames = "users") 35 | Optional findOneWithAuthoritiesByLogin(String login); 36 | 37 | Page findAllByLoginNot(Pageable pageable, String login); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/repository/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Spring Data JPA repositories. 3 | */ 4 | package io.github.jhipster.sample.repository; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/security/AuthoritiesConstants.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.security; 2 | 3 | /** 4 | * Constants for Spring Security authorities. 5 | */ 6 | public final class AuthoritiesConstants { 7 | 8 | public static final String ADMIN = "ROLE_ADMIN"; 9 | 10 | public static final String USER = "ROLE_USER"; 11 | 12 | public static final String ANONYMOUS = "ROLE_ANONYMOUS"; 13 | 14 | private AuthoritiesConstants() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/security/SpringSecurityAuditorAware.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.security; 2 | 3 | import io.github.jhipster.sample.config.Constants; 4 | 5 | import org.springframework.data.domain.AuditorAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * Implementation of AuditorAware based on Spring Security. 10 | */ 11 | @Component 12 | public class SpringSecurityAuditorAware implements AuditorAware { 13 | 14 | @Override 15 | public String getCurrentAuditor() { 16 | return SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM_ACCOUNT); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/security/UserNotActivatedException.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.security; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | 5 | /** 6 | * This exception is thrown in case of a not activated user trying to authenticate. 7 | */ 8 | public class UserNotActivatedException extends AuthenticationException { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | public UserNotActivatedException(String message) { 13 | super(message); 14 | } 15 | 16 | public UserNotActivatedException(String message, Throwable t) { 17 | super(message, t); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/security/jwt/JWTConfigurer.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.security.jwt; 2 | 3 | import org.springframework.security.config.annotation.SecurityConfigurerAdapter; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.web.DefaultSecurityFilterChain; 6 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 7 | 8 | public class JWTConfigurer extends SecurityConfigurerAdapter { 9 | 10 | public static final String AUTHORIZATION_HEADER = "Authorization"; 11 | 12 | private TokenProvider tokenProvider; 13 | 14 | public JWTConfigurer(TokenProvider tokenProvider) { 15 | this.tokenProvider = tokenProvider; 16 | } 17 | 18 | @Override 19 | public void configure(HttpSecurity http) throws Exception { 20 | JWTFilter customFilter = new JWTFilter(tokenProvider); 21 | http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/security/jwt/JWTFilter.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.security.jwt; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.security.core.context.SecurityContextHolder; 5 | import org.springframework.util.StringUtils; 6 | import org.springframework.web.filter.GenericFilterBean; 7 | 8 | import javax.servlet.FilterChain; 9 | import javax.servlet.ServletException; 10 | import javax.servlet.ServletRequest; 11 | import javax.servlet.ServletResponse; 12 | import javax.servlet.http.HttpServletRequest; 13 | import java.io.IOException; 14 | 15 | /** 16 | * Filters incoming requests and installs a Spring Security principal if a header corresponding to a valid user is 17 | * found. 18 | */ 19 | public class JWTFilter extends GenericFilterBean { 20 | 21 | private TokenProvider tokenProvider; 22 | 23 | public JWTFilter(TokenProvider tokenProvider) { 24 | this.tokenProvider = tokenProvider; 25 | } 26 | 27 | @Override 28 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) 29 | throws IOException, ServletException { 30 | HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; 31 | String jwt = resolveToken(httpServletRequest); 32 | if (StringUtils.hasText(jwt) && this.tokenProvider.validateToken(jwt)) { 33 | Authentication authentication = this.tokenProvider.getAuthentication(jwt); 34 | SecurityContextHolder.getContext().setAuthentication(authentication); 35 | } 36 | filterChain.doFilter(servletRequest, servletResponse); 37 | } 38 | 39 | private String resolveToken(HttpServletRequest request){ 40 | String bearerToken = request.getHeader(JWTConfigurer.AUTHORIZATION_HEADER); 41 | if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) { 42 | return bearerToken.substring(7, bearerToken.length()); 43 | } 44 | return null; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/security/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Spring Security configuration. 3 | */ 4 | package io.github.jhipster.sample.security; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/service/AuditEventService.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.service; 2 | 3 | import io.github.jhipster.sample.config.audit.AuditEventConverter; 4 | import io.github.jhipster.sample.repository.PersistenceAuditEventRepository; 5 | import org.springframework.boot.actuate.audit.AuditEvent; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.data.domain.Pageable; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | import java.time.Instant; 12 | import java.util.Optional; 13 | 14 | /** 15 | * Service for managing audit events. 16 | *

17 | * This is the default implementation to support SpringBoot Actuator AuditEventRepository 18 | */ 19 | @Service 20 | @Transactional 21 | public class AuditEventService { 22 | 23 | private final PersistenceAuditEventRepository persistenceAuditEventRepository; 24 | 25 | private final AuditEventConverter auditEventConverter; 26 | 27 | public AuditEventService( 28 | PersistenceAuditEventRepository persistenceAuditEventRepository, 29 | AuditEventConverter auditEventConverter) { 30 | 31 | this.persistenceAuditEventRepository = persistenceAuditEventRepository; 32 | this.auditEventConverter = auditEventConverter; 33 | } 34 | 35 | public Page findAll(Pageable pageable) { 36 | return persistenceAuditEventRepository.findAll(pageable) 37 | .map(auditEventConverter::convertToAuditEvent); 38 | } 39 | 40 | public Page findByDates(Instant fromDate, Instant toDate, Pageable pageable) { 41 | return persistenceAuditEventRepository.findAllByAuditEventDateBetween(fromDate, toDate, pageable) 42 | .map(auditEventConverter::convertToAuditEvent); 43 | } 44 | 45 | public Optional find(Long id) { 46 | return Optional.ofNullable(persistenceAuditEventRepository.findOne(id)).map 47 | (auditEventConverter::convertToAuditEvent); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/service/dto/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Data Transfer Objects. 3 | */ 4 | package io.github.jhipster.sample.service.dto; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/service/mapper/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MapStruct mappers for mapping domain objects and Data Transfer Objects. 3 | */ 4 | package io.github.jhipster.sample.service.mapper; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/service/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Service layer beans. 3 | */ 4 | package io.github.jhipster.sample.service; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/service/util/RandomUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.service.util; 2 | 3 | import org.apache.commons.lang3.RandomStringUtils; 4 | 5 | /** 6 | * Utility class for generating random Strings. 7 | */ 8 | public final class RandomUtil { 9 | 10 | private static final int DEF_COUNT = 20; 11 | 12 | private RandomUtil() { 13 | } 14 | 15 | /** 16 | * Generate a password. 17 | * 18 | * @return the generated password 19 | */ 20 | public static String generatePassword() { 21 | return RandomStringUtils.randomAlphanumeric(DEF_COUNT); 22 | } 23 | 24 | /** 25 | * Generate an activation key. 26 | * 27 | * @return the generated activation key 28 | */ 29 | public static String generateActivationKey() { 30 | return RandomStringUtils.randomNumeric(DEF_COUNT); 31 | } 32 | 33 | /** 34 | * Generate a reset key. 35 | * 36 | * @return the generated reset key 37 | */ 38 | public static String generateResetKey() { 39 | return RandomStringUtils.randomNumeric(DEF_COUNT); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/LogsResource.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest; 2 | 3 | import io.github.jhipster.sample.web.rest.vm.LoggerVM; 4 | 5 | import ch.qos.logback.classic.Level; 6 | import ch.qos.logback.classic.LoggerContext; 7 | import com.codahale.metrics.annotation.Timed; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | import java.util.stream.Collectors; 14 | 15 | /** 16 | * Controller for view and managing Log Level at runtime. 17 | */ 18 | @RestController 19 | @RequestMapping("/management") 20 | public class LogsResource { 21 | 22 | @GetMapping("/logs") 23 | @Timed 24 | public List getList() { 25 | LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); 26 | return context.getLoggerList() 27 | .stream() 28 | .map(LoggerVM::new) 29 | .collect(Collectors.toList()); 30 | } 31 | 32 | @PutMapping("/logs") 33 | @ResponseStatus(HttpStatus.NO_CONTENT) 34 | @Timed 35 | public void changeLevel(@RequestBody LoggerVM jsonLogger) { 36 | LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); 37 | context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/BadRequestAlertException.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | import org.zalando.problem.Status; 5 | 6 | import java.net.URI; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | public class BadRequestAlertException extends AbstractThrowableProblem { 11 | 12 | private final String entityName; 13 | 14 | private final String errorKey; 15 | 16 | public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { 17 | this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); 18 | } 19 | 20 | public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { 21 | super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey)); 22 | this.entityName = entityName; 23 | this.errorKey = errorKey; 24 | } 25 | 26 | public String getEntityName() { 27 | return entityName; 28 | } 29 | 30 | public String getErrorKey() { 31 | return errorKey; 32 | } 33 | 34 | private static Map getAlertParameters(String entityName, String errorKey) { 35 | Map parameters = new HashMap<>(); 36 | parameters.put("message", "error." + errorKey); 37 | parameters.put("params", entityName); 38 | return parameters; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/CustomParameterizedException.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | import static org.zalando.problem.Status.BAD_REQUEST; 9 | 10 | /** 11 | * Custom, parameterized exception, which can be translated on the client side. 12 | * For example: 13 | * 14 | *

15 |  * throw new CustomParameterizedException("myCustomError", "hello", "world");
16 |  * 
17 | * 18 | * Can be translated with: 19 | * 20 | *
21 |  * "error.myCustomError" :  "The server says {{param0}} to {{param1}}"
22 |  * 
23 | */ 24 | public class CustomParameterizedException extends AbstractThrowableProblem { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | private static final String PARAM = "param"; 29 | 30 | public CustomParameterizedException(String message, String... params) { 31 | this(message, toParamMap(params)); 32 | } 33 | 34 | public CustomParameterizedException(String message, Map paramMap) { 35 | super(ErrorConstants.PARAMETERIZED_TYPE, "Parameterized Exception", BAD_REQUEST, null, null, null, toProblemParameters(message, paramMap)); 36 | } 37 | 38 | public static Map toParamMap(String... params) { 39 | Map paramMap = new HashMap<>(); 40 | if (params != null && params.length > 0) { 41 | for (int i = 0; i < params.length; i++) { 42 | paramMap.put(PARAM + i, params[i]); 43 | } 44 | } 45 | return paramMap; 46 | } 47 | 48 | public static Map toProblemParameters(String message, Map paramMap) { 49 | Map parameters = new HashMap<>(); 50 | parameters.put("message", message); 51 | parameters.put("params", paramMap); 52 | return parameters; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/EmailAlreadyUsedException.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | public class EmailAlreadyUsedException extends BadRequestAlertException { 4 | 5 | public EmailAlreadyUsedException() { 6 | super(ErrorConstants.EMAIL_ALREADY_USED_TYPE, "Email address already in use", "userManagement", "emailexists"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/EmailNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | import org.zalando.problem.Status; 5 | 6 | public class EmailNotFoundException extends AbstractThrowableProblem { 7 | 8 | public EmailNotFoundException() { 9 | super(ErrorConstants.EMAIL_NOT_FOUND_TYPE, "Email address not registered", Status.BAD_REQUEST); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/ErrorConstants.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | import java.net.URI; 4 | 5 | public final class ErrorConstants { 6 | 7 | public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; 8 | public static final String ERR_VALIDATION = "error.validation"; 9 | public static final String PROBLEM_BASE_URL = "http://www.jhipster.tech/problem"; 10 | public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message"); 11 | public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/contraint-violation"); 12 | public static final URI PARAMETERIZED_TYPE = URI.create(PROBLEM_BASE_URL + "/parameterized"); 13 | public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password"); 14 | public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); 15 | public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); 16 | public static final URI EMAIL_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-found"); 17 | 18 | private ErrorConstants() { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/FieldErrorVM.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | import java.io.Serializable; 4 | 5 | public class FieldErrorVM implements Serializable { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | private final String objectName; 10 | 11 | private final String field; 12 | 13 | private final String message; 14 | 15 | public FieldErrorVM(String dto, String field, String message) { 16 | this.objectName = dto; 17 | this.field = field; 18 | this.message = message; 19 | } 20 | 21 | public String getObjectName() { 22 | return objectName; 23 | } 24 | 25 | public String getField() { 26 | return field; 27 | } 28 | 29 | public String getMessage() { 30 | return message; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/InternalServerErrorException.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | import org.zalando.problem.Status; 5 | 6 | /** 7 | * Simple exception with a message, that returns an Internal Server Error code. 8 | */ 9 | public class InternalServerErrorException extends AbstractThrowableProblem { 10 | 11 | public InternalServerErrorException(String message) { 12 | super(ErrorConstants.DEFAULT_TYPE, message, Status.INTERNAL_SERVER_ERROR); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/InvalidPasswordException.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | import org.zalando.problem.AbstractThrowableProblem; 4 | import org.zalando.problem.Status; 5 | 6 | public class InvalidPasswordException extends AbstractThrowableProblem { 7 | 8 | public InvalidPasswordException() { 9 | super(ErrorConstants.INVALID_PASSWORD_TYPE, "Incorrect password", Status.BAD_REQUEST); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/LoginAlreadyUsedException.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.errors; 2 | 3 | public class LoginAlreadyUsedException extends BadRequestAlertException { 4 | 5 | public LoginAlreadyUsedException() { 6 | super(ErrorConstants.LOGIN_ALREADY_USED_TYPE, "Login already in use", "userManagement", "userexists"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/errors/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Specific errors used with Zalando's "problem-spring-web" library. 3 | * 4 | * More information on https://github.com/zalando/problem-spring-web 5 | */ 6 | package io.github.jhipster.sample.web.rest.errors; 7 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Spring MVC REST controllers. 3 | */ 4 | package io.github.jhipster.sample.web.rest; 5 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/util/HeaderUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.util; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.http.HttpHeaders; 6 | 7 | /** 8 | * Utility class for HTTP headers creation. 9 | */ 10 | public final class HeaderUtil { 11 | 12 | private static final Logger log = LoggerFactory.getLogger(HeaderUtil.class); 13 | 14 | private static final String APPLICATION_NAME = "jhipsterJwtSampleApplicationApp"; 15 | 16 | private HeaderUtil() { 17 | } 18 | 19 | public static HttpHeaders createAlert(String message, String param) { 20 | HttpHeaders headers = new HttpHeaders(); 21 | headers.add("X-jhipsterJwtSampleApplicationApp-alert", message); 22 | headers.add("X-jhipsterJwtSampleApplicationApp-params", param); 23 | return headers; 24 | } 25 | 26 | public static HttpHeaders createEntityCreationAlert(String entityName, String param) { 27 | return createAlert(APPLICATION_NAME + "." + entityName + ".created", param); 28 | } 29 | 30 | public static HttpHeaders createEntityUpdateAlert(String entityName, String param) { 31 | return createAlert(APPLICATION_NAME + "." + entityName + ".updated", param); 32 | } 33 | 34 | public static HttpHeaders createEntityDeletionAlert(String entityName, String param) { 35 | return createAlert(APPLICATION_NAME + "." + entityName + ".deleted", param); 36 | } 37 | 38 | public static HttpHeaders createFailureAlert(String entityName, String errorKey, String defaultMessage) { 39 | log.error("Entity processing failed, {}", defaultMessage); 40 | HttpHeaders headers = new HttpHeaders(); 41 | headers.add("X-jhipsterJwtSampleApplicationApp-error", "error." + errorKey); 42 | headers.add("X-jhipsterJwtSampleApplicationApp-params", entityName); 43 | return headers; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/util/PaginationUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.util; 2 | 3 | import org.springframework.data.domain.Page; 4 | import org.springframework.http.HttpHeaders; 5 | import org.springframework.web.util.UriComponentsBuilder; 6 | 7 | /** 8 | * Utility class for handling pagination. 9 | * 10 | *

11 | * Pagination uses the same principles as the GitHub API, 12 | * and follow RFC 5988 (Link header). 13 | */ 14 | public final class PaginationUtil { 15 | 16 | private PaginationUtil() { 17 | } 18 | 19 | public static HttpHeaders generatePaginationHttpHeaders(Page page, String baseUrl) { 20 | 21 | HttpHeaders headers = new HttpHeaders(); 22 | headers.add("X-Total-Count", Long.toString(page.getTotalElements())); 23 | String link = ""; 24 | if ((page.getNumber() + 1) < page.getTotalPages()) { 25 | link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize()) + ">; rel=\"next\","; 26 | } 27 | // prev link 28 | if ((page.getNumber()) > 0) { 29 | link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize()) + ">; rel=\"prev\","; 30 | } 31 | // last and first link 32 | int lastPage = 0; 33 | if (page.getTotalPages() > 0) { 34 | lastPage = page.getTotalPages() - 1; 35 | } 36 | link += "<" + generateUri(baseUrl, lastPage, page.getSize()) + ">; rel=\"last\","; 37 | link += "<" + generateUri(baseUrl, 0, page.getSize()) + ">; rel=\"first\""; 38 | headers.add(HttpHeaders.LINK, link); 39 | return headers; 40 | } 41 | 42 | private static String generateUri(String baseUrl, int page, int size) { 43 | return UriComponentsBuilder.fromUriString(baseUrl).queryParam("page", page).queryParam("size", size).toUriString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/vm/KeyAndPasswordVM.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.vm; 2 | 3 | /** 4 | * View Model object for storing the user's key and password. 5 | */ 6 | public class KeyAndPasswordVM { 7 | 8 | private String key; 9 | 10 | private String newPassword; 11 | 12 | public String getKey() { 13 | return key; 14 | } 15 | 16 | public void setKey(String key) { 17 | this.key = key; 18 | } 19 | 20 | public String getNewPassword() { 21 | return newPassword; 22 | } 23 | 24 | public void setNewPassword(String newPassword) { 25 | this.newPassword = newPassword; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/vm/LoggerVM.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.vm; 2 | 3 | import ch.qos.logback.classic.Logger; 4 | 5 | /** 6 | * View Model object for storing a Logback logger. 7 | */ 8 | public class LoggerVM { 9 | 10 | private String name; 11 | 12 | private String level; 13 | 14 | public LoggerVM(Logger logger) { 15 | this.name = logger.getName(); 16 | this.level = logger.getEffectiveLevel().toString(); 17 | } 18 | 19 | public LoggerVM() { 20 | // Empty public constructor used by Jackson. 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getLevel() { 32 | return level; 33 | } 34 | 35 | public void setLevel(String level) { 36 | this.level = level; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "LoggerVM{" + 42 | "name='" + name + '\'' + 43 | ", level='" + level + '\'' + 44 | '}'; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/vm/LoginVM.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.vm; 2 | 3 | import io.github.jhipster.sample.config.Constants; 4 | import javax.validation.constraints.NotNull; 5 | import javax.validation.constraints.Pattern; 6 | import javax.validation.constraints.Size; 7 | 8 | /** 9 | * View Model object for storing a user's credentials. 10 | */ 11 | public class LoginVM { 12 | 13 | @Pattern(regexp = Constants.LOGIN_REGEX) 14 | @NotNull 15 | @Size(min = 1, max = 50) 16 | private String username; 17 | 18 | @NotNull 19 | @Size(min = ManagedUserVM.PASSWORD_MIN_LENGTH, max = ManagedUserVM.PASSWORD_MAX_LENGTH) 20 | private String password; 21 | 22 | private Boolean rememberMe; 23 | 24 | public String getUsername() { 25 | return username; 26 | } 27 | 28 | public void setUsername(String username) { 29 | this.username = username; 30 | } 31 | 32 | public String getPassword() { 33 | return password; 34 | } 35 | 36 | public void setPassword(String password) { 37 | this.password = password; 38 | } 39 | 40 | public Boolean isRememberMe() { 41 | return rememberMe; 42 | } 43 | 44 | public void setRememberMe(Boolean rememberMe) { 45 | this.rememberMe = rememberMe; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "LoginVM{" + 51 | "username='" + username + '\'' + 52 | ", rememberMe=" + rememberMe + 53 | '}'; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/vm/ManagedUserVM.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.vm; 2 | 3 | import io.github.jhipster.sample.service.dto.UserDTO; 4 | import javax.validation.constraints.Size; 5 | 6 | /** 7 | * View Model extending the UserDTO, which is meant to be used in the user management UI. 8 | */ 9 | public class ManagedUserVM extends UserDTO { 10 | 11 | public static final int PASSWORD_MIN_LENGTH = 4; 12 | 13 | public static final int PASSWORD_MAX_LENGTH = 100; 14 | 15 | @Size(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH) 16 | private String password; 17 | 18 | public ManagedUserVM() { 19 | // Empty constructor needed for Jackson. 20 | } 21 | 22 | public String getPassword() { 23 | return password; 24 | } 25 | 26 | public void setPassword(String password) { 27 | this.password = password; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "ManagedUserVM{" + 33 | "} " + super.toString(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/github/jhipster/sample/web/rest/vm/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * View Models used by Spring MVC REST controllers. 3 | */ 4 | package io.github.jhipster.sample.web.rest.vm; 5 | -------------------------------------------------------------------------------- /src/main/resources/.h2.server.properties: -------------------------------------------------------------------------------- 1 | #H2 Server Properties 2 | 0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:jhipsterjwtsampleapplication|jhipsterJwtSampleApplication 3 | webAllowOthers=true 4 | webPort=8082 5 | webSSL=false 6 | -------------------------------------------------------------------------------- /src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | 2 | ${AnsiColor.GREEN} ██╗${AnsiColor.RED} ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗ 3 | ${AnsiColor.GREEN} ██║${AnsiColor.RED} ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗ 4 | ${AnsiColor.GREEN} ██║${AnsiColor.RED} ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝ 5 | ${AnsiColor.GREEN}██╗ ██║${AnsiColor.RED} ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ 6 | ${AnsiColor.GREEN}╚██████╔╝${AnsiColor.RED} ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ 7 | ${AnsiColor.GREEN} ╚═════╝ ${AnsiColor.RED} ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ 8 | 9 | ${AnsiColor.BRIGHT_BLUE}:: JHipster 🤓 :: Running Spring Boot ${spring-boot.version} :: 10 | :: http://www.jhipster.tech ::${AnsiColor.DEFAULT} 11 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/authorities.csv: -------------------------------------------------------------------------------- 1 | name 2 | ROLE_ADMIN 3 | ROLE_USER 4 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/master.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/users.csv: -------------------------------------------------------------------------------- 1 | id;login;password_hash;first_name;last_name;email;image_url;activated;lang_key;created_by;last_modified_by 2 | 1;system;$2a$10$mE.qmcV0mFU5NcKh73TZx.z4ueI/.bDWbj0T1BYyqP481kGGarKLG;System;System;system@localhost;;true;en;system;system 3 | 2;anonymoususer;$2a$10$j8S5d7Sr7.8VTOYNviDPOeWX8KcYILUVJBsYV83Y5NtECayypx9lO;Anonymous;User;anonymous@localhost;;true;en;system;system 4 | 3;admin;$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC;Administrator;Administrator;admin@localhost;;true;en;system;system 5 | 4;user;$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K;User;User;user@localhost;;true;en;system;system 6 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/users_authorities.csv: -------------------------------------------------------------------------------- 1 | user_id;authority_name 2 | 1;ROLE_ADMIN 3 | 1;ROLE_USER 4 | 3;ROLE_ADMIN 5 | 3;ROLE_USER 6 | 4;ROLE_USER 7 | -------------------------------------------------------------------------------- /src/main/resources/i18n/messages.properties: -------------------------------------------------------------------------------- 1 | # Error page 2 | error.title=Your request cannot be processed 3 | error.subtitle=Sorry, an error has occurred. 4 | error.status=Status: 5 | error.message=Message: 6 | 7 | # Activation email 8 | email.activation.title=jhipsterJwtSampleApplication account activation 9 | email.activation.greeting=Dear {0} 10 | email.activation.text1=Your jhipsterJwtSampleApplication account has been created, please click on the URL below to activate it: 11 | email.activation.text2=Regards, 12 | email.signature=jhipsterJwtSampleApplication Team. 13 | 14 | # Creation email 15 | email.creation.text1=Your jhipsterJwtSampleApplication account has been created, please click on the URL below to access it: 16 | 17 | # Reset email 18 | email.reset.title=jhipsterJwtSampleApplication password reset 19 | email.reset.greeting=Dear {0} 20 | email.reset.text1=For your jhipsterJwtSampleApplication account a password reset was requested, please click on the URL below to reset it: 21 | email.reset.text2=Regards, 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/i18n/messages_en.properties: -------------------------------------------------------------------------------- 1 | # Error page 2 | error.title=Your request cannot be processed 3 | error.subtitle=Sorry, an error has occurred. 4 | error.status=Status: 5 | error.message=Message: 6 | 7 | # Activation email 8 | email.activation.title=jhipsterJwtSampleApplication account activation 9 | email.activation.greeting=Dear {0} 10 | email.activation.text1=Your jhipsterJwtSampleApplication account has been created, please click on the URL below to activate it: 11 | email.activation.text2=Regards, 12 | email.signature=jhipsterJwtSampleApplication Team. 13 | 14 | # Creation email 15 | email.creation.text1=Your jhipsterJwtSampleApplication account has been created, please click on the URL below to access it: 16 | 17 | # Reset email 18 | email.reset.title=jhipsterJwtSampleApplication password reset 19 | email.reset.greeting=Dear {0} 20 | email.reset.text1=For your jhipsterJwtSampleApplication account a password reset was requested, please click on the URL below to reset it: 21 | email.reset.text2=Regards, 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/mails/activationEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JHipster activation 5 | 6 | 7 | 8 | 9 |

10 | Dear 11 |

12 |

13 | Your JHipster account has been created, please click on the URL below to activate it: 14 |

15 |

16 | Activation Link 18 |

19 |

20 | Regards, 21 |
22 | JHipster. 23 |

24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/mails/creationEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JHipster creation 5 | 6 | 7 | 8 | 9 |

10 | Dear 11 |

12 |

13 | Your JHipster account has been created, please click on the URL below to access it: 14 |

15 |

16 | Login link 18 |

19 |

20 | Regards, 21 |
22 | JHipster. 23 |

24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/mails/passwordResetEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JHipster password reset 5 | 6 | 7 | 8 | 9 |

10 | Dear 11 |

12 |

13 | For your JHipster account a password reset was requested, please click on the URL below to reset it: 14 |

15 |

16 | Reset Link 18 |

19 |

20 | Regards, 21 |
22 | JHipster. 23 |

24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/webapp/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Page Not Found 6 | 7 | 8 | 55 | 56 | 57 |

Page Not Found

58 |

Sorry, but the page you were trying to view does not exist.

59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/account.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | import { JhipsterJwtSampleApplicationSharedModule } from '../shared'; 5 | 6 | import { 7 | Register, 8 | ActivateService, 9 | PasswordService, 10 | PasswordResetInitService, 11 | PasswordResetFinishService, 12 | PasswordStrengthBarComponent, 13 | RegisterComponent, 14 | ActivateComponent, 15 | PasswordComponent, 16 | PasswordResetInitComponent, 17 | PasswordResetFinishComponent, 18 | SettingsComponent, 19 | accountState 20 | } from './'; 21 | 22 | @NgModule({ 23 | imports: [ 24 | JhipsterJwtSampleApplicationSharedModule, 25 | RouterModule.forChild(accountState) 26 | ], 27 | declarations: [ 28 | ActivateComponent, 29 | RegisterComponent, 30 | PasswordComponent, 31 | PasswordStrengthBarComponent, 32 | PasswordResetInitComponent, 33 | PasswordResetFinishComponent, 34 | SettingsComponent 35 | ], 36 | providers: [ 37 | Register, 38 | ActivateService, 39 | PasswordService, 40 | PasswordResetInitService, 41 | PasswordResetFinishService 42 | ], 43 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 44 | }) 45 | export class JhipsterJwtSampleApplicationAccountModule {} 46 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/account.route.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { 4 | activateRoute, 5 | passwordRoute, 6 | passwordResetFinishRoute, 7 | passwordResetInitRoute, 8 | registerRoute, 9 | settingsRoute 10 | } from './'; 11 | 12 | const ACCOUNT_ROUTES = [ 13 | activateRoute, 14 | passwordRoute, 15 | passwordResetFinishRoute, 16 | passwordResetInitRoute, 17 | registerRoute, 18 | settingsRoute 19 | ]; 20 | 21 | export const accountState: Routes = [{ 22 | path: '', 23 | children: ACCOUNT_ROUTES 24 | }]; 25 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/activate/activate.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Activation

5 | 6 |
7 | Your user account has been activated. Please 8 | sign in. 9 |
10 | 11 |
12 | Your user could not be activated. Please use the registration form to sign up. 13 |
14 | 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/activate/activate.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | 5 | import { ActivateService } from './activate.service'; 6 | import { LoginModalService } from '../../shared'; 7 | 8 | @Component({ 9 | selector: 'jhi-activate', 10 | templateUrl: './activate.component.html' 11 | }) 12 | export class ActivateComponent implements OnInit { 13 | error: string; 14 | success: string; 15 | modalRef: NgbModalRef; 16 | 17 | constructor( 18 | private activateService: ActivateService, 19 | private loginModalService: LoginModalService, 20 | private route: ActivatedRoute 21 | ) { 22 | } 23 | 24 | ngOnInit() { 25 | this.route.queryParams.subscribe((params) => { 26 | this.activateService.get(params['key']).subscribe(() => { 27 | this.error = null; 28 | this.success = 'OK'; 29 | }, () => { 30 | this.success = null; 31 | this.error = 'ERROR'; 32 | }); 33 | }); 34 | } 35 | 36 | login() { 37 | this.modalRef = this.loginModalService.open(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/activate/activate.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { UserRouteAccessService } from '../../shared'; 4 | import { ActivateComponent } from './activate.component'; 5 | 6 | export const activateRoute: Route = { 7 | path: 'activate', 8 | component: ActivateComponent, 9 | data: { 10 | authorities: [], 11 | pageTitle: 'activate.title' 12 | }, 13 | canActivate: [UserRouteAccessService] 14 | }; 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/activate/activate.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http, Response, URLSearchParams } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | 6 | @Injectable() 7 | export class ActivateService { 8 | 9 | constructor(private http: Http) {} 10 | 11 | get(key: string): Observable { 12 | const params: URLSearchParams = new URLSearchParams(); 13 | params.set('key', key); 14 | 15 | return this.http.get(SERVER_API_URL + 'api/activate', { 16 | search: params 17 | }).map((res: Response) => res); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/index.ts: -------------------------------------------------------------------------------- 1 | export * from './activate/activate.component'; 2 | export * from './activate/activate.service'; 3 | export * from './activate/activate.route'; 4 | export * from './password/password.component'; 5 | export * from './password/password-strength-bar.component'; 6 | export * from './password/password.service'; 7 | export * from './password/password.route'; 8 | export * from './password-reset/finish/password-reset-finish.component'; 9 | export * from './password-reset/finish/password-reset-finish.service'; 10 | export * from './password-reset/finish/password-reset-finish.route'; 11 | export * from './password-reset/init/password-reset-init.component'; 12 | export * from './password-reset/init/password-reset-init.service'; 13 | export * from './password-reset/init/password-reset-init.route'; 14 | export * from './register/register.component'; 15 | export * from './register/register.service'; 16 | export * from './register/register.route'; 17 | export * from './settings/settings.component'; 18 | export * from './settings/settings.route'; 19 | export * from './account.route'; 20 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { UserRouteAccessService } from '../../../shared'; 4 | import { PasswordResetFinishComponent } from './password-reset-finish.component'; 5 | 6 | export const passwordResetFinishRoute: Route = { 7 | path: 'reset/finish', 8 | component: PasswordResetFinishComponent, 9 | data: { 10 | authorities: [], 11 | pageTitle: 'global.menu.account.password' 12 | }, 13 | canActivate: [UserRouteAccessService] 14 | }; 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../../app.constants'; 5 | 6 | @Injectable() 7 | export class PasswordResetFinishService { 8 | 9 | constructor(private http: Http) {} 10 | 11 | save(keyAndPassword: any): Observable { 12 | return this.http.post(SERVER_API_URL + 'api/account/reset-password/finish', keyAndPassword); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, AfterViewInit, Renderer, ElementRef } from '@angular/core'; 2 | 3 | import { PasswordResetInitService } from './password-reset-init.service'; 4 | import { EMAIL_NOT_FOUND_TYPE } from '../../../shared'; 5 | 6 | @Component({ 7 | selector: 'jhi-password-reset-init', 8 | templateUrl: './password-reset-init.component.html' 9 | }) 10 | export class PasswordResetInitComponent implements OnInit, AfterViewInit { 11 | error: string; 12 | errorEmailNotExists: string; 13 | resetAccount: any; 14 | success: string; 15 | 16 | constructor( 17 | private passwordResetInitService: PasswordResetInitService, 18 | private elementRef: ElementRef, 19 | private renderer: Renderer 20 | ) { 21 | } 22 | 23 | ngOnInit() { 24 | this.resetAccount = {}; 25 | } 26 | 27 | ngAfterViewInit() { 28 | this.renderer.invokeElementMethod(this.elementRef.nativeElement.querySelector('#email'), 'focus', []); 29 | } 30 | 31 | requestReset() { 32 | this.error = null; 33 | this.errorEmailNotExists = null; 34 | 35 | this.passwordResetInitService.save(this.resetAccount.email).subscribe(() => { 36 | this.success = 'OK'; 37 | }, (response) => { 38 | this.success = null; 39 | if (response.status === 400 && response.json().type === EMAIL_NOT_FOUND_TYPE) { 40 | this.errorEmailNotExists = 'ERROR'; 41 | } else { 42 | this.error = 'ERROR'; 43 | } 44 | }); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { UserRouteAccessService } from '../../../shared'; 4 | import { PasswordResetInitComponent } from './password-reset-init.component'; 5 | 6 | export const passwordResetInitRoute: Route = { 7 | path: 'reset/request', 8 | component: PasswordResetInitComponent, 9 | data: { 10 | authorities: [], 11 | pageTitle: 'global.menu.account.password' 12 | }, 13 | canActivate: [UserRouteAccessService] 14 | }; 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../../app.constants'; 5 | 6 | @Injectable() 7 | export class PasswordResetInitService { 8 | 9 | constructor(private http: Http) {} 10 | 11 | save(mail: string): Observable { 12 | return this.http.post(SERVER_API_URL + 'api/account/reset-password/init', mail); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password/password-strength-bar.css: -------------------------------------------------------------------------------- 1 | /* ========================================================================== 2 | start Password strength bar style 3 | ========================================================================== */ 4 | ul#strengthBar { 5 | display:inline; 6 | list-style:none; 7 | margin:0; 8 | margin-left:15px; 9 | padding:0; 10 | vertical-align:2px; 11 | } 12 | 13 | .point:last { 14 | margin:0 !important; 15 | } 16 | .point { 17 | background:#DDD; 18 | border-radius:2px; 19 | display:inline-block; 20 | height:5px; 21 | margin-right:1px; 22 | width:20px; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password/password.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { Principal } from '../../shared'; 4 | import { PasswordService } from './password.service'; 5 | 6 | @Component({ 7 | selector: 'jhi-password', 8 | templateUrl: './password.component.html' 9 | }) 10 | export class PasswordComponent implements OnInit { 11 | doNotMatch: string; 12 | error: string; 13 | success: string; 14 | account: any; 15 | password: string; 16 | confirmPassword: string; 17 | 18 | constructor( 19 | private passwordService: PasswordService, 20 | private principal: Principal 21 | ) { 22 | } 23 | 24 | ngOnInit() { 25 | this.principal.identity().then((account) => { 26 | this.account = account; 27 | }); 28 | } 29 | 30 | changePassword() { 31 | if (this.password !== this.confirmPassword) { 32 | this.error = null; 33 | this.success = null; 34 | this.doNotMatch = 'ERROR'; 35 | } else { 36 | this.doNotMatch = null; 37 | this.passwordService.save(this.password).subscribe(() => { 38 | this.error = null; 39 | this.success = 'OK'; 40 | }, () => { 41 | this.success = null; 42 | this.error = 'ERROR'; 43 | }); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password/password.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { UserRouteAccessService } from '../../shared'; 4 | import { PasswordComponent } from './password.component'; 5 | 6 | export const passwordRoute: Route = { 7 | path: 'password', 8 | component: PasswordComponent, 9 | data: { 10 | authorities: ['ROLE_USER'], 11 | pageTitle: 'global.menu.account.password' 12 | }, 13 | canActivate: [UserRouteAccessService] 14 | }; 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/password/password.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | 6 | @Injectable() 7 | export class PasswordService { 8 | 9 | constructor(private http: Http) {} 10 | 11 | save(newPassword: string): Observable { 12 | return this.http.post(SERVER_API_URL + 'api/account/change-password', newPassword); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/register/register.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { RegisterComponent } from './register.component'; 4 | 5 | export const registerRoute: Route = { 6 | path: 'register', 7 | component: RegisterComponent, 8 | data: { 9 | authorities: [], 10 | pageTitle: 'register.title' 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/register/register.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | 6 | @Injectable() 7 | export class Register { 8 | 9 | constructor(private http: Http) {} 10 | 11 | save(account: any): Observable { 12 | return this.http.post(SERVER_API_URL + 'api/register', account); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/settings/settings.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { JhiLanguageService } from 'ng-jhipster'; 3 | 4 | import { Principal, AccountService, JhiLanguageHelper } from '../../shared'; 5 | 6 | @Component({ 7 | selector: 'jhi-settings', 8 | templateUrl: './settings.component.html' 9 | }) 10 | export class SettingsComponent implements OnInit { 11 | error: string; 12 | success: string; 13 | settingsAccount: any; 14 | languages: any[]; 15 | 16 | constructor( 17 | private account: AccountService, 18 | private principal: Principal, 19 | private languageService: JhiLanguageService, 20 | private languageHelper: JhiLanguageHelper 21 | ) { 22 | } 23 | 24 | ngOnInit() { 25 | this.principal.identity().then((account) => { 26 | this.settingsAccount = this.copyAccount(account); 27 | }); 28 | this.languageHelper.getAll().then((languages) => { 29 | this.languages = languages; 30 | }); 31 | } 32 | 33 | save() { 34 | this.account.save(this.settingsAccount).subscribe(() => { 35 | this.error = null; 36 | this.success = 'OK'; 37 | this.principal.identity(true).then((account) => { 38 | this.settingsAccount = this.copyAccount(account); 39 | }); 40 | this.languageService.getCurrent().then((current) => { 41 | if (this.settingsAccount.langKey !== current) { 42 | this.languageService.changeLanguage(this.settingsAccount.langKey); 43 | } 44 | }); 45 | }, () => { 46 | this.success = null; 47 | this.error = 'ERROR'; 48 | }); 49 | } 50 | 51 | copyAccount(account) { 52 | return { 53 | activated: account.activated, 54 | email: account.email, 55 | firstName: account.firstName, 56 | langKey: account.langKey, 57 | lastName: account.lastName, 58 | login: account.login, 59 | imageUrl: account.imageUrl 60 | }; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/webapp/app/account/settings/settings.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { UserRouteAccessService } from '../../shared'; 4 | import { SettingsComponent } from './settings.component'; 5 | 6 | export const settingsRoute: Route = { 7 | path: 'settings', 8 | component: SettingsComponent, 9 | data: { 10 | authorities: ['ROLE_USER'], 11 | pageTitle: 'global.menu.account.settings' 12 | }, 13 | canActivate: [UserRouteAccessService] 14 | }; 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/admin.route.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { 4 | auditsRoute, 5 | configurationRoute, 6 | docsRoute, 7 | healthRoute, 8 | logsRoute, 9 | metricsRoute, 10 | userMgmtRoute, 11 | userDialogRoute 12 | } from './'; 13 | 14 | import { UserRouteAccessService } from '../shared'; 15 | 16 | const ADMIN_ROUTES = [ 17 | auditsRoute, 18 | configurationRoute, 19 | docsRoute, 20 | healthRoute, 21 | logsRoute, 22 | ...userMgmtRoute, 23 | metricsRoute 24 | ]; 25 | 26 | export const adminState: Routes = [{ 27 | path: '', 28 | data: { 29 | authorities: ['ROLE_ADMIN'] 30 | }, 31 | canActivate: [UserRouteAccessService], 32 | children: ADMIN_ROUTES 33 | }, 34 | ...userDialogRoute 35 | ]; 36 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/audits/audit-data.model.ts: -------------------------------------------------------------------------------- 1 | export class AuditData { 2 | constructor( 3 | public remoteAddress: string, 4 | public sessionId: string 5 | ) { } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/audits/audit.model.ts: -------------------------------------------------------------------------------- 1 | import { AuditData } from './audit-data.model'; 2 | 3 | export class Audit { 4 | constructor( 5 | public data: AuditData, 6 | public principal: string, 7 | public timestamp: string, 8 | public type: string 9 | ) { } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/audits/audits.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { AuditsComponent } from './audits.component'; 4 | 5 | export const auditsRoute: Route = { 6 | path: 'audits', 7 | component: AuditsComponent, 8 | data: { 9 | pageTitle: 'audits.title' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/audits/audits.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http, Response, URLSearchParams } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | 6 | @Injectable() 7 | export class AuditsService { 8 | constructor(private http: Http) { } 9 | 10 | query(req: any): Observable { 11 | const params: URLSearchParams = new URLSearchParams(); 12 | params.set('fromDate', req.fromDate); 13 | params.set('toDate', req.toDate); 14 | params.set('page', req.page); 15 | params.set('size', req.size); 16 | params.set('sort', req.sort); 17 | 18 | const options = { 19 | search: params 20 | }; 21 | 22 | return this.http.get(SERVER_API_URL + 'management/audits', options); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/configuration/configuration.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Configuration

3 | 4 | Filter (by prefix) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 |
PrefixProperties
{{entry.prefix}} 17 |
18 |
{{key}}
19 |
20 | {{entry.properties[key] | json}} 21 |
22 |
23 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 |
PropertyValue
{{item.key}} 40 | {{item.val}} 41 |
45 |
46 |
47 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/configuration/configuration.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { JhiConfigurationService } from './configuration.service'; 4 | 5 | @Component({ 6 | selector: 'jhi-configuration', 7 | templateUrl: './configuration.component.html' 8 | }) 9 | export class JhiConfigurationComponent implements OnInit { 10 | allConfiguration: any = null; 11 | configuration: any = null; 12 | configKeys: any[]; 13 | filter: string; 14 | orderProp: string; 15 | reverse: boolean; 16 | 17 | constructor( 18 | private configurationService: JhiConfigurationService 19 | ) { 20 | this.configKeys = []; 21 | this.filter = ''; 22 | this.orderProp = 'prefix'; 23 | this.reverse = false; 24 | } 25 | 26 | keys(dict): Array { 27 | return (dict === undefined) ? [] : Object.keys(dict); 28 | } 29 | 30 | ngOnInit() { 31 | this.configurationService.get().subscribe((configuration) => { 32 | this.configuration = configuration; 33 | 34 | for (const config of configuration) { 35 | if (config.properties !== undefined) { 36 | this.configKeys.push(Object.keys(config.properties)); 37 | } 38 | } 39 | }); 40 | 41 | this.configurationService.getEnv().subscribe((configuration) => { 42 | this.allConfiguration = configuration; 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/configuration/configuration.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { JhiConfigurationComponent } from './configuration.component'; 4 | 5 | export const configurationRoute: Route = { 6 | path: 'jhi-configuration', 7 | component: JhiConfigurationComponent, 8 | data: { 9 | pageTitle: 'configuration.title' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/configuration/configuration.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http, Response } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | 6 | @Injectable() 7 | export class JhiConfigurationService { 8 | 9 | constructor(private http: Http) { 10 | } 11 | 12 | get(): Observable { 13 | return this.http.get(SERVER_API_URL + 'management/configprops').map((res: Response) => { 14 | const properties: any[] = []; 15 | 16 | const propertiesObject = res.json(); 17 | 18 | for (const key in propertiesObject) { 19 | if (propertiesObject.hasOwnProperty(key)) { 20 | properties.push(propertiesObject[key]); 21 | } 22 | } 23 | 24 | return properties.sort((propertyA, propertyB) => { 25 | return (propertyA.prefix === propertyB.prefix) ? 0 : 26 | (propertyA.prefix < propertyB.prefix) ? -1 : 1; 27 | }); 28 | }); 29 | } 30 | 31 | getEnv(): Observable { 32 | return this.http.get(SERVER_API_URL + 'management/env').map((res: Response) => { 33 | const properties: any = {}; 34 | 35 | const propertiesObject = res.json(); 36 | 37 | for (const key in propertiesObject) { 38 | if (propertiesObject.hasOwnProperty(key)) { 39 | const valsObject = propertiesObject[key]; 40 | const vals: any[] = []; 41 | 42 | for (const valKey in valsObject) { 43 | if (valsObject.hasOwnProperty(valKey)) { 44 | vals.push({key: valKey, val: valsObject[valKey]}); 45 | } 46 | } 47 | properties[key] = vals; 48 | } 49 | } 50 | 51 | return properties; 52 | }); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/docs/docs.component.html: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/docs/docs.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'jhi-docs', 5 | templateUrl: './docs.component.html' 6 | }) 7 | export class JhiDocsComponent { 8 | constructor( 9 | ) { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/docs/docs.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { JhiDocsComponent } from './docs.component'; 4 | 5 | export const docsRoute: Route = { 6 | path: 'docs', 7 | component: JhiDocsComponent, 8 | data: { 9 | pageTitle: 'global.menu.admin.apidocs' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health-modal.component.html: -------------------------------------------------------------------------------- 1 | 9 | 34 | 37 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health-modal.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | import { JhiHealthService } from './health.service'; 5 | 6 | @Component({ 7 | selector: 'jhi-health-modal', 8 | templateUrl: './health-modal.component.html' 9 | }) 10 | export class JhiHealthModalComponent { 11 | 12 | currentHealth: any; 13 | 14 | constructor(private healthService: JhiHealthService, public activeModal: NgbActiveModal) {} 15 | 16 | baseName(name) { 17 | return this.healthService.getBaseName(name); 18 | } 19 | 20 | subSystemName(name) { 21 | return this.healthService.getSubSystemName(name); 22 | } 23 | 24 | readableValue(value: number) { 25 | if (this.currentHealth.name !== 'diskSpace') { 26 | return value.toString(); 27 | } 28 | 29 | // Should display storage space in an human readable unit 30 | const val = value / 1073741824; 31 | if (val > 1) { // Value 32 | return val.toFixed(2) + ' GB'; 33 | } else { 34 | return (value / 1048576).toFixed(2) + ' MB'; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | Health Checks 4 | 7 |

8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 30 | 31 | 32 |
Service NameStatusDetails
{{'health.indicator.' + baseName(health.name) | translate}} {{subSystemName(health.name)}} 21 | 22 | {{health.status}} 23 | 24 | 26 | 27 | 28 | 29 |
33 |
34 |
35 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | import { JhiHealthService } from './health.service'; 5 | import { JhiHealthModalComponent } from './health-modal.component'; 6 | 7 | @Component({ 8 | selector: 'jhi-health', 9 | templateUrl: './health.component.html' 10 | }) 11 | export class JhiHealthCheckComponent implements OnInit { 12 | healthData: any; 13 | updatingHealth: boolean; 14 | 15 | constructor( 16 | private modalService: NgbModal, 17 | private healthService: JhiHealthService 18 | ) { 19 | 20 | } 21 | 22 | ngOnInit() { 23 | this.refresh(); 24 | } 25 | 26 | baseName(name: string) { 27 | return this.healthService.getBaseName(name); 28 | } 29 | 30 | getBadgeClass(statusState) { 31 | if (statusState === 'UP') { 32 | return 'badge-success'; 33 | } else { 34 | return 'badge-danger'; 35 | } 36 | } 37 | 38 | refresh() { 39 | this.updatingHealth = true; 40 | 41 | this.healthService.checkHealth().subscribe((health) => { 42 | this.healthData = this.healthService.transformHealthData(health); 43 | this.updatingHealth = false; 44 | }, (error) => { 45 | if (error.status === 503) { 46 | this.healthData = this.healthService.transformHealthData(error.json()); 47 | this.updatingHealth = false; 48 | } 49 | }); 50 | } 51 | 52 | showHealth(health: any) { 53 | const modalRef = this.modalService.open(JhiHealthModalComponent); 54 | modalRef.componentInstance.currentHealth = health; 55 | modalRef.result.then((result) => { 56 | // Left blank intentionally, nothing to do here 57 | }, (reason) => { 58 | // Left blank intentionally, nothing to do here 59 | }); 60 | } 61 | 62 | subSystemName(name: string) { 63 | return this.healthService.getSubSystemName(name); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/health/health.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { JhiHealthCheckComponent } from './health.component'; 4 | 5 | export const healthRoute: Route = { 6 | path: 'jhi-health', 7 | component: JhiHealthCheckComponent, 8 | data: { 9 | pageTitle: 'health.title' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/index.ts: -------------------------------------------------------------------------------- 1 | export * from './audits/audits.component'; 2 | export * from './audits/audits.service'; 3 | export * from './audits/audits.route'; 4 | export * from './audits/audit.model'; 5 | export * from './audits/audit-data.model'; 6 | export * from './configuration/configuration.component'; 7 | export * from './configuration/configuration.service'; 8 | export * from './configuration/configuration.route'; 9 | export * from './docs/docs.component'; 10 | export * from './docs/docs.route'; 11 | export * from './health/health.component'; 12 | export * from './health/health-modal.component'; 13 | export * from './health/health.service'; 14 | export * from './health/health.route'; 15 | export * from './logs/logs.component'; 16 | export * from './logs/logs.service'; 17 | export * from './logs/logs.route'; 18 | export * from './logs/log.model'; 19 | export * from './metrics/metrics.component'; 20 | export * from './metrics/metrics-modal.component'; 21 | export * from './metrics/metrics.service'; 22 | export * from './metrics/metrics.route'; 23 | export * from './user-management/user-management-dialog.component'; 24 | export * from './user-management/user-management-delete-dialog.component'; 25 | export * from './user-management/user-management-detail.component'; 26 | export * from './user-management/user-management.component'; 27 | export * from './user-management/user-management.route'; 28 | export * from './user-management/user-modal.service'; 29 | export * from './admin.route'; 30 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/log.model.ts: -------------------------------------------------------------------------------- 1 | export class Log { 2 | constructor( 3 | public name: string, 4 | public level: string 5 | ) { } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/logs.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Logs

3 | 4 |

There are {{ loggers.length }} loggers.

5 | 6 | Filter 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 25 | 26 |
NameLevel
{{logger.name | slice:0:140}} 19 | 20 | 21 | 22 | 23 | 24 |
27 |
28 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/logs.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { Log } from './log.model'; 4 | import { LogsService } from './logs.service'; 5 | 6 | @Component({ 7 | selector: 'jhi-logs', 8 | templateUrl: './logs.component.html', 9 | }) 10 | export class LogsComponent implements OnInit { 11 | 12 | loggers: Log[]; 13 | filter: string; 14 | orderProp: string; 15 | reverse: boolean; 16 | 17 | constructor( 18 | private logsService: LogsService 19 | ) { 20 | this.filter = ''; 21 | this.orderProp = 'name'; 22 | this.reverse = false; 23 | } 24 | 25 | ngOnInit() { 26 | this.logsService.findAll().subscribe((loggers) => this.loggers = loggers); 27 | } 28 | 29 | changeLevel(name: string, level: string) { 30 | const log = new Log(name, level); 31 | this.logsService.changeLevel(log).subscribe(() => { 32 | this.logsService.findAll().subscribe((loggers) => this.loggers = loggers); 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/logs.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { LogsComponent } from './logs.component'; 4 | 5 | export const logsRoute: Route = { 6 | path: 'logs', 7 | component: LogsComponent, 8 | data: { 9 | pageTitle: 'logs.title' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/logs/logs.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http, Response } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | 6 | import { Log } from './log.model'; 7 | 8 | @Injectable() 9 | export class LogsService { 10 | constructor(private http: Http) { } 11 | 12 | changeLevel(log: Log): Observable { 13 | return this.http.put(SERVER_API_URL + 'management/logs', log); 14 | } 15 | 16 | findAll(): Observable { 17 | return this.http.get(SERVER_API_URL + 'management/logs').map((res: Response) => res.json()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/metrics/metrics-modal.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | @Component({ 5 | selector: 'jhi-metrics-modal', 6 | templateUrl: './metrics-modal.component.html' 7 | }) 8 | export class JhiMetricsMonitoringModalComponent implements OnInit { 9 | 10 | threadDumpFilter: any; 11 | threadDump: any; 12 | threadDumpAll = 0; 13 | threadDumpBlocked = 0; 14 | threadDumpRunnable = 0; 15 | threadDumpTimedWaiting = 0; 16 | threadDumpWaiting = 0; 17 | 18 | constructor(public activeModal: NgbActiveModal) {} 19 | 20 | ngOnInit() { 21 | this.threadDump.forEach((value) => { 22 | if (value.threadState === 'RUNNABLE') { 23 | this.threadDumpRunnable += 1; 24 | } else if (value.threadState === 'WAITING') { 25 | this.threadDumpWaiting += 1; 26 | } else if (value.threadState === 'TIMED_WAITING') { 27 | this.threadDumpTimedWaiting += 1; 28 | } else if (value.threadState === 'BLOCKED') { 29 | this.threadDumpBlocked += 1; 30 | } 31 | }); 32 | 33 | this.threadDumpAll = this.threadDumpRunnable + this.threadDumpWaiting + 34 | this.threadDumpTimedWaiting + this.threadDumpBlocked; 35 | } 36 | 37 | getBadgeClass(threadState) { 38 | if (threadState === 'RUNNABLE') { 39 | return 'badge-success'; 40 | } else if (threadState === 'WAITING') { 41 | return 'badge-info'; 42 | } else if (threadState === 'TIMED_WAITING') { 43 | return 'badge-warning'; 44 | } else if (threadState === 'BLOCKED') { 45 | return 'badge-danger'; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/metrics/metrics.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { JhiMetricsMonitoringComponent } from './metrics.component'; 4 | 5 | export const metricsRoute: Route = { 6 | path: 'jhi-metrics', 7 | component: JhiMetricsMonitoringComponent, 8 | data: { 9 | pageTitle: 'metrics.title' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/metrics/metrics.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Response, Http } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | 6 | @Injectable() 7 | export class JhiMetricsService { 8 | 9 | constructor(private http: Http) {} 10 | 11 | getMetrics(): Observable { 12 | return this.http.get(SERVER_API_URL + 'management/metrics').map((res: Response) => res.json()); 13 | } 14 | 15 | threadDump(): Observable { 16 | return this.http.get(SERVER_API_URL + 'management/dump').map((res: Response) => res.json()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 | 11 | 19 |
20 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; 4 | import { JhiEventManager } from 'ng-jhipster'; 5 | 6 | import { User, UserService } from '../../shared'; 7 | import { UserModalService } from './user-modal.service'; 8 | 9 | @Component({ 10 | selector: 'jhi-user-mgmt-delete-dialog', 11 | templateUrl: './user-management-delete-dialog.component.html' 12 | }) 13 | export class UserMgmtDeleteDialogComponent { 14 | 15 | user: User; 16 | 17 | constructor( 18 | private userService: UserService, 19 | public activeModal: NgbActiveModal, 20 | private eventManager: JhiEventManager 21 | ) { 22 | } 23 | 24 | clear() { 25 | this.activeModal.dismiss('cancel'); 26 | } 27 | 28 | confirmDelete(login) { 29 | this.userService.delete(login).subscribe((response) => { 30 | this.eventManager.broadcast({ name: 'userListModification', 31 | content: 'Deleted a user'}); 32 | this.activeModal.dismiss(true); 33 | }); 34 | } 35 | } 36 | 37 | @Component({ 38 | selector: 'jhi-user-delete-dialog', 39 | template: '' 40 | }) 41 | export class UserDeleteDialogComponent implements OnInit, OnDestroy { 42 | 43 | routeSub: any; 44 | 45 | constructor( 46 | private route: ActivatedRoute, 47 | private userModalService: UserModalService 48 | ) {} 49 | 50 | ngOnInit() { 51 | this.routeSub = this.route.params.subscribe((params) => { 52 | this.userModalService.open(UserMgmtDeleteDialogComponent as Component, params['login']); 53 | }); 54 | } 55 | 56 | ngOnDestroy() { 57 | this.routeSub.unsubscribe(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-management-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Subscription } from 'rxjs/Rx'; 4 | 5 | import { User, UserService } from '../../shared'; 6 | 7 | @Component({ 8 | selector: 'jhi-user-mgmt-detail', 9 | templateUrl: './user-management-detail.component.html' 10 | }) 11 | export class UserMgmtDetailComponent implements OnInit, OnDestroy { 12 | 13 | user: User; 14 | private subscription: Subscription; 15 | 16 | constructor( 17 | private userService: UserService, 18 | private route: ActivatedRoute 19 | ) { 20 | } 21 | 22 | ngOnInit() { 23 | this.subscription = this.route.params.subscribe((params) => { 24 | this.load(params['login']); 25 | }); 26 | } 27 | 28 | load(login) { 29 | this.userService.find(login).subscribe((user) => { 30 | this.user = user; 31 | }); 32 | } 33 | 34 | ngOnDestroy() { 35 | this.subscription.unsubscribe(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/webapp/app/admin/user-management/user-modal.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, Component } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; 4 | 5 | import { User, UserService } from '../../shared'; 6 | 7 | @Injectable() 8 | export class UserModalService { 9 | private ngbModalRef: NgbModalRef; 10 | 11 | constructor( 12 | private modalService: NgbModal, 13 | private router: Router, 14 | private userService: UserService 15 | ) { 16 | this.ngbModalRef = null; 17 | } 18 | 19 | open(component: Component, id?: number | any): Promise { 20 | return new Promise((resolve, reject) => { 21 | const isOpen = this.ngbModalRef !== null; 22 | if (isOpen) { 23 | resolve(this.ngbModalRef); 24 | } 25 | 26 | if (id) { 27 | this.userService.find(id).subscribe((user) => { 28 | this.ngbModalRef = this.userModalRef(component, user); 29 | resolve(this.ngbModalRef); 30 | }); 31 | } else { 32 | // setTimeout used as a workaround for getting ExpressionChangedAfterItHasBeenCheckedError 33 | setTimeout(() => { 34 | this.ngbModalRef = this.userModalRef(component, new User()); 35 | resolve(this.ngbModalRef); 36 | }, 0); 37 | } 38 | }); 39 | } 40 | 41 | userModalRef(component: Component, user: User): NgbModalRef { 42 | const modalRef = this.modalService.open(component, { size: 'lg', backdrop: 'static'}); 43 | modalRef.componentInstance.user = user; 44 | modalRef.result.then((result) => { 45 | this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true, queryParamsHandling: 'merge' }); 46 | this.ngbModalRef = null; 47 | }, (reason) => { 48 | this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true, queryParamsHandling: 'merge' }); 49 | this.ngbModalRef = null; 50 | }); 51 | return modalRef; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/webapp/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | import { errorRoute, navbarRoute } from './layouts'; 4 | 5 | const LAYOUT_ROUTES = [ 6 | navbarRoute, 7 | ...errorRoute 8 | ]; 9 | 10 | @NgModule({ 11 | imports: [ 12 | RouterModule.forRoot(LAYOUT_ROUTES, { useHash: true }) 13 | ], 14 | exports: [ 15 | RouterModule 16 | ] 17 | }) 18 | export class JhipsterJwtSampleApplicationAppRoutingModule {} 19 | -------------------------------------------------------------------------------- /src/main/webapp/app/app.constants.ts: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT THIS FILE, EDIT THE WEBPACK COMMON CONFIG INSTEAD, WHICH WILL MODIFY THIS FILE 2 | /* tslint:disable */ 3 | let _VERSION = '0.0.1-SNAPSHOT'; // This value will be overwritten by Webpack 4 | let _DEBUG_INFO_ENABLED = true; // This value will be overwritten by Webpack 5 | let _SERVER_API_URL = ''; // This value will be overwritten by Webpack 6 | /* @toreplace VERSION */ 7 | /* @toreplace DEBUG_INFO_ENABLED */ 8 | /* @toreplace SERVER_API_URL */ 9 | /* tslint:enable */ 10 | export const VERSION = _VERSION; 11 | export const DEBUG_INFO_ENABLED = _DEBUG_INFO_ENABLED; 12 | export const SERVER_API_URL = _SERVER_API_URL; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/app.main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | import { ProdConfig } from './blocks/config/prod.config'; 3 | import { JhipsterJwtSampleApplicationAppModule } from './app.module'; 4 | 5 | ProdConfig(); 6 | 7 | if (module['hot']) { 8 | module['hot'].accept(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(JhipsterJwtSampleApplicationAppModule) 12 | .then((success) => console.log(`Application started`)) 13 | .catch((err) => console.error(err)); 14 | -------------------------------------------------------------------------------- /src/main/webapp/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import './vendor.ts'; 2 | 3 | import { NgModule } from '@angular/core'; 4 | import { BrowserModule } from '@angular/platform-browser'; 5 | import { Ng2Webstorage } from 'ngx-webstorage'; 6 | 7 | import { JhipsterJwtSampleApplicationSharedModule, UserRouteAccessService } from './shared'; 8 | import { JhipsterJwtSampleApplicationAppRoutingModule} from './app-routing.module'; 9 | import { JhipsterJwtSampleApplicationHomeModule } from './home/home.module'; 10 | import { JhipsterJwtSampleApplicationAdminModule } from './admin/admin.module'; 11 | import { JhipsterJwtSampleApplicationAccountModule } from './account/account.module'; 12 | import { JhipsterJwtSampleApplicationEntityModule } from './entities/entity.module'; 13 | import { customHttpProvider } from './blocks/interceptor/http.provider'; 14 | import { PaginationConfig } from './blocks/config/uib-pagination.config'; 15 | 16 | // jhipster-needle-angular-add-module-import JHipster will add new module here 17 | 18 | import { 19 | JhiMainComponent, 20 | NavbarComponent, 21 | FooterComponent, 22 | ProfileService, 23 | PageRibbonComponent, 24 | ActiveMenuDirective, 25 | ErrorComponent 26 | } from './layouts'; 27 | 28 | @NgModule({ 29 | imports: [ 30 | BrowserModule, 31 | JhipsterJwtSampleApplicationAppRoutingModule, 32 | Ng2Webstorage.forRoot({ prefix: 'jhi', separator: '-'}), 33 | JhipsterJwtSampleApplicationSharedModule, 34 | JhipsterJwtSampleApplicationHomeModule, 35 | JhipsterJwtSampleApplicationAdminModule, 36 | JhipsterJwtSampleApplicationAccountModule, 37 | JhipsterJwtSampleApplicationEntityModule, 38 | // jhipster-needle-angular-add-module JHipster will add new module here 39 | ], 40 | declarations: [ 41 | JhiMainComponent, 42 | NavbarComponent, 43 | ErrorComponent, 44 | PageRibbonComponent, 45 | ActiveMenuDirective, 46 | FooterComponent 47 | ], 48 | providers: [ 49 | ProfileService, 50 | customHttpProvider(), 51 | PaginationConfig, 52 | UserRouteAccessService 53 | ], 54 | bootstrap: [ JhiMainComponent ] 55 | }) 56 | export class JhipsterJwtSampleApplicationAppModule {} 57 | -------------------------------------------------------------------------------- /src/main/webapp/app/app.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { NavbarComponent } from './layouts'; 4 | 5 | export const navbarRoute: Route = { 6 | path: '', 7 | component: NavbarComponent, 8 | outlet: 'navbar' 9 | }; 10 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/config/prod.config.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { DEBUG_INFO_ENABLED } from '../../app.constants'; 3 | 4 | export function ProdConfig() { 5 | // disable debug data on prod profile to improve performance 6 | if (!DEBUG_INFO_ENABLED) { 7 | enableProdMode(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/config/uib-pagination.config.ts: -------------------------------------------------------------------------------- 1 | import { ITEMS_PER_PAGE } from '../../shared'; 2 | import { Injectable } from '@angular/core'; 3 | import { NgbPaginationConfig} from '@ng-bootstrap/ng-bootstrap'; 4 | 5 | @Injectable() 6 | export class PaginationConfig { 7 | // tslint:disable-next-line: no-unused-variable 8 | constructor(private config: NgbPaginationConfig) { 9 | config.boundaryLinks = true; 10 | config.maxSize = 5; 11 | config.pageSize = ITEMS_PER_PAGE; 12 | config.size = 'sm'; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/auth-expired.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { JhiHttpInterceptor } from 'ng-jhipster'; 2 | import { Injector } from '@angular/core'; 3 | import { RequestOptionsArgs, Response } from '@angular/http'; 4 | import { Observable } from 'rxjs/Observable'; 5 | import { LoginService } from '../../shared/login/login.service'; 6 | 7 | export class AuthExpiredInterceptor extends JhiHttpInterceptor { 8 | 9 | constructor(private injector: Injector) { 10 | super(); 11 | } 12 | 13 | requestIntercept(options?: RequestOptionsArgs): RequestOptionsArgs { 14 | return options; 15 | } 16 | 17 | responseIntercept(observable: Observable): Observable { 18 | return > observable.catch((error, source) => { 19 | if (error.status === 401) { 20 | const loginService: LoginService = this.injector.get(LoginService); 21 | loginService.logout(); 22 | } 23 | return Observable.throw(error); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/auth.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from 'rxjs/Observable'; 2 | import { RequestOptionsArgs, Response } from '@angular/http'; 3 | import { LocalStorageService, SessionStorageService } from 'ngx-webstorage'; 4 | import { JhiHttpInterceptor } from 'ng-jhipster'; 5 | import { SERVER_API_URL } from '../../app.constants'; 6 | 7 | export class AuthInterceptor extends JhiHttpInterceptor { 8 | 9 | constructor( 10 | private localStorage: LocalStorageService, 11 | private sessionStorage: SessionStorageService 12 | ) { 13 | super(); 14 | } 15 | 16 | requestIntercept(options?: RequestOptionsArgs): RequestOptionsArgs { 17 | if (!options || !options.url || (/^http/.test(options.url) && !(SERVER_API_URL && options.url.startsWith(SERVER_API_URL)))) { 18 | return options; 19 | } 20 | 21 | const token = this.localStorage.retrieve('authenticationToken') || this.sessionStorage.retrieve('authenticationToken'); 22 | if (!!token) { 23 | options.headers.append('Authorization', 'Bearer ' + token); 24 | } 25 | return options; 26 | } 27 | 28 | responseIntercept(observable: Observable): Observable { 29 | return observable; // by pass 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/errorhandler.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { JhiHttpInterceptor, JhiEventManager } from 'ng-jhipster'; 2 | import { RequestOptionsArgs, Response } from '@angular/http'; 3 | import { Observable } from 'rxjs/Observable'; 4 | 5 | export class ErrorHandlerInterceptor extends JhiHttpInterceptor { 6 | 7 | constructor(private eventManager: JhiEventManager) { 8 | super(); 9 | } 10 | 11 | requestIntercept(options?: RequestOptionsArgs): RequestOptionsArgs { 12 | return options; 13 | } 14 | 15 | responseIntercept(observable: Observable): Observable { 16 | return > observable.catch((error) => { 17 | if (!(error.status === 401 && (error.text() === '' || 18 | (error.json().path && error.json().path.indexOf('/api/account') === 0 )))) { 19 | if (this.eventManager !== undefined) { 20 | this.eventManager.broadcast( {name: 'jhipsterJwtSampleApplicationApp.httpError', content: error}); 21 | } 22 | } 23 | return Observable.throw(error); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/http.provider.ts: -------------------------------------------------------------------------------- 1 | import { JhiEventManager, JhiInterceptableHttp } from 'ng-jhipster'; 2 | import { Injector } from '@angular/core'; 3 | import { Http, XHRBackend, RequestOptions } from '@angular/http'; 4 | 5 | import { AuthInterceptor } from './auth.interceptor'; 6 | import { LocalStorageService, SessionStorageService } from 'ngx-webstorage'; 7 | import { AuthExpiredInterceptor } from './auth-expired.interceptor'; 8 | import { ErrorHandlerInterceptor } from './errorhandler.interceptor'; 9 | import { NotificationInterceptor } from './notification.interceptor'; 10 | 11 | export function interceptableFactory( 12 | backend: XHRBackend, 13 | defaultOptions: RequestOptions, 14 | localStorage: LocalStorageService, 15 | sessionStorage: SessionStorageService, 16 | injector: Injector, 17 | eventManager: JhiEventManager 18 | ) { 19 | return new JhiInterceptableHttp( 20 | backend, 21 | defaultOptions, 22 | [ 23 | new AuthInterceptor(localStorage, sessionStorage), 24 | new AuthExpiredInterceptor(injector), 25 | // Other interceptors can be added here 26 | new ErrorHandlerInterceptor(eventManager), 27 | new NotificationInterceptor(injector) 28 | ] 29 | ); 30 | } 31 | 32 | export function customHttpProvider() { 33 | return { 34 | provide: Http, 35 | useFactory: interceptableFactory, 36 | deps: [ 37 | XHRBackend, 38 | RequestOptions, 39 | LocalStorageService, 40 | SessionStorageService, 41 | Injector, 42 | JhiEventManager 43 | ] 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /src/main/webapp/app/blocks/interceptor/notification.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { JhiAlertService, JhiHttpInterceptor } from 'ng-jhipster'; 2 | import { RequestOptionsArgs, Response } from '@angular/http'; 3 | import { Injector } from '@angular/core'; 4 | import { Observable } from 'rxjs/Observable'; 5 | 6 | export class NotificationInterceptor extends JhiHttpInterceptor { 7 | 8 | private alertService: JhiAlertService; 9 | 10 | // tslint:disable-next-line: no-unused-variable 11 | constructor(private injector: Injector) { 12 | super(); 13 | setTimeout(() => this.alertService = injector.get(JhiAlertService)); 14 | } 15 | 16 | requestIntercept(options?: RequestOptionsArgs): RequestOptionsArgs { 17 | return options; 18 | } 19 | 20 | responseIntercept(observable: Observable): Observable { 21 | return observable.map((response: Response) => { 22 | const headers = []; 23 | response.headers.forEach((value, name) => { 24 | if (name.toLowerCase().endsWith('app-alert') || name.toLowerCase().endsWith('app-params')) { 25 | headers.push(name); 26 | } 27 | }); 28 | if (headers.length > 1) { 29 | headers.sort(); 30 | const alertKey = response.headers.get(headers[ 0 ]); 31 | if (typeof alertKey === 'string') { 32 | if (this.alertService) { 33 | const alertParam = headers.length >= 2 ? response.headers.get(headers[ 1 ]) : null; 34 | this.alertService.success(alertKey, { param : alertParam }, null); 35 | } 36 | } 37 | } 38 | return response; 39 | }).catch((error) => { 40 | return Observable.throw(error); // here, response is an error 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/webapp/app/entities/entity.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | 3 | /* jhipster-needle-add-entity-module-import - JHipster will add entity modules imports here */ 4 | 5 | @NgModule({ 6 | imports: [ 7 | /* jhipster-needle-add-entity-module - JHipster will add entity modules here */ 8 | ], 9 | declarations: [], 10 | entryComponents: [], 11 | providers: [], 12 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 13 | }) 14 | export class JhipsterJwtSampleApplicationEntityModule {} 15 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; 3 | import { JhiEventManager } from 'ng-jhipster'; 4 | 5 | import { Account, LoginModalService, Principal } from '../shared'; 6 | 7 | @Component({ 8 | selector: 'jhi-home', 9 | templateUrl: './home.component.html', 10 | styleUrls: [ 11 | 'home.css' 12 | ] 13 | 14 | }) 15 | export class HomeComponent implements OnInit { 16 | account: Account; 17 | modalRef: NgbModalRef; 18 | 19 | constructor( 20 | private principal: Principal, 21 | private loginModalService: LoginModalService, 22 | private eventManager: JhiEventManager 23 | ) { 24 | } 25 | 26 | ngOnInit() { 27 | this.principal.identity().then((account) => { 28 | this.account = account; 29 | }); 30 | this.registerAuthenticationSuccess(); 31 | } 32 | 33 | registerAuthenticationSuccess() { 34 | this.eventManager.subscribe('authenticationSuccess', (message) => { 35 | this.principal.identity().then((account) => { 36 | this.account = account; 37 | }); 38 | }); 39 | } 40 | 41 | isAuthenticated() { 42 | return this.principal.isAuthenticated(); 43 | } 44 | 45 | login() { 46 | this.modalRef = this.loginModalService.open(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/home.css: -------------------------------------------------------------------------------- 1 | /* ========================================================================== 2 | Main page styles 3 | ========================================================================== */ 4 | 5 | .hipster { 6 | display: inline-block; 7 | width: 347px; 8 | height: 497px; 9 | background: url("../../content/images/hipster.png") no-repeat center top; 10 | background-size: contain; 11 | } 12 | 13 | /* wait autoprefixer update to allow simple generation of high pixel density media query */ 14 | @media 15 | only screen and (-webkit-min-device-pixel-ratio: 2), 16 | only screen and ( min--moz-device-pixel-ratio: 2), 17 | only screen and ( -o-min-device-pixel-ratio: 2/1), 18 | only screen and ( min-device-pixel-ratio: 2), 19 | only screen and ( min-resolution: 192dpi), 20 | only screen and ( min-resolution: 2dppx) { 21 | .hipster { 22 | background: url("../../content/images/hipster2x.png") no-repeat center top; 23 | background-size: contain; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | import { JhipsterJwtSampleApplicationSharedModule } from '../shared'; 5 | 6 | import { HOME_ROUTE, HomeComponent } from './'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | JhipsterJwtSampleApplicationSharedModule, 11 | RouterModule.forChild([ HOME_ROUTE ]) 12 | ], 13 | declarations: [ 14 | HomeComponent, 15 | ], 16 | entryComponents: [ 17 | ], 18 | providers: [ 19 | ], 20 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 21 | }) 22 | export class JhipsterJwtSampleApplicationHomeModule {} 23 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/home.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { HomeComponent } from './'; 4 | 5 | export const HOME_ROUTE: Route = { 6 | path: '', 7 | component: HomeComponent, 8 | data: { 9 | authorities: [], 10 | pageTitle: 'home.title' 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/home/index.ts: -------------------------------------------------------------------------------- 1 | export * from './home.component'; 2 | export * from './home.route'; 3 | export * from './home.module'; 4 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/error/error.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 |
7 |

Error Page!

8 | 9 |
10 |
{{errorMessage}} 11 |
12 |
13 |
You are not authorized to access this page. 14 |
15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/error/error.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'jhi-error', 6 | templateUrl: './error.component.html' 7 | }) 8 | export class ErrorComponent implements OnInit { 9 | errorMessage: string; 10 | error403: boolean; 11 | 12 | constructor( 13 | private route: ActivatedRoute 14 | ) { 15 | } 16 | 17 | ngOnInit() { 18 | this.route.data.subscribe((routeData) => { 19 | if (routeData.error403) { 20 | this.error403 = routeData.error403; 21 | } 22 | if (routeData.errorMessage) { 23 | this.errorMessage = routeData.errorMessage; 24 | } 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/error/error.route.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { ErrorComponent } from './error.component'; 4 | 5 | export const errorRoute: Routes = [ 6 | { 7 | path: 'error', 8 | component: ErrorComponent, 9 | data: { 10 | authorities: [], 11 | pageTitle: 'error.title' 12 | }, 13 | }, 14 | { 15 | path: 'accessdenied', 16 | component: ErrorComponent, 17 | data: { 18 | authorities: [], 19 | pageTitle: 'error.title', 20 | error403: true 21 | }, 22 | } 23 | ]; 24 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/footer/footer.component.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/footer/footer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'jhi-footer', 5 | templateUrl: './footer.component.html' 6 | }) 7 | export class FooterComponent {} 8 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/index.ts: -------------------------------------------------------------------------------- 1 | export * from './error/error.component'; 2 | export * from './error/error.route'; 3 | export * from './main/main.component'; 4 | export * from './footer/footer.component'; 5 | export * from './navbar/navbar.component'; 6 | export * from './navbar/navbar.route'; 7 | export * from './navbar/active-menu.directive'; 8 | export * from './profiles/page-ribbon.component'; 9 | export * from './profiles/profile.service'; 10 | export * from './profiles/profile-info.model'; 11 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/main/main.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |
6 |
7 | 8 | 9 |
10 | 11 |
12 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/main/main.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router, ActivatedRouteSnapshot, NavigationEnd } from '@angular/router'; 3 | 4 | import { JhiLanguageHelper } from '../../shared'; 5 | 6 | @Component({ 7 | selector: 'jhi-main', 8 | templateUrl: './main.component.html' 9 | }) 10 | export class JhiMainComponent implements OnInit { 11 | 12 | constructor( 13 | private jhiLanguageHelper: JhiLanguageHelper, 14 | private router: Router 15 | ) {} 16 | 17 | private getPageTitle(routeSnapshot: ActivatedRouteSnapshot) { 18 | let title: string = (routeSnapshot.data && routeSnapshot.data['pageTitle']) ? routeSnapshot.data['pageTitle'] : 'jhipsterJwtSampleApplicationApp'; 19 | if (routeSnapshot.firstChild) { 20 | title = this.getPageTitle(routeSnapshot.firstChild) || title; 21 | } 22 | return title; 23 | } 24 | 25 | ngOnInit() { 26 | this.router.events.subscribe((event) => { 27 | if (event instanceof NavigationEnd) { 28 | this.jhiLanguageHelper.updateTitle(this.getPageTitle(this.router.routerState.snapshot.root)); 29 | } 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/navbar/active-menu.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, OnInit, ElementRef, Renderer, Input} from '@angular/core'; 2 | import { TranslateService, LangChangeEvent } from '@ngx-translate/core'; 3 | 4 | @Directive({ 5 | selector: '[jhiActiveMenu]' 6 | }) 7 | export class ActiveMenuDirective implements OnInit { 8 | @Input() jhiActiveMenu: string; 9 | 10 | constructor(private el: ElementRef, private renderer: Renderer, private translateService: TranslateService) {} 11 | 12 | ngOnInit() { 13 | this.translateService.onLangChange.subscribe((event: LangChangeEvent) => { 14 | this.updateActiveFlag(event.lang); 15 | }); 16 | this.updateActiveFlag(this.translateService.currentLang); 17 | } 18 | 19 | updateActiveFlag(selectedLanguage) { 20 | if (this.jhiActiveMenu === selectedLanguage) { 21 | this.renderer.setElementClass(this.el.nativeElement, 'active', true); 22 | } else { 23 | this.renderer.setElementClass(this.el.nativeElement, 'active', false); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/navbar/navbar.css: -------------------------------------------------------------------------------- 1 | /* ========================================================================== 2 | Navbar 3 | ========================================================================== */ 4 | .navbar-version { 5 | font-size: 10px; 6 | color: #ccc 7 | } 8 | 9 | .jh-navbar { 10 | background-color: #353d47; 11 | padding: .2em 1em; 12 | } 13 | 14 | .jh-navbar .profile-image { 15 | margin: -10px 0px; 16 | height: 40px; 17 | width: 40px; 18 | border-radius: 50%; 19 | } 20 | 21 | .jh-navbar .dropdown-item.active, .jh-navbar .dropdown-item.active:focus, .jh-navbar .dropdown-item.active:hover { 22 | background-color: #353d47; 23 | } 24 | 25 | .jh-navbar .dropdown-toggle::after { 26 | margin-left: 0.15em; 27 | } 28 | 29 | .jh-navbar ul.navbar-nav { 30 | padding: 0.5em; 31 | } 32 | 33 | .jh-navbar .navbar-nav .nav-item { 34 | margin-left: 1.5rem; 35 | } 36 | 37 | .jh-navbar a.nav-link { 38 | font-weight: 400; 39 | } 40 | 41 | .jh-navbar .jh-navbar-toggler { 42 | color: #ccc; 43 | font-size: 1.5em; 44 | padding: 10px; 45 | } 46 | 47 | .jh-navbar .jh-navbar-toggler:hover { 48 | color: #fff; 49 | } 50 | 51 | @media screen and (min-width: 768px) { 52 | .jh-navbar-toggler { 53 | display: none; 54 | } 55 | } 56 | 57 | @media screen and (max-width: 992px) { 58 | .jh-logo-container { 59 | width: 100%; 60 | } 61 | } 62 | 63 | .navbar-title { 64 | display: inline-block; 65 | vertical-align: middle; 66 | } 67 | 68 | /* ========================================================================== 69 | Logo styles 70 | ========================================================================== */ 71 | .navbar-brand.logo { 72 | padding: 5px 15px; 73 | } 74 | 75 | .logo .logo-img { 76 | height: 45px; 77 | display: inline-block; 78 | vertical-align: middle; 79 | width: 70px; 80 | } 81 | 82 | .logo-img { 83 | height: 100%; 84 | background: url("../../../content/images/logo-jhipster.png") no-repeat center center; 85 | background-size: contain; 86 | width: 100%; 87 | } 88 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/navbar/navbar.route.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | 3 | import { NavbarComponent } from './navbar.component'; 4 | 5 | export const navbarRoute: Route = { 6 | path: '', 7 | component: NavbarComponent, 8 | outlet: 'navbar' 9 | }; 10 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/profiles/page-ribbon.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ProfileService } from './profile.service'; 3 | import { ProfileInfo } from './profile-info.model'; 4 | 5 | @Component({ 6 | selector: 'jhi-page-ribbon', 7 | template: ``, 8 | styleUrls: [ 9 | 'page-ribbon.css' 10 | ] 11 | }) 12 | export class PageRibbonComponent implements OnInit { 13 | 14 | profileInfo: ProfileInfo; 15 | ribbonEnv: string; 16 | 17 | constructor(private profileService: ProfileService) {} 18 | 19 | ngOnInit() { 20 | this.profileService.getProfileInfo().then((profileInfo) => { 21 | this.profileInfo = profileInfo; 22 | this.ribbonEnv = profileInfo.ribbonEnv; 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/profiles/page-ribbon.css: -------------------------------------------------------------------------------- 1 | /* ========================================================================== 2 | Developement Ribbon 3 | ========================================================================== */ 4 | .ribbon { 5 | background-color: rgba(170, 0, 0, 0.5); 6 | left: -3.5em; 7 | moz-transform: rotate(-45deg); 8 | ms-transform: rotate(-45deg); 9 | o-transform: rotate(-45deg); 10 | webkit-transform: rotate(-45deg); 11 | transform: rotate(-45deg); 12 | overflow: hidden; 13 | position: absolute; 14 | top: 40px; 15 | white-space: nowrap; 16 | width: 15em; 17 | z-index: 9999; 18 | pointer-events: none; 19 | opacity: 0.75; 20 | } 21 | 22 | .ribbon a { 23 | color: #fff; 24 | display: block; 25 | font-weight: 400; 26 | margin: 1px 0; 27 | padding: 10px 50px; 28 | text-align: center; 29 | text-decoration: none; 30 | text-shadow: 0 0 5px #444; 31 | pointer-events: none; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/profiles/profile-info.model.ts: -------------------------------------------------------------------------------- 1 | export class ProfileInfo { 2 | activeProfiles: string[]; 3 | ribbonEnv: string; 4 | inProduction: boolean; 5 | swaggerEnabled: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/webapp/app/layouts/profiles/profile.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http, Response } from '@angular/http'; 3 | 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | import { ProfileInfo } from './profile-info.model'; 6 | 7 | @Injectable() 8 | export class ProfileService { 9 | 10 | private profileInfoUrl = SERVER_API_URL + 'api/profile-info'; 11 | private profileInfo: Promise; 12 | 13 | constructor(private http: Http) { } 14 | 15 | getProfileInfo(): Promise { 16 | if (!this.profileInfo) { 17 | this.profileInfo = this.http.get(this.profileInfoUrl) 18 | .map((res: Response) => { 19 | const data = res.json(); 20 | const pi = new ProfileInfo(); 21 | pi.activeProfiles = data.activeProfiles; 22 | pi.ribbonEnv = data.ribbonEnv; 23 | pi.inProduction = data.activeProfiles.includes('prod'); 24 | pi.swaggerEnabled = data.activeProfiles.includes('swagger'); 25 | return pi; 26 | }).toPromise(); 27 | } 28 | return this.profileInfo; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/alert/alert.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnDestroy, OnInit } from '@angular/core'; 2 | import { JhiAlertService } from 'ng-jhipster'; 3 | 4 | @Component({ 5 | selector: 'jhi-alert', 6 | template: ` 7 | ` 14 | }) 15 | export class JhiAlertComponent implements OnInit, OnDestroy { 16 | alerts: any[]; 17 | 18 | constructor(private alertService: JhiAlertService) { } 19 | 20 | ngOnInit() { 21 | this.alerts = this.alertService.get(); 22 | } 23 | 24 | ngOnDestroy() { 25 | this.alerts = []; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/auth/account.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http, Response } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | import { SERVER_API_URL } from '../../app.constants'; 5 | 6 | @Injectable() 7 | export class AccountService { 8 | constructor(private http: Http) { } 9 | 10 | get(): Observable { 11 | return this.http.get(SERVER_API_URL + 'api/account').map((res: Response) => res.json()); 12 | } 13 | 14 | save(account: any): Observable { 15 | return this.http.post(SERVER_API_URL + 'api/account', account); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/auth/csrf.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CookieService } from 'ngx-cookie'; 3 | 4 | @Injectable() 5 | export class CSRFService { 6 | 7 | constructor(private cookieService: CookieService) {} 8 | 9 | getCSRF(name?: string) { 10 | name = `${name ? name : 'XSRF-TOKEN'}`; 11 | return this.cookieService.get(name); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/auth/has-any-authority.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; 2 | import { Principal } from './principal.service'; 3 | 4 | /** 5 | * @whatItDoes Conditionally includes an HTML element if current user has any 6 | * of the authorities passed as the `expression`. 7 | * 8 | * @howToUse 9 | * ``` 10 | * ... 11 | * 12 | * ... 13 | * ``` 14 | */ 15 | @Directive({ 16 | selector: '[jhiHasAnyAuthority]' 17 | }) 18 | export class HasAnyAuthorityDirective { 19 | 20 | private authorities: string[]; 21 | 22 | constructor(private principal: Principal, private templateRef: TemplateRef, private viewContainerRef: ViewContainerRef) { 23 | } 24 | 25 | @Input() 26 | set jhiHasAnyAuthority(value: string|string[]) { 27 | this.authorities = typeof value === 'string' ? [ value ] : value; 28 | this.updateView(); 29 | // Get notified each time authentication state changes. 30 | this.principal.getAuthenticationState().subscribe((identity) => this.updateView()); 31 | } 32 | 33 | private updateView(): void { 34 | this.principal.hasAnyAuthority(this.authorities).then((result) => { 35 | this.viewContainerRef.clear(); 36 | if (result) { 37 | this.viewContainerRef.createEmbeddedView(this.templateRef); 38 | } 39 | }); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/auth/state-storage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { SessionStorageService } from 'ngx-webstorage'; 3 | 4 | @Injectable() 5 | export class StateStorageService { 6 | constructor( 7 | private $sessionStorage: SessionStorageService 8 | ) {} 9 | 10 | getPreviousState() { 11 | return this.$sessionStorage.retrieve('previousState'); 12 | } 13 | 14 | resetPreviousState() { 15 | this.$sessionStorage.clear('previousState'); 16 | } 17 | 18 | storePreviousState(previousStateName, previousStateParams) { 19 | const previousState = { 'name': previousStateName, 'params': previousStateParams }; 20 | this.$sessionStorage.store('previousState', previousState); 21 | } 22 | 23 | getDestinationState() { 24 | return this.$sessionStorage.retrieve('destinationState'); 25 | } 26 | 27 | storeUrl(url: string) { 28 | this.$sessionStorage.store('previousUrl', url); 29 | } 30 | 31 | getUrl() { 32 | return this.$sessionStorage.retrieve('previousUrl'); 33 | } 34 | 35 | storeDestinationState(destinationState, destinationStateParams, fromState) { 36 | const destinationInfo = { 37 | 'destination': { 38 | 'name': destinationState.name, 39 | 'data': destinationState.data, 40 | }, 41 | 'params': destinationStateParams, 42 | 'from': { 43 | 'name': fromState.name, 44 | } 45 | }; 46 | this.$sessionStorage.store('destinationState', destinationInfo); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/constants/error.constants.ts: -------------------------------------------------------------------------------- 1 | export const PROBLEM_BASE_URL = 'http://www.jhipster.tech/problem'; 2 | export const EMAIL_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/email-already-used'; 3 | export const LOGIN_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/login-already-used'; 4 | export const EMAIL_NOT_FOUND_TYPE = PROBLEM_BASE_URL + '/email-not-found'; 5 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/constants/pagination.constants.ts: -------------------------------------------------------------------------------- 1 | export const ITEMS_PER_PAGE = 20; 2 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/index.ts: -------------------------------------------------------------------------------- 1 | export * from './constants/error.constants'; 2 | export * from './constants/pagination.constants'; 3 | export * from './alert/alert.component'; 4 | export * from './alert/alert-error.component'; 5 | export * from './auth/csrf.service'; 6 | export * from './auth/state-storage.service'; 7 | export * from './auth/account.service'; 8 | export * from './auth/auth-jwt.service'; 9 | export * from './auth/principal.service'; 10 | export * from './auth/has-any-authority.directive'; 11 | export * from './auth/user-route-access-service'; 12 | export * from './language/language.constants'; 13 | export * from './language/language.helper'; 14 | export * from './language/find-language-from-key.pipe'; 15 | export * from './login/login.component'; 16 | export * from './login/login-modal.service'; 17 | export * from './login/login.service'; 18 | export * from './user/account.model'; 19 | export * from './user/user.model'; 20 | export * from './user/user.service'; 21 | export * from './model/response-wrapper.model'; 22 | export * from './model/request-util'; 23 | export * from './model/base-entity'; 24 | export * from './shared-libs.module'; 25 | export * from './shared-common.module'; 26 | export * from './shared.module'; 27 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/language/find-language-from-key.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({name: 'findLanguageFromKey'}) 4 | export class FindLanguageFromKeyPipe implements PipeTransform { 5 | private languages: any = { 6 | 'en': { name: 'English' } 7 | // jhipster-needle-i18n-language-key-pipe - JHipster will add/remove languages in this object 8 | }; 9 | transform(lang: string): string { 10 | return this.languages[lang].name; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/language/language.constants.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Languages codes are ISO_639-1 codes, see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes 3 | They are written in English to avoid character encoding issues (not a perfect solution) 4 | */ 5 | export const LANGUAGES: string[] = [ 6 | 'en' 7 | // jhipster-needle-i18n-language-constant - JHipster will add/remove languages in this array 8 | ]; 9 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/language/language.helper.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, RendererFactory2, Renderer2 } from '@angular/core'; 2 | import { Title } from '@angular/platform-browser'; 3 | import { Router, ActivatedRouteSnapshot } from '@angular/router'; 4 | import { TranslateService, LangChangeEvent } from '@ngx-translate/core'; 5 | 6 | import { LANGUAGES } from './language.constants'; 7 | 8 | @Injectable() 9 | export class JhiLanguageHelper { 10 | renderer: Renderer2 = null; 11 | 12 | constructor( 13 | private translateService: TranslateService, 14 | // tslint:disable-next-line: no-unused-variable 15 | private rootRenderer: RendererFactory2, 16 | private titleService: Title, 17 | private router: Router 18 | ) { 19 | this.renderer = rootRenderer.createRenderer(document.querySelector('html'), null); 20 | this.init(); 21 | } 22 | 23 | getAll(): Promise { 24 | return Promise.resolve(LANGUAGES); 25 | } 26 | 27 | /** 28 | * Update the window title using params in the following 29 | * order: 30 | * 1. titleKey parameter 31 | * 2. $state.$current.data.pageTitle (current state page title) 32 | * 3. 'global.title' 33 | */ 34 | updateTitle(titleKey?: string) { 35 | if (!titleKey) { 36 | titleKey = this.getPageTitle(this.router.routerState.snapshot.root); 37 | } 38 | 39 | this.translateService.get(titleKey).subscribe((title) => { 40 | this.titleService.setTitle(title); 41 | }); 42 | } 43 | 44 | private init() { 45 | this.translateService.onLangChange.subscribe((event: LangChangeEvent) => { 46 | this.renderer.setAttribute(document.querySelector('html'), 'lang', this.translateService.currentLang); 47 | this.updateTitle(); 48 | }); 49 | } 50 | 51 | private getPageTitle(routeSnapshot: ActivatedRouteSnapshot) { 52 | let title: string = (routeSnapshot.data && routeSnapshot.data['pageTitle']) ? routeSnapshot.data['pageTitle'] : 'jhipsterJwtSampleApplicationApp'; 53 | if (routeSnapshot.firstChild) { 54 | title = this.getPageTitle(routeSnapshot.firstChild) || title; 55 | } 56 | return title; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/login/login-modal.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; 3 | 4 | import { JhiLoginModalComponent } from './login.component'; 5 | 6 | @Injectable() 7 | export class LoginModalService { 8 | private isOpen = false; 9 | constructor( 10 | private modalService: NgbModal, 11 | ) {} 12 | 13 | open(): NgbModalRef { 14 | if (this.isOpen) { 15 | return; 16 | } 17 | this.isOpen = true; 18 | const modalRef = this.modalService.open(JhiLoginModalComponent, { 19 | container: 'nav' 20 | }); 21 | modalRef.result.then((result) => { 22 | this.isOpen = false; 23 | }, (reason) => { 24 | this.isOpen = false; 25 | }); 26 | return modalRef; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/login/login.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { JhiLanguageService } from 'ng-jhipster'; 3 | 4 | import { Principal } from '../auth/principal.service'; 5 | import { AuthServerProvider } from '../auth/auth-jwt.service'; 6 | 7 | @Injectable() 8 | export class LoginService { 9 | 10 | constructor( 11 | private languageService: JhiLanguageService, 12 | private principal: Principal, 13 | private authServerProvider: AuthServerProvider 14 | ) {} 15 | 16 | login(credentials, callback?) { 17 | const cb = callback || function() {}; 18 | 19 | return new Promise((resolve, reject) => { 20 | this.authServerProvider.login(credentials).subscribe((data) => { 21 | this.principal.identity(true).then((account) => { 22 | // After the login the language will be changed to 23 | // the language selected by the user during his registration 24 | if (account !== null) { 25 | this.languageService.changeLanguage(account.langKey); 26 | } 27 | resolve(data); 28 | }); 29 | return cb(); 30 | }, (err) => { 31 | this.logout(); 32 | reject(err); 33 | return cb(err); 34 | }); 35 | }); 36 | } 37 | 38 | loginWithToken(jwt, rememberMe) { 39 | return this.authServerProvider.loginWithToken(jwt, rememberMe); 40 | } 41 | 42 | logout() { 43 | this.authServerProvider.logout().subscribe(); 44 | this.principal.authenticate(null); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/model/base-entity.ts: -------------------------------------------------------------------------------- 1 | export interface BaseEntity { 2 | // using type any to avoid methods complaining of invalid type 3 | id?: any; 4 | }; 5 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/model/request-util.ts: -------------------------------------------------------------------------------- 1 | import { URLSearchParams, BaseRequestOptions } from '@angular/http'; 2 | 3 | export const createRequestOption = (req?: any): BaseRequestOptions => { 4 | const options: BaseRequestOptions = new BaseRequestOptions(); 5 | if (req) { 6 | const params: URLSearchParams = new URLSearchParams(); 7 | params.set('page', req.page); 8 | params.set('size', req.size); 9 | if (req.sort) { 10 | params.paramsMap.set('sort', req.sort); 11 | } 12 | params.set('query', req.query); 13 | params.set('filter', req.filter); 14 | 15 | options.params = params; 16 | } 17 | return options; 18 | }; 19 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/model/response-wrapper.model.ts: -------------------------------------------------------------------------------- 1 | import { Headers } from '@angular/http'; 2 | 3 | export class ResponseWrapper { 4 | constructor( 5 | public headers: Headers, 6 | public json: any, 7 | public status: number 8 | ) { } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/shared-common.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, LOCALE_ID } from '@angular/core'; 2 | import { Title } from '@angular/platform-browser'; 3 | 4 | import { 5 | JhipsterJwtSampleApplicationSharedLibsModule, 6 | JhiLanguageHelper, 7 | FindLanguageFromKeyPipe, 8 | JhiAlertComponent, 9 | JhiAlertErrorComponent 10 | } from './'; 11 | 12 | @NgModule({ 13 | imports: [ 14 | JhipsterJwtSampleApplicationSharedLibsModule 15 | ], 16 | declarations: [ 17 | FindLanguageFromKeyPipe, 18 | JhiAlertComponent, 19 | JhiAlertErrorComponent 20 | ], 21 | providers: [ 22 | JhiLanguageHelper, 23 | Title, 24 | { 25 | provide: LOCALE_ID, 26 | useValue: 'en' 27 | }, 28 | ], 29 | exports: [ 30 | JhipsterJwtSampleApplicationSharedLibsModule, 31 | FindLanguageFromKeyPipe, 32 | JhiAlertComponent, 33 | JhiAlertErrorComponent 34 | ] 35 | }) 36 | export class JhipsterJwtSampleApplicationSharedCommonModule {} 37 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/shared-libs.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { CommonModule } from '@angular/common'; 4 | import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; 5 | import { NgJhipsterModule } from 'ng-jhipster'; 6 | import { InfiniteScrollModule } from 'ngx-infinite-scroll'; 7 | import { CookieModule } from 'ngx-cookie'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | NgbModule.forRoot(), 12 | NgJhipsterModule.forRoot({ 13 | // set below to true to make alerts look like toast 14 | alertAsToast: false, 15 | i18nEnabled: true, 16 | defaultI18nLang: 'en' 17 | }), 18 | InfiniteScrollModule, 19 | CookieModule.forRoot() 20 | ], 21 | exports: [ 22 | FormsModule, 23 | CommonModule, 24 | NgbModule, 25 | NgJhipsterModule, 26 | InfiniteScrollModule 27 | ] 28 | }) 29 | export class JhipsterJwtSampleApplicationSharedLibsModule {} 30 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/shared.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { DatePipe } from '@angular/common'; 3 | 4 | import { 5 | JhipsterJwtSampleApplicationSharedLibsModule, 6 | JhipsterJwtSampleApplicationSharedCommonModule, 7 | CSRFService, 8 | AuthServerProvider, 9 | AccountService, 10 | UserService, 11 | StateStorageService, 12 | LoginService, 13 | LoginModalService, 14 | JhiLoginModalComponent, 15 | Principal, 16 | HasAnyAuthorityDirective, 17 | } from './'; 18 | 19 | @NgModule({ 20 | imports: [ 21 | JhipsterJwtSampleApplicationSharedLibsModule, 22 | JhipsterJwtSampleApplicationSharedCommonModule 23 | ], 24 | declarations: [ 25 | JhiLoginModalComponent, 26 | HasAnyAuthorityDirective 27 | ], 28 | providers: [ 29 | LoginService, 30 | LoginModalService, 31 | AccountService, 32 | StateStorageService, 33 | Principal, 34 | CSRFService, 35 | AuthServerProvider, 36 | UserService, 37 | DatePipe 38 | ], 39 | entryComponents: [JhiLoginModalComponent], 40 | exports: [ 41 | JhipsterJwtSampleApplicationSharedCommonModule, 42 | JhiLoginModalComponent, 43 | HasAnyAuthorityDirective, 44 | DatePipe 45 | ], 46 | schemas: [CUSTOM_ELEMENTS_SCHEMA] 47 | 48 | }) 49 | export class JhipsterJwtSampleApplicationSharedModule {} 50 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/user/account.model.ts: -------------------------------------------------------------------------------- 1 | export class Account { 2 | constructor( 3 | public activated: boolean, 4 | public authorities: string[], 5 | public email: string, 6 | public firstName: string, 7 | public langKey: string, 8 | public lastName: string, 9 | public login: string, 10 | public imageUrl: string 11 | ) { } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/user/user.model.ts: -------------------------------------------------------------------------------- 1 | export class User { 2 | public id?: any; 3 | public login?: string; 4 | public firstName?: string; 5 | public lastName?: string; 6 | public email?: string; 7 | public activated?: Boolean; 8 | public langKey?: string; 9 | public authorities?: any[]; 10 | public createdBy?: string; 11 | public createdDate?: Date; 12 | public lastModifiedBy?: string; 13 | public lastModifiedDate?: Date; 14 | public password?: string; 15 | 16 | constructor( 17 | id?: any, 18 | login?: string, 19 | firstName?: string, 20 | lastName?: string, 21 | email?: string, 22 | activated?: Boolean, 23 | langKey?: string, 24 | authorities?: any[], 25 | createdBy?: string, 26 | createdDate?: Date, 27 | lastModifiedBy?: string, 28 | lastModifiedDate?: Date, 29 | password?: string 30 | ) { 31 | this.id = id ? id : null; 32 | this.login = login ? login : null; 33 | this.firstName = firstName ? firstName : null; 34 | this.lastName = lastName ? lastName : null; 35 | this.email = email ? email : null; 36 | this.activated = activated ? activated : false; 37 | this.langKey = langKey ? langKey : null; 38 | this.authorities = authorities ? authorities : null; 39 | this.createdBy = createdBy ? createdBy : null; 40 | this.createdDate = createdDate ? createdDate : null; 41 | this.lastModifiedBy = lastModifiedBy ? lastModifiedBy : null; 42 | this.lastModifiedDate = lastModifiedDate ? lastModifiedDate : null; 43 | this.password = password ? password : null; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/webapp/app/shared/user/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http, Response } from '@angular/http'; 3 | import { Observable } from 'rxjs/Rx'; 4 | 5 | import { SERVER_API_URL } from '../../app.constants'; 6 | import { User } from './user.model'; 7 | import { ResponseWrapper } from '../model/response-wrapper.model'; 8 | import { createRequestOption } from '../model/request-util'; 9 | 10 | @Injectable() 11 | export class UserService { 12 | private resourceUrl = SERVER_API_URL + 'api/users'; 13 | 14 | constructor(private http: Http) { } 15 | 16 | create(user: User): Observable { 17 | return this.http.post(this.resourceUrl, user) 18 | .map((res: Response) => this.convertResponse(res)); 19 | } 20 | 21 | update(user: User): Observable { 22 | return this.http.put(this.resourceUrl, user) 23 | .map((res: Response) => this.convertResponse(res)); 24 | } 25 | 26 | find(login: string): Observable { 27 | return this.http.get(`${this.resourceUrl}/${login}`).map((res: Response) => res.json()); 28 | } 29 | 30 | query(req?: any): Observable { 31 | const options = createRequestOption(req); 32 | return this.http.get(this.resourceUrl, options) 33 | .map((res: Response) => this.convertResponse(res)); 34 | } 35 | 36 | delete(login: string): Observable { 37 | return this.http.delete(`${this.resourceUrl}/${login}`); 38 | } 39 | 40 | authorities(): Observable { 41 | return this.http.get(SERVER_API_URL + 'api/users/authorities').map((res: Response) => { 42 | const json = res.json(); 43 | return json; 44 | }); 45 | } 46 | 47 | private convertResponse(res: Response): ResponseWrapper { 48 | const jsonResponse = res.json(); 49 | return new ResponseWrapper(res.headers, jsonResponse, res.status); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/webapp/app/vendor.ts: -------------------------------------------------------------------------------- 1 | /* after changing this file run 'yarn run webpack:build' */ 2 | /* tslint:disable */ 3 | import '../content/css/vendor.css'; 4 | // jhipster-needle-add-element-to-vendor - JHipster will add new menu items here 5 | -------------------------------------------------------------------------------- /src/main/webapp/content/css/documentation.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Your CSS files will be generated in this directory by "gulp sass" 3 | */ 4 | -------------------------------------------------------------------------------- /src/main/webapp/content/css/vendor.css: -------------------------------------------------------------------------------- 1 | /* after changing this file run 'yarn run webpack:build' */ 2 | @import '~bootstrap/dist/css/bootstrap.min.css'; 3 | @import '~font-awesome/css/font-awesome.css'; 4 | 5 | -------------------------------------------------------------------------------- /src/main/webapp/content/images/hipster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhipster/jhipster-sample-app-token/a13248b0ce65ac8f85ad00ba4b5a1f6e9a6fdd87/src/main/webapp/content/images/hipster.png -------------------------------------------------------------------------------- /src/main/webapp/content/images/hipster2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhipster/jhipster-sample-app-token/a13248b0ce65ac8f85ad00ba4b5a1f6e9a6fdd87/src/main/webapp/content/images/hipster2x.png -------------------------------------------------------------------------------- /src/main/webapp/content/images/logo-jhipster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhipster/jhipster-sample-app-token/a13248b0ce65ac8f85ad00ba4b5a1f6e9a6fdd87/src/main/webapp/content/images/logo-jhipster.png -------------------------------------------------------------------------------- /src/main/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhipster/jhipster-sample-app-token/a13248b0ce65ac8f85ad00ba4b5a1f6e9a6fdd87/src/main/webapp/favicon.ico -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/activate.json: -------------------------------------------------------------------------------- 1 | { 2 | "activate": { 3 | "title": "Activation", 4 | "messages": { 5 | "success": "Your user account has been activated. Please ", 6 | "error": "Your user could not be activated. Please use the registration form to sign up." 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/audits.json: -------------------------------------------------------------------------------- 1 | { 2 | "audits": { 3 | "title": "Audits", 4 | "filter": { 5 | "title": "Filter per date", 6 | "from": "from", 7 | "to": "to", 8 | "button": { 9 | "weeks": "Weeks", 10 | "today": "today", 11 | "clear": "clear", 12 | "close": "close" 13 | } 14 | }, 15 | "table": { 16 | "header": { 17 | "principal": "User", 18 | "date": "Date", 19 | "status": "State", 20 | "data": "Extra data" 21 | }, 22 | "data": { 23 | "remoteAddress": "Remote Address:" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "configuration": { 3 | "title": "Configuration", 4 | "filter": "Filter (by prefix)", 5 | "table": { 6 | "prefix": "Prefix", 7 | "properties": "Properties" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "error": { 3 | "title": "Error page!", 4 | "http": { 5 | "400": "Bad request.", 6 | "403": "You are not authorized to access this page.", 7 | "405": "The HTTP verb you used is not supported for this URL.", 8 | "500": "Internal server error." 9 | }, 10 | "concurrencyFailure": "Another user modified this data at the same time as you. Your changes were rejected.", 11 | "validation": "Validation error on the server." 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/gateway.json: -------------------------------------------------------------------------------- 1 | { 2 | "gateway": { 3 | "title": "Gateway", 4 | "routes": { 5 | "title": "Current routes", 6 | "url": "URL", 7 | "service": "service", 8 | "servers": "Available servers", 9 | "error": "Warning: no server available!" 10 | }, 11 | "refresh": { 12 | "button": "Refresh" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/health.json: -------------------------------------------------------------------------------- 1 | { 2 | "health": { 3 | "title": "Health Checks", 4 | "refresh.button": "Refresh", 5 | "stacktrace": "Stacktrace", 6 | "details": { 7 | "details": "Details", 8 | "properties": "Properties", 9 | "name": "Name", 10 | "value": "Value", 11 | "error": "Error" 12 | }, 13 | "indicator": { 14 | "diskSpace": "Disk space", 15 | "mail": "Email", 16 | "db": "Database" 17 | }, 18 | "table": { 19 | "service": "Service name", 20 | "status": "Status" 21 | }, 22 | "status": { 23 | "UP": "UP", 24 | "DOWN": "DOWN" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/home.json: -------------------------------------------------------------------------------- 1 | { 2 | "home": { 3 | "title": "Welcome, Java Hipster!", 4 | "subtitle": "This is your homepage", 5 | "logged": { 6 | "message": "You are logged in as user \"{{username}}\"." 7 | }, 8 | "question": "If you have any question on JHipster:", 9 | "link": { 10 | "homepage": "JHipster homepage", 11 | "stackoverflow": "JHipster on Stack Overflow", 12 | "bugtracker": "JHipster bug tracker", 13 | "chat": "JHipster public chat room", 14 | "follow": "follow @java_hipster on Twitter" 15 | }, 16 | "like": "If you like JHipster, don't forget to give us a star on", 17 | "github": "GitHub" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/login.json: -------------------------------------------------------------------------------- 1 | { 2 | "login": { 3 | "title": "Sign in", 4 | "form": { 5 | "password": "Password", 6 | "password.placeholder": "Your password", 7 | "rememberme": "Remember me", 8 | "button": "Sign in" 9 | }, 10 | "messages": { 11 | "error": { 12 | "authentication": "Failed to sign in! Please check your credentials and try again." 13 | } 14 | }, 15 | "password" : { 16 | "forgot": "Did you forget your password?" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/logs.json: -------------------------------------------------------------------------------- 1 | { 2 | "logs": { 3 | "title": "Logs", 4 | "nbloggers": "There are {{ total }} loggers.", 5 | "filter": "Filter", 6 | "table": { 7 | "name": "Name", 8 | "level": "Level" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/password.json: -------------------------------------------------------------------------------- 1 | { 2 | "password": { 3 | "title": "Password for [{{username}}]", 4 | "form": { 5 | "button": "Save" 6 | }, 7 | "messages": { 8 | "error": "An error has occurred! The password could not be changed.", 9 | "success": "Password changed!" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/register.json: -------------------------------------------------------------------------------- 1 | { 2 | "register": { 3 | "title": "Registration", 4 | "form": { 5 | "button": "Register" 6 | }, 7 | "messages": { 8 | "validate": { 9 | "login": { 10 | "required": "Your username is required.", 11 | "minlength": "Your username is required to be at least 1 character.", 12 | "maxlength": "Your username cannot be longer than 50 characters.", 13 | "pattern": "Your username can only contain lower-case letters and digits." 14 | } 15 | }, 16 | "success": "Registration saved! Please check your email for confirmation.", 17 | "error": { 18 | "fail": "Registration failed! Please try again later.", 19 | "userexists": "Login name already registered! Please choose another one.", 20 | "emailexists": "Email is already in use! Please choose another one." 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/reset.json: -------------------------------------------------------------------------------- 1 | { 2 | "reset": { 3 | "request": { 4 | "title": "Reset your password", 5 | "form": { 6 | "button": "Reset password" 7 | }, 8 | "messages": { 9 | "info": "Enter the email address you used to register", 10 | "success": "Check your emails for details on how to reset your password.", 11 | "notfound": "Email address isn't registered! Please check and try again" 12 | } 13 | }, 14 | "finish" : { 15 | "title": "Reset password", 16 | "form": { 17 | "button": "Validate new password" 18 | }, 19 | "messages": { 20 | "info": "Choose a new password", 21 | "success": "Your password has been reset. Please ", 22 | "keymissing": "The reset key is missing.", 23 | "error": "Your password couldn't be reset. Remember a password request is only valid for 24 hours." 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/sessions.json: -------------------------------------------------------------------------------- 1 | { 2 | "sessions": { 3 | "title": "Active sessions for [{{username}}]", 4 | "table": { 5 | "ipaddress": "IP address", 6 | "useragent": "User Agent", 7 | "date": "Date", 8 | "button": "Invalidate" 9 | }, 10 | "messages": { 11 | "success": "Session invalidated!", 12 | "error": "An error has occurred! The session could not be invalidated." 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "settings": { 3 | "title": "User settings for [{{username}}]", 4 | "form": { 5 | "firstname": "First Name", 6 | "firstname.placeholder": "Your first name", 7 | "lastname": "Last Name", 8 | "lastname.placeholder": "Your last name", 9 | "language": "Language", 10 | "button": "Save" 11 | }, 12 | "messages": { 13 | "error": { 14 | "fail": "An error has occurred! Settings could not be saved.", 15 | "emailexists": "Email is already in use! Please choose another one." 16 | }, 17 | "success": "Settings saved!", 18 | "validate": { 19 | "firstname": { 20 | "required": "Your first name is required.", 21 | "minlength": "Your first name is required to be at least 1 character", 22 | "maxlength": "Your first name cannot be longer than 50 characters" 23 | }, 24 | "lastname": { 25 | "required": "Your last name is required.", 26 | "minlength": "Your last name is required to be at least 1 character", 27 | "maxlength": "Your last name cannot be longer than 50 characters" 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/webapp/i18n/en/user-management.json: -------------------------------------------------------------------------------- 1 | { 2 | "userManagement": { 3 | "home": { 4 | "title": "Users", 5 | "createLabel": "Create a new user", 6 | "createOrEditLabel": "Create or edit a user" 7 | }, 8 | "created": "A new user is created with identifier {{ param }}", 9 | "updated": "An user is updated with identifier {{ param }}", 10 | "deleted": "An user is deleted with identifier {{ param }}", 11 | "delete": { 12 | "question": "Are you sure you want to delete user {{ login }}?" 13 | }, 14 | "detail": { 15 | "title": "User" 16 | }, 17 | "login": "Login", 18 | "firstName": "First name", 19 | "lastName": "Last name", 20 | "email": "Email", 21 | "activated": "Activated", 22 | "deactivated": "Deactivated", 23 | "profiles": "Profiles", 24 | "langKey": "Language", 25 | "createdBy": "Created by", 26 | "createdDate": "Created date", 27 | "lastModifiedBy": "Modified by", 28 | "lastModifiedDate": "Modified date" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | jhipsterJwtSampleApplication 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 24 | 33 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/webapp/manifest.webapp: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JhipsterJwtSampleApplication", 3 | "short_name": "JhipsterJwtSampleApplication", 4 | "icons": [ 5 | { 6 | "src": "./content/images/logo-jhipster.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "./content/images/logo-jhipster.png", 12 | "sizes": "256x256", 13 | "type": "image/png" 14 | }, 15 | { 16 | "src": "./content/images/logo-jhipster.png", 17 | "sizes": "384x384", 18 | "type": "image/png" 19 | }, 20 | { 21 | "src": "./content/images/logo-jhipster.png", 22 | "sizes": "512x512", 23 | "type": "image/png" 24 | } 25 | ], 26 | "theme_color": "#000000", 27 | "background_color": "#e0e0e0", 28 | "start_url": "/index.html", 29 | "display": "standalone", 30 | "orientation": "portrait" 31 | } 32 | -------------------------------------------------------------------------------- /src/main/webapp/robots.txt: -------------------------------------------------------------------------------- 1 | # robotstxt.org/ 2 | 3 | User-agent: * 4 | Disallow: /api/account 5 | Disallow: /api/account/change-password 6 | Disallow: /api/account/sessions 7 | Disallow: /api/audits/ 8 | Disallow: /api/logs/ 9 | Disallow: /api/users/ 10 | Disallow: /management/ 11 | Disallow: /v2/api-docs/ 12 | -------------------------------------------------------------------------------- /src/main/webapp/swagger-ui/dist/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhipster/jhipster-sample-app-token/a13248b0ce65ac8f85ad00ba4b5a1f6e9a6fdd87/src/main/webapp/swagger-ui/dist/images/throbber.gif -------------------------------------------------------------------------------- /src/test/gatling/conf/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/test/java/io/github/jhipster/sample/config/WebConfigurerTestController.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.config; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class WebConfigurerTestController { 8 | 9 | @GetMapping("/api/test-cors") 10 | public void testCorsOnApiPath() { 11 | } 12 | 13 | @GetMapping("/test/test-cors") 14 | public void testCorsOnOtherPath() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/io/github/jhipster/sample/web/rest/util/PaginationUtilUnitTest.java: -------------------------------------------------------------------------------- 1 | package io.github.jhipster.sample.web.rest.util; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNotNull; 5 | import static org.junit.Assert.assertTrue; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import org.junit.Test; 11 | import org.springframework.data.domain.Page; 12 | import org.springframework.data.domain.PageImpl; 13 | import org.springframework.data.domain.PageRequest; 14 | import org.springframework.http.HttpHeaders; 15 | 16 | /** 17 | * Tests based on parsing algorithm in app/components/util/pagination-util.service.js 18 | * 19 | * @see PaginationUtil 20 | */ 21 | public class PaginationUtilUnitTest { 22 | 23 | @Test 24 | public void generatePaginationHttpHeadersTest() { 25 | String baseUrl = "/api/_search/example"; 26 | List content = new ArrayList<>(); 27 | Page page = new PageImpl<>(content, new PageRequest(6, 50), 400L); 28 | HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, baseUrl); 29 | List strHeaders = headers.get(HttpHeaders.LINK); 30 | assertNotNull(strHeaders); 31 | assertTrue(strHeaders.size() == 1); 32 | String headerData = strHeaders.get(0); 33 | assertTrue(headerData.split(",").length == 4); 34 | String expectedData = "; rel=\"next\"," 35 | + "; rel=\"prev\"," 36 | + "; rel=\"last\"," 37 | + "; rel=\"first\""; 38 | assertEquals(expectedData, headerData); 39 | List xTotalCountHeaders = headers.get("X-Total-Count"); 40 | assertTrue(xTotalCountHeaders.size() == 1); 41 | assertTrue(Long.valueOf(xTotalCountHeaders.get(0)).equals(400L)); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/test/javascript/protractor.conf.js: -------------------------------------------------------------------------------- 1 | const HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter'); 2 | const JasmineReporters = require('jasmine-reporters'); 3 | 4 | exports.config = { 5 | allScriptsTimeout: 20000, 6 | 7 | specs: [ 8 | './e2e/account/*.spec.ts', 9 | './e2e/admin/*.spec.ts', 10 | './e2e/entities/*.spec.ts', 11 | /* jhipster-needle-add-protractor-tests - JHipster will add protractors tests here */ 12 | ], 13 | 14 | capabilities: { 15 | 'browserName': 'chrome', 16 | 'phantomjs.binary.path': require('phantomjs-prebuilt').path, 17 | 'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG'] 18 | }, 19 | 20 | directConnect: true, 21 | 22 | baseUrl: 'http://localhost:8080/', 23 | 24 | framework: 'jasmine2', 25 | 26 | jasmineNodeOpts: { 27 | showColors: true, 28 | defaultTimeoutInterval: 720000 29 | }, 30 | 31 | beforeLaunch: function() { 32 | require('ts-node').register({ 33 | project: '' 34 | }); 35 | }, 36 | 37 | onPrepare: function() { 38 | browser.driver.manage().window().setSize(1280, 1024); 39 | jasmine.getEnv().addReporter(new JasmineReporters.JUnitXmlReporter({ 40 | savePath: 'target/reports/e2e', 41 | consolidateAll: false 42 | })); 43 | jasmine.getEnv().addReporter(new HtmlScreenshotReporter({ 44 | dest: "target/reports/e2e/screenshots" 45 | })); 46 | }, 47 | 48 | useAllAngular2AppRoots: true 49 | }; 50 | -------------------------------------------------------------------------------- /src/test/javascript/spec/entry.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import 'core-js'; 3 | import 'zone.js/dist/zone'; 4 | import 'zone.js/dist/long-stack-trace-zone'; 5 | import 'zone.js/dist/async-test'; 6 | import 'zone.js/dist/fake-async-test'; 7 | import 'zone.js/dist/sync-test'; 8 | import 'zone.js/dist/proxy'; 9 | import 'zone.js/dist/jasmine-patch'; 10 | import 'rxjs'; 11 | import 'intl/locale-data/jsonp/en-US.js'; 12 | import { TestBed } from '@angular/core/testing'; 13 | import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); 16 | 17 | declare let require: any; 18 | const testsContext: any = require.context('./', true, /\.spec/); 19 | testsContext.keys().forEach(testsContext); 20 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-account.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { AccountService } from '../../../../main/webapp/app/shared/auth/account.service'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockAccountService extends SpyObject { 6 | 7 | getSpy: Spy; 8 | saveSpy: Spy; 9 | fakeResponse: any; 10 | 11 | constructor() { 12 | super(AccountService); 13 | 14 | this.fakeResponse = null; 15 | this.getSpy = this.spy('get').andReturn(this); 16 | this.saveSpy = this.spy('save').andReturn(this); 17 | } 18 | 19 | subscribe(callback: any) { 20 | callback(this.fakeResponse); 21 | } 22 | 23 | setResponse(json: any): void { 24 | this.fakeResponse = json; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-active-modal.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockActiveModal extends SpyObject { 6 | 7 | dismissSpy: Spy; 8 | 9 | constructor() { 10 | super(NgbActiveModal); 11 | this.dismissSpy = this.spy('dismiss').andReturn(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-event-manager.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { JhiEventManager } from 'ng-jhipster'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockEventManager extends SpyObject { 6 | 7 | broadcastSpy: Spy; 8 | 9 | constructor() { 10 | super(JhiEventManager); 11 | this.broadcastSpy = this.spy('broadcast').andReturn(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-language.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { JhiLanguageService } from 'ng-jhipster'; 3 | import { JhiLanguageHelper } from './../../../../main/webapp/app/shared/language/language.helper'; 4 | import Spy = jasmine.Spy; 5 | 6 | export class MockLanguageService extends SpyObject { 7 | 8 | getCurrentSpy: Spy; 9 | fakeResponse: any; 10 | 11 | constructor() { 12 | super(JhiLanguageService); 13 | 14 | this.fakeResponse = 'en'; 15 | this.getCurrentSpy = this.spy('getCurrent').andReturn(Promise.resolve(this.fakeResponse)); 16 | } 17 | 18 | init() {} 19 | 20 | changeLanguage(languageKey: string) {} 21 | 22 | setLocations(locations: string[]) {} 23 | 24 | addLocation(location: string) {} 25 | 26 | reload() {} 27 | } 28 | 29 | export class MockLanguageHelper extends SpyObject { 30 | 31 | getAllSpy: Spy; 32 | 33 | constructor() { 34 | super(JhiLanguageHelper); 35 | 36 | this.getAllSpy = this.spy('getAll').andReturn(Promise.resolve(['en', 'fr'])); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-login.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { LoginService } from '../../../../main/webapp/app/shared/login/login.service'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockLoginService extends SpyObject { 6 | 7 | loginSpy: Spy; 8 | logoutSpy: Spy; 9 | registerSpy: Spy; 10 | requestResetPasswordSpy: Spy; 11 | cancelSpy: Spy; 12 | 13 | constructor() { 14 | super(LoginService); 15 | 16 | this.setLoginSpy({}); 17 | this.logoutSpy = this.spy('logout').andReturn(this); 18 | this.registerSpy = this.spy('register').andReturn(this); 19 | this.requestResetPasswordSpy = this.spy('requestResetPassword').andReturn(this); 20 | this.cancelSpy = this.spy('cancel').andReturn(this); 21 | } 22 | 23 | setLoginSpy(json: any) { 24 | this.loginSpy = this.spy('login').andReturn(Promise.resolve(json)); 25 | } 26 | 27 | setResponse(json: any): void { 28 | this.setLoginSpy(json); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-principal.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { Principal } from '../../../../main/webapp/app/shared/auth/principal.service'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockPrincipal extends SpyObject { 6 | 7 | identitySpy: Spy; 8 | 9 | constructor() { 10 | super(Principal); 11 | 12 | this.setIdentitySpy({}); 13 | } 14 | setIdentitySpy(json: any): any { 15 | this.identitySpy = this.spy('identity').andReturn(Promise.resolve(json)); 16 | } 17 | 18 | setResponse(json: any): void { 19 | this.setIdentitySpy(json); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-route.service.ts: -------------------------------------------------------------------------------- 1 | import { ActivatedRoute, Router } from '@angular/router'; 2 | import { SpyObject } from './spyobject'; 3 | import { Observable } from 'rxjs'; 4 | import Spy = jasmine.Spy; 5 | 6 | export class MockActivatedRoute extends ActivatedRoute { 7 | 8 | constructor(parameters?: any) { 9 | super(); 10 | this.queryParams = Observable.of(parameters); 11 | this.params = Observable.of(parameters); 12 | this.data = Observable.of({ ...parameters, pagingParams: { 13 | page: 10, 14 | ascending: false, 15 | predicate: 'id' 16 | }}); 17 | } 18 | } 19 | 20 | export class MockRouter extends SpyObject { 21 | navigateSpy: Spy; 22 | 23 | constructor() { 24 | super(Router); 25 | this.navigateSpy = this.spy('navigate'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/javascript/spec/helpers/mock-state-storage.service.ts: -------------------------------------------------------------------------------- 1 | import { SpyObject } from './spyobject'; 2 | import { StateStorageService } from '../../../../main/webapp/app/shared/auth/state-storage.service'; 3 | import Spy = jasmine.Spy; 4 | 5 | export class MockStateStorageService extends SpyObject { 6 | 7 | getUrlSpy: Spy 8 | storeUrlSpy: Spy 9 | 10 | constructor() { 11 | super(StateStorageService); 12 | this.setUrlSpy({}); 13 | this.storeUrlSpy = this.spy('storeUrl').andReturn(this); 14 | } 15 | 16 | setUrlSpy(json) { 17 | this.getUrlSpy = this.spy('getUrl').andReturn(json); 18 | } 19 | 20 | setResponse(json: any): void { 21 | this.setUrlSpy(json); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/i18n/messages_en.properties: -------------------------------------------------------------------------------- 1 | email.test.title=test title 2 | -------------------------------------------------------------------------------- /src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/test/resources/mails/testEmail.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tsconfig-aot.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "sourceMap": false, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": false, 11 | "suppressImplicitAnyIndexErrors": true, 12 | "skipLibCheck": true, 13 | "outDir": "target/www/app", 14 | "lib": ["es2015", "dom"], 15 | "typeRoots": [ 16 | "node_modules/@types" 17 | ] 18 | }, 19 | "angularCompilerOptions": { 20 | "genDir": "target/aot", 21 | "skipMetadataEmit" : true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": false, 11 | "skipLibCheck": true, 12 | "suppressImplicitAnyIndexErrors": true, 13 | "outDir": "target/www/app", 14 | "lib": ["es6", "dom"], 15 | "typeRoots": [ 16 | "node_modules/@types" 17 | ], 18 | "baseUrl": "./", 19 | "paths": { 20 | "@angular/*": [ 21 | "../node_modules/@angular/*" 22 | ] 23 | } 24 | }, 25 | "include": [ 26 | "src/main/webapp/app", 27 | "src/test/javascript/" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /webpack/logo-jhipster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhipster/jhipster-sample-app-token/a13248b0ce65ac8f85ad00ba4b5a1f6e9a6fdd87/webpack/logo-jhipster.png -------------------------------------------------------------------------------- /webpack/utils.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | module.exports = { 5 | parseVersion, 6 | root, 7 | isExternalLib 8 | }; 9 | 10 | const parseString = require('xml2js').parseString; 11 | // return the version number from `pom.xml` file 12 | function parseVersion() { 13 | let version = null; 14 | const pomXml = fs.readFileSync('pom.xml', 'utf8'); 15 | parseString(pomXml, (err, result) => { 16 | if (err) { 17 | throw new Error('Failed to parse pom.xml: ' + err); 18 | } 19 | if (result.project.version && result.project.version[0]) { 20 | version = result.project.version[0]; 21 | } else if (result.project.parent && result.project.parent[0] && result.project.parent[0].version && result.project.parent[0].version[0]) { 22 | version = result.project.parent[0].version[0]; 23 | } 24 | }); 25 | if (version === null) { 26 | throw new Error('pom.xml is malformed. No version is defined'); 27 | } 28 | return version; 29 | } 30 | 31 | const _root = path.resolve(__dirname, '..'); 32 | 33 | function root(args) { 34 | args = Array.prototype.slice.call(arguments, 0); 35 | return path.join.apply(path, [_root].concat(args)); 36 | } 37 | 38 | function isExternalLib(module, check = /node_modules/) { 39 | const req = module.userRequest; 40 | if (typeof req !== 'string') { 41 | return false; 42 | } 43 | return req.search(check) >= 0; 44 | } 45 | --------------------------------------------------------------------------------