GithubHelp home page GithubHelp logo

kaliop / oidc-sample-provider Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 62 KB

Demo OpenID Connect identity provider in NodeJS (tutorial mode)

License: MIT License

JavaScript 76.18% CSS 1.16% HTML 22.66%

oidc-sample-provider's Introduction

oidc-sample-provider

Demo OpenID Connect identity provider in NodeJS (tutorial mode)

Tutoral

Requirements

NodeJS >= 8.16

Init

Clone the sources:

git clone https://github.com/kaliop/oidc-sample-provider.git && cd oidc-sample-provider

Fetch the start tag to get the boostrap:

git checkout start

Install main depencencies:

npm install

Start the application:

npm start

Go to http://localhost:4000

Step 1: init userAuthorize endpoint

checkout step-01

Check if all the required request parameters are present with good values:

  • response_type: must be equal to "code".

  • scope: specifies which user data the service requires.
    Space delimited list of keywords ('openid', 'profile', 'email', 'address', 'phone'). At least "openid" is required. The other are optional.

  • client_id: must be found in the knwon allowed clients list (see default config file)

  • redirect_uri: must match the configured redirect_uri for the client.

Step 2: Redirect to loginCallback

checkout step-02

Generate a callback redirection with following parameters, according to specifications:

  • code: random value
  • state: value of state parameter from input request, if present.

Step 3: init Token Endpoint

checkout step-03

Initiate the Token Endpoint:

  • check the mandatory parameters
  • return a JSON object

Step 4: Token Endpoint - validate code and return token data

checkout step-04

  • use a dummy key/value in-memory storage service (use it only for tutorial purpose !) to share some data between the user session and the Access Token Endpoint.
  • generate a random "access_token" value and store it as key with UserInfo as value.
  • generate a random "code" value and store it as key with {access_token, id_token} as value.

Step 5: generate a valid ID Token

checkout step-05

The ID Token must be a valid JWT that follows OIDC ID Token specifications. We use nJwt library to generate it.

Step 6: UserInfo Endpoint

checkout step-06

Fetch the user info that are stored within the in-memory storage, related to the request's access_token header.

Step 7: Consent form

checkout step-07

Step 8: update consents

checkout step-08

Step 9: Logout propagation

checkout step-09

Implement the logout propagation (see RP-Initiated Logout):

Resources

oidc-sample-provider's People

Watchers

 avatar  avatar

Forkers

sunnypardeshi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.