首页 \ 问答 \ OAuth 2.0。(OAuth 2.0. No session? (stateless))

OAuth 2.0。(OAuth 2.0. No session? (stateless))

我将使用它来实现OAuth 2.0REST API

为每个用户授予不同的权限,并且可以很好地扩展。

为了扩展好, 无状态因为存在而更容易

NO文件,数据库,基于内存的会话。


以下是我对OAuth 2的理解。

  1. OAuth服务器为用户提供访问令牌。
  2. 用户的访问令牌存储在cookie中。
  3. 当用户访问REST API时,用户使用访问令牌进行发送。
  4. 服务器通过访问令牌接收请求。
  5. 服务器确定访问令牌是否有效,并且用户有权执行请求。
  6. 根据用户的特权进行或拒绝。

所以我不必担心会话存储。 对?


I'm going to implement OAuth 2.0 and REST API with it

to grant different permissions per users and also to scale well.

To scale well, stateless is easier because there is

NO file, database, in-memory based session with it.


Below is how I understand OAuth 2.

  1. OAuth Server give an access token to a user.
  2. The user's access token is stored in cookie.
  3. When user access to REST API, user sends with the access token.
  4. Server receives request with access token.
  5. Server find out whether access token is valid and the user has permission to do request.
  6. Do or reject based on user's privilege.

So I do not have to worry about session storage. Right?


原文:https://stackoverflow.com/questions/11458364
更新时间:2022-04-01 09:04

最满意答案

最接近你在PHP地区寻找的是Dindent, https://github.com/gajus/dindent 。 Dindent是一个使用正则表达式缩进标记的HTML美化工具。 这与Tidy不同,它充当DOM解析器。

从文档:

不使用正则表达式来解析HTML是一个很好的理由。 但是,DOM解析器将重建整个HTML文档。 它会添加缺少的标签,关闭开放的块标签,或删除任何不是有效的HTML的东西。 这就是Tidy所做的,DOM等等。当调试HTML输出时,这种行为是不可取的。 基于正则表达式的解析器不会重建文档。 Dindent只会添加缩进,而不会影响标记。

Dindent唯一的目的是缩进HTML标记。 它允许配置哪些元素要视为内联以及哪些元素要视为块。


The closest to what you are looking for in the PHP land is Dindent, https://github.com/gajus/dindent. Dindent is a HTML beautifier that uses regular expressions to indent the markup. This is different from Tidy, that acts as a DOM parser.

From the documentation:

There is a good reason not to use regular expression to parse HTML. However, DOM parser will rebuild the whole HTML document. It will add missing tags, close open block tags, or remove anything that's not a valid HTML. This is what Tidy does, DOM, etc. This behavior is undesirable when debugging HTML output. Regex based parser will not rebuild the document. Dindent will only add indentation, without otherwise affecting the markup.

Dindent sole purpose is to indent the HTML markup. It allows to configure what elements to treat as inline and what elements to treat as block.

相关问答

更多
  • 最接近你在PHP地区寻找的是Dindent, https://github.com/gajus/dindent 。 Dindent是一个使用正则表达式缩进标记的HTML美化工具。 这与Tidy不同,它充当DOM解析器。 从文档: 不使用正则表达式来解析HTML是一个很好的理由。 但是,DOM解析器将重建整个HTML文档。 它会添加缺少的标签,关闭开放的块标签,或删除任何不是有效的HTML的东西。 这就是Tidy所做的,DOM等等。当调试HTML输出时,这种行为是不可取的。 基于正则表达式的解析器不会重建文档 ...
  • 这还是让我烦恼 我只是决定最好的工作(对我个人而言)是这样的: :set filetype=html 然后突出显示你的文字,然后点击= 。 繁荣! HTML格式化成功。 (不理想,我知道,但至少它有效。) This still bothers me. I only just decided that the best work-around (for me personally) is this: :set filetype=html And then highlight your text and h ...
  • filetype indent on我的.vimrc里面,Vim很好地filetype indent on HTML文件。 shiftwidth为2的简单示例

    text

    With filetype indent on inside my .vimrc, Vim indents HTML files quite nicely. Simple example with a shiftwidth of ...
  • 你的div没有任何内容,即使你给它一个高度它也没有,因为它的父级没有高度。 尝试向父母添加高度,如: .a { background-color: #ff0000; height: 30%; width: 100%; } body, html { height: 100%; }
    作为高度状态的文档 : 百分比是根据生成的框的包含块的高度计算的。 如果未明确指定包含块的高度(即,它取决于内容高度),并且此元素未绝对定位,则该值计算 ...
  • 在HTML中没有像元素那样的东西,所以解析规则(对于未知元素)意味着结束标记是必需的。 如果您使用禁止结束标记的元素(例如 ),则应该看到正确的缩进。 There is no such thing as an element in HTML, so the parsing rules (for unknown elements) mean that the end tag is required. If you use an element where the end ...
  • 这是我的缩进功能,希望它有所帮助。 class Html { private static $_indent = " "; private static function indentStr($indentlevel = 0){ $replaceindent = null; //Sets the indentation from current indentlevel for($o = 0; $o < $indentlevel; $o++ ...
  • 以下是一个使用JavaScript填充隐藏的以及 : var form = document.getElementById('my-form'); form.addEventListener('input', function() { this.tot.value = this.tot_display.value = this.subtot.value - this.lasdue.value; });
  • 在Firefox中,它是可能的,但据我所知它还没有标准化(Chrome也可能支持它): https://wiki.mozilla.org/Audio_Data_API Webkit API提案: https : //dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html 以及一些相关的文章/演示: http://ajaxian.com/by/topic/sound http://ajaxian.com/archives/amazing-au ...
  • 希望这对你有用 $a=0; foreach ($data[0] as $data) { if ($data == a) { echo "
    "; } elseif ($data == b) { echo "
  • Ctrl + Alt + L是Reformat Code的快捷方式,它自动应用PhpStorm设置中设置的代码缩进规则。 目前无法使代码自动显示 。 您必须每次手动格式化代码。 原因是PhpStorm格式化引擎的局限性。 PhpStorm问题跟踪器已经有功能请求解决了这个问题: WI-32401 另见本期报告: WI-17786 The Ctrl+Alt+L is the shortcut for Reformat Code, which automatically applies the code ind ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)