{"version":3,"file":"api_security.mjs","sources":["../../../src/decorators/api_security.ts"],"sourcesContent":["import { OperationSecurityMetadataStorage } from '../metadata/operation_security.js'\n\n/**\n * Configures security requirements.\n * Can be applied to Controllers and Operations.\n *\n * @see https://swagger.io/specification/#security-requirement-object\n */\nexport function ApiSecurity(name: string, ...scopes: string[]) {\n  return (target: Object, propertyKey?: string | symbol) => {\n    OperationSecurityMetadataStorage.mergeMetadata(\n      target,\n      {\n        [name]: scopes,\n      },\n      propertyKey\n    )\n  }\n}\n\n/**\n * Configures Basic auth security requirement.\n * Can be applied to Controllers and Operations.\n *\n * @see https://swagger.io/specification/#security-requirement-object\n */\nexport function ApiBasicAuth() {\n  return ApiSecurity('basic')\n}\n\n/**\n * Configures Bearer auth security requirement.\n * Can be applied to Controllers and Operations.\n *\n * @see https://swagger.io/specification/#security-requirement-object\n */\nexport function ApiBearerAuth() {\n  return ApiSecurity('bearer')\n}\n\n/**\n * Configures Cookie auth security requirement.\n * Can be applied to Controllers and Operations.\n *\n * @see https://swagger.io/specification/#security-requirement-object\n */\nexport function ApiCookieAuth() {\n  return ApiSecurity('cookie')\n}\n\n/**\n * Configures OAuth2 auth security requirement.\n * Can be applied to Controllers and Operations.\n *\n * @see https://swagger.io/specification/#security-requirement-object\n */\nexport function ApiOauth2(...scopes: string[]) {\n  return ApiSecurity('oauth2', ...scopes)\n}\n"],"names":[],"mappings":";;AAQO,SAAS,WAAA,CAAY,SAAiB,MAAA,EAAkB;AAC7D,EAAA,OAAO,CAAC,QAAgB,WAAA,KAAkC;AACxD,IAAA,gCAAA,CAAiC,aAAA;AAAA,MAC/B,MAAA;AAAA,MACA;AAAA,QACE,CAAC,IAAI,GAAG;AAAA,OACV;AAAA,MACA;AAAA,KACF;AAAA,EACF,CAAA;AACF;AAQO,SAAS,YAAA,GAAe;AAC7B,EAAA,OAAO,YAAY,OAAO,CAAA;AAC5B;AAQO,SAAS,aAAA,GAAgB;AAC9B,EAAA,OAAO,YAAY,QAAQ,CAAA;AAC7B;AAQO,SAAS,aAAA,GAAgB;AAC9B,EAAA,OAAO,YAAY,QAAQ,CAAA;AAC7B;AAQO,SAAS,aAAa,MAAA,EAAkB;AAC7C,EAAA,OAAO,WAAA,CAAY,QAAA,EAAU,GAAG,MAAM,CAAA;AACxC;;;;"}