UNPKG

react-native-azure-auth

Version:

An React Native module implements Azure AD V2.0 authentication flow

1,099 lines (312 loc) 17.3 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Global - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Auth.html">Auth</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Auth.html#.acquireTokenSilent">acquireTokenSilent</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Auth.html#.clearPersistenCache">clearPersistenCache</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Auth.html#.exchange">exchange</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Auth.html#.loginUrl">loginUrl</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Auth.html#.logoutUrl">logoutUrl</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Auth.html#.msGraphRequest">msGraphRequest</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Auth.html#.refreshTokens">refreshTokens</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="AzureAuth.html">AzureAuth</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="BaseError.html">BaseError</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Client.html">Client</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TokenCache.AccessTokenItem.html">AccessTokenItem</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TokenCache.BaseTokenItem.html">BaseTokenItem</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TokenCache.RefreshTokenItem.html">RefreshTokenItem</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TokenCache.Scope.html">Scope</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TokenCache.TokenCache.html">TokenCache</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="WebAuth.html">WebAuth</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="WebAuth.html#.authorize">authorize</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="WebAuth.html#.clearSession">clearSession</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#getAllUserTokenKeys">getAllUserTokenKeys</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isIntersects">isIntersects</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isSubsetOf">isSubsetOf</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#request">request</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#serializeParams">serializeParams</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#validate">validate</a></span></li> </nav> <div id="main"> <h1 class="page-title">Global</h1> <section> <header> <h2> </h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Methods</h3> <div class="section-method"> <h4 class="name" id="getAllUserTokenKeys"><span class="type-signature">(async) </span>getAllUserTokenKeys<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Return all tokens for the client ID the cache initialized with and given user ID. If userId omitted - for all users of current client ID</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="token_cache.js.html">token/cache.js</a>, <a href="token_cache.js.html#line131">line 131</a> </li></ul></dd> </dl> </div> <div class="section-method"> <h4 class="name" id="isIntersects"><span class="type-signature"></span>isIntersects<span class="signature">(otherScope)</span><span class="type-signature"></span></h4> <div class="description"> <p>Copmare if the current instance scope intersects witt one from parameter Only NON basic scopes are compared</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="token_scope.js.html">token/scope.js</a>, <a href="token_scope.js.html#line85">line 85</a> </li></ul></dd> </dl> <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>otherScope</code></td> <td class="type"> <span class="param-type"><code>Scope</code></span> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="isSubsetOf"><span class="type-signature"></span>isSubsetOf<span class="signature">(newScope, otherScope)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Check if newScope is a subset of baseScope</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="token_scope.js.html">token/scope.js</a>, <a href="token_scope.js.html#line66">line 66</a> </li></ul></dd> </dl> <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>newScope</code></td> <td class="type"> <span class="param-type"><code>Array</code></span> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>otherScope</code></td> <td class="type"> <span class="param-type"><code>Array</code></span> </td> <td class="description last"> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> </div> </div> <div class="section-method"> <h4 class="name" id="request"><span class="type-signature">(async) </span>request<span class="signature">(method, url, body<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> <p>Helper function to send HTTP requests</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="networking_index.js.html">networking/index.js</a>, <a href="networking_index.js.html#line71">line 71</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>method</code></td> <td class="type"> <span class="param-type"><code>String</code></span> </td> <td class="attributes"> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>url</code></td> <td class="type"> <span class="param-type"><code>String</code></span> </td> <td class="attributes"> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>body</code></td> <td class="type"> <span class="param-type"><code>Object</code></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"> <p>request body</p> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="serializeParams"><span class="type-signature"></span>serializeParams<span class="signature">(params)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Helper function to serialize object into urlencoded form data string, properties which value is either <code>null</code> or <code>undefined</code> will be ignored.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="networking_index.js.html">networking/index.js</a>, <a href="networking_index.js.html#line9">line 9</a> </li></ul></dd> </dl> <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>params</code></td> <td class="type"> <span class="param-type"><code>Object</code></span> </td> <td class="description last"> <p>Object which contains props.</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>string</code></span> </dd> </dl> <div class="param-desc"> <p>Result form data string.</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="validate"><span class="type-signature"></span>validate<span class="signature">(rules, values)</span><span class="type-signature"></span></h4> <div class="description"> <p>Applies the validtion and transform rules to the given values</p> <p>Possible rules: rules = { parameters: { // define rules for needed keys from <code>values</code> input object realm: {} // just declared without rules, not required by default state: {required: true}, // required nonce: {required: false, type: 'string'}, // not required, but if given must have type <code>strng</code> clientId: {toName: 'client_id'}, // key name transform rule }, validate: true | false // if true (default) - pass through only declared params aliases: { connection: 'realm', clientID: 'clientId' } } Actions:</p> <ul> <li>removes not declared in rules values (can be disabled by 'validate: false' parameter)</li> <li>checks if all required values are exist in values ('required: true')</li> <li>cheks if all given typed parameters have a required type</li> <li>all values are optional by default (without &quot;required&quot; rule)</li> </ul> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utils_validate.js.html">utils/validate.js</a>, <a href="utils_validate.js.html#line49">line 49</a> </li></ul></dd> </dl> <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>rules</code></td> <td class="type"> <span class="param-type"><code>Object</code></span> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>values</code></td> <td class="type"> <span class="param-type"><code>Object</code></span> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> </article> </section> </div> <br class="clear"> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Wed Jun 25 2025 10:35:11 GMT+0200 (Central European Summer Time) using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>