188 lines
36 KiB
HTML
188 lines
36 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
|
<title>management/DeviceCredentialsManager.js - 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="module-auth.AuthenticationClient.html">AuthenticationClient</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#changePassword">changePassword</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#clientCredentialsGrant">clientCredentialsGrant</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#getClientInfo">getClientInfo</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#getDelegationToken">getDelegationToken</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#getProfile">getProfile</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#passwordGrant">passwordGrant</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#requestChangePasswordEmail">requestChangePasswordEmail</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#requestEmailCode">requestEmailCode</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#requestMagicLink">requestMagicLink</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#requestSMSCode">requestSMSCode</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#verifySMSCode">verifySMSCode</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html">DatabaseAuthenticator</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html#changePassword">changePassword</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html#requestChangePasswordEmail">requestChangePasswordEmail</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html#signIn">signIn</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html#signUp">signUp</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-auth.OAuthAuthenticator.html">OAuthAuthenticator</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.OAuthAuthenticator.html#passwordGrant">passwordGrant</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.OAuthAuthenticator.html#signIn">signIn</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.OAuthAuthenticator.html#socialSignIn">s
|
||
|
</nav>
|
||
|
|
||
|
<div id="main">
|
||
|
|
||
|
<h1 class="page-title">management/DeviceCredentialsManager.js</h1>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<section>
|
||
|
<article>
|
||
|
<pre class="prettyprint source linenums"><code>var ArgumentError = require('rest-facade').ArgumentError;
|
||
|
var utils = require('../utils');
|
||
|
var Auth0RestClient = require('../Auth0RestClient');
|
||
|
var RetryRestClient = require('../RetryRestClient');
|
||
|
|
||
|
/**
|
||
|
* Simple facade for consuming a REST API endpoint.
|
||
|
* @external RestClient
|
||
|
* @see https://github.com/ngonzalvez/rest-facade
|
||
|
*/
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @class DeviceCredentialsManager
|
||
|
* Manages Auth0 Device Credentials.
|
||
|
* @constructor
|
||
|
* @memberOf module:management
|
||
|
*
|
||
|
* @param {Object} options The client options.
|
||
|
* @param {String} options.baseUrl The URL of the API.
|
||
|
* @param {Object} [options.headers] Headers to be included in all requests.
|
||
|
* @param {Object} [options.retry] Retry Policy Config
|
||
|
*/
|
||
|
var DeviceCredentialsManager = function (options) {
|
||
|
if (options === null || typeof options !== 'object') {
|
||
|
throw new ArgumentError('Must provide manager options');
|
||
|
}
|
||
|
|
||
|
if (options.baseUrl === null || options.baseUrl === undefined) {
|
||
|
throw new ArgumentError('Must provide a base URL for the API');
|
||
|
}
|
||
|
|
||
|
if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
|
||
|
throw new ArgumentError('The provided base URL is invalid');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Options object for the RestClient instance.
|
||
|
*
|
||
|
* @type {Object}
|
||
|
*/
|
||
|
var clientOptions = {
|
||
|
errorFormatter: { message: 'message', name: 'error' },
|
||
|
headers: options.headers,
|
||
|
query: { repeatParams: false }
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Provides an abstraction layer for consuming the
|
||
|
* {@link https://auth0.com/docs/api/v2#!/Device_Credentials
|
||
|
* Auth0 DeviceCredentialsManagers endpoint}.
|
||
|
*
|
||
|
* @type {external:RestClient}
|
||
|
*/
|
||
|
var auth0RestClient = new Auth0RestClient(options.baseUrl + '/device-credentials/:id', clientOptions, options.tokenProvider);
|
||
|
this.resource = new RetryRestClient(auth0RestClient, options.retry);
|
||
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Create an Auth0 credential.
|
||
|
*
|
||
|
* @method create
|
||
|
* @memberOf module:management.DeviceCredentialsManager.prototype
|
||
|
*
|
||
|
* @example
|
||
|
* management.deviceCredentials.create(data, function (err) {
|
||
|
* if (err) {
|
||
|
* // Handle error.
|
||
|
* }
|
||
|
*
|
||
|
* // Credential created.
|
||
|
* });
|
||
|
*
|
||
|
* @param {Object} data The device credential data object.
|
||
|
* @param {Function} [cb] Callback function.
|
||
|
*
|
||
|
* @return {Promise|undefined}
|
||
|
*/
|
||
|
utils.wrapPropertyMethod(DeviceCredentialsManager, 'createPublicKey', 'resource.create');
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Get all Auth0 credentials.
|
||
|
*
|
||
|
* @method getAll
|
||
|
* @memberOf module:management.DeviceCredentialsManager.prototype
|
||
|
*
|
||
|
* @example
|
||
|
* management.deviceCredentials.getAll(function (err, credentials) {
|
||
|
* console.log(credentials.length);
|
||
|
* });
|
||
|
*
|
||
|
* @param {Function} [cb] Callback function.
|
||
|
*
|
||
|
* @return {Promise|undefined}
|
||
|
*/
|
||
|
utils.wrapPropertyMethod(DeviceCredentialsManager, 'getAll', 'resource.getAll');
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Delete an Auth0 device credential.
|
||
|
*
|
||
|
* @method delete
|
||
|
* @memberOf module:management.DeviceCredentialsManager.prototype
|
||
|
*
|
||
|
* @example
|
||
|
* var params = { id: CREDENTIAL_ID };
|
||
|
*
|
||
|
* management.deviceCredentials.delete(params, function (err) {
|
||
|
* if (err) {
|
||
|
* // Handle error.
|
||
|
* }
|
||
|
*
|
||
|
* // Credential deleted.
|
||
|
* });
|
||
|
*
|
||
|
* @param {Object} params Credential parameters.
|
||
|
* @param {String} params.id Device credential ID.
|
||
|
* @param {Function} [cb] Callback function.
|
||
|
*
|
||
|
* @return {Promise|undefined}
|
||
|
*/
|
||
|
utils.wrapPropertyMethod(DeviceCredentialsManager, 'delete', 'resource.delete');
|
||
|
|
||
|
|
||
|
module.exports = DeviceCredentialsManager;
|
||
|
</code></pre>
|
||
|
</article>
|
||
|
</section>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<br class="clear">
|
||
|
|
||
|
<footer>
|
||
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri Dec 08 2017 10:01:22 GMT-0300 (-03) using the Minami theme.
|
||
|
</footer>
|
||
|
|
||
|
<script>prettyPrint();</script>
|
||
|
<script src="scripts/linenumber.js"></script>
|
||
|
</body>
|
||
|
</html>
|