• <small id='cBMd9'></small><noframes id='cBMd9'>

    <i id='cBMd9'><tr id='cBMd9'><dt id='cBMd9'><q id='cBMd9'><span id='cBMd9'><b id='cBMd9'><form id='cBMd9'><ins id='cBMd9'></ins><ul id='cBMd9'></ul><sub id='cBMd9'></sub></form><legend id='cBMd9'></legend><bdo id='cBMd9'><pre id='cBMd9'><center id='cBMd9'></center></pre></bdo></b><th id='cBMd9'></th></span></q></dt></tr></i><div id='cBMd9'><tfoot id='cBMd9'></tfoot><dl id='cBMd9'><fieldset id='cBMd9'></fieldset></dl></div>
    <legend id='cBMd9'><style id='cBMd9'><dir id='cBMd9'><q id='cBMd9'></q></dir></style></legend>
    <tfoot id='cBMd9'></tfoot>

        • <bdo id='cBMd9'></bdo><ul id='cBMd9'></ul>

        ASP.NET 5 授权两个或多个策略(或组合策略)

        ASP.NET 5 Authorize against two or more policies (OR-combined policy)(ASP.NET 5 授权两个或多个策略(或组合策略))

            <tbody id='V7dMY'></tbody>
            <bdo id='V7dMY'></bdo><ul id='V7dMY'></ul>
          • <legend id='V7dMY'><style id='V7dMY'><dir id='V7dMY'><q id='V7dMY'></q></dir></style></legend><tfoot id='V7dMY'></tfoot>

              <small id='V7dMY'></small><noframes id='V7dMY'>

              • <i id='V7dMY'><tr id='V7dMY'><dt id='V7dMY'><q id='V7dMY'><span id='V7dMY'><b id='V7dMY'><form id='V7dMY'><ins id='V7dMY'></ins><ul id='V7dMY'></ul><sub id='V7dMY'></sub></form><legend id='V7dMY'></legend><bdo id='V7dMY'><pre id='V7dMY'><center id='V7dMY'></center></pre></bdo></b><th id='V7dMY'></th></span></q></dt></tr></i><div id='V7dMY'><tfoot id='V7dMY'></tfoot><dl id='V7dMY'><fieldset id='V7dMY'></fieldset></dl></div>

                1. 本文介绍了ASP.NET 5 授权两个或多个策略(或组合策略)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以针对两个或多个策略应用授权?我正在使用 ASP.NET 5,rc1.

                  Is it possible to apply authorization against two or more policies? I am using ASP.NET 5, rc1.

                  [Authorize(Policy = "Limited,Full")]
                  public class FooBarController : Controller
                  {
                      // This code doesn't work
                  }
                  

                  如果没有,我如何在不使用策略的情况下实现这一目标?有两组用户可以访问此控制器:完全"和有限".用户可能属于完全"或有限",或两者兼而有之.他们只需要属于这两个组之一即可访问此控制器.

                  If not, how may I achieve this without using policies? There are two groups of users that may access this controller: "Full" and "Limited". Users may either belong to "Full" or "Limited", or both. They only require to belong to one of the two groups in order to access this controller.

                  推荐答案

                  不是你想要的方式;政策旨在累积.例如,如果您使用两个单独的属性,那么它们都必须通过.

                  Not the way you want; policies are designed to be cumulative. For example if you use two separate attributes then they must both pass.

                  您必须在单个策略中评估 OR 条件.但是您不必在单个处理程序中将其编码为 OR.您可以有一个具有多个处理程序的需求.如果任一处理程序标记成功,则满足要求.请参阅我的授权研讨会中的第 6 步.

                  You have to evaluate OR conditions within a single policy. But you don't have to code it as ORs within a single handler. You can have a requirement which has more than one handler. If either of the handlers flag success then the requirement is fulfilled. See Step 6 in my Authorization Workshop.

                  这篇关于ASP.NET 5 授权两个或多个策略(或组合策略)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to keep the Text of a Read only TextBox after PostBack()?(PostBack()之后如何保留只读文本框的文本?)
                  Winforms Textbox - Using Ctrl-Backspace to Delete Whole Word(Winforms 文本框 - 使用 Ctrl-Backspace 删除整个单词)
                  C# - Add button click events using code(C# - 使用代码添加按钮单击事件)
                  Multi-color TextBox C#(多色文本框 C#)
                  How can i set the caret position to a specific index in passwordbox in WPF(如何将插入符号位置设置为 WPF 密码框中的特定索引)
                  C# Numeric Only TextBox Control(C# 纯数字文本框控件)
                2. <i id='ScVRS'><tr id='ScVRS'><dt id='ScVRS'><q id='ScVRS'><span id='ScVRS'><b id='ScVRS'><form id='ScVRS'><ins id='ScVRS'></ins><ul id='ScVRS'></ul><sub id='ScVRS'></sub></form><legend id='ScVRS'></legend><bdo id='ScVRS'><pre id='ScVRS'><center id='ScVRS'></center></pre></bdo></b><th id='ScVRS'></th></span></q></dt></tr></i><div id='ScVRS'><tfoot id='ScVRS'></tfoot><dl id='ScVRS'><fieldset id='ScVRS'></fieldset></dl></div>

                  <small id='ScVRS'></small><noframes id='ScVRS'>

                    <legend id='ScVRS'><style id='ScVRS'><dir id='ScVRS'><q id='ScVRS'></q></dir></style></legend>
                      • <bdo id='ScVRS'></bdo><ul id='ScVRS'></ul>
                          <tbody id='ScVRS'></tbody>
                      • <tfoot id='ScVRS'></tfoot>