UNPKG

node-red-contrib-ldap-login

Version:
133 lines (120 loc) 4.06 kB
<script type="text/javascript"> RED.nodes.registerType('find-user',{ category: 'Active Directory', color: '#0E9EFF', defaults: { name: { value: "" }, url: { value: "", required: true }, baseDN: { value: "", required: false }, filter: { value: "", required: false }, attributes: { value: "", required: false } }, credentials: { username: { type:"text", required: true }, password: { type:"password", required: true } }, inputs:1, outputs:1, icon: "bridge.png", label: function() { return this.name||"ldap find"; } }); </script> <script type="text/x-red" data-template-name="find-user"> <hr> <h4>Node Configuration</h4> <hr> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <hr> <h5>Active Directory</h5> <hr> <div class="form-row"> <label for="node-input-url"><i class="icon-globe"></i> Url</label> <input type="text" id="node-input-url" placeholder="ldap://localhost"> </div> <div class="form-row"> <label for="node-input-baseDN"><i class="icon-tag"></i> Base DN</label> <input type="text" id="node-input-baseDN" placeholder="dc=domain,dc=com"> </div> <div class="form-row"> <label for="node-input-filter"><i class="icon-tag"></i> Filter</label> <input type="text" id="node-input-filter" placeholder="(&(objectCategory=Person)(objectClass=User)(samaccountname={{{payload.find}}}))"> </div> <div class="form-row"> <label for="node-input-attributes"><i class="icon-tag"></i> Attributes</label> <input type="text" id="node-input-attributes" placeholder="objectGUID, emailAddress, departmentNumber, title, userPrincipalName, memberOf, sn, givenName, mail"> </div> <hr> <h5>Credentials</h5> <hr> <div class="form-row"> <label for="node-input-username"><i class="icon-user"></i> Username</label> <input type="text" id="node-input-username" placeholder="username@domain.com"> </div> <div class="form-row"> <label for="node-input-password"><i class="fa fa-key"></i> Password</label> <input type="password" id="node-input-password"> </div> </script> <script type="text/x-red" data-help-name="find-user"> <p>Connects to a Microsoft Active Directory and returns the user corresponding to the username/DN set in <code>msg.payload</code>.</p> <h3>Inputs</h3> <dl class="message-properties"> <dt>payload <span class="property-type">JSON object</span> </dt> <dd> the AD username and password of the user to login. It also works with DN. </dd> </dl> <dl class="message-properties"> <dt>tlsOptions <span class="property-type">JSON object</span> </dt> <dd> <p><code>msg.tlsOptions</code>: (Optional) Additional options passed to TLS connection layer when connecting via <code>ldaps://</code>. (See: <a target="_blank" href="https://nodejs.org/api/tls.html#tls_tls_connect_options_callback">TLS docs for node.js</a>)</p> </dd> </dl> <h3>Outputs</h3> <ol class="node-ports"> <li>Standard output <dl class="message-properties"> <dt>payload <span class="property-type">string</span></dt> <dd>the standard output of the command, a JSON object that contains all the information about the user.</dd> </dl> </li> <li>Standard error <dl class="message-properties"> <dt>payload <span class="property-type">string</span></dt> <dd>the standard error of the command.</dd> </dl> </li> </ol> <h3>References</h3> <ul> <li><a href="https://github.com/dmvstar/node-red-contrib-ldap-login">GitHub</a> - the nodes github repository</li> </ul> </script>