1.2.1 • Published 8 months ago

@platformatic/mtls-auth v1.2.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

mtls-auth

Plugin to extract authentication information from mTLS certificate common name.

Example:

Common name: payments.test.com

const app = fastify(/* tls certs */)

app.register(mtlsAuthPlugin, {
  mtlsDomain: 'test.com'
})

app.get('/test', async (request) => {
  const session = request.getMtlsAuth()
  console.log(session['X-PLATFORMATIC-ROLE']) // payments
})

Common name: e4a123f8-1f12-11ee-be56-0242ac120002.clients.test.com

const app = fastify(/* tls certs */)

app.register(mtlsAuthPlugin, {
  mtlsClientsRole: 'clients',
  mtlsDomain: 'test.com'
})

app.get('/test', async (request) => {
  const session = request.getMtlsAuth()
  console.log(session['X-PLATFORMATIC-ROLE']) // clients
  console.log(session['X-PLATFORMATIC-WORKSPACE-ID']) // e4a123f8-1f12-11ee-be56-0242ac120002
})
1.2.1

8 months ago

1.2.0

10 months ago

1.1.0

10 months ago

1.0.0

11 months ago