Skip to content

Commit

Permalink
Merge pull request #31 from ibm-cloud-security/development
Browse files Browse the repository at this point in the history
dev->master
  • Loading branch information
TalAviel authored Jan 13, 2020
2 parents dbb7b90 + 852053f commit 9f12a1e
Show file tree
Hide file tree
Showing 21 changed files with 616 additions and 8,626 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules/
.nyc_output/
coverage/
package-lock.json
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log

## [v0.3.2](https://github.com/ibm-cloud-security/appid-clientsdk-js/tree/0.3.2) (2020-01-13)

**Added**

- Change details for Cloud Directory users
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import AppID from 'ibmcloud-appid-js';

From the CDN:
```html
<script src="https://cdn.appid.cloud.ibm.com/appid-0.3.0.min.js"></script>
<script src="https://cdn.appid.cloud.ibm.com/appid-0.3.2.min.js"></script>
```

Or for development purposes use the minified file in this repo:
Expand Down
385 changes: 50 additions & 335 deletions dist/appid.min.js

Large diffs are not rendered by default.

395 changes: 50 additions & 345 deletions dist/appid.umd.min.js

Large diffs are not rendered by default.

248 changes: 246 additions & 2 deletions docs/AppID.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<nav >

<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li><li data-type='method'><a href="AppID.html#changeDetails">changeDetails</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -1498,6 +1498,250 @@ <h5>Returns:</h5>







<h4 class="name" id="changeDetails"><span class="type-signature">(async) </span>changeDetails<span class="signature">(tokens)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="global.html#Tokens">Tokens</a>>}</span></h4>






<dl class="details">


<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line231">line 231</a>
</li></ul></dd>































</dl>





<div class="description">
<p>This method will open a popup to the change details widget for Cloud Directory users.<br>
You must enable users to manage their account from your app in Cloud Directory settings.</p>
</div>









<h5>Example</h5>

<pre class="prettyprint"><code>let tokens = {accessToken, idToken}
let newTokens = await appID.changeDetails(tokens);</code></pre>




<h5>Parameters:</h5>


<table class="params">
<thead>
<tr>

<th>Name</th>


<th>Type</th>





<th class="last">Description</th>
</tr>
</thead>

<tbody>


<tr>

<td class="name"><code>tokens</code></td>


<td class="type">


<span class="param-type">Object</span>



</td>





<td class="description last"><p>App ID tokens</p></td>
</tr>


</tbody>
</table>














<h5>Throws:</h5>
<ul>
<li>

<dl>
<dt>
<div class="param-desc">
<p>&quot;Missing id token string&quot;</p>
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">AppIDError</span>


</dd>
</dl>
</dt>
<dd></dd>
</dl>

</li>

<li>

<dl>
<dt>
<div class="param-desc">
<p>&quot;Missing access token string&quot;</p>
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">AppIDError</span>


</dd>
</dl>
</dt>
<dd></dd>
</dl>

</li>

<li>

<dl>
<dt>
<div class="param-desc">
<p>&quot;Missing tokens object&quot;</p>
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">AppIDError</span>


</dd>
</dl>
</dt>
<dd></dd>
</dl>

</li>
</ul>


<h5>Returns:</h5>




<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">Promise.&lt;<a href="global.html#Tokens">Tokens</a>></span>


</dd>
</dl>









Expand All @@ -1517,7 +1761,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Mon Oct 28 2019 11:08:24 GMT-0500 (CDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 15:52:52 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<nav >

<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li><li data-type='method'><a href="AppID.html#changeDetails">changeDetails</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -329,7 +329,7 @@ <h5>Type:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Mon Oct 28 2019 11:08:24 GMT-0500 (CDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 15:52:52 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<nav >

<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li><li data-type='method'><a href="AppID.html#changeDetails">changeDetails</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -124,7 +124,7 @@ <h2 id="api-reference">API Reference</h2>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Mon Oct 28 2019 11:08:24 GMT-0500 (CDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 15:52:52 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
45 changes: 42 additions & 3 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<nav >

<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li><li data-type='method'><a href="AppID.html#changeDetails">changeDetails</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -252,14 +252,53 @@ <h1 class="page-title">index.js</h1>
}

const endpoint = this.openIdConfigResource.getIssuer() + constants.CHANGE_PASSWORD;
return this.utils.performOAuthFlowAndGetTokens({
return await this.utils.performOAuthFlowAndGetTokens({
userId,
origin: this.window.origin,
clientId: this.clientId,
endpoint
});
}

/**
* This method will open a popup to the change details widget for Cloud Directory users.
* You must enable users to manage their account from your app in Cloud Directory settings.
* @param {Object} tokens App ID tokens
* @returns {Promise&lt;Tokens>}
* @throws {AppIDError} "Missing id token string"
* @throws {AppIDError} "Missing access token string"
* @throws {AppIDError} "Missing tokens object"
* @example
* let tokens = {accessToken, idToken}
* let newTokens = await appID.changeDetails(tokens);
*/
async changeDetails({accessToken, idToken}) {
this._validateInitalize();

if (!accessToken &amp;&amp; typeof accessToken !== 'string') {
throw new AppIDError(constants.MISSING_ACCESS_TOKEN);
}

if (!idToken &amp;&amp; typeof idToken !== 'string') {
throw new AppIDError(constants.MISSING_ID_TOKEN);
}

const generateCodeUrl = this.openIdConfigResource.getIssuer() + constants.GENERATE_CODE;
const changeDetailsCode = await this.request(generateCodeUrl, {
headers: {
'Authorization': 'Bearer ' + accessToken + ' ' + idToken
}
});
const endpoint = this.openIdConfigResource.getIssuer() + constants.CHANGE_DETAILS;

return this.utils.performOAuthFlowAndGetTokens({
origin: this.window.origin,
clientId: this.clientId,
endpoint,
changeDetailsCode
});
}

/**
*
* @private
Expand All @@ -286,7 +325,7 @@ <h1 class="page-title">index.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Mon Oct 28 2019 11:08:24 GMT-0500 (CDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 15:52:52 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
Loading

0 comments on commit 9f12a1e

Please sign in to comment.