OpenId Connect Java Client

A no magic OpenId Connect Java Client for Basic flow

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

io.github.shyamz-22
ArtifactId

ArtifactId

oidc-jvm-client
Last Version

Last Version

0.2.8
Release Date

Release Date

Type

Type

jar
Description

Description

OpenId Connect Java Client
A no magic OpenId Connect Java Client for Basic flow
Project URL

Project URL

https://github.com/shyamz-22/openid-connect-client.git
Source Code Management

Source Code Management

https://github.com/shyamz-22/openid-connect-client.git

Download oidc-jvm-client

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.shyamz-22/oidc-jvm-client/ -->
<dependency>
    <groupId>io.github.shyamz-22</groupId>
    <artifactId>oidc-jvm-client</artifactId>
    <version>0.2.8</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.shyamz-22/oidc-jvm-client/
implementation 'io.github.shyamz-22:oidc-jvm-client:0.2.8'
// https://jarcasting.com/artifacts/io.github.shyamz-22/oidc-jvm-client/
implementation ("io.github.shyamz-22:oidc-jvm-client:0.2.8")
'io.github.shyamz-22:oidc-jvm-client:jar:0.2.8'
<dependency org="io.github.shyamz-22" name="oidc-jvm-client" rev="0.2.8">
  <artifact name="oidc-jvm-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.shyamz-22', module='oidc-jvm-client', version='0.2.8')
)
libraryDependencies += "io.github.shyamz-22" % "oidc-jvm-client" % "0.2.8"
[io.github.shyamz-22/oidc-jvm-client "0.2.8"]

Dependencies

compile (6)

Group / Artifact Type Version
com.mashape.unirest : unirest-java jar 1.4.9
com.nimbusds : nimbus-jose-jwt jar 5.4
com.github.ben-manes.caffeine : caffeine jar 2.6.1
com.fasterxml.jackson.core : jackson-core jar 2.9.3
com.fasterxml.jackson.module : jackson-module-kotlin jar 2.9.3
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.2.30

test (5)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 4.0.0
org.assertj : assertj-core jar 3.9.0
com.github.tomakehurst : wiremock jar 2.14.0
org.mockito : mockito-all jar 1.10.19
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

OpenID Connect JVM client

codecov MavenCentral License: Apache-2.0

OpenId Connect Client written in Kotlin.

OpenID in a nutshell

A Gist of OpenID Connect

This client is implemented with reference to OpenID Connect Basic Client Implementer's Guide

OpenID connect Basic Flow

OpenID basic flow

Installation

Gradle

compile 'io.github.shyamz-22:oidc-jvm-client:$version'

Maven

<dependency>
    <groupId>io.github.shyamz-22</groupId>
    <artifactId>oidc-jvm-client</artifactId>
    <version>${version}</version>
</dependency>

How to use the library

Kotlin

  • Step 1: Load Client Configuration
 ClientConfiguration.
               .with()
               .client("<your-client-id>",
               "<your-redirect-uri>",
               "<your-secret>")
               .issuer("<issuer-url>")
  • Step 2: Make an Authentication Request
AuthenticationRequestBuilder()
                        .basic()
                        .build()
                        .andRedirect(response);
  • Step 3: Exchange Code for access token and id token
val user = OpenIdConnectCallBackInterceptor(httpServletRequest)
                .extractCode()
                .exchangeCodeForTokens()
                .extractAuthenticatedUserInfo();

Java

  • Step 1: Load Client Configuration
 ClientConfiguration.INSTANCE
               .with()
               .client("<your-client-id>",
               "<your-redirect-uri>",
               "<your-secret>")
               .issuer("<issuer-url>")
  • Step 2: Make an Authentication Request
new AuthenticationRequestBuilder()
                        .basic()
                        .build()
                        .andRedirect(response);
  • Step 3: Exchange Code for access token and id token
AuthenticatedUser user = new OpenIdConnectCallBackInterceptor(httpServletRequest)
                .extractCode(null)
                .exchangeCodeForTokens()
                .extractAuthenticatedUserInfo(null);

References

  1. OpenID Connect Specification
  2. OpenID connect playground
  3. JWT

Versions

Version
0.2.8
0.2.6
0.2.5