Support postman basic, digest, bearer, oauth, and aws auth (#1244)

Add support for importing 5 new authentication types from both
Postman v2.0 and v2.1 import formats.

- Basic Auth (Fixes #1235)
- Bearer Tokens (Fixes #1236)
- Digest Auth username and password (Fixes #1237)
- AWS IAMv4 Authentication (Fixes #1241)
- Oauth 1.0 and Oauth 2.0 (Fixes #1240)

Note: For Oauth2.0 this means setting authorization to Oauth2 but
generating a disabled config, since postman does not export anything we
can use to fill our config values.
This commit is contained in:
Joe Bauser 2018-11-05 19:38:43 -05:00 committed by Gregory Schier
parent dcfa960be1
commit 182acbef2b
33 changed files with 2101 additions and 1108 deletions

8
package-lock.json generated
View File

@ -4546,13 +4546,15 @@
"version": "1.0.0",
"resolved": false,
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": false,
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -4575,7 +4577,8 @@
"version": "0.0.1",
"resolved": false,
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
@ -4742,6 +4745,7 @@
"resolved": false,
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "insomnia-cookies",
"version": "0.0.9",
"version": "0.0.10",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "insomnia-importers",
"version": "2.0.8",
"version": "2.0.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -0,0 +1,33 @@
{
"info": {
"_postman_id": "994955c9-397a-494e-820e-294cbd76c318",
"name": "AWS Signature Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "AWS Signature",
"request": {
"auth": {
"type": "awsv4",
"awsv4": {
"sessionToken": "aws-session-token",
"service": "aws-service-name",
"region": "aws-region",
"secretKey": "aws-secret-key",
"accessKey": "aws-access-key"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}

View File

@ -0,0 +1,37 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "AWS Signature Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "AWS Signature",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"accessKeyId": "aws-access-key",
"disabled": false,
"region": "aws-region",
"secretAccessKey": "aws-secret-key",
"service": "aws-service-name",
"sessionToken": "aws-session-token",
"type": "iam"
}
}
]
}

View File

@ -0,0 +1,57 @@
{
"info": {
"_postman_id": "994955c9-397a-494e-820e-294cbd76c318",
"name": "AWS Signature Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "AWS Signature",
"request": {
"auth": {
"type": "awsv4",
"awsv4": [
{
"key": "sessionToken",
"value": "aws-session-token",
"type": "string"
},
{
"key": "service",
"value": "aws-service-name",
"type": "string"
},
{
"key": "region",
"value": "aws-region",
"type": "string"
},
{
"key": "secretKey",
"value": "aws-secret-key",
"type": "string"
},
{
"key": "accessKey",
"value": "aws-access-key",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}

View File

@ -0,0 +1,37 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "AWS Signature Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "AWS Signature",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"accessKeyId": "aws-access-key",
"disabled": false,
"region": "aws-region",
"secretAccessKey": "aws-secret-key",
"service": "aws-service-name",
"sessionToken": "aws-session-token",
"type": "iam"
}
}
]
}

View File

@ -0,0 +1,30 @@
{
"info": {
"_postman_id": "229681fe-8c82-44c3-a741-b3dc7dfa870f",
"name": "Basic Auth Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Basic Auth",
"request": {
"auth": {
"type": "basic",
"basic": {
"password": "basic-password",
"username": "basic-username"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}

View File

@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Basic Auth Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Basic Auth",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"password": "basic-password",
"type": "basic",
"username": "basic-username"
}
}
]
}

View File

@ -0,0 +1,42 @@
{
"info": {
"_postman_id": "229681fe-8c82-44c3-a741-b3dc7dfa870f",
"name": "Basic Auth Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Basic Auth",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "basic-password",
"type": "string"
},
{
"key": "username",
"value": "basic-username",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}

View File

@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Basic Auth Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Basic Auth",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"password": "basic-password",
"type": "basic",
"username": "basic-username"
}
}
]
}

View File

@ -0,0 +1,29 @@
{
"info": {
"_postman_id": "77937747-606b-4086-b4e5-7bc776849a13",
"name": "Bearer Token Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Bearer Token",
"request": {
"auth": {
"type": "bearer",
"bearer": {
"token": "bearer-token-value"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}

View File

@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Bearer Token Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Bearer Token",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"prefix": "",
"token": "bearer-token-value",
"type": "bearer"
}
}
]
}

View File

@ -0,0 +1,37 @@
{
"info": {
"_postman_id": "77937747-606b-4086-b4e5-7bc776849a13",
"name": "Bearer Token Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Bearer Token",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "bearer-token-value",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}

View File

@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Bearer Token Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Bearer Token",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"prefix": "",
"token": "bearer-token-value",
"type": "bearer"
}
}
]
}

View File

@ -0,0 +1,35 @@
{
"info": {
"_postman_id": "8bfb46b0-4a02-4941-b46f-bba11fadd681",
"name": "Digest Authentication Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Digest Auth",
"request": {
"auth": {
"type": "digest",
"digest": {
"nonceCount": "digest-nonce-count",
"qop": "digest-qop",
"algorithm": "MD5",
"nonce": "digest-nonce",
"realm": "digest-realm",
"password": "guest",
"username": "guest"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://jigsaw.w3.org/HTTP/Digest/"
},
"response": []
}
]
}

View File

@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Digest Authentication Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://jigsaw.w3.org/HTTP/Digest/",
"name": "Digest Auth",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"password": "guest",
"type": "digest",
"username": "guest"
}
}
]
}

