Giter Club home page Giter Club logo

veritas's Introduction

veritas

This is an auth0 experimental project.

Requirements

  • Username / password sign-in
  • User registration
  • Social connect sign-in
  • User account linking
  • SAML sign-in
  • WS-Fed sign-in
  • Terraform configuration

Getting Started

In order to use this project the following tools are required:

  1. Follow the instructions in the Terraform README to configure the auth0 infrastructure.
  2. Start the application: yarn start:dev
  3. Navigate to http://localhost:3000 in a browser OR use the veritas.http file to execute REST calls directly to the API.

Flows

Username & Password

Traditional username and password authentication flow.

Registration

A user registers by providing a username and password:

  • Does the user already exist in the database?

    • Yes: return a 201 (to avoid user enumeration attacks)
    • No: continue with the flow
  • Is the user already registered in auth0?

    • Yes: retrieve the auth0_id, and continue with the flow
    • No: create the user in auth0, and continue with the flow
  • Create the user record in the database with the auth0_id

    • Should we allow a user that is registered with a social connection in auth0 to also register using a username and password, and then link the accounts?
  • Return a 201 to the user. (The user should be redirected to a login page)

sequenceDiagram
    actor User
    participant API
    User->>API: /users/registration
    alt exists in db
        API->>User: Return a 201
    else is not in db
        alt exists
            API->>Auth0: getUsersByEmail(email)
            Auth0->>API: Return the user
            Note over API: Create user in db
            API->>User: Return a 201
        else does not exist
            API->>Auth0: createUser(user)
            Auth0->>API: Return the user
            Note over API: Create user in db
            API->>User: Return a 201
        end
    end
Loading

Login

A user logs in by providing a username and password:

  • Does the user exist in the database?

    • Yes: continue with the flow
    • No: return a 404 (to avoid user enumeration attacks): "Invalid username or password"
  • User's credentials are correct in auth0?

    • Yes: continue with the flow (returns a JWT)
    • What action should we take if a user has registered with google-oauth?
    • No: return a 404 (to avoid user enumeration attacks): "Invalid username or password"
  • Return a 200 to the user with the JWT.

sequenceDiagram
    actor User
    participant API
    User->>API: /auth/login
    alt has registered
        API->>Auth0: /oauth/token
        alt valid credentials
            Auth0->>API: Return a JWT
            API->>User: Return a 200 with the JWT
        else invalid credentials
            Auth0->>API: Throws a 401
            API->>User: Return a 404
        end
    else is not registered
        API->>User: Return a 404
    end
Loading

Social Connect

Allow registration and sign-in via a Social Network platform, e.g. Google, Facebook, etc.

A user registers by selecting "Continue with Google" on the registration page:

The user is authenticated in the browser, subsequently the auth0 actions are triggered:

pre-registration

  • Does the user have multiple identities in auth0:

    • Yes:
      • metadata.link_identities = true
    • No:
      • metadata.link_identities = false
  • Does the user exist in the database:

    • Yes:
      • metadata.create_user = false
    • No:
      • metadata.create_user = true
  • Can the identities be requested directly from auth0 in the action?

  • Is there a scenario where a user exists in the database but not in auth0?

post-login

  • metadata.create_user = true:

    • Create user in the database
      • Endpoint needs to be defined
  • metadata.link_identities = true:

    • Link user identities from the API
      • Endpoint needs to be defined

SAML

Allow registration and sign-in via a configured SAML flow.

SAML sign-in requirements:

  • SAML 2.0 standard, a generic solution that will cover more use cases and will help for specific SSO such as Google or Microsoft (Office / Active Directory).
  • External identity provider integration (e.g. Okta, Auth0, etc.)

The implementation of SSO will allow users to create an account and log in to the console using the identity provider they want configured for their organization. They also would like their own groups of users to be reflected in internal roles and permissions.

TODO

  • Allow account linking when their are multiple accounts using the same email address.

  • Determine what Auth0 can store, and how would we extend our Auth0 to access other Okta or Auth0 instances of external companies.

  • Create auth0 actions

  • Create admin panel using Retool

  • What other flows are there?

  • What is the database structure?

  • How are the roles and permissions structured?

  • Create DB schema for organizations, users (members), and roles and permissions.

veritas's People

Contributors

renovate[bot] avatar nicolaspearson avatar renovate-bot avatar

Watchers

 avatar  avatar

veritas's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • fix(): pin express-openid-connect v2.7.2 [security]

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

dockerfile
Dockerfile
  • node 16.13-alpine3.12
  • node 16.13-alpine3.12
github-actions
.github/workflows/markdown.yaml
  • actions/checkout master
.github/workflows/veritas.yaml
  • actions/checkout master
  • actions/setup-node master
npm
.yarn/sdks/eslint/package.json
.yarn/sdks/prettier/package.json
.yarn/sdks/typescript/package.json
package.json
  • $ no version found
  • auth0 ^2.42.0
  • axios ^0.27.2
  • boom ^7.3.0
  • class-transformer-validator ^0.9.1
  • class-validator ^0.13.2
  • dotenv ^16.0.1
  • ejs ^3.1.8
  • express ^4.18.1
  • express-oauth2-jwt-bearer ^1.1.0
  • express-openid-connect ^2.7.1
  • morgan ^1.10.0
  • pg ^8.7.3
  • reflect-metadata ^0.1.13
  • typeorm ^0.2.45
  • @commitlint/cli ^17.0.3
  • @commitlint/config-conventional ^17.0.3
  • @types/auth0 ^2.35.2
  • @types/boom ^7.3.2
  • @types/express ^4.17.13
  • @types/morgan ^1.9.3
  • @types/node ^16.11.43
  • @types/webpack-env ^1.17.0
  • @typescript-eslint/eslint-plugin ^5.30.6
  • @typescript-eslint/parser ^5.30.6
  • eslint ^8.19.0
  • eslint-config-prettier ^8.5.0
  • eslint-import-resolver-node ^0.3.6
  • eslint-import-resolver-typescript ^3.2.5
  • eslint-plugin-eslint-comments ^3.2.0
  • eslint-plugin-import ^2.26.0
  • eslint-plugin-jest ^26.5.3
  • eslint-plugin-node ^11.1.0
  • eslint-plugin-ordered-imports ^0.6.0
  • eslint-plugin-prettier ^4.2.1
  • eslint-plugin-promise ^6.0.0
  • eslint-plugin-unicorn ^43.0.1
  • husky ^8.0.1
  • markdownlint-cli ^0.31.1
  • pinst ^3.0.0
  • prettier ^2.7.1
  • rimraf ^3.0.2
  • run-script-webpack-plugin ^0.1.1
  • ts-loader ^9.3.1
  • ts-node ^10.8.2
  • typescript ^4.7.4
  • webpack ^5.73.0
  • webpack-cli ^4.10.0
  • webpack-pnp-externals ^1.1.0
  • node >=v16.16.0
  • yarn 3.2.1

  • Check this box to trigger a request for Renovate to run again on this repository

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.