Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
): express.RequestHandler {
const handler = GetProfileHandler(profileModel);
const azureUserAttributesMiddleware = AzureUserAttributesMiddleware(
serviceModel
);
const middlewaresWrap = withRequestMiddlewares(
AzureApiAuthMiddleware(
new Set([UserGroup.ApiLimitedProfileRead, UserGroup.ApiFullProfileRead])
),
ClientIpMiddleware,
azureUserAttributesMiddleware,
FiscalCodeMiddleware
);
return wrapRequestHandler(
middlewaresWrap(
checkSourceIpForHandler(handler, (_, c, u, __) => ipTuple(c, u))
)
);
}
export function GetDebug(serviceModel: ServiceModel): express.RequestHandler {
const azureApiMiddleware = AzureApiAuthMiddleware(
new Set([UserGroup.ApiDebugRead])
);
const azureUserAttributesMiddleware = AzureUserAttributesMiddleware(
serviceModel
);
const middlewaresWrap = withRequestMiddlewares(
ExpressRequestMiddleware,
ClientIpMiddleware,
azureApiMiddleware,
azureUserAttributesMiddleware
);
return wrapRequestHandler(
middlewaresWrap(
checkSourceIpForHandler(getDebugHandler, (_, c, __, u) => ipTuple(c, u))
)
);
}
export function CreateService(
serviceModel: ServiceModel
): express.RequestHandler {
const handler = CreateServiceHandler(serviceModel);
const azureUserAttributesMiddleware = AzureUserAttributesMiddleware(
serviceModel
);
const middlewaresWrap = withRequestMiddlewares(
AzureApiAuthMiddleware(new Set([UserGroup.ApiServiceWrite])),
ClientIpMiddleware,
azureUserAttributesMiddleware,
ServicePayloadMiddleware
);
return wrapRequestHandler(
middlewaresWrap(
checkSourceIpForHandler(handler, (_, c, u, __) => ipTuple(c, u))
)
);
}
export function GetMessages(
serviceModel: ServiceModel,
messageModel: MessageModel
): express.RequestHandler {
const handler = GetMessagesHandler(messageModel);
const middlewaresWrap = withRequestMiddlewares(
AzureApiAuthMiddleware(new Set([UserGroup.ApiMessageList])),
ClientIpMiddleware,
AzureUserAttributesMiddleware(serviceModel),
FiscalCodeMiddleware
);
return wrapRequestHandler(
middlewaresWrap(
checkSourceIpForHandler(handler, (_, c, u, __) => ipTuple(c, u))
)
);
}
export function GetVisibleServices(
serviceModel: ServiceModel,
blobService: BlobService
): express.RequestHandler {
const handler = GetVisibleServicesHandler(blobService);
const azureUserAttributesMiddleware = AzureUserAttributesMiddleware(
serviceModel
);
const middlewaresWrap = withRequestMiddlewares(
AzureApiAuthMiddleware(new Set([UserGroup.ApiPublicServiceList])),
ClientIpMiddleware,
azureUserAttributesMiddleware
);
return wrapRequestHandler(
middlewaresWrap(
checkSourceIpForHandler(handler, (_, c, u) => ipTuple(c, u))
)
);
}
export function GetInfo(serviceModel: ServiceModel): express.RequestHandler {
const azureUserAttributesMiddleware = AzureUserAttributesMiddleware(
serviceModel
);
const azureApiAuthMiddleware = AzureApiAuthMiddleware(
new Set([UserGroup.ApiInfoRead])
);
const middlewaresWrap = withRequestMiddlewares(
azureApiAuthMiddleware,
ClientIpMiddleware,
azureUserAttributesMiddleware
);
return wrapRequestHandler(
middlewaresWrap(
checkSourceIpForHandler(getInfoHandler, (_, c, u) => ipTuple(c, u))
)
);
}