GithubHelp home page GithubHelp logo

big-kahuna-burger / f0 Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 2.66 MB

OIDC Protocol Conforming Identity Provider and a Management Dashboard

Home Page: https://f0-manage.vercel.app

License: MIT License

JavaScript 94.14% EJS 2.97% CSS 2.45% HTML 0.44%
idp issuer jwt jwt-authentication oauth2 oidc oidc-client oidc-server

f0's Introduction

A Auth0 (micro) copy

Requirements

  • Node 18/20
  • Docker

Install

Clone repo, cd to it:

Env

Add env files:

OP ENV (fastify server)
cat <<EOT > services/idp/.env
# IDP Environment Variables
ISSUER=http://localhost:9876/oidc
POSTGRES_PRISMA_URL='postgres://postgres:secret123@localhost:5432/idp'
POSTGRES_URL_NON_POOLING='postgres://postgres:secret123@localhost:5432/idp'
GRANTS_DEBUG=1
DEBUG=oidc:events:*
DASHBOARD_ORIGIN=http://localhost:3036

# after running scripts/init
DASHBOARD_CLIENT_ID=
EOT
Manage ENV (React SPA)
cat <<EOT > services/manage/.env
# React App Environment Variables
PORT=3036
REACT_APP_ISSUER=http://localhost:9876/oidc

# after running scripts/init
DASHBOARD_CLIENT_ID=
EOT

Run installation for services/idp

Daemonize postgres and jaeger on docker

cd services/idp && docker compose up -d

Install deps: it will run client generation and db migrations as well

npm i

Initialize

Makes those default/readonly objects for bootstrapping:

  • Management API ResourceServer
  • Dashboard OidcClient
  • Default Admin Connection
  • Enables Dashboard OidcClient with a Admin Connection
npm run init

After initialization, output will give a client id that needs to be added to env vars

Script that needs user interaction and let's you create account. (TODO, ask for claims other than email/password)

npm run create-account
npm start

Visit well known url: http://localhost:9876/oidc/.well-known/openid-configuration Visit jwks: http://localhost:9876/oidc/jwks

Run installation for services/manage

cd ../manage && npm i
npm start

Visit management app: http://localhost:3036/

f0's People

Contributors

big-kahuna-burger avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

f0's Issues

Implement dynamic connections for interaction router

  • Based on a OidcClient -> ClientConnection -> Connection relation, there will be 0 to N Connections enabled for a client

Given this fact:

  • Implement dynamic connections loading in the login interaction and dynamic plugin mounting the relevant connection configurations, start with Google as first alt example that can be enabled/disabled
  • Implement error when it's 0 saying "Client disabled" or something

Custom SAML

Implement custom custom connection to other IDPs using SAML protocol and expose SAML IDP federation metadata.

Implement proper update of `urn:f0:type`

  1. Changing from m2m/web into native/spa => not allowed
  2. Changing from native/spa into m2m/web => allowed, to be followed up with issuing a secret for a client and (maybe?) adding client_credentials to grant_types.

Token Endpoint Method is nonsecretive when token_endpoint_auth_method is one of (private_key_jwt, none, tls_client_auth, self_signed_tls_client_auth)
Corresponding default grant types: implicit (?), authorization_code, refresh_token

Token Endpoint Method is a secretive when token_endpoint_auth_method is not in above set.
Corresponding default grant types: implicit (?), authorization_code, refresh_token, client_credentials

Social Connections

Implement Social Connections strategies starting with Google and Github

Enforce permissions on manage router

A Management API token should have permissions built in and enforced at v1/manage router, returning 403 then token has insufficient scope.

Additional context
Consider declarative api like fastify-guard, built in is the preferred way of implementation.

Wire up the Authentication Method details related to signup into the Login Prompt

1. Connection parameter

There is no standard auth parameter for connection property, but rather it needs a support trough a extraParams prop with oidc-provider library.
See docs

2. Given a client_id during GET interaction/:uid call, the login screen needs to be dynamic based on following:

  • Load all possible connections for this client and (it's just a DB/internal strategy for now, until social / external IDP/SAML gets implemented)
  • If at least one of those connections has a disabled signup, then the login screen has a disabled signup.
  • If all of those connections have enabled signup, then oldest one is selected as registration target based on the creation timestamp.

3. For a specified connection (connection parameter implemented and client has passed a specific known connection name (id?) in the prop):

  • Load that connection, see if it's enabled for a client, similar to (2.). In case it's disabled - give RP error with description specified connection disabled for a client

Identity Connection Table Schema Design

Right now, there is only single identity connection.
This DB.
So Account,PasswordHash,Identity models are all in single schema.
See the schema layout and disjunct the schema into base schema plus password bound connection/s schemas parts.
Query appropriately.
Ideally N are needed, so something like making/destroying parts of schema for password bound connections on the fly needs to happen with DB server.

Private JWT Endpoint Authn Method

  • Implement adding jwks to oidcClient on load by library

  • storing of n jwks per client when auth method is private_key_jwt
    (RSA 2-4K as PEM/JWK formatted, or X509 cert as PEM/JWK formatted)
    Translate everything into JWK and show diff format on demand.

  • Endpoint to accept PEM or JWK for clientId

  • Render Credentials when private_key_jwt

  • Credential Actions full cycle

Theme switch/contrast issue

A nicer looking light theme.
Right now I just use dark in development, but it should be switchable and also have ability to follow system applied colour scheme.

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.