authorization-panel

WebJar for authorization-panel

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

org.webjars.bowergithub.advanced-rest-client
ArtifactId

ArtifactId

authorization-panel
Last Version

Last Version

2.0.11
Release Date

Release Date

Type

Type

jar
Description

Description

authorization-panel
WebJar for authorization-panel
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/advanced-rest-client/authorization-panel

Download authorization-panel

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/authorization-panel/ -->
<dependency>
    <groupId>org.webjars.bowergithub.advanced-rest-client</groupId>
    <artifactId>authorization-panel</artifactId>
    <version>2.0.11</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/authorization-panel/
implementation 'org.webjars.bowergithub.advanced-rest-client:authorization-panel:2.0.11'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/authorization-panel/
implementation ("org.webjars.bowergithub.advanced-rest-client:authorization-panel:2.0.11")
'org.webjars.bowergithub.advanced-rest-client:authorization-panel:jar:2.0.11'
<dependency org="org.webjars.bowergithub.advanced-rest-client" name="authorization-panel" rev="2.0.11">
  <artifact name="authorization-panel" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.advanced-rest-client', module='authorization-panel', version='2.0.11')
)
libraryDependencies += "org.webjars.bowergithub.advanced-rest-client" % "authorization-panel" % "2.0.11"
[org.webjars.bowergithub.advanced-rest-client/authorization-panel "2.0.11"]

Dependencies

compile (10)

Group / Artifact Type Version
org.webjars.bowergithub.polymerelements : iron-meta jar [2.0.0,3)
org.webjars.bowergithub.advanced-rest-client : amf-helper-mixin jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : paper-listbox jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : paper-dropdown-menu jar [2.0.3,3)
org.webjars.bowergithub.polymer : polymer jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : paper-item jar [2.1.0,3)
org.webjars.bowergithub.advanced-rest-client » events-target-behavior jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : paper-ripple jar [2.1.0,3)
org.webjars.bowergithub.advanced-rest-client » auth-methods jar [3.0.0,4)
org.webjars.bowergithub.polymerelements : iron-flex-layout jar [2.0.3,3)

Project Modules

There are no modules declared in this project.

Published on NPM

Build Status

<authorization-panel>

Accessible forms to provide authorization data for various authorization methods.

The forms used in the panel are coming from auth-methods element.

Version compatibility

This version only works with AMF model version 2 (AMF parser >= 4.0.0). For compatibility with previous model version use 3.x.x version of the component.

Usage

Installation

npm install --save @advanced-rest-client/authorization-panel

In an html file

<html>
  <head>
    <script type="module">
      import '@advanced-rest-client/authorization-panel/authorization-panel.js';
    </script>
  </head>
  <body>
    <authorization-panel></authorization-panel>
    <script>
    {
      document.querySelector('authorization-panel').addEventListener('authorization-settings-changed', (e) => {
        console.log('current settings', e.detail);
      });
    }
    </script>
  </body>
</html>

In a LitElement

import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/authorization-panel/authorization-panel.js';

class SampleElement extends PolymerElement {
  render() {
    return html`
    <authorization-panel
      @authorization-settings-changed="${this._handleModel}"
      @request-header-deleted="${this._headerDeleted}"
      @request-header-changed="${this._headerChanged}"></authorization-panel>
    `;
  }

  _handleModel(e) {
    this.authData = e.detail.value;
  }

  _headerDeleted(e) {
    const { name } = e.detail;
    this.httpHeaders = ``;
  }

  _headerChanged(e) {
    const { name, value } = e.detail;
    this.httpHeaders = `${name}: ${value}`;
  }
}
customElements.define('sample-element', SampleElement);

AMF model

The element works with AMF model which describes both RAML and OAS API specs into a common data model.

First step is to set amf property on the element which is the AMF model for the API. Second step is to lookup security scheme definition for an operation (HTTP method). It has to be an array of all security schemes defined for the endpoint / method. Pass it to securedBy property of the element. The element automatically updates the UI to only render methods supported by the endpoint or method. Authorization panels updates their state when selected and use pre-defined data to fill up the forms.

const amfModel = await generateApiModel();
const method = computeMethodModel(amfModel, 'some id of selected method');
const securityArray = getSecurityList(method);
panel.amf = amfModel;
panel.securedBy = securityArray;

Breaking Changes in v3

Use the scripts below to include dependencies into the web page.

OAuth 1

<script src="node_modules/cryptojslib/components/core.js"></script>
<script src="node_modules/cryptojslib/rollups/sha1.js"></script>
<script src="node_modules/cryptojslib/components/enc-base64-min.js"></script>
<script src="node_modules/cryptojslib/rollups/md5.js"></script>
<script src="node_modules/cryptojslib/rollups/hmac-sha1.js"></script>
<script src="node_modules/jsrsasign/lib/jsrsasign-rsa-min.js"></script>

Digest

<script src="node_modules/cryptojslib/rollups/md5.js"></script>

The required modules are installed with this element. You can skip it if you won't use OAuth1 or Digest methods.

Development

git clone https://github.com/advanced-rest-client/authorization-panel
cd authorization-panel
npm install

Running the demo locally

npm start

Running the tests

npm test

API components

This components is a part of API components ecosystem

org.webjars.bowergithub.advanced-rest-client

ARC

A set of repositories related to the Advanced REST Client and API console (by Mulesoft)

Versions

Version
2.0.11