UNPKG

@cgignite/ignite-auth

Version:

Auth node allows you to integrate security withing your Ignite APIs and apps

53 lines (51 loc) 1.9 kB
<script type="text/javascript"> RED.nodes.registerType('jwt', { category: 'security', color: '#3d7e9a', defaults: { name: { value: "" }, jwtconfig : { type: "jwt-config" }, generatejwt : { value: 'false' }, outputs: { value: 2} }, inputs: 1, outputs: 2, outputLabels: ["Authorized", "Unauthorized"], icon: 'font-awesome/fa-unlock-alt', label: function () { return this.name || "jwt"; }, oneditsave : function () { this.generatejwt = $("#node-input-generatejwt").val() == "true"; if(this.generatejwt) { $("#node-input-outputs").val(JSON.stringify(1)); } else { $("#node-input-outputs").val(JSON.stringify(2)); } } }); </script> <script type="text/html" data-template-name="jwt"> <div class="form-row"> <label for="node-input-name">Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-jwtconfig">Setting</label> <input type="text" id="node-input-jwtconfig" placeholder="Setting"> </div> <div class="form-row"> <label for="node-input-generatejwt"><i class="icon-tag"></i><span>Mode</span></label> <select type="select" id="node-input-generatejwt"> <option value="false">validate</option> <option value="true">generate</option> </select> <input type="hidden" id="node-input-outputs"/> </div> </script> <script type="text/html" data-help-name="jwt"> <p>jwt node can create a jwt token from msg.payload if mode is generate, otherwise it'll verify a jwt from authorization headers of a request (msg.req.headers['authorization']).</p> </script>