Socket
Socket
Sign inDemoInstall

@webex/plugin-authorization-node

Package Overview
Dependencies
Maintainers
21
Versions
1198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webex/plugin-authorization-node - npm Package Compare versions

Comparing version 1.59.0 to 1.60.1

20

dist/authorization.js

@@ -16,3 +16,3 @@ 'use strict';

var _dec, _desc, _value, _obj; /*!
* Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
* Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
*/

@@ -62,3 +62,3 @@

*/
var Authorization = _webexCore.SparkPlugin.extend((_dec = (0, _common.whileInFlight)('isAuthorizing'), (_obj = {
var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFlight)('isAuthorizing'), (_obj = {
derived: {

@@ -97,3 +97,3 @@ /**

this.spark.request({
this.webex.request({
method: 'POST',

@@ -127,3 +127,3 @@ uri: this.config.logoutUrl,

return this.spark.request({
return this.webex.request({
method: 'POST',

@@ -144,3 +144,3 @@ uri: this.config.tokenUrl,

}).then(function (res) {
_this.spark.credentials.set({ supertoken: res.body });
_this.webex.credentials.set({ supertoken: res.body });
}).catch(function (res) {

@@ -158,7 +158,7 @@ if (res.statusCode !== 400) {

/**
* Requests a Cisco Spark access token for a user already authenticated into
* Requests a Webex Teams access token for a user already authenticated into
* your product.
*
* Note: You'll need to supply a jwtRefreshCallback of the form
* `Promise<jwt> = jwtRefreshCallback(spark)` for automatic token refresh to
* `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to
* work.

@@ -178,3 +178,3 @@ *

return this.spark.request({
return this.webex.request({
method: 'POST',

@@ -194,3 +194,3 @@ service: 'hydra',

}).then(function (token) {
_this2.spark.credentials.set({
_this2.webex.credentials.set({
supertoken: token

@@ -200,3 +200,3 @@ });

},
version: '1.59.0'
version: '1.60.1'
}, (_applyDecoratedDescriptor(_obj, 'requestAuthorizationCodeGrant', [_dec, _common.oneFlight], (0, _getOwnPropertyDescriptor2.default)(_obj, 'requestAuthorizationCodeGrant'), _obj), _applyDecoratedDescriptor(_obj, 'requestAccessTokenFromJwt', [_common.oneFlight], (0, _getOwnPropertyDescriptor2.default)(_obj, 'requestAccessTokenFromJwt'), _obj)), _obj)));

@@ -203,0 +203,0 @@

@@ -7,3 +7,3 @@ "use strict";

/*!
* Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
* Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
*/

@@ -10,0 +10,0 @@

@@ -37,3 +37,3 @@ 'use strict';

/*!
* Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
* Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
*/

@@ -40,0 +40,0 @@

{
"name": "@webex/plugin-authorization-node",
"version": "1.59.0",
"version": "1.60.1",
"description": "",

@@ -9,3 +9,3 @@ "license": "MIT",

"devMain": "src/index.js",
"repository": "https://github.com/webex/spark-js-sdk/tree/master/packages/node_modules/@webex/plugin-authorization-node",
"repository": "https://github.com/webex/webex-js-sdk/tree/master/packages/node_modules/@webex/plugin-authorization-node",
"engines": {

@@ -22,7 +22,7 @@ "node": ">=4"

"babel-runtime": "^6.23.0",
"@webex/common": "1.59.0",
"@webex/webex-core": "1.59.0",
"@webex/internal-plugin-wdm": "1.59.0",
"@webex/common": "1.60.1",
"@webex/webex-core": "1.60.1",
"@webex/internal-plugin-wdm": "1.60.1",
"envify": "^4.1.0"
}
}

@@ -21,3 +21,3 @@ # @webex/plugin-authorization-node

This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/sdks-and-widgets.html) and the [API docs](https://webex.github.io/spark-js-sdk/api/) for full details.
This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/sdks-and-widgets.html) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.

@@ -34,6 +34,6 @@ ## Install

const ciscospark = require('ciscospark');
const Webex = require('webex');
const spark = ciscospark.init()
spark.authorization-node.get(id)
const webex = Webex.init();
webex.authorization-node.get(id)
.then((authorization-node) => {

@@ -51,3 +51,3 @@ console.log(authorization-node);

Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/spark-js-sdk/blob/master/CONTRIBUTING.md) for more details.
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.

@@ -54,0 +54,0 @@ ## License

/*!
* Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
* Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
*/

@@ -8,3 +8,3 @@

import {oneFlight, whileInFlight} from '@webex/common';
import {grantErrors, SparkPlugin} from '@webex/webex-core';
import {grantErrors, WebexPlugin} from '@webex/webex-core';

@@ -16,3 +16,3 @@ /**

*/
const Authorization = SparkPlugin.extend({
const Authorization = WebexPlugin.extend({
derived: {

@@ -49,3 +49,3 @@ /**

logout(options = {}) {
this.spark.request({
this.webex.request({
method: 'POST',

@@ -77,3 +77,3 @@ uri: this.config.logoutUrl,

return this.spark.request({
return this.webex.request({
method: 'POST',

@@ -95,3 +95,3 @@ uri: this.config.tokenUrl,

.then((res) => {
this.spark.credentials.set({supertoken: res.body});
this.webex.credentials.set({supertoken: res.body});
})

@@ -111,7 +111,7 @@ .catch((res) => {

/**
* Requests a Cisco Spark access token for a user already authenticated into
* Requests a Webex Teams access token for a user already authenticated into
* your product.
*
* Note: You'll need to supply a jwtRefreshCallback of the form
* `Promise<jwt> = jwtRefreshCallback(spark)` for automatic token refresh to
* `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to
* work.

@@ -127,3 +127,3 @@ *

requestAccessTokenFromJwt({jwt}) {
return this.spark.request({
return this.webex.request({
method: 'POST',

@@ -142,3 +142,3 @@ service: 'hydra',

.then((token) => {
this.spark.credentials.set({
this.webex.credentials.set({
supertoken: token

@@ -145,0 +145,0 @@ });

/*!
* Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
* Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
*/

@@ -4,0 +4,0 @@

/*!
* Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
* Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
*/

@@ -4,0 +4,0 @@

/*!
* Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
* Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
*/

@@ -10,7 +10,7 @@

import {createUser} from '@webex/test-helper-appid';
import CiscoSpark, {filterScope} from '@webex/webex-core';
import WebexCore, {filterScope} from '@webex/webex-core';
import uuid from 'uuid';
import sinon from '@webex/test-helper-sinon';
const apiScope = filterScope('spark:kms', process.env.CISCOSPARK_SCOPE);
const apiScope = filterScope('spark:kms', process.env.WEBEX_SCOPE);

@@ -20,18 +20,18 @@ nodeOnly(describe)('plugin-authorization-node', () => {

describe('#logout()', () => {
let spark, spock;
let webex, spock;
beforeEach('create authorized spark user', () => testUsers.create({count: 1})
beforeEach('create authorized webex user', () => testUsers.create({count: 1})
.then(([u]) => {
spock = u;
spark = new CiscoSpark({credentials: spock.token});
webex = new WebexCore({credentials: spock.token});
}));
it('invalidates all of the use\'s tokens', () => {
sinon.spy(spark.authorization, 'logout');
sinon.spy(spark, 'logout');
sinon.spy(webex.authorization, 'logout');
sinon.spy(webex, 'logout');
return spark.logout()
return webex.logout()
.then(() => {
assert.called(spark.logout);
assert.called(spark.authorization.logout);
assert.called(webex.logout);
assert.called(webex.authorization.logout);
});

@@ -48,6 +48,6 @@ });

.then(({jwt}) => {
const spark = new CiscoSpark();
const webex = new WebexCore();
return spark.authorization.requestAccessTokenFromJwt({jwt})
.then(() => assert.isTrue(spark.canAuthorize));
return webex.authorization.requestAccessTokenFromJwt({jwt})
.then(() => assert.isTrue(webex.canAuthorize));
});

@@ -65,3 +65,3 @@ });

.then(({jwt}) => {
const spark = new CiscoSpark({
const webex = new WebexCore({
config: {

@@ -78,11 +78,11 @@ credentials: {

return spark.authorization.requestAccessTokenFromJwt({jwt})
return webex.authorization.requestAccessTokenFromJwt({jwt})
.then(() => {
token = spark.credentials.supertoken.access_token;
assert.isTrue(spark.canAuthorize);
token = webex.credentials.supertoken.access_token;
assert.isTrue(webex.canAuthorize);
})
.then(() => spark.refresh())
.then(() => webex.refresh())
.then(() => {
assert.isTrue(spark.canAuthorize);
assert.notEqual(spark.credentials.supertoken.access_token, token);
assert.isTrue(webex.canAuthorize);
assert.notEqual(webex.credentials.supertoken.access_token, token);
});

@@ -95,18 +95,18 @@ });

describe('#requestAuthorizationCodeGrant()', () => {
describe('when the user has the spark entitlement', () => {
let code, spark;
describe('when the user has the webex entitlement', () => {
let code, webex;
beforeEach('create auth code only test user', () => testUsers.create({config: {authCodeOnly: true}})
.then(([u]) => {
spark = new CiscoSpark();
webex = new WebexCore();
code = u.token.auth_code;
}));
it('exchanges an authorization code for an access token', () => spark.authorization.requestAuthorizationCodeGrant({code})
it('exchanges an authorization code for an access token', () => webex.authorization.requestAuthorizationCodeGrant({code})
.then(() => {
assert.isDefined(spark.credentials.supertoken);
assert.isDefined(webex.credentials.supertoken);
return Promise.all([
spark.credentials.getUserToken(apiScope),
spark.credentials.getUserToken('spark:kms')
webex.credentials.getUserToken(apiScope),
webex.credentials.getUserToken('spark:kms')
]);

@@ -116,8 +116,8 @@ }));

describe('when the user does not have the spark entitlement', () => {
let code, spark;
describe('when the user does not have the webex entitlement', () => {
let code, webex;
beforeEach('create non-spark-entitled test user', () => testUsers.create({
beforeEach('create non-webex-entitled test user', () => testUsers.create({
config: {
// We omit the spark entitlment so that CI gives us a token lacking
// We omit the webex entitlment so that CI gives us a token lacking
// spark:* scopes

@@ -134,15 +134,15 @@ entitlements: [

.then(([u]) => {
spark = new CiscoSpark();
webex = new WebexCore();
code = u.token.auth_code;
}));
it('exchanges an authorization code for an access token', () => spark.authorization.requestAuthorizationCodeGrant({code})
it('exchanges an authorization code for an access token', () => webex.authorization.requestAuthorizationCodeGrant({code})
.then(() => {
assert.isDefined(spark.credentials.supertoken);
assert.isDefined(webex.credentials.supertoken);
return Promise.all([
spark.credentials.getUserToken(apiScope)
.then((token) => assert.equal(token.access_token, spark.credentials.supertoken.access_token)),
spark.credentials.getUserToken('spark:kms')
.then((token) => assert.equal(token.access_token, spark.credentials.supertoken.access_token))
webex.credentials.getUserToken(apiScope)
.then((token) => assert.equal(token.access_token, webex.credentials.supertoken.access_token)),
webex.credentials.getUserToken('spark:kms')
.then((token) => assert.equal(token.access_token, webex.credentials.supertoken.access_token))
]);

@@ -149,0 +149,0 @@ }));

/*!
* Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
* Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
*/

@@ -9,3 +9,3 @@

import {browserOnly, nodeOnly} from '@webex/test-helper-mocha';
import MockSpark from '@webex/test-helper-mock-webex';
import MockWebex from '@webex/test-helper-mock-webex';
import Authorization from '@webex/plugin-authorization-node';

@@ -20,6 +20,6 @@ import {Credentials} from '@webex/webex-core';

describe('Authorization', () => {
let spark;
let webex;
beforeEach(() => {
spark = new MockSpark({
webex = new MockWebex({
children: {

@@ -31,3 +31,3 @@ authorization: Authorization,

spark.request.returns(Promise.resolve({
webex.request.returns(Promise.resolve({
statusCode: 200,

@@ -42,23 +42,23 @@ body: {

describe('#requestAuthorizationCodeGrant', () => {
it('requires a `code`', () => assert.isRejected(spark.authorization.requestAuthorizationCodeGrant(), /`options.code` is required/));
it('requires a `code`', () => assert.isRejected(webex.authorization.requestAuthorizationCodeGrant(), /`options.code` is required/));
it('exchanges an authorization code for an access token', () => spark.authorization.requestAuthorizationCodeGrant({code: 1})
.then(() => assert.equal(spark.credentials.supertoken.access_token, 'AT3')));
it('exchanges an authorization code for an access token', () => webex.authorization.requestAuthorizationCodeGrant({code: 1})
.then(() => assert.equal(webex.credentials.supertoken.access_token, 'AT3')));
it('sets #isAuthenticating', () => {
const promise = spark.authorization.requestAuthorizationCodeGrant({code: 5});
const promise = webex.authorization.requestAuthorizationCodeGrant({code: 5});
assert.isTrue(spark.authorization.isAuthenticating);
assert.isTrue(webex.authorization.isAuthenticating);
return promise
.then(() => assert.isFalse(spark.authorization.isAuthenticating));
.then(() => assert.isFalse(webex.authorization.isAuthenticating));
});
it('sets #isAuthorizing', () => {
const promise = spark.authorization.requestAuthorizationCodeGrant({code: 5});
const promise = webex.authorization.requestAuthorizationCodeGrant({code: 5});
assert.isTrue(spark.authorization.isAuthorizing);
assert.isTrue(webex.authorization.isAuthorizing);
return promise
.then(() => assert.isFalse(spark.authorization.isAuthorizing));
.then(() => assert.isFalse(webex.authorization.isAuthorizing));
});

@@ -65,0 +65,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc