airic-api-gateway-key-server
API Gateway Key Server
Last updated 2 years ago by airicyu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install airic-api-gateway-key-server 
SYNC missed versions from official npm registry.

airic-api-gateway-key-server

npm version node Codecov branch Build

dependencies Status devDependencies Status

Description

airic-api-gateway-key-server module is the ID key/API key server component of airic-api-gateway.


Samples

Hello world

Starting server:

'use strict';
const YAML = require('yamljs');
const keyServer = require('airic-api-gateway-key-server');

const keyServerConfigYaml = YAML.load('./key-server-config.yaml');
keyServer.setConfig(keyServerYaml);

keyServer.run();

Key Server Config YAML

Sample:

port: 3002
admin-token: d8745e9d03be41ad817a47176ade4dcc
pull-api-config-interval-second: 60
config-server-base-url: http://localhost:3001
id-key-cache-max-second: 15
api-key-cache-max-second: 10
private-key-path : './system-key-dir/private-key.pem'
public-key-path : './system-key-dir/public-key.pem'

REST APIs

Generate Workspace ID key (with admin token)

POST http://localhost:3001/config/workspaces/{{workspaceId}}/id-keys
Content-type: application/json
id-key: {{adminToken}}

Generate Workspace ID key (with workspace ID/secret)

POST http://localhost:3001/config/workspaces/{{workspaceId}}/id-keys
Content-type: application/json
id-key: {{adminToken}}

{
    "workspaceId": "{{workspaceId}}",
    "secret": "{{workspaceSecret}}"
}

Generate App ID key (with admin token)

POST http://localhost:3001/config/workspaces/{{workspaceId}}/apps/{{appId}}/id-keys
Content-type: application/json
id-key: {{adminToken}}

Generate App ID key (with workspace ID key)

POST http://localhost:3001/config/workspaces/{{workspaceId}}/apps/{{appId}}/id-keys
Content-type: application/json
id-key: {{workspaceIdKey}}

Generate App ID key (with app ID/secret)

POST http://localhost:3001/config/workspaces/{{workspaceId}}/apps/{{appId}}/id-keys
Content-type: application/json
id-key: {{adminToken}}

{
    "appId": "{{appId}}",
    "secret": "{{appSecret}}"
}

Verify Workspace ID key or App ID key

POST http://localhost:3001/keys/id-keys/verification
Content-type: application/json

{
    "key": "{{workspaceIdKey}}"
}
POST http://localhost:3001/keys/id-keys/verification
Content-type: application/json

{
    "key": "{{appIdKey}}"
}

Register App API key for Client

POST http://localhost:3001/config/workspaces/{{workspaceId}}/apps/{{appId}}/api-keys
Content-type: application/json
id-key: {{adminToken}}

{
    "clientId": "{{clientId}}"
}

Verify API key

POST http://localhost:3001/keys/api-keys/verification
Content-type: application/json

{
    "key": "{{apiKey}}"
}

Current Tags

  • 0.1.0                                ...           latest (2 years ago)

5 Versions

  • 0.1.0                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 5
This Month 10
Last Day 5
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |