{"_id":"@api-components/api-authorization-method","_rev":"10-b38bfdb48fc77d57a73bf063da070f25","name":"@api-components/api-authorization-method","dist-tags":{"latest":"0.3.2"},"versions":{"0.2.0":{"name":"@api-components/api-authorization-method","version":"0.2.0","keywords":["web-components","authorization-forms","http","oauth1","oauth2","basic","ntlm","api","amf"],"license":"Apache-2.0","_id":"@api-components/api-authorization-method@0.2.0","maintainers":[{"name":"lbauret","email":"leandro.bauret@mulesoft.com"},{"name":"twoplustwoone","email":"francisco.digiandomenico@gmail.com"},{"name":"jarrodek","email":"jarrodek@gmail.com"}],"contributors":[{"name":"The Advanced REST client authors","email":"arc@mulesoft.com"}],"homepage":"https://github.com/advanced-rest-client/api-authorization-method#readme","bugs":{"url":"https://github.com/advanced-rest-client/api-authorization-method/issues","email":"arc@mulesoft.com"},"dist":{"shasum":"254c4bc8d146235ce37c04ab5d9b9fbfb28154ec","tarball":"https://registry.npmjs.org/@api-components/api-authorization-method/-/api-authorization-method-0.2.0.tgz","fileCount":57,"integrity":"sha512-JoeKIb4LHiEUSOXOT2AtBai7zjGuuBcDHaX7PwyTYh1crPehgIRFlTqd5pqZihYVok1GVtvI+MnZ3SdGTvIiaQ==","signatures":[{"sig":"MEUCICn2pDnVJFAwxgh7hhMI8uEneG70uF8K9JMnxFe64F3UAiEAxAUAjcXgn45RICsp7R3zEqVksvxKLOzp1o1BJq5YscA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":226803,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeoToHCRA9TVsSAnZWagAA2MgP+gMxtFzrC8VlVoq+18l8\nGR9BOKh6efwtTRu6PN1DUuNaFZR5NG4oUfOHxSPu3CwYOTnQ2O2x4nz8ewIw\nVshDRDLxmOXj1rL3txQ1ZmkAHSS+dhvTbclVQSbPmPAfLp5BsF7MxMcFEqsU\ncb4a8MeUC09PHy/wQeBBa768Ay5wsYO9mVy+oPI0ruQx4W2uxbORiZHDH6kP\npNmtrBbu4IpNzNNzXAvAmtl+lgbig7eieIS1AC4fbf9LX+V4tTH9PwPsVhhs\nQSmN2zZFtq+lag2CzTBzoTqvQIHEsXySFItO9lPz1tYwTTsNUzMZZBJgn8Jc\nDdH03sp4VQfez0KjoOzn5/ToqoMWpWNWZeQFPXRQ6St9h+NmbgziDE/5khWj\nxNUCh3YYhVolWBcPo9fSaM/ULv6FxilNSfmH7e6qOxFdp2FKSFuPYPah9Pae\nymW7uG7MRjEBQBBbkBirbm2BLq03wEQr5ZjyYDcaIb0+q7oSl7ApWwZfXix9\nV3JLKoX6PhrG2YqMVXUCUi08pz2KEhJ/XjyTPzUhEa55d7X1lHTcU9eu18Gr\nyhLtk6RFMUYtgpd8iXHH6329vJq2YKANcVqTY1qpQoWiUW1aUY+yaIdK6+/6\nOodEVEUYRbh+GW2IjYHW3hOy23Ext8fbiJw8+Ky9MRFZDnVxGjo+HvYXANPC\n/XV3\r\n=7mj6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"lint-staged"}},"module":"index.js","authors":["Pawel Psztyc"],"gitHead":"355feb2957c51885150beb83c93b65d6dbb39865","scripts":{"lint":"npm run lint:eslint && npm run lint:prettier","test":"karma start --coverage","start":"es-dev-server --app-index demo/index.html --node-resolve --open --watch","format":"npm run format:eslint && npm run format:prettier","prepare":"node demo/model.js","test:sl":"karma start karma.sl.config.js  --compatibility auto --coverage --timeout 9000","test:watch":"karma start --auto-watch=true --single-run=false","lint:eslint":"eslint --ext .js,.html . --ignore-path .gitignore","format:eslint":"eslint --ext .js,.html . --fix --ignore-path .gitignore","lint:prettier":"prettier \"**/*.js\" --check --ignore-path .gitignore","format:prettier":"prettier \"**/*.js\" --write --ignore-path .gitignore","test:prune-snapshots":"karma start --prune-snapshots","test:update-snapshots":"karma start --update-snapshots"},"_npmUser":{"name":"jarrodek","email":"jarrodek@gmail.com"},"prettier":"@advanced-rest-client/prettier-config","deprecated":"Use @api-components/api-authorization instead","repository":{"url":"git://github.com/advanced-rest-client/api-authorization-method.git","type":"git"},"_npmVersion":"6.14.4","description":"An element to render an UI for various authorization methods with support of AMF data model for web APIs","directories":{},"lint-staged":{"*.js":["eslint --fix"]},"_nodeVersion":"12.16.2","dependencies":{"lit-html":"^1.2.1","lit-element":"^2.3.1","@advanced-rest-client/arc-icons":"^3.0.5","@advanced-rest-client/arc-marked":"^1.0.6","@api-components/amf-helper-mixin":"^4.0.26","@api-components/api-property-form-item":"^3.0.12","@anypoint-web-components/anypoint-button":"^1.0.15","@advanced-rest-client/authorization-method":"^0.1.13","@api-components/api-view-model-transformer":"^4.0.3"},"eslintConfig":{"extends":["@advanced-rest-client/eslint-config"]},"_hasShrinkwrap":false,"devDependencies":{"husky":"^4.2.5","sinon":"^9.0.2","eslint":"^6.8.0","lint-staged":"^10.1.7","es-dev-server":"^1.46.5","webpack-merge":"^4.1.5","@commitlint/cli":"^8.3.5","@open-wc/testing":"^2.5.13","@open-wc/testing-karma":"^3.3.15","@polymer/iron-test-helpers":"^3.0.1","@api-components/api-navigation":"^4.1.0","@commitlint/config-conventional":"^8.3.4","@advanced-rest-client/eslint-config":"^1.1.5","@api-components/api-model-generator":"^0.2.8","@advanced-rest-client/arc-demo-helper":"^2.1.3","@advanced-rest-client/prettier-config":"^0.1.0","@advanced-rest-client/testing-karma-sl":"^1.2.0","@advanced-rest-client/oauth-authorization":"^4.0.2"},"_npmOperationalInternal":{"tmp":"tmp/api-authorization-method_0.2.0_1587624454899_0.045871899868098254","host":"s3://npm-registry-packages"}},"0.3.1":{"name":"@api-components/api-authorization-method","version":"0.3.1","keywords":["web-components","authorization-forms","http","oauth1","oauth2","basic","ntlm","api","amf"],"license":"Apache-2.0","_id":"@api-components/api-authorization-method@0.3.1","maintainers":[{"name":"jarrodek","email":"jarrodek@gmail.com"},{"name":"twoplustwoone","email":"francisco.digiandomenico@gmail.com"},{"name":"lbauret","email":"leandro.bauret@mulesoft.com"}],"contributors":[{"name":"Your name can be here!"}],"homepage":"https://github.com/advanced-rest-client/api-authorization-method#readme","bugs":{"url":"https://github.com/advanced-rest-client/api-authorization-method/issues","email":"arc@mulesoft.com"},"dist":{"shasum":"1d1fe543490f2d7247bb34cd0aee49037697f6cc","tarball":"https://registry.npmjs.org/@api-components/api-authorization-method/-/api-authorization-method-0.3.1.tgz","fileCount":22,"integrity":"sha512-gCM/AptFAE/mD2kT9ULbYEG9jhGMYOEA/oZvDFBUwwobt3HCAWX44iV1mheMp3iT2B5ROpoPdRPSVki61Wku1g==","signatures":[{"sig":"MEYCIQCBwvmA5XI9jhvQuuopRo/QZQjTJxEJ5UpSGNelO6X4DgIhALIHOPyLsHpfDl/hdKimwpDA9QyuNAuKyKEYFbu0hO0f","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":182914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf2OxjCRA9TVsSAnZWagAAAK4P/12mGqRH+89t5dx9eUME\nBX1miBzdC2WTlkjAPFhxA9vtmkV+oNtHJ+WoRWeI6zMJ3Orf2luO3IwZEbtE\np88i1MJ3GmDMfFQXyo9nz4pctgd5T8PXYU08w5vpiZHPpLaIJ1E6KTvG9QAP\n2G9b4NGZK32F12TIOwANC0T9VXFH4UYbvkfMA14VrabN15wjOk9wnUqYlo0Y\nhE2TyLGHioSBqgiiiH4VMtcUoovQeTbpJ3GTD5R+L6iAkdLJ6OTr2tUfVMaa\nDXAaImD/fojSo+voy6Q1Dk21o/qA61ANYAwcKNZFoiuW6GywpDr7cAP924vI\nmtf1aYMZ5YDqLB61q6OnrJHW/C6DipKQm9PB0qVovfDMKp3o0BVqFfVw2o3I\nbJ6t3U9Calu+osswv926A7LaVA3RmQsYVUf/o+Kn5cq1klgiVK/tpA3MZZ/s\nNIhfL8dqfuEsEpNL0c6zQgrCqDTlolQSIRHaTarGTIP+HSiNGQ+JcWYgtiIS\n5BLkcOTWf2+esJBkT3IcFYxVgKyxrnEjXT6VhPVdwe9pFYSv0DAqxkBy/tuO\nYfmLkpUMRUoFTxLY33TH8YzgyeWjS3k/dA5xHaZWx1+clOv+AKrV4yvPM2Oc\n6xCgdd8IBB2BiGDejIRGcKI7O+sBRxA0mSZY+BZHRQyLSRuT73gUcbPTdG42\nHIyo\r\n=yZaj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"module":"index.js","authors":["Pawel Psztyc"],"gitHead":"1f9f3782cb09db1b69d1cd9cca79514be70e5966","scripts":{"lint":"npm run lint:eslint","test":"web-test-runner test/**/*.test.js --coverage --node-resolve --playwright --browsers chromium firefox webkit","start":"es-dev-server --app-index demo/index.html --node-resolve --open --watch","format":"npm run format:eslint","gen:wc":"wca analyze \"*.js\" --outFile custom-elements.json","prepare":"node demo/model.js","lint:types":"tsc","test:watch":"web-test-runner test/**/*.test.js --node-resolve --watch","lint:eslint":"eslint --ext .js,.html . --ignore-path .gitignore","format:eslint":"eslint --ext .js,.html . --fix --ignore-path .gitignore"},"_npmUser":{"name":"jarrodek","email":"jarrodek@gmail.com"},"deprecated":"Use @api-components/api-authorization instead","repository":{"url":"git://github.com/advanced-rest-client/api-authorization-method.git","type":"git"},"_npmVersion":"6.14.9","description":"An element to render an UI for various authorization methods with support of AMF data model for web APIs","directories":{},"lint-staged":{"*.js":["eslint --fix"]},"_nodeVersion":"12.17.0","dependencies":{"lit-html":"^1.3.0","lit-element":"^2.4.0","@open-wc/dedupe-mixin":"^1.3.0","@advanced-rest-client/arc-icons":"^3.1.2","@advanced-rest-client/arc-types":"^0.2.14","@advanced-rest-client/arc-marked":"^1.1.0","@api-components/amf-helper-mixin":"^4.2.0","@api-components/api-property-form-item":"^3.0.15","@anypoint-web-components/anypoint-button":"^1.1.1","@advanced-rest-client/authorization-method":"^0.2.0","@api-components/api-view-model-transformer":"^4.2.2"},"eslintConfig":{"extends":["@open-wc/eslint-config","eslint-config-prettier"],"overrides":[{"files":["**/demo/**/*.js","**/test/**/*.js","**/demo/**/*.html","**/demo/**/*.js"],"rules":{"no-console":"off","no-plusplus":"off","no-unused-expressions":"off","class-methods-use-this":"off","import/no-extraneous-dependencies":"off"}}]},"_hasShrinkwrap":false,"devDependencies":{"husky":"^4.3.0","sinon":"^9.2.1","eslint":"^7.13.0","deepmerge":"^4.2.1","typescript":"^4.0.5","lint-staged":"^10.5.1","es-dev-server":"^1.57.8","@open-wc/testing":"^2.5.32","@web/test-runner":"^0.9.8","@open-wc/eslint-config":"^4.0.1","eslint-config-prettier":"^6.15.0","@polymer/iron-test-helpers":"^3.0.1","typescript-lit-html-plugin":"^0.9.0","@web/test-runner-playwright":"^0.6.4","@api-components/api-navigation":"^4.1.4","@api-components/api-model-generator":"^0.2.9","@advanced-rest-client/arc-demo-helper":"^2.2.0","@advanced-rest-client/oauth-authorization":"^5.0.0"},"peerDependencies":{"jsrsasign":"^10.0.5","cryptojslib":"^3.1.2"},"_npmOperationalInternal":{"tmp":"tmp/api-authorization-method_0.3.1_1608051810589_0.7337641731629214","host":"s3://npm-registry-packages"}},"0.3.2":{"name":"@api-components/api-authorization-method","version":"0.3.2","keywords":["web-components","authorization-forms","http","oauth1","oauth2","basic","ntlm","api","amf"],"license":"Apache-2.0","_id":"@api-components/api-authorization-method@0.3.2","maintainers":[{"name":"jarrodek","email":"jarrodek@gmail.com"},{"name":"twoplustwoone","email":"francisco.digiandomenico@gmail.com"},{"name":"lbauret","email":"leandro.bauret@mulesoft.com"}],"contributors":[{"name":"Your name can be here!"}],"homepage":"https://github.com/advanced-rest-client/api-authorization-method#readme","bugs":{"url":"https://github.com/advanced-rest-client/api-authorization-method/issues","email":"arc@mulesoft.com"},"dist":{"shasum":"eb5cfb9747e8bf43ff0e3d71b6421cee6756b012","tarball":"https://registry.npmjs.org/@api-components/api-authorization-method/-/api-authorization-method-0.3.2.tgz","fileCount":22,"integrity":"sha512-3kq0w4Nv8yTRMblAjRY2RLHCVB8Onj94fDc/avR7NPYZnAmSA3BIEBpeBWCTjuZ9AzWeFSToMjY1dWsbLsLTtQ==","signatures":[{"sig":"MEQCIBXJ383IKSnwzRlb0BjSoPsKsuewhLuijX0Ml9BxYJ9mAiBQeHHZvzPENOVZykZ8XOrpXiaczHIbTvi6rP6YmFViaw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":182778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf2QO1CRA9TVsSAnZWagAAenQP/1SXoIYP0dJ7BpETSNdY\nkRmLKBzIMtwpVJD94CkrhQGv7l4Wwk7JwaaZVcRoYNZn5HDJ5igh4bY39ZWB\nT81vVb/9hA8gIi1sA5cgEQKarvGEDcHha4UFnF0y72atV8cFySzAZ2MA0IH2\ncBAOi/K9rxEgFhgQkfvfuQiwst3/yiTrROo7kSuibmbGuOcyK7jxTUzcF/8s\nm5r03tCJqqMQhmnOr9xYcE8VfD3o2pdF1HaHpdJyNVaOOXYcLIS3IoxQxNXr\nLK4ZDANye+LDOouXEbLNUIOZDoJotL+PFOIlSXoBzP0q5hgWApWHYFSxZLJh\nf0Sq4QimtFG/QN2z4R82McgKFwhYmq90yw0Y+5LItb2XrJ8vGCl82xwduRvp\nghBDIA0WPQV9J7WL+x5vPjdPz1nc1dLICTsxB6wC68ViZLzf7oSlOmtncDHt\nvldnMAg038jyKZfvc6AMchBF+M9tUyHyPtpaS4m+Mv2TL9bypbLfqnhzU9e1\nQpuQLqLTIEo8ZXL8cMraiEkUn9IxhFstUtZ9sb56Le1nVVI6GFAapVkCrzdJ\n5L80qr7we5CJ2STAh6/x6eq8OYxl/4xmuKQlIACocYsmy2JPnS0TBI5QqTIf\n7bBf+AmPJZVo//unG2ZGdKOjDLiyW2JCOT1oeMmSHv6FkwAoDrvS4QajBD24\n3BYP\r\n=5OnV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"module":"index.js","authors":["Pawel Psztyc"],"gitHead":"f674e60ff14e19245b942c07f91a712c406caafc","scripts":{"lint":"npm run lint:eslint","test":"web-test-runner test/**/*.test.js --coverage --node-resolve --playwright --browsers chromium firefox webkit","start":"es-dev-server --app-index demo/index.html --node-resolve --open --watch","format":"npm run format:eslint","gen:wc":"wca analyze \"*.js\" --outFile custom-elements.json","prepare":"node demo/model.js","lint:types":"tsc","test:watch":"web-test-runner test/**/*.test.js --node-resolve --watch","lint:eslint":"eslint --ext .js,.html . --ignore-path .gitignore","format:eslint":"eslint --ext .js,.html . --fix --ignore-path .gitignore"},"_npmUser":{"name":"jarrodek","email":"jarrodek@gmail.com"},"deprecated":"Use @api-components/api-authorization instead","repository":{"url":"git://github.com/advanced-rest-client/api-authorization-method.git","type":"git"},"_npmVersion":"6.14.9","description":"An element to render an UI for various authorization methods with support of AMF data model for web APIs","directories":{},"lint-staged":{"*.js":["eslint --fix"]},"_nodeVersion":"12.17.0","dependencies":{"lit-html":"^1.3.0","lit-element":"^2.4.0","@open-wc/dedupe-mixin":"^1.3.0","@advanced-rest-client/arc-icons":"^3.1.2","@advanced-rest-client/arc-types":"^0.2.14","@advanced-rest-client/arc-marked":"^1.1.0","@api-components/amf-helper-mixin":"^4.2.0","@api-components/api-property-form-item":"^3.0.15","@anypoint-web-components/anypoint-button":"^1.1.1","@advanced-rest-client/authorization-method":"^0.2.0","@api-components/api-view-model-transformer":"^4.2.2"},"eslintConfig":{"extends":["@open-wc/eslint-config","eslint-config-prettier"],"overrides":[{"files":["**/demo/**/*.js","**/test/**/*.js","**/demo/**/*.html","**/demo/**/*.js"],"rules":{"no-console":"off","no-plusplus":"off","no-unused-expressions":"off","class-methods-use-this":"off","import/no-extraneous-dependencies":"off"}}]},"_hasShrinkwrap":false,"devDependencies":{"husky":"^4.3.0","sinon":"^9.2.1","eslint":"^7.13.0","deepmerge":"^4.2.1","typescript":"^4.0.5","lint-staged":"^10.5.1","es-dev-server":"^1.57.8","@open-wc/testing":"^2.5.32","@web/test-runner":"^0.9.8","@open-wc/eslint-config":"^4.0.1","eslint-config-prettier":"^6.15.0","@polymer/iron-test-helpers":"^3.0.1","typescript-lit-html-plugin":"^0.9.0","@web/test-runner-playwright":"^0.6.4","@api-components/api-navigation":"^4.1.4","@api-components/api-model-generator":"^0.2.9","@advanced-rest-client/arc-demo-helper":"^2.2.0","@advanced-rest-client/oauth-authorization":"^5.0.0"},"peerDependencies":{"jsrsasign":"^10.0.5","cryptojslib":"^3.1.2"},"_npmOperationalInternal":{"tmp":"tmp/api-authorization-method_0.3.2_1608057780581_0.36902799976328393","host":"s3://npm-registry-packages"}}},"time":{"created":"2020-04-23T06:47:34.817Z","modified":"2026-04-07T19:29:33.694Z","0.2.0":"2020-04-23T06:47:35.024Z","0.3.1":"2020-12-15T17:03:30.777Z","0.3.2":"2020-12-15T18:43:00.827Z"},"bugs":{"url":"https://github.com/advanced-rest-client/api-authorization-method/issues","email":"arc@mulesoft.com"},"license":"Apache-2.0","homepage":"https://github.com/advanced-rest-client/api-authorization-method#readme","keywords":["web-components","authorization-forms","http","oauth1","oauth2","basic","ntlm","api","amf"],"repository":{"url":"git://github.com/advanced-rest-client/api-authorization-method.git","type":"git"},"description":"An element to render an UI for various authorization methods with support of AMF data model for web APIs","contributors":[{"name":"Your name can be here!"}],"maintainers":[{"email":"jarrodek@gmail.com","name":"jarrodek"},{"email":"alexperez@mulesoft.com","name":"alexperez_march_2024"},{"email":"elmellidiego@gmail.com","name":"dmacias"}],"readme":"# api-authorization-method\n\nA web component that extends `@advanced-rest-client/authorization-method` to add ability to process API security configuration.\nThe component works with the [AML](https://a.ml) model generated by AMF parser. After applying `amf` and `security` properties to the element it, if possible, determines what are the authorization settings for the method, and applies default values.\n\nFor example, OAuth 2 can be configured in a number of different ways. When the security model is applied to the element it renders only those properties that the server requires to authenticate the user.\n\nThis element adds support for the following security description:\n\n-   OAuth 2\n-   OAuth 2 with annotation (see [RAML's docs](https://github.com/raml-org/raml-annotations/tree/master/annotations/security-schemes))\n-   OAuth 1\n-   RAML's custom scheme\n-   Pass Through\n-   Api Key (OAS)\n-   Bearer (OAS)\n\nThis component fully support OAS security schemes.\n\n## Usage\n\nThe component extends `@advanced-rest-client/authorization-method` package to add API model support. The base component renders basic authorization methods.\nThe element requires to apply AML's JSON+LD model to the `amf` property and scheme definition to the `security` property.\n\n### Installation\n\n```bash\nnpm install --save @advanced-rest-client/api-authorization-method\n```\n\n### In an html file\n\n```html\n<html>\n  <head>\n    <script type=\"module\">\n      import '@advanced-rest-client/api-authorization-method/api-authorization-method.js';\n    </script>\n  </head>\n  <body>\n    <api-authorization-method type=\"OAuth 2\" redirecturi=\"...\"></api-authorization-method>\n    <script>\n    (async () => {\n      const model = await getAmfModel();\n      const oauthSecurity = getSecurity(model, '/endpoint', 'get');\n      const element = document.querySelector('api-authorization-method');\n      element.amf = model;\n      element.security = oauthSecurity;\n      element.onchange = (e) => {\n        console.log(e.target.validate(), e.target.serialize());\n      };\n    })();\n    </script>\n  </body>\n</html>\n```\n\n### In a LitElement\n\n```js\nimport { LitElement, html } from 'lit-element';\nimport '@advanced-rest-client/api-authorization-method/api-authorization-method.js';\n\nclass SampleElement extends LitElement {\n  static get properties() {\n    return {\n      amfModel: { type: Array },\n      endpoint: { type: String },\n      method: { type: String },\n    };\n  }\n\n  get security() {\n    const { amfModel, endpoint, method } = this;\n    return this.readSecurityFor(amfModel, endpoint, method);\n  }\n\n  readSecurityFor(amf, endpoint, method) {\n    // implement me\n  }\n\n  render() {\n    const { amfModel, security } = this;\n    return html`\n    <api-authorization-method\n      type=\"OAuth 2\"\n      .amf=\"${amfModel}\"\n      .security=\"${security}\"\n      @change=\"${this._securityChangeHandler}\"></api-authorization-method>\n    `;\n  }\n\n  _securityChangeHandler(e) {\n    console.log('current authorization settings', e.target.serialize());\n  }\n}\ncustomElements.define('sample-element', SampleElement);\n```\n\n### Applying AMF model\n\nFirst step is to pass the whole generated AMF model to the `amf` property. It is required to properly resolve internal model dependencies and to properly read keys in [JSON+LD compact model](https://w3c.github.io/json-ld-syntax/#compact-iris).\n\nSecond step is to extract the correct security definition for a method. It is added to a `http://a.ml/vocabularies/apiContract#supportedOperation` object. The security setting that should be applied to the `security` property has type of `http://a.ml/vocabularies/security#ParametrizedSecurityScheme`.\n\nAn example script that applies the values can look like the following.\n\n```html\n<api-authorization-method type=\"OAuth 2\" id=\"auth\"></api-authorization-method>\n<script>\n(async () => {\n  const model = await getAmfModelSomehow();\n  const security = readSecurityFor(model, '/endpoint', 'GET');\n  const method = document.getElementById('auth');\n  method.amf = model;\n  method.security = security;\n})();\n</script>\n```\n\nThe `getAmfModelSomehow()` function can download pre-generated model or run AMF parser directly from RAML or OAS specification.\nThen the `readSecurityFor()` function looks for security definition in `/endpoint` endpoint, inside `GET` method.\nWhen ready the values are applied to the element.\n\nThe order of setting `type`, `amf`, and `security` parameters doesn't matter as the data processing starts asynchronously. However, if the `type` does not match passed `security` the `security` settings is ignored.\n\nA note on clearing `settings` property. When an `undefined` or any incompatible value is set to the `settings` property, the view won't change. Incompatible value is just ignored. Remove the element from the DOM if no longer applicable, change `type` property to something else, or apply new `settings` with the new values.\n\n__Exception__\n\nOAS' Api Key method support logical `AND` operation. This means that in this case the `security` parameter should receive the array of defined for the operation security schemes. That is, the array of items that is under `security.scheme` property when accessing security definition in the AMF model.\n\nSee [demo/index.js](demo/index.js) for an example of how this is handled (`setData()` function).\n\n## Development\n\n```sh\ngit clone https://github.com/advanced-rest-client/api-authorization-method\ncd api-authorization-method\nnpm install\n```\n\n### Running the demo locally\n\n```sh\nnpm start\n```\n\n### Running the tests\n```sh\nnpm test\n```\n\n### API components\n\nThis components is a part of [API components ecosystem](https://elements.advancedrestclient.com/)\n","readmeFilename":"README.md"}