zoukankan      html  css  js  c++  java
  • sqler sql 转rest api 授权处理

    我们可以使用内置的authorizer 以及js 脚本,方便的进行api 接口的授权处理

    说明: 这个是2.0 的功能,注意版本的使用

    参考格式

    addpost {
        authorizer = <<JS
            (function(){
                // $input is a global variable holds all request inputs,
                // including the http headers too (prefixed with `http_`)
                // all http header keys are normalized to be in this form 
                // `http_x_header_example`, `http_authorization` ... etc in lower case.
                token = $input.http_authorization
                response = fetch("http://requestbin.fullcontact.com/zxpjigzx", {
                    headers: {
                        "Authorization": token
                    }
                })
                if ( response.statusCode != 200 ) {
                    return false
                }
                return true
            })()
        JS
    }
     

    参考资料

    https://github.com/alash3al/sqler

  • 相关阅读:
    Django(二)
    VSCode写Django的坑
    AXF—个Django项目
    Linux
    安装软件方面的问题及解决方法杂烩
    Python
    环境搭建
    Django(一)
    关于excel表
    (十)selenium实现微博高级搜索信息爬取
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/10265345.html
Copyright © 2011-2022 走看看