Skip to content

Commit

Permalink
Merge pull request #72 from mzlnk/release/0.1.0
Browse files Browse the repository at this point in the history
oauth2-exchange 0.1.0
  • Loading branch information
mzlnk authored Mar 10, 2022
2 parents 8741500 + 45bd7ac commit aa05b94
Show file tree
Hide file tree
Showing 146 changed files with 8,802 additions and 54 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/oauth2-exchange-cd-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 'oauth2-exchange CD (releases)'

on:
release:
types:
- released

jobs:
core-deploy-release:
name: 'deploy release'
runs-on: ubuntu-latest

defaults:
run:
working-directory: core

steps:
- uses: actions/checkout@v2

- name: Setting up JDK 17 and Maven Central Repository
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
cache: maven

- name: deploy release (core)
working-directory: core
run: mvn clean deploy -P release
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: deploy release (spring-boot-autoconfigure)
working-directory: spring-boot/autoconfigure
run: mvn clean deploy -P release
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: deploy release (spring-boot-starter)
working-directory: spring-boot/starter
run: mvn clean deploy -P release
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
45 changes: 45 additions & 0 deletions .github/workflows/oauth2-exchange-cd-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'oauth2-exchange CD (snapshots)'

on:
push:
branches:
- 'develop'

jobs:
deploy-snapshots:
name: 'deploy snapshots'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setting up JDK 17 and Maven Central Repository
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
cache: maven

- name: deploy snapshot (core)
working-directory: core
run: mvn clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

- name: deploy snapshot (spring-boot-autoconfigure)
working-directory: spring-boot/autoconfigure
run: mvn clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

- name: deploy snapshot (spring-boot-starter)
working-directory: spring-boot/starter
run: mvn clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/oauth2-exchange-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'oauth2-exchange CI'

on:
pull_request:
branches:
- 'main'
- 'develop'
- 'feature/**'
- 'bugfix/**'
- 'release/**'
- 'tmp/**'

jobs:
tests:
name: 'run tests'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setting up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
cache: maven

- name: run tests (core)
working-directory: core
run: mvn clean install

- name: run tests (spring-boot-autoconfigure)
working-directory: spring-boot/autoconfigure
run: mvn clean install

- name: run tests (spring-boot-starter)
working-directory: spring-boot/starter
run: mvn clean verify
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Marcin Zielonka

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# OAuth2 Exchange Library for Java

[![Licence: MIT](https://img.shields.io/badge/Licence-MIT-blue.svg)](https://shields.io/)
[![Version: 0.1.0](https://img.shields.io/badge/version-0.1.0-blue.svg)](https://shields.io/)
[![Java : 17](https://img.shields.io/badge/Java-17-orange.svg)](https://jdk.java.net/17/)
[![Open Source](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)

## About
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](https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2) found on DigitalOcen,
the library manages the step 4 (issuing a token from authorization code) and step 5 (receiving token response):

![OAuth2 Authorization Code Flow diagram](https://assets.digitalocean.com/articles/oauth/auth_code_flow.png)

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](https://github.com/mzlnk/oauth2-exchange/wiki).

## Development

The whole project is currently in development, so you can expect plenty of updates over time.

| type | current version |
| ------ | --------------- |
| stable | 0.1.0 |
| latest | 0.1.0-SNAPSHOT |


### Supported auth providers

Currently, the oauth2-exchange library provides *ready-to-use* support for the following auth providers:
- [Facebook](https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/)
- [GitHub](https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps)
- [Google](https://developers.google.com/identity/protocols/oauth2/web-server)
- [Keycloak](https://www.keycloak.org/docs/latest/server_admin/)
- [Microsoft](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow)
- [Okta](https://developer.okta.com/docs/reference/api/oidc/#_2-okta-as-the-identity-platform-for-your-app-or-api)

### See a bug?

Have noticed a bug in a library? Do not hesitate to report it by creating an GitHub issue!

### Want to contribute?

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

## How to install

### Standalone library

#### Using Maven

If you want to use the core library itself in your Maven project - just include the dependency in your `pom.xml` file:
```xml
<dependency>
<groupId>io.mzlnk.oauth2.exchange</groupId>
<artifactId>oauth2-exchange-core</artifactId>
<version>0.1.0</version>
</dependency>
```

#### Using Gradle

If you want to use the core library itself in your Gradle project - just include the dependency `build.gradle` file:
```text
implementation 'io.mzlnk.oauth2.exchange:oauth2-exchange-core:0.1.0'
```

#### Using standalone JAR file

If you want to manually add the core library in your Java project - you can always download the proper JAR file from [Releases](https://github.com/mzlnk/oauth2-exchange/releases) page.


### Starter for Spring Boot

#### Using Maven

If you want to use the Spring Boot starter in your Maven project - just include the dependency in your `pom.xml` file:
```xml
<dependency>
<groupId>io.mzlnk.oauth2.exchange</groupId>
<artifactId>oauth2-exchange-spring-boot-starter</artifactId>
<version>0.1.0</version>
</dependency>
```

#### Using Gradle

If you want to use the core library itself in your Gradle project - just include the dependency `build.gradle` file:
```text
implementation 'io.mzlnk.oauth2.exchange:oauth2-exchange-spring-boot-starter:0.1.0'
```

## Documentation

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](https://github.com/mzlnk/oauth2-exchange/wiki)
which include guides and tutorials. There are also official [Java docs](https://www.javadoc.io/doc/io.mzlnk.oauth2.exchange/oauth2-exchange-core) for core library.

## Credits

This starter is under MIT licence so feel free to use it for your personal or commercial use ;)

Created by Marcin Zielonka
Loading

0 comments on commit aa05b94

Please sign in to comment.