Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 0a8e7e0

Browse files
authored
Merge pull request #64 from IBM-Security/V2.0.6
V2.0.6 release
2 parents d6b91cd + 523d719 commit 0a8e7e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+12641
-33978
lines changed

lib/OAuthContext.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class FlowAbstract {
240240
}
241241

242242
/**
243-
* @function getToken Makes an api request to the Cloud Identity Authorization server
243+
* @function getToken Makes an api request to the ISV Authorization server
244244
* to retrieve access_token, refresh_token, grant_id... used for NodeJS applications that can
245245
* store secure credentials
246246
* @param {object} params Required data and url path to token EP to retrieve a OAuth 2.0 Bearer Token.
@@ -463,8 +463,12 @@ class ImplicitFlow extends FlowAbstract {
463463
* @params {string} path Optional path to redirect to, defaults to index page.
464464
*/
465465
async logout(path: string) {
466-
const accessToken: IToken = this.fetchToken();
467-
await this.revokeToken(accessToken, ETokens.AccessToken);
466+
const accessToken: IToken = await this.fetchToken();
467+
468+
if (typeof accessToken === 'string'){
469+
await this.revokeToken(accessToken, ETokens.AccessToken);
470+
}
471+
468472
await this.storageHandler.clearStorage();
469473
await window.location.replace(path || '/');
470474
}
@@ -473,6 +477,7 @@ class ImplicitFlow extends FlowAbstract {
473477
* @function handleCallback Stores token into sessionStorage
474478
* @returns {Promise<void>} Promise rejection if error
475479
*/
480+
476481
handleCallback() {
477482
let urlObj: Object | string;
478483
const errorCheck: RegExp = RegExp('#error');
@@ -660,7 +665,7 @@ class DeviceFlow extends FlowAbstract {
660665
}
661666

662667
if (response) {
663-
return Promise.resolve();
668+
return Promise.resolve(response);
664669
}
665670
return Promise.reject(error.messageDescription);
666671
}

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ibm-verify-sdk",
3-
"version": "2.0.5",
3+
"version": "2.0.6",
44
"description": "IBM Security Verify SDK for JavaScript",
55
"main": "dist/index.js",
66
"directories": {

samples/authorization-code-flow/node/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ This sample shows how to use the SDK to
1515
4. npm run start
1616
5. navigate to `http://localhost:3000`
1717

18-
The IBM Verify Javascript SDK also supports the ability to manage IBM Verify registration profiles. You can read more about how this is implemented [here](http://developer.ice.ibmcloud.com/verify/javascript/ibm-verify-sdk-object-model/authenticator-context)
19-
18+
For more details how this application works visit the [IBM Security Documentation Hub](https://docs.verify.ibm.com/verify/docs/authorization-code-example#introduction)
2019
## License
2120

2221
The MIT License (MIT)

samples/authorization-code-flow/node/front-end/dashboard.html

Lines changed: 0 additions & 72 deletions
This file was deleted.

samples/authorization-code-flow/node/front-end/dashboard.js

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
extends layout.pug
2+
3+
block content
4+
.container.main
5+
h3 Welcome #{userInfo.displayName},
6+
p.lead.mb-5 You have successfully authenticated with IBM Security Verify.
7+
p Below is the information retrieved from the <code>userInfo</code> endpoint for the authenticated user.
8+
.container
9+
.row
10+
.col-md-8
11+
table.table.table-bordered
12+
thead.table-dark
13+
tr
14+
th User claims
15+
th Value
16+
tbody
17+
each val, key in userInfo
18+
if key === 'ext'
19+
tr
20+
td tenantId
21+
td= userInfo.ext.tenantId
22+
else
23+
tr
24+
td= key
25+
td= val
26+
.row
27+
.col-md-6
28+
a(href=`/logout`).btn.btn-primary log out
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
extends layout.pug
2+
3+
block content
4+
.container.main
5+
p The sample app demonstrates how to authenticate with IBM Security Verify using the Authorization Code Flow.
6+
p You can authenticate using a registered IBM Security Verify's username and password.
7+
a(href='/login').btn.btn-primary log in
8+
9+
if isAnonymous
10+
p you have succuessfully logged out.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
html
2+
head
3+
title= title
4+
link(href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous")
5+
script(src='https://code.jquery.com/jquery-3.3.1.min.js')
6+
7+
style(type="text/css").
8+
.jumbotron {
9+
padding: 4rem 2rem;
10+
margin-bottom: 2rem;
11+
background-color: var(--bs-light);
12+
border-radius: .3rem;
13+
}
14+
15+
16+
body.d-flex.flex-column.h-100
17+
.jumbotron
18+
.container
19+
h1 Authorization code flow sample app.
20+
p The sample is using #[a(href='https://www.npmjs.com/package/ibm-verify-sdk' title='IBM Verify Javascript SDK' target='_blank') IBM Verify Javascript SDK]
21+
22+
.main.flex-shrink-0.mb-5
23+
block content
24+
25+
footer.mt-auto.py-3.bg-dark.text-white
26+
.container
27+
.row
28+
.col
29+
p.mb-0 Visit the IBM Security Verify #[a(href='https://docs.verify.ibm.com/verify/docs/authorization-code-example' title='IBM Security Verify authorization code example' target='_blank') Documentation Hub ] for more information about the Authorization code flow sample.

0 commit comments

Comments
 (0)