Skip to content

Set custom auth header #47

@mattyod

Description

@mattyod

🚀 Feature Proposal

Add the ability to set a custom authorization header.

If a header property exists in options then use basic-auths auth.parse() method rather than auth().

Motivation

Some of our services sit behind an API Gateway that transfers incoming authorization headers onto a custom x-forwarded-authorization header. Unfortunately that API Gateway does not provide basic authentication checks 🤷 , so authentication still needs to be done within the service. (there are other benefits to the Gateway in case you are wondering 😄 ).

Example

fastify.register(basicAuth, { validate, authenticate, header: 'x-forwarded-authorization` }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions