OAuth2 Exchange is a Java library that provides a bunch of functionalities for exchanging authorization code for an access token in OAuth2 Authorization Code Flow. It consists of templates and ready-to-use implementations for most common authorization providers (like Google or Facebook). The mentioned templates make a proper HTTP call to issue an access token based on provided authorization code. Therefore, you can save your time as you do not need to search through plenty of API docs or to implement a custom HTTP client just to exchange a code for a token - the library do it under the hood via a single method call ;)
According to the OAuth2 overview found on DigitalOcean, the library manages the step 4 (issuing a token from authorization code) and step 5 (receiving token response):
Apart from the core library which can be used in any Java project, there is also a dedicated starter for Spring Boot provided. It wraps the core library and automatically configures proper templates based on provided credentials via application properties. Therefore, you do not need to bother about declaring necessary beans and other related stuff in your Spring Boot application ;)
You can find out more about implementation details and how to get started with a library on GitHub wiki pages or official Java docs.
The whole project is currently in development, so you can expect plenty of updates over time.
type | current version |
---|---|
stable | 0.1.1 |
latest | 0.2.0-SNAPSHOT |
Currently, the oauth2-exchange library provides ready-to-use support for the following auth providers:
Every successfull build from develop
branch is automatically deployed in form of snapshot to a public Sonatype repository.
Have noticed a bug in a library? Do not hesitate to report it by creating an GitHub issue!
If you want to contribute to the source code:
- find an issue you want to work on (or create a new one if you want to create something new)
- fork the project
- implement the feature/fix (do not forget about test coverage!)
- create a pull request to
develop
branch
If you want to use the core library itself in your Maven project - just include the dependency in your pom.xml
file:
<dependency>
<groupId>io.mzlnk.oauth2.exchange</groupId>
<artifactId>oauth2-exchange-core</artifactId>
<version>0.1.1</version>
</dependency>
If you want to use the core library itself in your Gradle project - just include the dependency build.gradle
file:
implementation 'io.mzlnk.oauth2.exchange:oauth2-exchange-core:0.1.1'
If you want to manually add the core library in your Java project - you can always download the proper JAR file from Releases page.
If you want to use the Spring Boot starter in your Maven project - just include the dependency in your pom.xml
file:
<dependency>
<groupId>io.mzlnk.oauth2.exchange</groupId>
<artifactId>oauth2-exchange-spring-boot-starter</artifactId>
<version>0.1.1</version>
</dependency>
If you want to use the core library itself in your Gradle project - just include the dependency build.gradle
file:
implementation 'io.mzlnk.oauth2.exchange:oauth2-exchange-spring-boot-starter:0.1.1'
If you want to get to know how the whole library works and how to use it in your project - you can check out GitHub wiki pages which include guides and tutorials. There are also official Java docs for core library.
This starter is under MIT licence so feel free to use it for your personal or commercial use ;)
Created by Marcin Zielonka