View File

@ -0,0 +1,68 @@
{
"info": {
"_postman_id": "8bfb46b0-4a02-4941-b46f-bba11fadd681",
"name": "Digest Authentication Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Digest Auth",
"request": {
"auth": {
"type": "digest",
"digest": [
{
"key": "nonceCount",
"value": "digest-nonce-count",
"type": "string"
},
{
"key": "qop",
"value": "digest-qop",
"type": "string"
},
{
"key": "algorithm",
"value": "MD5",
"type": "string"
},
{
"key": "nonce",
"value": "digest-nonce",
"type": "string"
},
{
"key": "realm",
"value": "digest-realm",
"type": "string"
},
{
"key": "password",
"value": "guest",
"type": "string"
},
{
"key": "username",
"value": "guest",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://jigsaw.w3.org/HTTP/Digest/",
"protocol": "https",
"host": ["jigsaw", "w3", "org"],
"path": ["HTTP", "Digest", ""]
}
},
"response": []
}
]
}

View File

@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Digest Authentication Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://jigsaw.w3.org/HTTP/Digest/",
"name": "Digest Auth",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"password": "guest",
"type": "digest",
"username": "guest"
}
}
]
}

View File

@ -0,0 +1,155 @@
{
"info": {
"_postman_id": "7864cdf9-3256-42ce-9afb-1a75fe6555bc",
"name": "Oauth 1.0 Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Added to Request Body/URL",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": false,
"addEmptyParamsToSign": true,
"realm": "realm-value",
"nonce": "nonce-value",
"timestamp": "timestamp-value",
"tokenSecret": "token-secret-value",
"token": "access-token-value",
"consumerSecret": "consumer-secret-value",
"consumerKey": "consumer-key-value",
"signatureMethod": "HMAC-SHA1",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Added to Request Headers",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": true,
"addEmptyParamsToSign": true,
"realm": "realm-value",
"nonce": "nonce-value",
"timestamp": "timestamp-value",
"tokenSecret": "token-secret-value",
"token": "access-token-value",
"consumerSecret": "consumer-secret-value",
"consumerKey": "consumer-key-value",
"signatureMethod": "HMAC-SHA1",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Signature Method PLAINTEXT",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": true,
"addEmptyParamsToSign": true,
"realm": "plaintext-realm-value",
"nonce": "plaintext-nonce-value",
"timestamp": "plaintext-timestamp-value",
"tokenSecret": "plaintext-token-secret-value",
"token": "plaintext-access-token-value",
"consumerSecret": "plaintext-consumer-secret-value",
"consumerKey": "plaintext-consumer-key-value",
"signatureMethod": "PLAINTEXT",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Signature Method HMAC-SHA256",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": true,
"addEmptyParamsToSign": true,
"realm": "sha256-realm-value",
"nonce": "sha256-nonce-value",
"timestamp": "sha256-timestamp-value",
"tokenSecret": "sha256-token-secret-value",
"token": "sha256-access-token-value",
"consumerSecret": "sha256-consumer-secret-value",
"consumerKey": "sha256-consumer-key-value",
"signatureMethod": "HMAC-SHA256",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Signature Method HMAC-SHA1",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": true,
"addEmptyParamsToSign": true,
"realm": "sha1-realm-value",
"nonce": "sha1-nonce-value",
"timestamp": "sha1-timestamp-value",
"tokenSecret": "sha1-token-secret-value",
"token": "sha1-access-token-value",
"consumerSecret": "sha1-consumer-secret-value",
"consumerKey": "sha1-consumer-key-value",
"signatureMethod": "HMAC-SHA1",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}

View File

@ -0,0 +1,156 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Oauth 1.0 Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Body/URL",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "consumer-key-value",
"consumerSecret": "consumer-secret-value",
"disabled": false,
"nonce": "nonce-value",
"privateKey": "",
"realm": "realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "timestamp-value",
"tokenKey": "access-token-value",
"tokenSecret": "token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_2__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Headers",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "consumer-key-value",
"consumerSecret": "consumer-secret-value",
"disabled": false,
"nonce": "nonce-value",
"privateKey": "",
"realm": "realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "timestamp-value",
"tokenKey": "access-token-value",
"tokenSecret": "token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_3__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method PLAINTEXT",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "plaintext-consumer-key-value",
"consumerSecret": "plaintext-consumer-secret-value",
"disabled": false,
"nonce": "plaintext-nonce-value",
"privateKey": "",
"realm": "plaintext-realm-value",
"signatureMethod": "PLAINTEXT",
"timestamp": "plaintext-timestamp-value",
"tokenKey": "plaintext-access-token-value",
"tokenSecret": "plaintext-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_4__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method HMAC-SHA256",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "sha256-consumer-key-value",
"consumerSecret": "sha256-consumer-secret-value",
"disabled": false,
"nonce": "sha256-nonce-value",
"privateKey": "",
"realm": "sha256-realm-value",
"signatureMethod": "HMAC-SHA256",
"timestamp": "sha256-timestamp-value",
"tokenKey": "sha256-access-token-value",
"tokenSecret": "sha256-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_5__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method HMAC-SHA1",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "sha1-consumer-key-value",
"consumerSecret": "sha1-consumer-secret-value",
"disabled": false,
"nonce": "sha1-nonce-value",
"privateKey": "",
"realm": "sha1-realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "sha1-timestamp-value",
"tokenKey": "sha1-access-token-value",
"tokenSecret": "sha1-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
}
]
}

