2.0.3 • Published 2 years ago

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

Weekly downloads
18
License
MIT
Repository
github
Last release
2 years 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

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

3 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

5 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

7 years ago

1.0.5

8 years ago

1.0.4

8 years ago