UNPKG

prisme-flow

Version:

prisme platform flow engine

197 lines (187 loc) 7.03 kB
<!-- Created by prisme.io on 09/06/2017. @author <a href="mailto:hello@prisme.io">savane vamara</a> (prisme.io) --> <script type="text/x-red" data-template-name="auth0-server"> <div class="form-row"> <ul style="background: #fff; min-width: 600px; margin-bottom: 20px;" id="node-config-auth0-server-tabs"></ul> </div> <div id="node-config-auth0-server-tabs-content" style="min-height: 170px;"> <div id="auth0-server-tab-connection" style="display:none"> <div class="form-row node-input-name"> <label for="node-config-input-name"><i class="fa fa-globe"></i> <span>Name</span></label> <input class="input-append-left" type="text" id="node-config-input-name" placeholder="Enter a server name" style="width: 40%;" > </div> <div class="form-row node-input-address"> <label for="node-config-input-address"><i class="fa fa-link"></i> <span>Token Info</span></label> <input class="input-append-left" type="text" id="node-config-input-address" placeholder="https://yourdomain.auth0.com/tokeninfo" style="width: 40%;" > </div> <div class="form-row node-input-secret"> <label for="node-config-input-secret"><i class="fa fa-key"></i> <span>Client Secret</span></label> <input class="input-append-left" type="password" id="node-config-input-secret" placeholder="Auth0 Client Secret" style="width: 40%;" > </div> </div> <div id="auth0-server-tab-about" style="display:none"> <div class="form-row node-label-author"> <label><i class="fa fa-user"></i> <span>Author</span></label> <span class="input-append-left" style="width: 40%;" >Duong Dinh Cuong</span> </div> <div class="form-row node-label-email"> <label><i class="fa fa-email"></i> <span>Email</span></label> <span class="input-append-left" style="width: 40%;" >cuong3ihut@gmail.com</span> </div> </div> </div> </script> <script type="text/javascript"> RED.nodes.registerType('auth0-server', { category : 'config', defaults : { name : { value : "", required : true }, address : { value : "", }, secret : { value : "" } }, label : function() { return (this.name ? this.name: this.address + "@" + this.port); }, oneditprepare : function() { var tabs = RED.tabs.create({ id : "node-config-auth0-server-tabs", onchange : function(tab) { $("#node-config-auth0-server-tabs-content").children().hide(); $("#" + tab.id).show(); } }); tabs.addTab({ id : "auth0-server-tab-connection", label : "Auth0" }); tabs.addTab({ id : "auth0-server-tab-about", label : "About" }); setTimeout(function() { tabs.resize(); }, 0); } }); </script> <script type="text/x-red" data-template-name="http-auth0"> <div class="form-row"> <label for="node-input-auth0"><i class="fa fa-globe"></i> <span>Auth0</span></label> <input type="text" id="node-input-auth0" placeholder="Enter auth0 name"> </div> <div class="form-row"> <label for="node-input-method"><i class="fa fa-tasks"></i> <span>Method</span></label> <select type="text" id="node-input-method" style="width:72%;"> <option value="get">GET</option> <option value="post">POST</option> <option value="put">PUT</option> <option value="delete">DELETE</option> <option value="patch">PATCH</option> </select> </div> <div class="form-row"> <label for="node-input-url"><i class="fa fa-globe"></i> <span>URL</span></label> <input type="text" id="node-input-url" placeholder="/url"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label> <input type="text" id="node-input-name" placeholder="Enter a name"> </div> <div class="form-row"> <label for="node-input-role"><i class="fa fa-support"></i> <span>Role</span></label> <input type="text" id="node-input-role" placeholder="administrator"> </div> <div class="form-row"> <label for="node-input-group"><i class="fa fa-group"></i> <span>Group</span></label> <input type="text" id="node-input-group" placeholder="Administrator"> </div> </script> <script type="text/x-red" data-help-name="http-auth0"> <p>Provides an input node for http requests, allowing the creation of simple web services.</p> <p>The resulting message has the following properties: <ul> <li>msg.req : <a href="http://expressjs.com/api.html#req">http request</a></li> <li>msg.res : <a href="http://expressjs.com/api.html#res">http response</a></li> </ul> </p> <p>For POST/PUT requests, the body is available under <code>msg.req.body</code>. This uses the <a href="http://expressjs.com/api.html#bodyParser">Express bodyParser middleware</a> to parse the content to a JSON object. </p> <p> By default, this expects the body of the request to be url encoded: <pre>foo=bar&amp;this=that</pre> </p> <p> To send JSON encoded data to the node, the content-type header of the request must be set to <code>application/json</code>. </p> <p> <b>Note: </b>This node does not send any response to the http request. This should be done with a subsequent HTTP Response node. </p> </script> <script type="text/javascript"> RED.nodes.registerType('http-auth0',{ category: 'input', color:"#FFCC66", defaults: { name: {value:""}, role: {value:""}, group: {value:""}, url: {value:"",required:true}, method: {value:"get",required:true}, auth0 : { type : "auth0-server", required : true } }, inputs:0, outputs:1, icon: "http-auth.png", label: function() { if (this.name) { return this.name; } else if (this.url) { var root = RED.settings.httpNodeRoot; if (root.slice(-1) != "/") { root = root+"/"; } if (this.url.charAt(0) == "/") { root += this.url.slice(1); } else { root += this.url; } return "["+this.method+"] "+root; } else { return "http auth0"; } }, labelStyle: function() { return this.name?"node_label_italic":""; }, oneditprepare: function() { var root = RED.settings.httpNodeRoot; if (root.slice(-1) == "/") { root = root.slice(0,-1); } if (root == "") { $("#node-input-tip").hide(); } else { $("#node-input-path").html(root); $("#node-input-tip").show(); } if(!RED.nodes.getType("swagger-doc")){ $('.row-swagger-doc').hide(); } } }); </script>