View File

@ -0,0 +1,395 @@
{
"info": {
"_postman_id": "7864cdf9-3256-42ce-9afb-1a75fe6555bc",
"name": "Oauth 1.0 Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Added to Request Body/URL",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": false,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA1",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Added to Request Headers",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": true,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA1",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Signature Method PLAINTEXT",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": true,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "plaintext-realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "plaintext-nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "plaintext-timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "plaintext-token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "plaintext-access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "plaintext-consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "plaintext-consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "PLAINTEXT",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Signature Method HMAC-SHA256",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": true,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "sha256-realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "sha256-nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "sha256-timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "sha256-token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "sha256-access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "sha256-consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "sha256-consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA256",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Signature Method HMAC-SHA1",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": true,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "sha1-realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "sha1-nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "sha1-timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "sha1-token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "sha1-access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "sha1-consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "sha1-consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA1",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}

View File

@ -0,0 +1,156 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Oauth 1.0 Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Body/URL",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "consumer-key-value",
"consumerSecret": "consumer-secret-value",
"disabled": false,
"nonce": "nonce-value",
"privateKey": "",
"realm": "realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "timestamp-value",
"tokenKey": "access-token-value",
"tokenSecret": "token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_2__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Headers",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "consumer-key-value",
"consumerSecret": "consumer-secret-value",
"disabled": false,
"nonce": "nonce-value",
"privateKey": "",
"realm": "realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "timestamp-value",
"tokenKey": "access-token-value",
"tokenSecret": "token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_3__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method PLAINTEXT",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "plaintext-consumer-key-value",
"consumerSecret": "plaintext-consumer-secret-value",
"disabled": false,
"nonce": "plaintext-nonce-value",
"privateKey": "",
"realm": "plaintext-realm-value",
"signatureMethod": "PLAINTEXT",
"timestamp": "plaintext-timestamp-value",
"tokenKey": "plaintext-access-token-value",
"tokenSecret": "plaintext-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_4__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method HMAC-SHA256",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "sha256-consumer-key-value",
"consumerSecret": "sha256-consumer-secret-value",
"disabled": false,
"nonce": "sha256-nonce-value",
"privateKey": "",
"realm": "sha256-realm-value",
"signatureMethod": "HMAC-SHA256",
"timestamp": "sha256-timestamp-value",
"tokenKey": "sha256-access-token-value",
"tokenSecret": "sha256-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_5__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method HMAC-SHA1",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "sha1-consumer-key-value",
"consumerSecret": "sha1-consumer-secret-value",
"disabled": false,
"nonce": "sha1-nonce-value",
"privateKey": "",
"realm": "sha1-realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "sha1-timestamp-value",
"tokenKey": "sha1-access-token-value",
"tokenSecret": "sha1-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
}
]
}

