@webex/plugin-authorization-browser 2.59.2 → 2.59.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -6
- package/README.md +53 -53
- package/babel.config.js +3 -3
- package/dist/authorization.js +109 -109
- package/dist/authorization.js.map +1 -1
- package/dist/config.js +8 -8
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +20 -19
- package/process +1 -1
- package/src/authorization.js +394 -394
- package/src/config.js +16 -16
- package/src/index.js +19 -19
- package/test/automation/fixtures/app.js +76 -76
- package/test/automation/fixtures/index.html +27 -27
- package/test/automation/spec/authorization-code-grant.js +123 -123
- package/test/automation/spec/implicit-grant.js +90 -90
- package/test/integration/spec/authorization.js +76 -76
- package/test/unit/spec/authorization.js +430 -430
package/src/config.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
credentials: {
|
|
7
|
-
/**
|
|
8
|
-
* Controls whether {@link Authorization#initiateLogin()} requests a token
|
|
9
|
-
* or an auth code. Anything other than 'confidential' will be treated as
|
|
10
|
-
* 'public'
|
|
11
|
-
* @private
|
|
12
|
-
* @type {string}
|
|
13
|
-
*/
|
|
14
|
-
clientType: 'public',
|
|
15
|
-
},
|
|
16
|
-
};
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
credentials: {
|
|
7
|
+
/**
|
|
8
|
+
* Controls whether {@link Authorization#initiateLogin()} requests a token
|
|
9
|
+
* or an auth code. Anything other than 'confidential' will be treated as
|
|
10
|
+
* 'public'
|
|
11
|
+
* @private
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
clientType: 'public',
|
|
15
|
+
},
|
|
16
|
+
};
|
package/src/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@webex/internal-plugin-device';
|
|
6
|
-
import {registerPlugin} from '@webex/webex-core';
|
|
7
|
-
|
|
8
|
-
import Authorization from './authorization';
|
|
9
|
-
import config from './config';
|
|
10
|
-
|
|
11
|
-
const proxies = ['isAuthorizing', 'isAuthenticating'];
|
|
12
|
-
|
|
13
|
-
registerPlugin('authorization', Authorization, {
|
|
14
|
-
config,
|
|
15
|
-
proxies,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export {default} from './authorization';
|
|
19
|
-
export {default as config} from './config';
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@webex/internal-plugin-device';
|
|
6
|
+
import {registerPlugin} from '@webex/webex-core';
|
|
7
|
+
|
|
8
|
+
import Authorization from './authorization';
|
|
9
|
+
import config from './config';
|
|
10
|
+
|
|
11
|
+
const proxies = ['isAuthorizing', 'isAuthenticating'];
|
|
12
|
+
|
|
13
|
+
registerPlugin('authorization', Authorization, {
|
|
14
|
+
config,
|
|
15
|
+
proxies,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export {default} from './authorization';
|
|
19
|
+
export {default as config} from './config';
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-env browser */
|
|
6
|
-
|
|
7
|
-
import '@webex/plugin-authorization-browser';
|
|
8
|
-
import StorageAdapterLocalStorage from '@webex/storage-adapter-local-storage';
|
|
9
|
-
import WebexCore from '@webex/webex-core';
|
|
10
|
-
|
|
11
|
-
import pkg from '../../../package';
|
|
12
|
-
|
|
13
|
-
const webex = (window.webex = new WebexCore({
|
|
14
|
-
config: {
|
|
15
|
-
credentials: {
|
|
16
|
-
refreshCallback(webex, token) {
|
|
17
|
-
return webex
|
|
18
|
-
.request({
|
|
19
|
-
method: 'POST',
|
|
20
|
-
uri: '/refresh',
|
|
21
|
-
body: {
|
|
22
|
-
// eslint-disable-next-line camelcase
|
|
23
|
-
refresh_token: token.refresh_token,
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
.then((res) => res.body);
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
storage: {
|
|
30
|
-
boundedAdapter: new StorageAdapterLocalStorage('webex'),
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
}));
|
|
34
|
-
|
|
35
|
-
webex.once('ready', () => {
|
|
36
|
-
if (webex.canAuthorize) {
|
|
37
|
-
document.getElementById('access-token').innerHTML = webex.credentials.supertoken.access_token;
|
|
38
|
-
document.getElementById('refresh-token').innerHTML = webex.credentials.supertoken.refresh_token;
|
|
39
|
-
|
|
40
|
-
webex
|
|
41
|
-
.request({
|
|
42
|
-
uri: 'https://locus-a.wbx2.com/locus/api/v1/ping',
|
|
43
|
-
})
|
|
44
|
-
.then(() => {
|
|
45
|
-
document.getElementById('ping-complete').innerHTML = 'success';
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// ready class implies js has loaded and selenium can start doing stuff
|
|
51
|
-
document.body.classList.add('ready');
|
|
52
|
-
|
|
53
|
-
document.getElementById('initiate-implicit-grant').addEventListener('click', () => {
|
|
54
|
-
webex.authorization.initiateLogin({
|
|
55
|
-
state: {name: pkg.name},
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
document.getElementById('initiate-authorization-code-grant').addEventListener('click', () => {
|
|
60
|
-
webex.config.credentials.clientType = 'confidential';
|
|
61
|
-
webex.authorization.initiateLogin({
|
|
62
|
-
state: {name: pkg.name},
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
document.getElementById('token-refresh').addEventListener('click', () => {
|
|
67
|
-
document.getElementById('access-token').innerHTML = '';
|
|
68
|
-
webex.refresh({force: true}).then(() => {
|
|
69
|
-
document.getElementById('access-token').innerHTML = webex.credentials.supertoken.access_token;
|
|
70
|
-
document.getElementById('refresh-token').innerHTML = webex.credentials.supertoken.refresh_token;
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
document.getElementById('logout').addEventListener('click', () => {
|
|
75
|
-
webex.logout();
|
|
76
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-env browser */
|
|
6
|
+
|
|
7
|
+
import '@webex/plugin-authorization-browser';
|
|
8
|
+
import StorageAdapterLocalStorage from '@webex/storage-adapter-local-storage';
|
|
9
|
+
import WebexCore from '@webex/webex-core';
|
|
10
|
+
|
|
11
|
+
import pkg from '../../../package';
|
|
12
|
+
|
|
13
|
+
const webex = (window.webex = new WebexCore({
|
|
14
|
+
config: {
|
|
15
|
+
credentials: {
|
|
16
|
+
refreshCallback(webex, token) {
|
|
17
|
+
return webex
|
|
18
|
+
.request({
|
|
19
|
+
method: 'POST',
|
|
20
|
+
uri: '/refresh',
|
|
21
|
+
body: {
|
|
22
|
+
// eslint-disable-next-line camelcase
|
|
23
|
+
refresh_token: token.refresh_token,
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
.then((res) => res.body);
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
storage: {
|
|
30
|
+
boundedAdapter: new StorageAdapterLocalStorage('webex'),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
webex.once('ready', () => {
|
|
36
|
+
if (webex.canAuthorize) {
|
|
37
|
+
document.getElementById('access-token').innerHTML = webex.credentials.supertoken.access_token;
|
|
38
|
+
document.getElementById('refresh-token').innerHTML = webex.credentials.supertoken.refresh_token;
|
|
39
|
+
|
|
40
|
+
webex
|
|
41
|
+
.request({
|
|
42
|
+
uri: 'https://locus-a.wbx2.com/locus/api/v1/ping',
|
|
43
|
+
})
|
|
44
|
+
.then(() => {
|
|
45
|
+
document.getElementById('ping-complete').innerHTML = 'success';
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// ready class implies js has loaded and selenium can start doing stuff
|
|
51
|
+
document.body.classList.add('ready');
|
|
52
|
+
|
|
53
|
+
document.getElementById('initiate-implicit-grant').addEventListener('click', () => {
|
|
54
|
+
webex.authorization.initiateLogin({
|
|
55
|
+
state: {name: pkg.name},
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
document.getElementById('initiate-authorization-code-grant').addEventListener('click', () => {
|
|
60
|
+
webex.config.credentials.clientType = 'confidential';
|
|
61
|
+
webex.authorization.initiateLogin({
|
|
62
|
+
state: {name: pkg.name},
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
document.getElementById('token-refresh').addEventListener('click', () => {
|
|
67
|
+
document.getElementById('access-token').innerHTML = '';
|
|
68
|
+
webex.refresh({force: true}).then(() => {
|
|
69
|
+
document.getElementById('access-token').innerHTML = webex.credentials.supertoken.access_token;
|
|
70
|
+
document.getElementById('refresh-token').innerHTML = webex.credentials.supertoken.refresh_token;
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
document.getElementById('logout').addEventListener('click', () => {
|
|
75
|
+
webex.logout();
|
|
76
|
+
});
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Authorization Automation Test</title>
|
|
5
|
-
</head>
|
|
6
|
-
<body class="authorization-automation-test">
|
|
7
|
-
<button title="Login with Implicit Grant" id="initiate-implicit-grant">
|
|
8
|
-
Login with Implicit Grant
|
|
9
|
-
</button>
|
|
10
|
-
<button title="Login with Authorization Code Grant" id="initiate-authorization-code-grant">
|
|
11
|
-
Login with Authorization Code Grant
|
|
12
|
-
</button>
|
|
13
|
-
<button title="Refresh Access Token" id="token-refresh">Refresh Access Token</button>
|
|
14
|
-
|
|
15
|
-
<h1>Access Token</h1>
|
|
16
|
-
<div id="access-token"></div>
|
|
17
|
-
<h1>Refresh Token</h1>
|
|
18
|
-
<div id="refresh-token"></div>
|
|
19
|
-
|
|
20
|
-
<h1>Pinging WDM</h1>
|
|
21
|
-
<div id="ping-complete"></div>
|
|
22
|
-
|
|
23
|
-
<button title="Logout" id="logout">Logout</button>
|
|
24
|
-
|
|
25
|
-
<script src="app.js"></script>
|
|
26
|
-
</body>
|
|
27
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Authorization Automation Test</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body class="authorization-automation-test">
|
|
7
|
+
<button title="Login with Implicit Grant" id="initiate-implicit-grant">
|
|
8
|
+
Login with Implicit Grant
|
|
9
|
+
</button>
|
|
10
|
+
<button title="Login with Authorization Code Grant" id="initiate-authorization-code-grant">
|
|
11
|
+
Login with Authorization Code Grant
|
|
12
|
+
</button>
|
|
13
|
+
<button title="Refresh Access Token" id="token-refresh">Refresh Access Token</button>
|
|
14
|
+
|
|
15
|
+
<h1>Access Token</h1>
|
|
16
|
+
<div id="access-token"></div>
|
|
17
|
+
<h1>Refresh Token</h1>
|
|
18
|
+
<div id="refresh-token"></div>
|
|
19
|
+
|
|
20
|
+
<h1>Pinging WDM</h1>
|
|
21
|
+
<div id="ping-complete"></div>
|
|
22
|
+
|
|
23
|
+
<button title="Logout" id="logout">Logout</button>
|
|
24
|
+
|
|
25
|
+
<script src="app.js"></script>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable indent */
|
|
6
|
-
|
|
7
|
-
import {assert} from '@webex/test-helper-chai';
|
|
8
|
-
import {createBrowser} from '@webex/test-helper-automation';
|
|
9
|
-
import testUsers from '@webex/test-helper-test-users';
|
|
10
|
-
|
|
11
|
-
import pkg from '../../../package';
|
|
12
|
-
|
|
13
|
-
const redirectUri = process.env.WEBEX_REDIRECT_URI || process.env.REDIRECT_URI;
|
|
14
|
-
|
|
15
|
-
describe('plugin-authorization-browser', function () {
|
|
16
|
-
this.timeout(120000);
|
|
17
|
-
describe('Authorization', () => {
|
|
18
|
-
describe.skip('Authorization Code Grant', () => {
|
|
19
|
-
let browser, user;
|
|
20
|
-
|
|
21
|
-
before(() =>
|
|
22
|
-
testUsers.create({count: 1}).then((users) => {
|
|
23
|
-
user = users[0];
|
|
24
|
-
})
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
before(() =>
|
|
28
|
-
createBrowser(pkg).then((b) => {
|
|
29
|
-
browser = b;
|
|
30
|
-
})
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
after(() => browser && browser.printLogs());
|
|
34
|
-
|
|
35
|
-
after(
|
|
36
|
-
() =>
|
|
37
|
-
browser &&
|
|
38
|
-
browser.quit().catch((reason) => {
|
|
39
|
-
console.warn(reason);
|
|
40
|
-
})
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
it('authorizes a user', () =>
|
|
44
|
-
browser
|
|
45
|
-
.get(`${redirectUri}/${pkg.name}`)
|
|
46
|
-
.waitForElementByClassName('ready')
|
|
47
|
-
.title()
|
|
48
|
-
.should.eventually.become('Authorization Automation Test')
|
|
49
|
-
.waitForElementByCssSelector('[title="Login with Authorization Code Grant"]')
|
|
50
|
-
.click()
|
|
51
|
-
.login(user)
|
|
52
|
-
.waitForElementByClassName('authorization-automation-test')
|
|
53
|
-
.waitForElementById('refresh-token')
|
|
54
|
-
.text()
|
|
55
|
-
.should.eventually.not.be.empty.waitForElementByCssSelector('#ping-complete:not(:empty)')
|
|
56
|
-
.text()
|
|
57
|
-
.should.eventually.become('success'));
|
|
58
|
-
|
|
59
|
-
it('is still logged in after reloading the page', () =>
|
|
60
|
-
browser
|
|
61
|
-
.waitForElementById('access-token')
|
|
62
|
-
.text()
|
|
63
|
-
.should.eventually.not.be.empty.get(`${redirectUri}/${pkg.name}`)
|
|
64
|
-
.sleep(500)
|
|
65
|
-
.waitForElementById('access-token')
|
|
66
|
-
.text().should.eventually.not.be.empty);
|
|
67
|
-
|
|
68
|
-
it("refreshes the user's access token", () => {
|
|
69
|
-
let accessToken = '';
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
browser
|
|
73
|
-
.waitForElementByCssSelector('#access-token:not(:empty)')
|
|
74
|
-
.text()
|
|
75
|
-
.then((text) => {
|
|
76
|
-
accessToken = text;
|
|
77
|
-
assert.isString(accessToken);
|
|
78
|
-
assert.isAbove(accessToken.length, 0);
|
|
79
|
-
|
|
80
|
-
return browser;
|
|
81
|
-
})
|
|
82
|
-
.waitForElementByCssSelector('[title="Refresh Access Token"]')
|
|
83
|
-
.click()
|
|
84
|
-
// Not thrilled by a sleep, but we just need to give the button click
|
|
85
|
-
// enough time to clear the #access-token box
|
|
86
|
-
.sleep(500)
|
|
87
|
-
.waitForElementByCssSelector('#access-token:not(:empty)')
|
|
88
|
-
.text()
|
|
89
|
-
.then((text) => {
|
|
90
|
-
assert.isString(text);
|
|
91
|
-
assert.isAbove(text.length, 0);
|
|
92
|
-
assert.notEqual(text, accessToken);
|
|
93
|
-
|
|
94
|
-
return browser;
|
|
95
|
-
})
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('logs out a user', () =>
|
|
100
|
-
browser
|
|
101
|
-
.title()
|
|
102
|
-
.should.eventually.become('Authorization Automation Test')
|
|
103
|
-
.waitForElementByCssSelector('[title="Logout"]')
|
|
104
|
-
.click()
|
|
105
|
-
// We need to revoke three tokens before the window.location assignment.
|
|
106
|
-
// So far, I haven't found any ques to wait for, so sleep seems to be
|
|
107
|
-
// the only option.
|
|
108
|
-
.sleep(3000)
|
|
109
|
-
.title()
|
|
110
|
-
.should.eventually.become('Redirect Dispatcher')
|
|
111
|
-
.get(`${redirectUri}/${pkg.name}`)
|
|
112
|
-
.title()
|
|
113
|
-
.should.eventually.become('Authorization Automation Test')
|
|
114
|
-
.waitForElementById('access-token')
|
|
115
|
-
.text()
|
|
116
|
-
.should.eventually.be.empty.waitForElementByCssSelector(
|
|
117
|
-
'[title="Login with Authorization Code Grant"]'
|
|
118
|
-
)
|
|
119
|
-
.click()
|
|
120
|
-
.waitForElementById('IDToken1'));
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable indent */
|
|
6
|
+
|
|
7
|
+
import {assert} from '@webex/test-helper-chai';
|
|
8
|
+
import {createBrowser} from '@webex/test-helper-automation';
|
|
9
|
+
import testUsers from '@webex/test-helper-test-users';
|
|
10
|
+
|
|
11
|
+
import pkg from '../../../package';
|
|
12
|
+
|
|
13
|
+
const redirectUri = process.env.WEBEX_REDIRECT_URI || process.env.REDIRECT_URI;
|
|
14
|
+
|
|
15
|
+
describe('plugin-authorization-browser', function () {
|
|
16
|
+
this.timeout(120000);
|
|
17
|
+
describe('Authorization', () => {
|
|
18
|
+
describe.skip('Authorization Code Grant', () => {
|
|
19
|
+
let browser, user;
|
|
20
|
+
|
|
21
|
+
before(() =>
|
|
22
|
+
testUsers.create({count: 1}).then((users) => {
|
|
23
|
+
user = users[0];
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
before(() =>
|
|
28
|
+
createBrowser(pkg).then((b) => {
|
|
29
|
+
browser = b;
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
after(() => browser && browser.printLogs());
|
|
34
|
+
|
|
35
|
+
after(
|
|
36
|
+
() =>
|
|
37
|
+
browser &&
|
|
38
|
+
browser.quit().catch((reason) => {
|
|
39
|
+
console.warn(reason);
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
it('authorizes a user', () =>
|
|
44
|
+
browser
|
|
45
|
+
.get(`${redirectUri}/${pkg.name}`)
|
|
46
|
+
.waitForElementByClassName('ready')
|
|
47
|
+
.title()
|
|
48
|
+
.should.eventually.become('Authorization Automation Test')
|
|
49
|
+
.waitForElementByCssSelector('[title="Login with Authorization Code Grant"]')
|
|
50
|
+
.click()
|
|
51
|
+
.login(user)
|
|
52
|
+
.waitForElementByClassName('authorization-automation-test')
|
|
53
|
+
.waitForElementById('refresh-token')
|
|
54
|
+
.text()
|
|
55
|
+
.should.eventually.not.be.empty.waitForElementByCssSelector('#ping-complete:not(:empty)')
|
|
56
|
+
.text()
|
|
57
|
+
.should.eventually.become('success'));
|
|
58
|
+
|
|
59
|
+
it('is still logged in after reloading the page', () =>
|
|
60
|
+
browser
|
|
61
|
+
.waitForElementById('access-token')
|
|
62
|
+
.text()
|
|
63
|
+
.should.eventually.not.be.empty.get(`${redirectUri}/${pkg.name}`)
|
|
64
|
+
.sleep(500)
|
|
65
|
+
.waitForElementById('access-token')
|
|
66
|
+
.text().should.eventually.not.be.empty);
|
|
67
|
+
|
|
68
|
+
it("refreshes the user's access token", () => {
|
|
69
|
+
let accessToken = '';
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
browser
|
|
73
|
+
.waitForElementByCssSelector('#access-token:not(:empty)')
|
|
74
|
+
.text()
|
|
75
|
+
.then((text) => {
|
|
76
|
+
accessToken = text;
|
|
77
|
+
assert.isString(accessToken);
|
|
78
|
+
assert.isAbove(accessToken.length, 0);
|
|
79
|
+
|
|
80
|
+
return browser;
|
|
81
|
+
})
|
|
82
|
+
.waitForElementByCssSelector('[title="Refresh Access Token"]')
|
|
83
|
+
.click()
|
|
84
|
+
// Not thrilled by a sleep, but we just need to give the button click
|
|
85
|
+
// enough time to clear the #access-token box
|
|
86
|
+
.sleep(500)
|
|
87
|
+
.waitForElementByCssSelector('#access-token:not(:empty)')
|
|
88
|
+
.text()
|
|
89
|
+
.then((text) => {
|
|
90
|
+
assert.isString(text);
|
|
91
|
+
assert.isAbove(text.length, 0);
|
|
92
|
+
assert.notEqual(text, accessToken);
|
|
93
|
+
|
|
94
|
+
return browser;
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('logs out a user', () =>
|
|
100
|
+
browser
|
|
101
|
+
.title()
|
|
102
|
+
.should.eventually.become('Authorization Automation Test')
|
|
103
|
+
.waitForElementByCssSelector('[title="Logout"]')
|
|
104
|
+
.click()
|
|
105
|
+
// We need to revoke three tokens before the window.location assignment.
|
|
106
|
+
// So far, I haven't found any ques to wait for, so sleep seems to be
|
|
107
|
+
// the only option.
|
|
108
|
+
.sleep(3000)
|
|
109
|
+
.title()
|
|
110
|
+
.should.eventually.become('Redirect Dispatcher')
|
|
111
|
+
.get(`${redirectUri}/${pkg.name}`)
|
|
112
|
+
.title()
|
|
113
|
+
.should.eventually.become('Authorization Automation Test')
|
|
114
|
+
.waitForElementById('access-token')
|
|
115
|
+
.text()
|
|
116
|
+
.should.eventually.be.empty.waitForElementByCssSelector(
|
|
117
|
+
'[title="Login with Authorization Code Grant"]'
|
|
118
|
+
)
|
|
119
|
+
.click()
|
|
120
|
+
.waitForElementById('IDToken1'));
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|