Skip to content

Commit

Permalink
Merge pull request #64 from IBM-Security/V2.0.6
Browse files Browse the repository at this point in the history
V2.0.6 release
  • Loading branch information
trumanbutter committed Jun 18, 2021
2 parents d6b91cd + 523d719 commit 0a8e7e0
Show file tree
Hide file tree
Showing 64 changed files with 12,641 additions and 33,978 deletions.
13 changes: 9 additions & 4 deletions lib/OAuthContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class FlowAbstract {
}

/**
* @function getToken Makes an api request to the Cloud Identity Authorization server
* @function getToken Makes an api request to the ISV Authorization server
* to retrieve access_token, refresh_token, grant_id... used for NodeJS applications that can
* store secure credentials
* @param {object} params Required data and url path to token EP to retrieve a OAuth 2.0 Bearer Token.
Expand Down Expand Up @@ -463,8 +463,12 @@ class ImplicitFlow extends FlowAbstract {
* @params {string} path Optional path to redirect to, defaults to index page.
*/
async logout(path: string) {
const accessToken: IToken = this.fetchToken();
await this.revokeToken(accessToken, ETokens.AccessToken);
const accessToken: IToken = await this.fetchToken();

if (typeof accessToken === 'string'){
await this.revokeToken(accessToken, ETokens.AccessToken);
}

await this.storageHandler.clearStorage();
await window.location.replace(path || '/');
}
Expand All @@ -473,6 +477,7 @@ class ImplicitFlow extends FlowAbstract {
* @function handleCallback Stores token into sessionStorage
* @returns {Promise<void>} Promise rejection if error
*/

handleCallback() {
let urlObj: Object | string;
const errorCheck: RegExp = RegExp('#error');
Expand Down Expand Up @@ -660,7 +665,7 @@ class DeviceFlow extends FlowAbstract {
}

if (response) {
return Promise.resolve();
return Promise.resolve(response);
}
return Promise.reject(error.messageDescription);
}
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ibm-verify-sdk",
"version": "2.0.5",
"version": "2.0.6",
"description": "IBM Security Verify SDK for JavaScript",
"main": "dist/index.js",
"directories": {
Expand Down
3 changes: 1 addition & 2 deletions samples/authorization-code-flow/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ This sample shows how to use the SDK to
4. npm run start
5. navigate to `http://localhost:3000`

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)

For more details how this application works visit the [IBM Security Documentation Hub](https://docs.verify.ibm.com/verify/docs/authorization-code-example#introduction)
## License

The MIT License (MIT)
Expand Down
72 changes: 0 additions & 72 deletions samples/authorization-code-flow/node/front-end/dashboard.html

This file was deleted.

43 changes: 0 additions & 43 deletions samples/authorization-code-flow/node/front-end/dashboard.js

This file was deleted.

28 changes: 28 additions & 0 deletions samples/authorization-code-flow/node/front-end/dashboard.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
extends layout.pug

block content
.container.main
h3 Welcome #{userInfo.displayName},
p.lead.mb-5 You have successfully authenticated with IBM Security Verify.
p Below is the information retrieved from the <code>userInfo</code> endpoint for the authenticated user.
.container
.row
.col-md-8
table.table.table-bordered
thead.table-dark
tr
th User claims
th Value
tbody
each val, key in userInfo
if key === 'ext'
tr
td tenantId
td= userInfo.ext.tenantId
else
tr
td= key
td= val
.row
.col-md-6
a(href=`/logout`).btn.btn-primary log out
10 changes: 10 additions & 0 deletions samples/authorization-code-flow/node/front-end/index.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends layout.pug

block content
.container.main
p The sample app demonstrates how to authenticate with IBM Security Verify using the Authorization Code Flow.
p You can authenticate using a registered IBM Security Verify's username and password.
a(href='/login').btn.btn-primary log in

if isAnonymous
p you have succuessfully logged out.
29 changes: 29 additions & 0 deletions samples/authorization-code-flow/node/front-end/layout.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
html
head
title= title
link(href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous")
script(src='https://code.jquery.com/jquery-3.3.1.min.js')

style(type="text/css").
.jumbotron {
padding: 4rem 2rem;
margin-bottom: 2rem;
background-color: var(--bs-light);
border-radius: .3rem;
}


body.d-flex.flex-column.h-100
.jumbotron
.container
h1 Authorization code flow sample app.
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]

.main.flex-shrink-0.mb-5
block content

footer.mt-auto.py-3.bg-dark.text-white
.container
.row
.col
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.
Loading

0 comments on commit 0a8e7e0

Please sign in to comment.