2.2.1 • Published 4 months ago

@jrposada/pm-creds v2.2.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

PM Creds

Version Downloads Install Size

Getting started

  1. Install

    npm i @jrposada/pm-creds -g
  2. Create config files and self-signed certificates

    pm-creds init
  3. Start server

    pm-creds

    You may also use run command as a daemon

    pm-creds --daemon

    To stop daemon process

    pm-creds stop

Install Self Signed Certificate

Windows

  1. Open Manage user certificates. Press Windows logo key and search Manage user certificates
  2. Select Trusted Root Certification Authorities from the list.
  3. Go to Action -> All Tasks -> Import...
  4. Select ~/.pm-creds/ca.crt

Configure Postman

Add the next pre-script to postman. It will request the target AWS profile define through aws_profile and inject the tokens it into the request. For AWS you also need to select "AWS Signature" as auth method:

Postman Auth Tab

let profile = pm.collectionVariables.get("aws_profile");

if (!profile) {
    profile = pm.environment.get("aws_profile")
}

if (!profile) {
    throw new Error("'aws_profile' variable not set")
}

pm.sendRequest({
    url: `https://localhost:9999/aws/${profile}`,
    method: "GET",
    }, function (_, response) {
        if (response.status == "OK") {
            const body = response.json()
            pm.variables.set("aws_access_key_id", body.aws_access_key_id)
            pm.variables.set("aws_secret_access_key", body.aws_secret_access_key)
            if (body.aws_session_token) {
                pm.variables.set("aws_session_token", body.aws_session_token)
            }
            console.log(`using aws credentials from '${profile}'`)
            return
        } else {
            console.log(err)
            throw new Error(response.text() || JSON.stringify(err) || "unknown error fetching aws credentials")
        }
    }
)

Postman certificates

This step is only needed if certificates where not installed through the system.

Postman Certificates

2.2.1

4 months ago

2.2.0

4 months ago

2.1.0

5 months ago

2.0.0

6 months ago

1.1.0

8 months ago

1.0.1

10 months ago

1.0.0

10 months ago