mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
* feat(auth): configure aws-xray-sdk for express * configured aws sdk clients * configure setting user metadata on segment * fix binding * fix binding order
26 lines
765 B
TypeScript
26 lines
765 B
TypeScript
import { CrossServiceTokenData, TokenDecoderInterface } from '@standardnotes/security'
|
|
import { NextFunction, Request, Response } from 'express'
|
|
import { Logger } from 'winston'
|
|
|
|
import { ApiGatewayAuthMiddleware } from './ApiGatewayAuthMiddleware'
|
|
|
|
export class OptionalCrossServiceTokenMiddleware extends ApiGatewayAuthMiddleware {
|
|
constructor(
|
|
tokenDecoder: TokenDecoderInterface<CrossServiceTokenData>,
|
|
isConfiguredForAWSProduction: boolean,
|
|
logger: Logger,
|
|
) {
|
|
super(tokenDecoder, isConfiguredForAWSProduction, logger)
|
|
}
|
|
|
|
protected override handleMissingToken(request: Request, _response: Response, next: NextFunction): boolean {
|
|
if (!request.headers['x-auth-token']) {
|
|
next()
|
|
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
}
|