Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 2.31 KB

overview.adoc

File metadata and controls

43 lines (32 loc) · 2.31 KB

There are several samples building on each other, adding new features at each step:

  • simple: a very basic static app with just a home page and unconditional login via Spring Boot’s OAuth 2.0 configuration properties (if you visit the home page, you will be automatically redirected to GitHub).

  • click: adds an explicit link that the user has to click to login.

  • logout: adds a logout link as well for authenticated users.

  • two-providers: adds a second login provider so the user can choose on the home page which one to use.

  • custom-error: adds an error message for unauthenticated users, and a custom authentication based on GitHub’s API.

Note
The changes needed to migrate from one app to the next one in the feature ladder can be tracked in the source code. Each version of the app is its own directory so that you can compare their differences.

Each app can be imported into an IDE. You can run the main method in SocialApplication to start an app. They all come up with a home page on http://localhost:8080 (and all require that you have at least a GitHub and Google account if you want to log in and see the content).

You can also run all the apps on the command line using mvn spring-boot:run or by building the jar file and running it with mvn package and java -jar target/*.jar (per the Spring Boot docs and other available documentation). There is no need to install Maven if you use the wrapper at the top level, e.g.

$ cd simple
$ ../mvnw package
$ java -jar target/*.jar
Note
The apps all work on localhost:8080 because they’ll use OAuth 2.0 clients registered with GitHub and Google for that address. To run them on a different host or port, you need to register your apps that way. There is no danger of leaking your credentials beyond localhost if you use the default values. But, be careful what you expose on the Internet, and don’t put your own app registrations in public source control.