Coder Social home page Coder Social logo

namdao2000 / sso Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3.5 MB

Serverless Single Sign-on (SSO) service implemented using CloudFlare workers

Home Page: https://sso.namdao.dev

License: MIT License

TypeScript 69.32% JavaScript 3.32% Shell 2.22% HTML 25.14%
sso oauth serverless

sso's Introduction

Description

Live Demo

This is a Serverless SSO service for my web applications. Its powered by Bcryptjs for password hashing, Jose for JWT and Worktop's Router for routing HTTP requests.

Due to the limitation of the worker's 10ms cpu limit, passwords are only hashed up to 5 salt rounds (The recommended is 10). Users info are stored in Workers KV, a globally distributed, eventually consistent key value store.

This costs $0 to maintain, due to Cloudflare's generous workers free teir (100,000 req/day). Noice ๐Ÿ˜Ž

Endpoints

Full API Documentation

- GET /public-key

- POST /login

- POST /signup

- POST /verify-jwt

Running in development

  1. Make sure you have wrangler and nvm installed.
  2. Run nvm install to install the correct Nodejs version.
  3. Run sh generate-ecdsa-keypair.sh. This will create an .env file and add PUBLIC_KEY and PRIVATE_KEY to it.
  4. Run npm run dev.

Deploying to production

  1. Make sure you have wrangler and nvm installed.
  2. Run nvm install to install the correct Nodejs version.
  3. Go to the Workers dashboard, create a new project called sso.
  4. Go to the Workers KV dashboard, make sure USER namespace is created.
  5. Run wrangler secret put PUBLIC_KEY and type in your public key.
  6. Run wrangler secret put PRIVATE_KEY and type in your private key.
  7. Run wrangler publish.

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.