Skip to content

Commit c95f6a3

Browse files
initial commit
0 parents  commit c95f6a3

52 files changed

Lines changed: 3739 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Quickstart: Spring Web and Thymeleaf with FusionAuth
2+
3+
This respository contains a SpringBoot application that works with a locally-running instance of [FusionAuth](https://fusionauth.io/), the authentication and authorization platform.
4+
5+
## Setup
6+
7+
### Prerequisites
8+
You will need the following things properly installed on your computer.
9+
10+
* [Git](http://git-scm.com/): Presumably you already have this on your machine if you are looking at this project locally; if not, use your platform's package manager to install git, and `git clone` this repo.
11+
* [Java](https://www.oracle.com/java/technologies/downloads/): Java can be installed via a variety of methods
12+
* `mvn`: Maven, a java package manager. Install it by [following the instructions here](https://maven.apache.org/install.html).
13+
* [Docker](https://www.docker.com): For standing up FusionAuth from within a Docker container. (You can [install it other ways](https://fusionauth.io/docs/v1/tech/installation-guide/), but for this example we will assume you are using Docker.)
14+
15+
This app was built using Java 17 and the maven wrapper. If you wish to use a different version of Java you will need to update the `java.version` in the [pom file](./complete-application/pom.xml).
16+
17+
18+
### FusionAuth Installation via Docker
19+
20+
The root of this project directory (next to this README) are two files [a Docker compose file](./docker-compose.yml) and an [environment variables configuration file](./.env). Assuming you have Docker installed on your machine, you can stand up FusionAuth up on your machine with:
21+
22+
```
23+
docker-compose up -d
24+
```
25+
26+
The FusionAuth configuration files also make use of a unique feature of FusionAuth, called [Kickstart](https://fusionauth.io/docs/v1/tech/installation-guide/kickstart): when FusionAuth comes up for the first time, it will look at the [Kickstart file](./kickstart/kickstart.json) and mimic API calls to configure FusionAuth for use when it is first run.
27+
28+
> **NOTE**: If you ever want to reset the FusionAuth system, delete the volumes created by docker-compose by executing `docker-compose down -v`.
29+
30+
FusionAuth will be initially configured with these settings:
31+
32+
* Your client Id is: `e9fdb985-9173-4e01-9d73-ac2d60d1dc8e`
33+
* Your client secret is: `super-secret-secret-that-should-be-regenerated-for-production`
34+
* Your example username is `richard@example.com` and your password is `password`.
35+
* Your admin username is `admin@example.com` and your password is `password`.
36+
* Your fusionAuthBaseUrl is 'http://localhost:9011/'
37+
38+
You can log into the [FusionAuth admin UI](http://localhost:9011/admin) and look around if you want, but with Docker/Kickstart you don't need to.
39+
40+
### Spring Web complete-app
41+
42+
The `complete-app` directory contains a minimal SpringBoot app configured to authenticate with locally running FusionAuth.
43+
44+
Install the dependencies via the Maven wrapper and run the app server with:
45+
```
46+
cd complete-app
47+
./mvnw package
48+
./mvnw spring-boot:run
49+
```
50+
Note: If you are on Windows swap `./mvnw` with `.\mvnw.cmd`
51+
52+
Now vist the SpringBoot app at [http://localhost:8080](http://localhost:8080)
53+
You can login with a user preconfigured during Kickstart, `richard@example.com` with the password of `password`.
54+
55+
### Further Information
56+
57+
Visit https://fusionauth.io/quickstarts/quickstart-springboot-web for a step by step guide on how to build this Rails app integrated with FusionAuth by scratch.
58+
59+
### Troubleshooting
60+
61+
* I get `This site can’t be reached localhost refused to connect.` when I click the Login button
62+
63+
Ensure FusionAuth is running in the Docker container. You should be able to login as the admin user, `admin@example.com` with the password of `password` at http://localhost:9011/admin
64+
65+
* I get an error page when I click on the Login button with message of `"error_reason" : "invalid_client_id"`
66+
67+
Ensure the value for `spring.security.oauth2.client.registration.fusionauth-client.client-id` in the [application properties file](complete-application/src/main/resources/application.properties) matches client id configured in FusionAuth for the Example App application at http://localhost:9011/admin/application/

complete-application/.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
POSTGRES_USER=postgres
2+
POSTGRES_PASSWORD=postgres
3+
DATABASE_USERNAME=fusionauth
4+
DATABASE_PASSWORD=hkaLBM3RVnyYeYeqE3WI1w2e4Avpy0Wd5O3s3
5+
ES_JAVA_OPTS="-Xms512m -Xmx512m"
6+
FUSIONAUTH_APP_MEMORY=512M
7+
8+
FUSIONAUTH_APP_KICKSTART_FILE=/usr/local/fusionauth/kickstart/kickstart.json
57.4 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

complete-application/mvnw

Lines changed: 316 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)