View File

@ -0,0 +1,50 @@
{
"info": {
"_postman_id": "acf8fcf9-f63b-4bf8-93a9-c95cee40bde4",
"name": "Oauth 2.0 Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Added to Request URL",
"request": {
"auth": {
"type": "oauth2",
"oauth2": {
"accessToken": "oauth2.0-access-token-url",
"addTokenTo": "queryParams"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Added to Request Headers",
"request": {
"auth": {
"type": "oauth2",
"oauth2": {
"accessToken": "oauth2.0-adccess-token-headers",
"addTokenTo": "header"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}

View File

@ -0,0 +1,58 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Oauth 2.0 Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request URL",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": true,
"accessTokenUrl": "",
"authorizationUrl": "",
"grantType": "authorization_code",
"password": "",
"type": "oauth2",
"username": ""
}
},
{
"_id": "__REQ_2__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Headers",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": true,
"accessTokenUrl": "",
"authorizationUrl": "",
"grantType": "authorization_code",
"password": "",
"type": "oauth2",
"username": ""
}
}
]
}

View File

@ -0,0 +1,74 @@
{
"info": {
"_postman_id": "acf8fcf9-f63b-4bf8-93a9-c95cee40bde4",
"name": "Oauth 2.0 Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Added to Request URL",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "accessToken",
"value": "oauth2.0-access-token-url",
"type": "string"
},
{
"key": "addTokenTo",
"value": "queryParams",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Added to Request Headers",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "accessToken",
"value": "oauth2.0-adccess-token-headers",
"type": "string"
},
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}

View File

@ -0,0 +1,58 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Oauth 2.0 Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request URL",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": true,
"accessTokenUrl": "",
"authorizationUrl": "",
"grantType": "authorization_code",
"password": "",
"type": "oauth2",
"username": ""
}
},
{
"_id": "__REQ_2__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Headers",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": true,
"accessTokenUrl": "",
"authorizationUrl": "",
"grantType": "authorization_code",
"password": "",
"type": "oauth2",
"username": ""
}
}
]
}

View File

