1.0.7 • Published 4 years ago

koa-gcp-iap v1.0.7

Weekly downloads
10
License
MIT
Repository
-
Last release
4 years ago

koa-gcp-iap

Node.js CI

A koa middleware to verify requests with the GCP Identity-Aware Proxy.

Install

npm i koa-gcp-iap

Usage

Insert iap middleware before your application. It needs projectNumber/backendServiceId or projectNumber/projectId, which depends on your runtime environment.

Following application can read sub and email field from ctx.iapPayload. See https://cloud.google.com/iap/docs/signed-headers-howto#retrieving_the_user_identity for more details.

This is a minimal example.

const iap = require("koa-gcp-iap");
const Koa = require("koa");
const app = new Koa();

app.use(
  iap({
    projectNumber: "123456789",
    // projectId: "dummyProjectId",
    backendServiceId: "dummyBackendServiceId",
  })
);

app.use(async (ctx) => {
  ctx.body = `Hello World: ${ctx.iapPayload}`;
});
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

5 years ago