{"id":15782971,"url":"https://github.com/pascalgrimaud/jhipster-example-oauth2","last_synced_at":"2025-03-31T16:47:02.294Z","repository":{"id":86174966,"uuid":"302645139","full_name":"pascalgrimaud/jhipster-example-oauth2","owner":"pascalgrimaud","description":null,"archived":false,"fork":false,"pushed_at":"2020-10-09T13:13:31.000Z","size":1422,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-05T19:22:24.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pascalgrimaud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-09T13:12:12.000Z","updated_at":"2020-10-09T13:13:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"82326430-a84c-446c-b9bc-f00ab352a3a2","html_url":"https://github.com/pascalgrimaud/jhipster-example-oauth2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascalgrimaud%2Fjhipster-example-oauth2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascalgrimaud%2Fjhipster-example-oauth2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascalgrimaud%2Fjhipster-example-oauth2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascalgrimaud%2Fjhipster-example-oauth2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pascalgrimaud","download_url":"https://codeload.github.com/pascalgrimaud/jhipster-example-oauth2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246500195,"owners_count":20787659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T19:22:34.083Z","updated_at":"2025-03-31T16:47:02.266Z","avatar_url":"https://github.com/pascalgrimaud.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gateway\n\nThis application was generated using JHipster 6.1.2, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v6.1.2](https://www.jhipster.tech/documentation-archive/v6.1.2).\n\nThis is a \"gateway\" application intended to be part of a microservice architecture, please refer to the [Doing microservices with JHipster][] page of the documentation for more information.\n\nThis application is configured for Service Discovery and Configuration with Consul. On launch, it will refuse to start if it is not able to connect to Consul at [http://localhost:8500](http://localhost:8500). For more information, read our documentation on [Service Discovery and Configuration with Consul][].\n\n## Development\n\nBefore you can build this project, you must install and configure the following dependencies on your machine:\n\n1. [Node.js][]: We use Node to run a development web server and build the project.\n   Depending on your system, you can install Node either from source or as a pre-packaged bundle.\n\nAfter installing Node, you should be able to run the following command to install development tools.\nYou will only need to run this command when dependencies change in [package.json](package.json).\n\n    npm install\n\nWe use npm scripts and [Webpack][] as our build system.\n\nRun the following commands in two separate terminals to create a blissful development experience where your browser\nauto-refreshes when files change on your hard drive.\n\n    ./mvnw\n    npm start\n\nNpm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by\nspecifying a newer version in [package.json](package.json). You can also run `npm update` and `npm install` to manage dependencies.\nAdd the `help` flag on any command to see how you can use it. For example, `npm help update`.\n\nThe `npm run` command will list all of the scripts available to run for this project.\n\n## OAuth 2.0 / OpenID Connect\n\nCongratulations! You've selected an excellent way to secure your JHipster application. If you're not sure what OAuth and OpenID Connect (OIDC) are, please see [What the Heck is OAuth?](https://developer.okta.com/blog/2017/06/21/what-the-heck-is-oauth)\n\nTo log in to your app, you'll need to have [Keycloak](https://keycloak.org) 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.\n\n```\ndocker-compose -f src/main/docker/keycloak.yml up\n```\n\nThe security settings in `src/main/resources/application.yml` are configured for this image.\n\n```yaml\nspring:\n  ...\n  security:\n    oauth2:\n      client:\n        provider:\n          oidc:\n            issuer-uri: http://localhost:9080/auth/realms/jhipster\n        registration:\n          oidc:\n            client-id: web_app\n            client-secret: web_app\n```\n\n### Okta\n\nIf you'd like to use Okta instead of Keycloak, you'll need to change a few things. First, you'll need to create a free developer account at \u003chttps://developer.okta.com/signup/\u003e. After doing so, you'll get your own Okta domain, that has a name like `https://dev-123456.okta.com`.\n\nModify `src/main/resources/application.yml` to use your Okta settings.\n\n```yaml\nspring:\n  ...\n  security:\n    oauth2:\n      client:\n        provider:\n          oidc:\n            issuer-uri: https://{yourOktaDomain}/oauth2/default\n        registration:\n          oidc:\n            client-id: {clientId}\n            client-secret: {clientSecret}\nsecurity:\n```\n\nCreate an OIDC App in Okta to get a `{clientId}` and `{clientSecret}`. To do this, log in to your Okta Developer account and navigate to **Applications** \u003e **Add Application**. Click **Web** and click the **Next** button. Give the app a name you’ll remember, specify `http://localhost:8080` as a Base URI, and `http://localhost:8080/login/oauth2/code/oidc` as a Login Redirect URI. Click **Done**, then Edit and add `http://localhost:8080` as a Logout redirect URI. Copy and paste the client ID and secret into your `application.yml` file.\n\n\u003e **TIP:** If you want to use the [Ionic Module for JHipster](https://www.npmjs.com/package/generator-jhipster-ionic), you'll need to add `http://localhost:8100` as a **Login redirect URI** as well.\n\nCreate a `ROLE_ADMIN` and `ROLE_USER` group and add users into them. Modify e2e tests to use this account when running integration tests. You'll need to change credentials in `src/test/javascript/e2e/account/account.spec.ts` and `src/test/javascript/e2e/admin/administration.spec.ts`.\n\nNavigate to **API** \u003e **Authorization Servers**, click the **Authorization Servers** tab and edit the default one. Click the **Claims** tab and **Add Claim**. Name it \"roles\", and include it in the ID Token. Set the value type to \"Groups\" and set the filter to be a Regex of `.*`.\n\nAfter making these changes, you should be good to go! If you have any issues, please post them to [Stack Overflow](https://stackoverflow.com/questions/tagged/jhipster). Make sure to tag your question with \"jhipster\" and \"okta\".\n\n### Service workers\n\nService workers are commented by default, to enable them please uncomment the following code.\n\n- The service worker registering script in index.html\n\n```html\n\u003cscript\u003e\n  if ('serviceWorker' in navigator) {\n    navigator.serviceWorker.register('./service-worker.js').then(function() {\n      console.log('Service Worker Registered');\n    });\n  }\n\u003c/script\u003e\n```\n\nNote: workbox creates the respective service worker and dynamically generate the `service-worker.js`\n\n### Managing dependencies\n\nFor example, to add [Leaflet][] library as a runtime dependency of your application, you would run following command:\n\n    npm install --save --save-exact leaflet\n\nTo benefit from TypeScript type definitions from [DefinitelyTyped][] repository in development, you would run following command:\n\n    npm install --save-dev --save-exact @types/leaflet\n\nThen you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them:\nEdit [src/main/webapp/app/vendor.ts](src/main/webapp/app/vendor.ts) file:\n\n```\nimport 'leaflet/dist/leaflet.js';\n```\n\nEdit [src/main/webapp/content/css/vendor.css](src/main/webapp/content/css/vendor.css) file:\n\n```\n@import '~leaflet/dist/leaflet.css';\n```\n\nNote: there are still few other things remaining to do for Leaflet that we won't detail here.\n\nFor further instructions on how to develop with JHipster, have a look at [Using JHipster in development][].\n\n### Using angular-cli\n\nYou can also use [Angular CLI][] to generate some custom client code.\n\nFor example, the following command:\n\n    ng generate component my-component\n\nwill generate few files:\n\n    create src/main/webapp/app/my-component/my-component.component.html\n    create src/main/webapp/app/my-component/my-component.component.ts\n    update src/main/webapp/app/app.module.ts\n\n## Building for production\n\n### Packaging as jar\n\nTo build the final jar and optimize the gateway application for production, run:\n\n    ./mvnw -Pprod clean verify\n\nThis will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files.\nTo ensure everything worked, run:\n\n    java -jar target/*.jar\n\nThen navigate to [http://localhost:8080](http://localhost:8080) in your browser.\n\nRefer to [Using JHipster in production][] for more details.\n\n### Packaging as war\n\nTo package your application as a war in order to deploy it to an application server, run:\n\n    ./mvnw -Pprod,war clean verify\n\n## Testing\n\nTo launch your application's tests, run:\n\n    ./mvnw verify\n\n### Client tests\n\nUnit tests are run by [Jest][] and written with [Jasmine][]. They're located in [src/test/javascript/](src/test/javascript/) and can be run with:\n\n    npm test\n\nFor more information, refer to the [Running tests page][].\n\n### Code quality\n\nSonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with:\n\n```\ndocker-compose -f src/main/docker/sonar.yml up -d\n```\n\nYou can run a Sonar analysis with using the [sonar-scanner](https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner) or by using the maven plugin.\n\nThen, run a Sonar analysis:\n\n```\n./mvnw -Pprod clean verify sonar:sonar\n```\n\nIf you need to re-run the Sonar phase, please be sure to specify at least the `initialize` phase since Sonar properties are loaded from the sonar-project.properties file.\n\n```\n./mvnw initialize sonar:sonar\n```\n\nor\n\nFor more information, refer to the [Code quality page][].\n\n## Using Docker to simplify development (optional)\n\nYou can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services.\n\nFor example, to start a mysql database in a docker container, run:\n\n    docker-compose -f src/main/docker/mysql.yml up -d\n\nTo stop it and remove the container, run:\n\n    docker-compose -f src/main/docker/mysql.yml down\n\nYou can also fully dockerize your application and all the services that it depends on.\nTo achieve this, first build a docker image of your app by running:\n\n    ./mvnw -Pprod verify jib:dockerBuild\n\nThen run:\n\n    docker-compose -f src/main/docker/app.yml up -d\n\nFor more information refer to [Using 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.\n\n## Continuous Integration (optional)\n\nTo configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.\n\n[jhipster homepage and latest documentation]: https://www.jhipster.tech\n[jhipster 6.1.2 archive]: https://www.jhipster.tech/documentation-archive/v6.1.2\n[doing microservices with jhipster]: https://www.jhipster.tech/documentation-archive/v6.1.2/microservices-architecture/\n[using jhipster in development]: https://www.jhipster.tech/documentation-archive/v6.1.2/development/\n[service discovery and configuration with consul]: https://www.jhipster.tech/documentation-archive/v6.1.2/microservices-architecture/#consul\n[using docker and docker-compose]: https://www.jhipster.tech/documentation-archive/v6.1.2/docker-compose\n[using jhipster in production]: https://www.jhipster.tech/documentation-archive/v6.1.2/production/\n[running tests page]: https://www.jhipster.tech/documentation-archive/v6.1.2/running-tests/\n[code quality page]: https://www.jhipster.tech/documentation-archive/v6.1.2/code-quality/\n[setting up continuous integration]: https://www.jhipster.tech/documentation-archive/v6.1.2/setting-up-ci/\n[node.js]: https://nodejs.org/\n[yarn]: https://yarnpkg.org/\n[webpack]: https://webpack.github.io/\n[angular cli]: https://cli.angular.io/\n[browsersync]: http://www.browsersync.io/\n[jest]: https://facebook.github.io/jest/\n[jasmine]: http://jasmine.github.io/2.0/introduction.html\n[protractor]: https://angular.github.io/protractor/\n[leaflet]: http://leafletjs.com/\n[definitelytyped]: http://definitelytyped.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpascalgrimaud%2Fjhipster-example-oauth2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpascalgrimaud%2Fjhipster-example-oauth2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpascalgrimaud%2Fjhipster-example-oauth2/lists"}