2.0.3 • Published 6 months ago

kth-node-api-key-strategy v2.0.3

Weekly downloads
18
License
MIT
Repository
github
Last release
6 months ago

kth-node-api-key-strategy Build Status

A api key strategy for Node applications.

Configure

serverSettings.js

module.exports = {
  secure: {
    api_keys: [
      {name: 'devClient', apikey: '1234567', scope: ['write', 'read']},
      {name: 'testClient', apikey: '891011', scope: ['read']}
      {name: 'publicClient', apikey: '0000', scope: ['readPublic']}
    ],
  }
};

swagger.js

Setting security on a route

"/v1/some/route/{id}": {
      "get": {
        "operationId": "",
        "summary": "",
        "description": "",
        "parameters": [],
        "tags": [
          "v1"
        ],
        "responses": { ... },
        "security": {
          "api_key": [
            "read"
          ]
        }
      }
    }

Defining security definition

"securityDefinitions": {
    "api_key": {
      "type": "apiKey",
      "name": "api_key",
      "in": "header",
      "scopes": {
        "read": "Read access to data",
        "write": "Write access to data",
        "readPublic": "Read only access to publicly visible data",
      }
    }
  }
2.0.3

6 months ago

2.0.2

6 months ago

2.0.1

6 months ago

2.0.0

2 years ago

1.0.14

2 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

4 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago