Skip to content

Commit

Permalink
authenticationUrl fix (KEY-343) (#40)
Browse files Browse the repository at this point in the history
* authenticationUrl fix + tests

* linting
  • Loading branch information
zxan1285 authored and shawnmclean committed Nov 16, 2018
1 parent b8d2215 commit 70a924c
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 15 deletions.
1 change: 0 additions & 1 deletion dist/auth0-sso-dashboard.extension.2.0.0.js

This file was deleted.

6 changes: 0 additions & 6 deletions dist/auth0-sso-dashboard.ui.2.0.0.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/auth0-sso-dashboard.ui.2.0.0.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/auth0-sso-dashboard.ui.vendors.2.0.0.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/manifest.json

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth0-sso-dashboard",
"version": "2.0.0",
"version": "2.0.1",
"description": "This extension provides your users with a dashboard for all of their applications.",
"engines": {
"node": ">=4.x"
Expand Down Expand Up @@ -130,6 +130,7 @@
"autoprefixer": "^6.5.1",
"babel-eslint": "7.1.1",
"babel-loader": "^8.0.0-beta",
"babel-polyfill": "^6.26.0",
"chai": "^3.5.0",
"classnames": "^2.2.5",
"cross-env": "^3.1.3",
Expand Down
2 changes: 1 addition & 1 deletion server/lib/authenticationUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = (app) => {
}

if (app.connection) {
const sep = loginUrl.indexOf('?') > 0 ? '?' : '&';
const sep = loginUrl.indexOf('?') < 0 ? '?' : '&';
const type = authProtocol === 'wsfed' ? 'whr' : 'connection';
loginUrl += `${sep}${type}=${app.connection}`;
}
Expand Down
4 changes: 2 additions & 2 deletions server/lib/multipartRequest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Promise from 'bluebird';
import { ArgumentError } from 'auth0-extension-tools';

export default function(client, entity, opts = {}, perPage = 100, concurrency = 5) {
export default function (client, entity, opts = {}, perPage = 100, concurrency = 5) {
if (client === null || client === undefined) {
throw new ArgumentError('Must provide a auth0 client object.');
}
Expand Down Expand Up @@ -41,7 +41,7 @@ export default function(client, entity, opts = {}, perPage = 100, concurrency =
}

const pages = [];
for (let i=1; i<=pageCount; i++) {
for (let i = 1; i <= pageCount; i++) {
pages.push(i);
}

Expand Down
47 changes: 47 additions & 0 deletions tests/server/lib/authenticationUrl.tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* eslint-disable import/no-extraneous-dependencies */
import { expect } from 'chai';
import { setProvider } from '../../../server/lib/config';
import authenticationUrl from '../../../server/lib/authenticationUrl';

describe('authenticationUrl', () => {
setProvider(() => 'auth0.example.com');

it('should return saml url with connection', () => {
const app = {
type: 'saml',
scope: 'scope',
client: 'client',
callback: 'callback',
connection: 'connection',
response_type: 'response_type'
};

expect(authenticationUrl(app)).to.equal('https://auth0.example.com/samlp/client?connection=connection');
});

it('should return wsfed url with connection', () => {
const app = {
type: 'wsfed',
scope: 'scope',
client: 'client',
callback: 'callback',
connection: 'connection',
response_type: 'response_type'
};

expect(authenticationUrl(app)).to.equal('https://auth0.example.com/wsfed/client?wreply=callback&whr=connection');
});

it('should return oidc url with connection', () => {
const app = {
type: 'oidc',
scope: 'scope',
client: 'client',
callback: 'callback',
connection: 'connection',
response_type: 'response_type'
};

expect(authenticationUrl(app)).to.equal('https://auth0.example.com/authorize?response_type=response_type&scope=scope&client_id=client&redirect_uri=callback&connection=connection');
});
});
2 changes: 1 addition & 1 deletion webtask.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "SSO Dashboard",
"name": "auth0-sso-dashboard",
"version": "2.0.0",
"version": "2.0.1",
"preVersion": "1.1.6",
"author": "Auth0",
"useHashName": false,
Expand Down

0 comments on commit 70a924c

Please sign in to comment.