https://github.com/shyamz-22/openid-connect-client
OpenId Connect Java Client
https://github.com/shyamz-22/openid-connect-client
java jvm-languages kotlin openid-connect openid-connect-basic-client spring-security
Last synced: 5 months ago
JSON representation
OpenId Connect Java Client
- Host: GitHub
- URL: https://github.com/shyamz-22/openid-connect-client
- Owner: shyamz-22
- License: apache-2.0
- Created: 2018-01-13T10:08:29.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T15:57:49.000Z (over 7 years ago)
- Last Synced: 2025-04-11T15:15:40.428Z (8 months ago)
- Topics: java, jvm-languages, kotlin, openid-connect, openid-connect-basic-client, spring-security
- Language: Kotlin
- Size: 898 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenID Connect JVM client
[](https://codecov.io/gh/shyamz-22/openid-connect-client) [](https://maven-badges.herokuapp.com/maven-central/io.github.shyamz-22/oidc-jvm-client) [](https://opensource.org/licenses/Apache-2.0)
OpenId Connect Client written in Kotlin.
# OpenID in a nutshell
A Gist of [OpenID Connect](securingApplications.pdf)
This client is implemented with reference to [OpenID Connect Basic Client Implementer's Guide](https://openid.net/specs/openid-connect-basic-1_0.html)
# OpenID connect Basic Flow

## Installation
### Gradle
```gradle
compile 'io.github.shyamz-22:oidc-jvm-client:$version'
```
### Maven
```xml
io.github.shyamz-22
oidc-jvm-client
${version}
```
# How to use the library
## Kotlin
- Step 1: Load Client Configuration
```kotlin
ClientConfiguration.
.with()
.client("",
"",
"")
.issuer("")
```
- Step 2: Make an Authentication Request
```kotlin
AuthenticationRequestBuilder()
.basic()
.build()
.andRedirect(response);
```
- Step 3: Exchange Code for access token and id token
```kotlin
val user = OpenIdConnectCallBackInterceptor(httpServletRequest)
.extractCode()
.exchangeCodeForTokens()
.extractAuthenticatedUserInfo();
```
## Java
- Step 1: Load Client Configuration
```java
ClientConfiguration.INSTANCE
.with()
.client("",
"",
"")
.issuer("")
```
- Step 2: Make an Authentication Request
```java
new AuthenticationRequestBuilder()
.basic()
.build()
.andRedirect(response);
```
- Step 3: Exchange Code for access token and id token
```java
AuthenticatedUser user = new OpenIdConnectCallBackInterceptor(httpServletRequest)
.extractCode(null)
.exchangeCodeForTokens()
.extractAuthenticatedUserInfo(null);
```
# References
1. [OpenID Connect Specification](https://openid.net/specs/openid-connect-core-1_0.html)
2. [OpenID connect playground](https://openidconnect.net/)
3. [JWT](https://jwt.io/)