UNPKG

api-console-assets

Version:

This repo only exists to publish api console components to npm

96 lines (91 loc) 3.36 kB
<!doctype html> <!-- @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> <title>auth-methods demo</title> <script src="../../webcomponentsjs/webcomponents-lite.js"></script> <link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html"> <link rel="import" href="../../arc-demo-helpers/arc-demo-snippet.html"> <link rel="import" href="../../oauth-authorization/oauth2-authorization.html"> <link rel="import" href="../../paper-toggle-button/paper-toggle-button.html"> <link rel="import" href="../../arc-demo-helpers/raml-demo-page.html"> <link rel="import" href="../auth-methods.html"> <style is="custom-style" include="demo-pages-shared-styles"> :root { --form-label: { font-weight: 500; }; --arc-font-subhead: { @apply --paper-font-subhead; }; } html, body { margin: 0; padding: 0; } .vertical-section-container { max-width: 600px; } output { white-space: pre-wrap; margin-top: 20px; } auth-method-oauth2 { margin-bottom: 40px; } </style> </head> <body unresolved> <template is="dom-bind" id="demo"> <raml-demo-page selected-object="{{selectedObject}}" is-method="{{isMethod}}" path="{{path}}"> <div main> <h1>OAuth 2.0 settings with RAML definition</h1> <template is="dom-if" if="[[hasSecurityScheme]]"> <auth-method-oauth2 raml-settings="[[securityScheme]]" redirect-url="[[redirectUrl]]"></auth-method-oauth2> </template> <template is="dom-if" if="[[!hasSecurityScheme]]"> <p>Select a HTTP method that has a security scheme.</p> <p>Current path is [[path]]</p> </template> <oauth2-authorization></oauth2-authorization> </div> <paper-item data-url$="[[demoUrl]]oauth2-api.raml">RAML with annotations</paper-item> </raml-demo-page> </template> <script> (function(scope) { scope.observers = [ '_selectedChanged(selectedObject, isMethod)' ]; scope.redirectUrl = location.href.replace('/auth-methods/demo/oauth2-raml.html', '/oauth-authorization/oauth-popup.html'); scope.hasSecurityScheme = false; scope.demoUrl = location.href.replace(/\/oauth2-raml\.html.*/, '/'); scope._selectedChanged = function(selected, isMethod) { if (!isMethod) { return; } var secList = scope.selectedObject.securedBy; if (!secList || !secList.length) { scope.hasSecurityScheme = false; return; } scope.securityScheme = secList[0]; scope.hasSecurityScheme = true; }; })(document.getElementById('demo')); </script> </body> </html>