Search code examples
resthyperledgerblockchainhyperledger-composerloopback

How to connect hyperledger composer rest server to own created authentication?


I have a node.js application that authenticate users and generates token. My question is:

    1. How to configure my own created authentication to composer-rest-server?
    1. How to configure the environment variable COMPOSER_PROVIDERS

Solution

  • 1) Using JSON Web Token (JWT)

    2) Environment variables that the composer rest server runs in a multi-user mode, and allows authentication based on passport-jwt

    COMPOSER_PROVIDERS='{
      "jwt": {
        "provider": "jwt",
        "module": "/home/composer/node_modules/custom-jwt.js",
        "secretOrKey": "gSi4WmttWuvy2ewoTGooigPwSDoxwZOy",
        "authScheme": "saml",
        "successRedirect": "/",
        "failureRedirect":"/"
        }
    }