Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This is a sample application created with NodeJS JHipster Official Blueprint (NHipster), with OAuth2 and the React option

NotificationsYou must be signed in to change notification settings

jhipster/jhipster-sample-app-nodejs-oauth2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This application was generated using theNodeJS blueprint of JHipster 7.0.1, you can find documentation and help athttps://www.jhipster.tech/documentation-archive/v7.0.1. For any questions you can refer to the stream lead:Angelo Manganiello.

Development

Before you can build this project, you must install and configure the following dependencies on your machine:

  1. Node.js: We use Node to run a development web server and build the project.Depending on your system, you can install Node either from source or as a pre-packaged bundle.

After installing Node, you should be able to run the following command to install development tools.You will only need to run this command when dependencies change inpackage.json.

npm installcd server && npm install

We use npm scripts andWebpack as our build system.

Run the following commands in two separate terminals to create a blissful development experience where your browserauto-refreshes when files change on your hard drive.

cd server && npm startnpm start

Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies byspecifying a newer version inpackage.json. You can also runnpm update andnpm install to manage dependencies.Add thehelp flag on any command to see how you can use it. For example,npm help update.

Thenpm run command will list all of the scripts available to run for this project.

Using Docker to simplify development (optional)

You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in thesrc/main/docker folder to launch required third party services.You can also fully dockerize your application and all the services that it depends on.

For example, to start a mysql database in a docker container, run:

docker-compose -f src/main/docker/mysql.yml up -d

To stop it and remove the container, run:

docker-compose -f src/main/docker/mysql.yml down

For the entire app run:

docker-compose -f src/main/docker/app.yml up -d

For more information refer toUsing Docker and Docker-Compose, this page also contains information on the docker-compose sub-generator (jhipster docker-compose), which is able to generate docker configurations for one or several JHipster applications.

OAuth 2.0 / OpenID Connect

Congratulations! You've selected an excellent way to secure your NHipster application. If you're not sure what OAuth and OpenID Connect (OIDC) are, please seeWhat the Heck is OAuth?

To log in to your app, you'll need to haveKeycloak up and running. The JHipster Team has created a Docker container for you that has the default users and roles. Start Keycloak using the following command.

docker-compose -f src/main/docker/keycloak.yml up

Okta

To log in to your app, you'll need to change a few things. First, you'll need to create a free developer account athttps://developer.okta.com/signup/. After doing so, you'll get your own Okta domain, that has a name likehttps://dev-123456.okta.com.

Modifyserver/src/config/application.yml to use your Okta settings.

...security:oauth2:client:provider:oidc:issuer-uri:https://{yourOktaDomain}/oauth2/defaultregistration:oidc:client-id:{clientId}client-secret:{clientSecret}

Create an OIDC App in Okta to get a{clientId} and{clientSecret}. To do this, log in to your Okta Developer account and navigate toApplications >Add Application. ClickWeb and click theNext button. Give the app a name you’ll remember, specifyhttp://localhost:8081 as a Base URI, andhttp://localhost:8081/login/oauth2/code/oidc as a Login Redirect URI. ClickDone, then Edit and addhttp://localhost:8081 as a Logout redirect URI. Copy and paste the client ID and secret into yourapplication.yml file.

Create aROLE_ADMIN andROLE_USER group and add users into them.

Navigate toAPI >Authorization Servers, click theAuthorization Servers tab and edit the default one. Click theClaims tab andAdd Claim. Name it "groups", and include it in the ID Token. Set the value type to "Groups" and set the filter to be a Regex of.*.

After making these changes, you should be good to go! If you have any issues, please post them toStack Overflow. Make sure to tag your question with "jhipster" and "okta".

PWA Support

JHipster ships with PWA (Progressive Web App) support, and it's disabled by default. One of the main components of a PWA is a service worker.

The service worker initialization code is commented out by default. To enable it, uncomment the following code insrc/main/webapp/index.html:

<script>if('serviceWorker'innavigator){navigator.serviceWorker.register('./service-worker.js').then(function(){console.log('Service Worker Registered');});}</script>

Note:Workbox powers JHipster's service worker. It dynamically generates theservice-worker.js file.

Managing dependencies

For example, to addLeaflet library as a runtime dependency of your application, you would run following command:

npm install --save --save-exact leaflet

To benefit from TypeScript type definitions fromDefinitelyTyped repository in development, you would run following command:

npm install --save-dev --save-exact @types/leaflet

Then you would import the JS and CSS files specified in library's installation instructions so thatWebpack knows about them:Note: There are still a few other things remaining to do for Leaflet that we won't detail here.

For further instructions on how to develop with JHipster, have a look atUsing JHipster in development.

Using NestJS CLI

You can also useNestJS CLI to generate some custom server code.

For example, the following command:

nest generate module my-module

will generate the file:

create server/src/my-component/my-component.module.ts

Building and running

Running

npm run start:app

Building

npm run build:app

The build folder with all compiled sources will beserver/dist.

For more explanation about full stack server/client build refer toserver/README.md

Client tests

Unit tests are run byJest and written withJasmine. They're located insrc/test/javascript/ and can be run with:

npm test

UI end-to-end tests are powered byProtractor, which is built on top of WebDriverJS. They're located insrc/test/javascript/e2eand can be run in a terminal (npm run e2e) after that the full application is run (npm run start:app).

For more information, refer to theRunning tests page.

Code quality

Sonar is used to analyse code quality. You can start a local Sonar server (accessible onhttp://localhost:9001) with:

docker-compose -f src/main/docker/sonar.yml up -d

You can run a Sonar analysis with using thesonar-scanner.Then, run a Sonar analysis in the server folder:

npm run sonar:scanner

For more information, refer to theCode quality page.

About

This is a sample application created with NodeJS JHipster Official Blueprint (NHipster), with OAuth2 and the React option

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp