Giter Club home page Giter Club logo

checkerboard's Introduction

Checkerboard

Checkerboard is a FastAPI service to map user identities between systems with their own concepts of identity. Currently, only mapping between Slack users and GitHub users is supported. Slack users are associated with GitHub users via a custom field in the Slack profile. The default field name is "GitHub Username".

This is an Rubin Observatory DM SQuaRE Roundtable microservice, developed with the Safir framework.

Usage

Use checkerboard run to start the service. By default, it will run on port 8080. This can be changed with the --port option.

Configuration

The following environment variables must be set in Checkerboard's runtime environment.

  • CHECKERBOARD_USERNAME: The HTTP Basic Authentication user expected
  • CHECKERBOARD_PASSWORD: The HTTP Basic Authentication password expected
  • CHECKERBOARD_SLACK_TOKEN: Slack bot token with users:read and users.profile:read scopes
  • CHECKERBOARD_REDIS_PASSWORD: The password for Checkerboard to communicate with its Redis instance.

The following environment variables may optionally be set to change default behavior.

  • SAFIR_PROFILE: Set to production to enable production logging
  • SAFIR_LOG_LEVEL: Set to DEBUG, INFO, WARNING, or ERROR to change the log level. The default is INFO.
  • CHECKERBOARD_PROFILE_FIELD: The name of the custom field in Slack from which to obtain the GitHub username. The default is GitHub Username.
  • CHECKERBOARD_REFRESH_INTERVAL: How frequently (in seconds) to refresh the Slack <-> GitHub mapping. This takes about 10 minutes for 2,000 users, so do not lower this too much. The default is 3600 (one hour).

Routes

Checkerboard has a / health-check route exposing metadata; /checkerboard/ gives the same data under the _metadata key. This does not require authentication.

It has the standard set of documentation endpoints at /checkerboard/docs, /checkerboard/redoc, and /checkerboard/openapi.json. These routes, too, do not require authentication.

All other requests must be authenticated with HTTP Basic Authentication using the username and password defined by the CHECKERBOARD_USERNAME and CHECKERBOARD_PASSWORD environment variables. The routes and their expected parameters are available at the documentation endpoints. They are as follows:

  • /checkerboard/slack: Returns all known Slack to GitHub user mappings. The Slack user ID is the key, and the lowercased representation of the GitHub username (or, more generally, the contents of the field specified in the service) is the value.

  • /checkerboard/slack/<user>: Returns a JSON object whose key is <user>, which is a Slack id (not a display name), and whose value is the corresponding GitHub user. Returns a 404 if either the user ID is not found, or there is no corresponding GitHub user.

  • /checkerboard/github/<user>: Returns a JSON object whose value is <user> and whose key is the corresponding Slack user id. Returns a 404 if there is no GitHub username <user> (not case-sensitive) mapped to a Slack user. The GitHub username in the returned value will always have the same capitalization as the query, regardless of the actual username at GitHub.

Deployment

Checkerboard is deployed as a standard Phalanx application.

Naming

Checkerboard is a (very simple) federated identity service used by the SQuaRE tem at the Rubin Observatory. A checkerboard is a federation of squares.

checkerboard's People

Contributors

athornton avatar dependabot-preview[bot] avatar dependabot[bot] avatar rra avatar sqrbot avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  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.