From 68a9feaa8ab2950b506a449b72e65836bd70a543 Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Tue, 16 Jan 2018 14:48:10 +0100 Subject: [PATCH] Document how to secure client api #231 --- docs/securing-unleash.md | 3 +-- examples/client-auth-unleash.js | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/securing-unleash.md b/docs/securing-unleash.md index 5dbc954adf..c8e69aed76 100644 --- a/docs/securing-unleash.md +++ b/docs/securing-unleash.md @@ -20,7 +20,6 @@ unleash.start({ }).then(unleash => { console.log(`Unleash started on http://localhost:${unleash.app.get('port')}`); }); - ``` Examples on custom authentication hooks: @@ -42,7 +41,7 @@ UnleashConfig unleashConfig = UnleashConfig.builder() .build(); ``` -On the unleash server side you need to implement a preRouterHook hook which verifies that all calls to `/api/client` includes this pre shared key in the defined header. This could look something like this: +On the unleash server side you need to implement a preRouter hook which verifies that all calls to `/api/client` includes this pre shared key in the defined header. This could look something like this: ```javascript const unleash = require('unleash-server'); diff --git a/examples/client-auth-unleash.js b/examples/client-auth-unleash.js index 13ad5b741e..743d547f69 100644 --- a/examples/client-auth-unleash.js +++ b/examples/client-auth-unleash.js @@ -9,7 +9,10 @@ const sharedSecret = '12312Random'; unleash .start({ databaseUrl: 'postgres://unleash_user:passord@localhost:5432/unleash', +<<<<<<< HEAD enableLegacyRoutes: false, +======= +>>>>>>> 0681945... Document how to secure client api #231 preRouterHook: app => { app.use('/api/client', (req, res, next) => { if (req.headers.authorization === sharedSecret) {