Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork6
jhipster/jhipster-sample-app-nodejs-oauth2
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
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.
Before you can build this project, you must install and configure the following dependencies on your machine:
- 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 installWe 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 startNpm 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.
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 -dTo stop it and remove the container, run:
docker-compose -f src/main/docker/mysql.yml downFor the entire app run:
docker-compose -f src/main/docker/app.yml up -dFor 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.
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 upTo 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".
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.
For example, to addLeaflet library as a runtime dependency of your application, you would run following command:
npm install --save --save-exact leafletTo benefit from TypeScript type definitions fromDefinitelyTyped repository in development, you would run following command:
npm install --save-dev --save-exact @types/leafletThen 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.
You can also useNestJS CLI to generate some custom server code.
For example, the following command:
nest generate module my-modulewill generate the file:
create server/src/my-component/my-component.module.tsnpm run start:app
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
Unit tests are run byJest and written withJasmine. They're located insrc/test/javascript/ and can be run with:
npm testUI 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.
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 -dYou can run a Sonar analysis with using thesonar-scanner.Then, run a Sonar analysis in the server folder:
npm run sonar:scannerFor 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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.