Giter VIP home page Giter VIP logo

hid-api's Introduction

Humanitarian ID

Status Create image

Installation / Setup

We have a separate hid-stack repo with instructions for running HID locally. Please follow those instructions. You can't run HID locally without the stack.

About the application

Humanitarian ID is an OAuth 2.0 and OpenID Connect server. Most end users will only briefly see HID as they log in, approve a website, and get redirected. It is built with:

  • mongoDB as its database backend
  • node.js + hapi as the server

If you want to use HID within an application that requires a REST API, those docs are here: https://api.humanitarian.id/docs/

Models

  • User: the main and most important model of the API: it stores all the information related to a user
  • Client: an OAuth client application
  • JwtToken: a blacklisted JSON Web Token stored in the database
  • OauthToken: an OAuth token

Controllers

  • AdminController: handles UI for HID Admins.
  • AuthController: handles the creation of JSON Web Tokens and the OpenID Connect process
  • ClientController: CRUD for OAuth clients
  • UserController: CRUD and multiple user related endpoints
  • ViewController: handles UI for HID Auth functions (OAuth + OpenID Connect) and general account management (profile + settings).

Routes

Routes map API endpoints to their respective controller methods. Routes are defined in the config/routes.js file.

Policies

Policies provide access control for the controller methods.

  • AuthPolicy: defines policies to determine if a user is authenticated and if a user is an administrator or not
  • UserPolicy: determines if a user can access controller methods of UserController

Services

Services are helper methods provided to the controllers.

  • EmailService: service to send emails
  • HelperService: various helper functions for controllers
  • JwtService: issues and verifies JSON Web tokens

Configuration files

Configuration files are stored in /config.

  • env/index.js: config for different environments (local, testing, prod)
  • log.js: configure logging
  • main.js: configure trailpacks and paths
  • routes.js: configure routes
  • session.js: configure sessions when authenticating with OpenId Connect
  • web.js: used to configure the web server (hapi)

hid-api's People

Contributors

guillaumev avatar rupl avatar left23 avatar dependabot[bot] avatar teodorescuserban avatar lazysoundsystem avatar amyvbenson avatar orakili avatar cafuego avatar attiks avatar s0 avatar

Stargazers

Steven Hein avatar Rachel Krynski avatar Emerson Rocha avatar  avatar  avatar Erdong avatar Yezid Carrillo avatar Jiří Podhorecký avatar

Watchers

 avatar  avatar Joe Turgeon avatar  avatar James Cloos avatar Emma Jane avatar  avatar CJ Hendrix avatar Hayyaan Ahmad avatar Patrick Hernusi avatar OCHA FIS avatar  avatar Rachel Krynski avatar

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.