How to use the io-functions-commons/dist/src/utils/source_ip_check.clientIPAndCidrTuple function in io-functions-commons

To help you get started, we’ve selected a few io-functions-commons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github teamdigitale / io-functions / lib / controllers / profiles.ts View on Github external
): 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))
    )
  );
}
github teamdigitale / io-functions / lib / controllers / debug.ts View on Github external
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))
    )
  );
}
github teamdigitale / io-functions / lib / controllers / adm / services.ts View on Github external
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))
    )
  );
}
github teamdigitale / io-functions / lib / controllers / messages.ts View on Github external
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))
    )
  );
}
github teamdigitale / io-functions / lib / controllers / services.ts View on Github external
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))
    )
  );
}
github teamdigitale / io-functions / lib / controllers / info.ts View on Github external
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))
    )
  );
}

io-functions-commons

Common code for Azure functions

MIT
Latest version published 4 years ago

Package Health Score

50 / 100
Full package analysis

Similar packages