Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patkub/sample-oauth2-spring-boot
Fork of Okta's Spring Boot Login Samples, without Okta Spring Boot Starter.
https://github.com/patkub/sample-oauth2-spring-boot
java oauth2 spring-boot spring-mvc spring-security
Last synced: 21 days ago
JSON representation
Fork of Okta's Spring Boot Login Samples, without Okta Spring Boot Starter.
- Host: GitHub
- URL: https://github.com/patkub/sample-oauth2-spring-boot
- Owner: patkub
- License: mit
- Created: 2024-11-03T15:25:37.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-26T21:55:25.000Z (about 2 months ago)
- Last Synced: 2024-11-26T22:30:56.240Z (about 2 months ago)
- Topics: java, oauth2, spring-boot, spring-mvc, spring-security
- Language: HTML
- Homepage:
- Size: 132 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sample-oauth2-spring-boot
## Description
This is a fork of Okta's [Spring Boot Login Samples](https://github.com/auth0-samples/auth0-spring-boot-login-samples), without Okta Spring Boot Starter.
## Requirements
- Java 21
## Configuration
### Auth0 Dashboard
1. On the [Auth0 Dashboard](https://manage.auth0.com/#/clients) create a new Application of type **Regular Web Application**.
1. On the **Settings** tab of your application, add the following URLs to the **Allowed Callback URLs** field.
- `http://localhost:3000/login/oauth2/code/okta, http://localhost:3001/login/oauth2/code/okta`
1. On the **Settings** tab of your application, add the following URLs to the **Allowed Logout URLs** field.
- `http://localhost:3000, http://localhost:3001`
1. Save the changes to your application settings. Don't close this page; you'll need some of the settings when configuring the application below.### Application configuration
Create application.yml by copying example config:
```bash
cp mvc-login/src/main/resources/application.yml.example mvc-login/src/main/resources/application.yml
cp webflux-login/src/main/resources/application.yml.example webflux-login/src/main/resources/application.yml
```Set the application values in the `src/main/resources/application.yml` file to the values of your Auth0 application for both mvc-login and webflux-login subprojects.
```yaml
issuer-uri: https://{YOUR-DOMAIN}/
client-id: {YOUR-CLIENT-ID}
client-secret: {YOUR-CLIENT-SECRET}
```## Running the MVC sample
Open a terminal, go to the project root directory and run the following command:
Linux or MacOS:
```bash
./gradlew :mvc-login:bootRun
```Windows:
```bash
gradlew.bat :mvc-login:bootRun
```The application will be accessible at http://localhost:3000.
## Running the WebFlux sample
Open a terminal, go to the project root directory and run the following command:
Linux or MacOS:
```bash
./gradlew :webflux-login:bootRun
```Windows:
```bash
gradlew.bat :webflux-login:bootRun
```The application will be accessible at http://localhost:3001.
## Upgrading the samples
Use [OpenRewrite](https://docs.openrewrite.org/) to upgrade to latest Java and SpringBoot.
Define latest recipes in `gradle/openrewrite.gradle`, and run:
```
./gradlew rewriteRun
```