@ -75,7 +75,8 @@ function importRequestItem(item, parentId, schema) {
url: importUrl(request.url),
method: request.method || 'GET',
headers: mapImporter(request.header, importHeader),
body: importBody(request.body, schema)
body: importBody(request.body, schema),
authentication: importAuthentication(request.auth, schema)
};
}
@ -181,3 +182,214 @@ function mapImporter(arr, importFn) {
return arr.map(importFn);
}
}
function importAuthentication(auth, schema) {
if (!auth) {
return {};
}
if (auth.type === 'awsv4') {
return importAwsV4Authentication(auth, schema);
} else if (auth.type === 'basic') {
return importBasicAuthentication(auth, schema);
} else if (auth.type === 'bearer') {
return importBearerTokenAuthentication(auth, schema);
} else if (auth.type === 'digest') {
return importDigestAuthentication(auth, schema);
} else if (auth.type === 'oauth1') {
return importOauth1Authentication(auth, schema);
} else if (auth.type === 'oauth2') {
return importOauth2Authentication(auth, schema);
} else {
return {};
}
}
function importAwsV4Authentication(auth, schema) {
if (!auth.awsv4) {
return {};
}
const item = {
type: 'iam',
disabled: false,
accessKeyId: 'aws-access-key',
region: 'aws-region',
secretAccessKey: 'aws-secret-key',
service: 'aws-service-name',
sessionToken: 'aws-session-token'
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.accessKeyId = auth.awsv4.accessKey;
item.region = auth.awsv4.region;
item.secretAccessKey = auth.awsv4.secretKey;
item.service = auth.awsv4.service;
item.sessionToken = auth.awsv4.sessionToken;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.accessKeyId = findValueByKey(auth.awsv4, 'accessKey');
item.region = findValueByKey(auth.awsv4, 'region');
item.secretAccessKey = findValueByKey(auth.awsv4, 'secretKey');
item.service = findValueByKey(auth.awsv4, 'service');
item.sessionToken = findValueByKey(auth.awsv4, 'sessionToken');
}
return item;
}
function importBasicAuthentication(auth, schema) {
if (!auth.basic) {
return {};
}
const item = {
type: 'basic',
disabled: false,
username: '',
password: ''
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.username = auth.basic.username;
item.password = auth.basic.password;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.username = findValueByKey(auth.basic, 'username');
item.password = findValueByKey(auth.basic, 'password');
}
return item;
}
function importBearerTokenAuthentication(auth, schema) {
if (!auth.bearer) {
return {};
}
const item = {
type: 'bearer',
disabled: false,
token: '',
prefix: ''
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.token = auth.bearer.token;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.token = findValueByKey(auth.bearer, 'token');
}
return item;
}
function importDigestAuthentication(auth, schema) {
if (!auth.digest) {
return {};
}
const item = {
type: 'digest',
disabled: false,
username: '',
password: ''
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.username = auth.digest.username;
item.password = auth.digest.password;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.username = findValueByKey(auth.digest, 'username');
item.password = findValueByKey(auth.digest, 'password');
}
return item;
}
function importOauth1Authentication(auth, schema) {
if (!auth.oauth1) {
return {};
}
const item = {
type: 'oauth1',
disabled: false,
callback: '',
consumerKey: '',
consumerSecret: '',
nonce: '',
privateKey: '',
realm: '',
signatureMethod: '',
timestamp: '',
tokenKey: '',
tokenSecret: '',
verifier: '',
version: ''
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.consumerKey = auth.oauth1.consumerKey;
item.consumerSecret = auth.oauth1.consumerSecret;
item.nonce = auth.oauth1.nonce;
item.realm = auth.oauth1.realm;
item.signatureMethod = auth.oauth1.signatureMethod;
item.timestamp = auth.oauth1.timestamp;
item.tokenKey = auth.oauth1.token;
item.tokenSecret = auth.oauth1.tokenSecret;
item.version = auth.oauth1.version;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.consumerKey = findValueByKey(auth.oauth1, 'consumerKey');
item.consumerSecret = findValueByKey(auth.oauth1, 'consumerSecret');
item.nonce = findValueByKey(auth.oauth1, 'nonce');
item.realm = findValueByKey(auth.oauth1, 'realm');
item.signatureMethod = findValueByKey(auth.oauth1, 'signatureMethod');
item.timestamp = findValueByKey(auth.oauth1, 'timestamp');
item.tokenKey = findValueByKey(auth.oauth1, 'token');
item.tokenSecret = findValueByKey(auth.oauth1, 'tokenSecret');
item.version = findValueByKey(auth.oauth1, 'version');
}
return item;
}
function importOauth2Authentication(auth, schema) {
if (!auth.oauth2) {
return {};
}
// Note: Postman v2.0 and v2.1 don't export any Oauth config. They only export the token
// So just return a disabled and empty Oauth 2 configuration so the user can fill it in later.
const item = {
type: 'oauth2',
disabled: true,
accessTokenUrl: '',
authorizationUrl: '',
grantType: 'authorization_code',
password: '',
username: ''
};
return item;
}
function findValueByKey(array, key) {
if (!array) {
return '';
}
let obj = array.find(o => o.key === key);
if (obj) {
return obj.value || '';
}
return '';
}

View File

@ -1,6 +1,6 @@
{
"name": "insomnia-xpath",
"version": "1.0.6",
"version": "1.0.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "insomnia-plugin-now",
"version": "1.0.8",
"version": "1.0.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "insomnia-plugin-os",
"version": "1.0.10",
"version": "1.0.11",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "insomnia-plugin-uuid",
"version": "1.0.7",
"version": "1.0.8",
"lockfileVersion": 1,
"requires": true,
"dependencies": {