Coder Social home page Coder Social logo

cyralinc / jwt-cyral-sar-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danperovich/jwt-cyral-sar-project

0.0 1.0 0.0 61 KB

A simple NodeJS app demonstrating JWT WebApp authorization coupled with Cyral Service Account Resolution using query annotation.

Shell 2.38% JavaScript 97.62%

jwt-cyral-sar-project's Introduction

jwt-cyral-sar-project

A simple NodeJS app demonstrating JWT WebApp authorization coupled with Cyral Service Account Resolution using query annotation.

Installation / Setup

  1. Create an .env file before running the application. Use the .env.example file as a template.
  2. Run npm install
  3. Run one of the following:
  • npm run original
  • npm run sar
  • npm run sarV2
  1. Import the Postman collection and environment files from the JWT-PROJECT/postman folder
  2. Optional: use the register POST to create a new username/password combination in the Mongo database you have configured in your .env file. These users are persisted in the MongoDB, so no need execute this step upon every restart of the webapp
  3. Use the login POST to generate a JWT token
  4. Save the token from the response in step 6 to the {{currentJwtToken}} Postman variable
  5. Send the welcome GET (optionally sending the limit querystring paramter)

Note: Please see the Cyral documentation (https://docs.cyral.com) for Cyral Control Plane-side configuration details to enable Custom Application Service Account Resolution for PostgreSQL.

Features per Environment:

  • original - Sends the SELECT query to the PostgreSQL database you have configured in your .evn file. Optionally, you can send a "limit" querystring parameter with an integer to control the literal used in the SQL LIMIT contraint. If the querystring is not specified, it is defaulted to a value of 1
  • sar - demonstrates how the user email from the JWT can be passed to Cyral using a CyralContext query comment
  • sarV2 - builts upon the "sar" version to demonstrated passing arbitrary key value pairs within the CyralContext. The policies_samples/additionalChecksForCyralContext.yaml file contains an example of how the arbitrary key value pairs can be targeted

jwt-cyral-sar-project's People

Contributors

danperovich avatar olanetsoft avatar

Watchers

 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.