Git Product home page Git Product logo

dune-privacy-demo's Introduction

Dune Privacy Demo

Use this application to configure your an OIDC application that illustrates purpose-aware OAuth scopes and native purpose-aware consent. The application is built with Node.js, the Verify OAuth SDK and the Verify Privacy SDK. All UI assets can be found under views and public. All views are written using vanilla HTML and JS and templated using Handlebars.

This application uses IBM Security Verify as the identity provider to illustrate the capabilities.

In this app, you can do the following -

  • Authenticating the client using IBM Security Verify with one or more purpose-aware scopes
  • Viewing the authenticated user's profile by unpacking the id_token
  • Simulating a shopping cart consent experience, where the user's email and address is requested as part of the checkout process for the purpose of shipping purchases.

Pre-requisites

  1. Install Node and Git on your machine
  2. Create a tenant on IBM Security Verify
  3. Clone this repo to your machine

Setup

Admin: Create attributes

  1. Login to IBM Security Verify admin console (https://yourtenant.verify.ibm.com/ui/admin) using admin

  2. Go to Configuration > Attributes

  3. Add a new custom attribute with the ID home_address. When saved, it should look like this.

Admin/Privacy Officer: Add data privacy items

  1. Login to IBM Security Verify admin console (https://yourtenant.verify.ibm.com/ui/admin) using admin or privacy officer credentials

  2. Go to Data privacy & consent > Purposes

  3. Add purpose with ID marketing and 3 user attributes - email, mobile_number and work_number. Set access type as default. When saved and published, it should look like this.

  4. Add purpose with ID profilemgmt and 5 user attributes - mobile_number, given_name, family_name, display_name, email. Create two new access types during the creation of the purpose with the ID read and write. When saved and published, it should look like this.

  5. Add purpose with ID shipping and 3 user attributes - Home Address, mobile_number, email. Set access type as default. When saved and published, it should look like this.

Admin: Create an application

  1. Login to IBM Security Verify admin console (https://yourtenant.verify.ibm.com/ui/admin) using admin credentials

  2. Go to Applications

  3. Click on Add Application and add a Custom Application

  4. Fill in the name of the application etc. in the General tab.

  5. Switch to the Sign On tab and choose Open ID Connect as the Sign-on method.

  6. Enter an application URL. If you are running this app locally, use http://localhost:3000

  7. Verify that Authorization code is selected the grant type

  8. Uncheck Require proof key for code exchange (PKCE) verification.

  9. Add the redirect URI as http://localhost:3000/auth/callback if you are running this locally. If you hosting this somewhere, replace the hostname and protocol as appropriate.

  10. Uncheck "Restrict Custom Scopes"

  11. Click Save.

  12. In the Entitlements tab, choose Automatic access for all users and groups. Click Save.

  13. In the Privacy tab, add the Marketing, Profile Management and Shipping purposes.

Setup the application

  1. Copy the dotenv file and name the new file .env.

  2. Change the TENANT_URL, ClIENT_ID and CLIENT_SECRET. The client ID and secret are obtained from the application that was created in the previous section.

Run the application

  1. Install node dependencies

    npm install
  2. Run the application. You should see Server started and listening on port 3000 after executing the command below.

    npm start
  3. Open the browser and go to http://localhost:3000 and you should be able to use the application

  4. If everything is correctly setup, you should be redirected to authenticate with your tenant. On authentication, you should be presented with a consent page as below. This demonstrates the OAuth integration using the special format of the scope (see the SCOPE in the .env file).

  5. Click on Cart once you login and you should see a consent prompt for shipping purpose. This demonstrates the native integration with APIs.

dune-privacy-demo's People

Contributors

vivshankar avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

dune-privacy-demo's Issues

DeprecationWarning on package.json

When I run the application under node 16.4, I see the following warning on application start:

(node:21756) [DEP0128] DeprecationWarning: Invalid 'main' field in '.../git/dune-privacy-demo/node_modules/verify-dpcm-sdk-js/package.json' of 'lib/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)

If I run with the trace-deprecation flag, as suggested, I get this output:

$ node --trace-deprecation server/server.js 
(node:22467) [DEP0128] DeprecationWarning: Invalid 'main' field in '.../git/dune-privacy-demo/node_modules/verify-dpcm-sdk-js/package.json' of 'lib/index.js'. Please either fix that or report it to the module author
    at tryPackage (node:internal/modules/cjs/loader:360:15)
    at Function.Module._findPath (node:internal/modules/cjs/loader:562:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:927:27)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/Users/jonharry/git/dune-privacy-demo/server/controllers/users-controller.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)

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.