{"id":20307484,"url":"https://github.com/oktadev/auth0-full-stack-java-example","last_synced_at":"2025-04-11T15:12:03.125Z","repository":{"id":40489700,"uuid":"416472758","full_name":"oktadev/auth0-full-stack-java-example","owner":"oktadev","description":"🔥 Full Stack Java Example","archived":false,"fork":false,"pushed_at":"2022-05-12T01:05:06.000Z","size":5618,"stargazers_count":29,"open_issues_count":1,"forks_count":19,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-25T11:21:26.682Z","etag":null,"topics":["auth0","fullstack","fullstack-java","java","oidc","react","spring-boot"],"latest_commit_sha":null,"homepage":"https://auth0.com/blog/full-stack-java-with-react-spring-boot-and-jhipster/","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/oktadev.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}},"created_at":"2021-10-12T19:33:58.000Z","updated_at":"2024-11-26T10:00:12.000Z","dependencies_parsed_at":"2022-08-09T22:00:42.253Z","dependency_job_id":null,"html_url":"https://github.com/oktadev/auth0-full-stack-java-example","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fauth0-full-stack-java-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fauth0-full-stack-java-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fauth0-full-stack-java-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fauth0-full-stack-java-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/auth0-full-stack-java-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429110,"owners_count":21101783,"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":["auth0","fullstack","fullstack-java","java","oidc","react","spring-boot"],"created_at":"2024-11-14T17:17:52.420Z","updated_at":"2025-04-11T15:12:03.098Z","avatar_url":"https://github.com/oktadev.png","language":"Java","readme":"# Full Stack Java Example with JHipster (React + Spring Boot) 🤓\n\nThis example app shows you how to create a slick-looking, full-stack, secure application using React, Spring Boot, and JHipster.\n\nPlease read the following blog posts to learn more:\n\n- [Full Stack Java with React, Spring Boot, and JHipster][blog] to see how this app was created.\n- [Introducing Spring Native for JHipster: Serverless Full-Stack Made Easy][blog-spring-native] to convert this app to an executable with Spring Native.\n- [Use GitHub Actions to Build GraalVM Native Images][blog-github-graalvm] to automate your GraalVM builds.\n\n**Prerequisites:**\n\n- [Node.js 14+](https://nodejs.org/)\n- [Java 11+](https://sdkman.io)\n- [Docker Compose](https://docs.docker.com/compose/install/)\n- An [Auth0 Account](https://auth0.com/signup)\n\n\u003e [Auth0](https://auth0.com) is an easy to implement, adaptable authentication and authorization platform. Basically, we make your login box awesome.\n\n- [Getting Started](#getting-started)\n- [Links](#links)\n- [Help](#help)\n- [License](#license)\n\n## Getting Started\n\nTo install this example, clone it.\n\n```\ngit clone https://github.com/oktadev/auth0-full-stack-java-example.git\ncd auth0-full-stack-java-example\n```\n\nCreate a `.auth0.env` file in the root of the project, and fill it with the code below to override the default OIDC settings:\n\n```shell\nexport SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_OIDC_ISSUER_URI=https://\u003cyour-auth0-domain\u003e/\nexport SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_ID=\u003cyour-client-id\u003e\nexport SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_SECRET=\u003cyour-client-secret\u003e\nexport JHIPSTER_SECURITY_OAUTH2_AUDIENCE=https://\u003cyour-auth0-domain\u003e/api/v2/\n```\n\nYou'll need to create a new web application in Auth0 and fill in the `\u003c...\u003e` placeholders before this works.\n\n### Create an OpenID Connect App on Auth0\n\nLog in to your Auth0 account (or [sign up](https://auth0.com/signup) if you don't have an account). You should have a unique domain like `dev-xxx.eu.auth0.com`.\n\nPress the **Create Application** button in [Applications section](https://manage.auth0.com/#/applications). Use a name like `JHipster Baby!`, select `Regular Web Applications`, and click **Create**.\n\nSwitch to the **Settings** tab and configure your application settings:\n\n- Allowed Callback URLs: `http://localhost:8080/login/oauth2/code/oidc`\n- Allowed Logout URLs: `http://localhost:8080/`\n\nScroll to the bottom and click **Save Changes**.\n\nIn the [roles](https://manage.auth0.com/#/roles) section, create new roles named `ROLE_ADMIN` and `ROLE_USER`.\n\nCreate a new user account in the [users](https://manage.auth0.com/#/users) section. Click on the **Role** tab to assign the roles you just created to the new account.\n\n_Make sure your new user's email is verified before attempting to log in!_\n\nNext, head to **Auth Pipeline** \u003e **Rules** \u003e **Create**. Select the `Empty rule` template. Provide a meaningful name like `Group claims` and replace the Script content with the following.\n\n```js\nfunction(user, context, callback) {\n  user.preferred_username = user.email;\n  const roles = (context.authorization || {}).roles;\n\n  function prepareCustomClaimKey(claim) {\n    return `https://www.jhipster.tech/${claim}`;\n  }\n\n  const rolesClaim = prepareCustomClaimKey('roles');\n\n  if (context.idToken) {\n    context.idToken[rolesClaim] = roles;\n  }\n\n  if (context.accessToken) {\n    context.accessToken[rolesClaim] = roles;\n  }\n\n  callback(null, user, context);\n}\n```\n\nThis code is adding the user's roles to a custom claim (prefixed with `https://www.jhipster.tech/roles`). This claim is mapped to Spring Security authorities in `SecurityUtils.java`.\n\nClick **Save changes** to continue.\n\n**NOTE**: Want to have all these steps automated for you? Vote for [this issue](https://github.com/auth0/auth0-cli/issues/351) in the Auth0 CLI project.\n\n### Run Your JHipster App with Auth0\n\nSet your Auth0 properties in `.auth0.env`, and start the app.\n\n```shell\nsource .auth0.env\n./mvnw\n```\n\n_Voilà_ - your full stack app is using Auth0! Open your favorite browser to `http://localhost:8080` and sign-in.\n\n## Links\n\nThis example uses the following open source libraries:\n\n- [JHipster](https://www.jhipster.tech)\n- [Spring Boot](https://spring.io/projects/spring-boot)\n- [Spring Security](https://spring.io/projects/spring-security)\n\n## Help\n\nPlease post any questions as comments on the [blog post][blog].\n\n## License\n\nApache 2.0, see [LICENSE](LICENSE).\n\n[blog]: https://auth0.com/blog/full-stack-java-with-react-spring-boot-and-jhipster/\n[blog-spring-native]: https://developer.okta.com/blog/2022/03/03/spring-native-jhipster\n[blog-github-graalvm]: https://developer.okta.com/blog/2022/04/22/github-actions-graalvm\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fauth0-full-stack-java-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fauth0-full-stack-java-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fauth0-full-stack-java-example/lists"}