2012-01-05 136 views
11

我一直在尝试关于NetSqlAzMan项目的原始(和/或当前)动机的“行间阅读”。NetSqlAzMan vs AzMan vs(?????)

这是写的吗?

  1. 适用于Windows授权管理器(AzMan)的适配器。 NetSqlAzMan中的方法只是将调用传递给(Windows授权管理器(AzMan)),但也许使用更好或更清晰的方法?

  2. (Windows授权管理器(AzMan))的替代品。在NetSqlAzMan中重新创建(Windows授权管理器(AzMan))中可用功能的大部分或全部功能,但代码是独立开发的。 (可能提供DotNet 4.0支持???)(也许删除任何COM依赖项)

  3. 提供比(Windows授权管理器(AzMan))提供的更多功能。也就是(Windows授权管理器(AzMan))的“更智能”/“更好”版本。

  4. 重写,但也通过开源保持半死不活的项目。 (也许,(Windows授权管理器(AzMan)))是微软的一个死或被遗弃的项目)。

  5. 其他?

................

我喜欢NetSqlAzMan的对象模型。但我需要捍卫将其用于项目经理和其他开发人员的任何决定。 对于我所期望的安全性,对象模型看起来“恰到好处”(认为是goldilocks和中间床)。 我不想做基于角色的安全。我想要正确的(或任务或权限)的安全。

(参见: http://lostechies.com/derickbailey/2011/05/24/dont-do-role-based-authorization-checks-do-activity-based-checks/http://granadacoder.wordpress.com/2010/12/01/rant-hard-coded-security-roles/

,基本上是想出的问题是: “什么是使用NetSqlAzMan代替的优势(Windows授权管理器(AzMan))”

而子问题是“Windows授权管理器(AzMan)死了吗?”。 (和Long Live NetSqlAzMan!一致!)。

..................

我的,总体要求是:

非活动目录用户。 (顺着Active Directory和/或LDAP的支持会很好,但不是要求)。 密码未以纯文本形式存储。 能够处理RIGHTS进行安全检查。
将任何角色下的权限分组。 为用户分配角色。 (但是,代码将再次检查权利,而不是执行操作时的角色。) 允许(有时)将权限分配给用户。使用拒绝覆盖。 (也就是说,在愚蠢的事情上执行任务的单个用户(例如“删除员工”)可以撤消该权利。) 可以为多个应用程序维护角色和权利。

因此,欢迎其他想法。但Windows Identity Foundation似乎有点矫枉过正。

谢谢。

回答

10

昨晚我终于找到了一篇“比较”文章。

http://www.c-sharpcorner.com/uploadfile/a.ferendeles/netsqlazman12122006123316pm/netsqlazman.aspx

,我要在这里贴上相关的部分(下图)。 (以防万一网站在将来不复存在,我知道这个机会很小,但我讨厌“答案就在这里”链接,而当你点击链接时,它就是一个死链。)

从什么我可以告诉。

NetSqlAzMan提供了一个(表)用户自定义函数,您可以重载以提供用户列表(将被分配给角色/任务)。 NetSqlAzMan不仅提供“是的,你可以”映射(格兰特),但也拒绝和授权与代表。 NetSqlAzMan和Azman允许用户(组)进行角色映射。只有NetSqlAzMan允许用户执行任务映射。

看了几个样本...... NetSqlAzMan的对象模型非常干净。

============================================== =========

女士授权管理器(AzMan)VS .NET SQL授权经理 (NetSqlAzMan)

正如前面所指出的,类似微软的产品已经存在 ,被称为授权经理(AzMan); AzMan存在,默认情况下为 ,在Windows Server 2003中,并通过管理包安装程序在 Windows XP中存在。

AzMan的和NetSqlAzMan之间的重要区别是, 第一个是基于角色的,即,基于所述属于 - 角色概念 和在每个角色的操作的容器中,而第二个是 项目为基础(或如果您更喜欢基于操作),即用户或用户可以或不能属于角色或执行此类任务和/或操作(项目)的组或组的组或组。

这里最重要的特征和差异两个 产品之间:

AzMan的女士:

* It's COM. 
* It's equipped by a MMC 2.0 (COM) console. 
* Its storage can be an XML file or ADAM (Active Directory Application Mode - e un LDAP). 
* It's role-based. 
* It supports static/dynamic applicative groups, members/not-members. 
* Structure based on Roles -> Tasks -> Operations. (Hierarchical Roles and Tasks , none Operations). 
* Authorizations can be added only to Roles. 
* It doesn't implement the "delegate" concept. 
* It doesn't manage authorizations "in the time". 
* It doesn't trigger events. 
* The only type of authorization is "Allow". 
    (to "deny" it needs to remove the user/group from his Role). 
* It supports Scripting/Biz rules. 
* It supports Active Directory users/groups and ADAM users. 

NetSqlAzMan:

* It's .NET 2.0. 
* It's equipped by a MMC 3.0 (.NET) console. 
* Its storage is a Sql Server database(2000/MSDE/2005/Express). 
* It's based on Tdo - Typed Data Object technology. 
* It's Item-based. 
* Structure based on Roles -> Tasks -> Operations. (all hierarchical ones). 
* Authorizations can be added to Roles, Task and Operations. 
* It supports static/dynamic applicative groups, members/not-members. 
* LDAP query testing directly from console. 
* It's time-dependant. 
* It's delegate-compliant. 
* It triggers events (ENS). 
* It supports 4 authorization types: 
     o Allow with delegation (authorized and authorized to delegate). 
     o Allow (authorized). 
     o Deny (not authorized). 
     o Neutral (neutral permission, it depends on higher level Item permission). 
* Hierarchical authorizations. 
* It supports Scripting/Biz rules (compiled in .NET - C# - VB - and not interpreted) 
* It supports Active Directory users/groups and custom users defined in SQL Server Database. 

这里还有一个疑难杂症。

阿兹曼示例代码: http://channel9.msdn.com/forums/sandbox/252978-AzMan-in-the-Enterprise-Sample-Code http://channel9.msdn.com/forums/sandbox/252973-Programming-AzMan-Sample-Code

using System; 
using System.Security.Principal; 
using System.Runtime.InteropServices; 
using AZROLESLib; 

namespace TreyResearch { 
    public class AzManHelper : IDisposable { 

     AzAuthorizationStore store; 
     IAzApplication app; 
     string appName; 

     public AzManHelper(string connectionString, string appName) { 

      this.appName = appName; 

      try { 
       // load and initialize the AzMan runtime 
       store = new AzAuthorizationStore(); 
       store.Initialize(0, connectionString, null); 

       // drill down to our application 
       app = store.OpenApplication(appName, null); 
      } 
      catch (COMException x) { 
       throw new AzManException("Failed to initizlize AzManHelper", x); 
      } 
      catch (System.IO.FileNotFoundException x) { 
       throw new AzManException(string.Format("Failed to load AzMan policy from {0} - make sure your connection string is correct.", connectionString), x); 
      } 
     } 

     public void Dispose() { 
      if (null == app) return; 

      Marshal.ReleaseComObject(app); 
      Marshal.ReleaseComObject(store); 

      app = null; 
      store = null; 
     } 

     public bool AccessCheck(string audit, Operations op, 
           WindowsIdentity clientIdentity) { 

      try { 
       // first step is to create an AzMan context for the client 
       // this looks at the security identifiers (SIDs) in the user's 
       // access token and maps them onto AzMan roles, tasks, and operations 
       IAzClientContext ctx = app.InitializeClientContextFromToken(
        (ulong)clientIdentity.Token.ToInt64(), null); 

       // next step is to see if this user is authorized for 
       // the requested operation. Note that AccessCheck allows 
       // you to check multiple operations at once if you desire 
       object[] scopes = { "" }; 
       object[] operations = { (int)op }; 
       object[] results = (object[])ctx.AccessCheck(audit, scopes, operations, 
                  null, null, null, null, null); 
       int result = (int)results[0]; 
       return 0 == result; 
      } 
      catch (COMException x) { 
       throw new AzManException("AccessCheck failed", x); 
      } 
     } 

     public bool AccessCheckWithArg(string audit, Operations op, 
             WindowsIdentity clientIdentity, 
             string argName, object argValue) { 

      try { 
       // first step is to create an AzMan context for the client 
       // this looks at the security identifiers (SIDs) in the user's 
       // access token and maps them onto AzMan roles, tasks, and operations 
       IAzClientContext ctx = app.InitializeClientContextFromToken(
        (ulong)clientIdentity.Token.ToInt64(), null); 

       // next step is to see if this user is authorized for 
       // the requested operation. Note that AccessCheck allows 
       // you to check multiple operations at once if you desire 
       object[] scopes = { "" }; 
       object[] operations = { (int)op }; 
       object[] argNames = { argName }; 
       object[] argValues = { argValue }; 
       object[] results = (object[])ctx.AccessCheck(audit, scopes, operations, 
                  argNames, argValues, 
                  null, null, null); 
       int result = (int)results[0]; 
       return 0 == result; 
      } 
      catch (COMException x) { 
       throw new AzManException("AccessCheckWithArg failed", x); 
      } 
     } 

     // use this to update a running app 
     // after you change the AzMan policy 
     public void UpdateCache() { 
      try { 
       store.UpdateCache(null); 
       Marshal.ReleaseComObject(app); 
       app = store.OpenApplication(appName, null); 
      } 
      catch (COMException x) { 
       throw new AzManException("UpdateCache failed", x); 
      } 
     } 
    } 

    public class AzManException : Exception { 
     public AzManException(string message, Exception innerException) 
      : base(message, innerException) 
     {} 
    } 
} 

即阿兹曼辅助代码。这是丑陋的COM/Interopish的东西。:<

现在检查NetSqlAzMan代码示例:

http://netsqlazman.codeplex.com/wikipage?title=Samples

/// <summary> 
/// Create a Full Storage through .NET code 
/// </summary> 
private void CreateFullStorage() 
{ 
    // USER MUST BE A MEMBER OF SQL DATABASE ROLE: NetSqlAzMan_Administrators 

    //Sql Storage connection string 
    string sqlConnectionString = "data source=(local);initial catalog=NetSqlAzManStorage;user id=netsqlazmanuser;password=password"; 
    //Create an instance of SqlAzManStorage class 
    IAzManStorage storage = new SqlAzManStorage(sqlConnectionString); 
    //Open Storage Connection 
    storage.OpenConnection(); 
    //Begin a new Transaction 
    storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted); 
    //Create a new Store 
    IAzManStore newStore = storage.CreateStore("My Store", "Store description"); 
    //Create a new Basic StoreGroup 
    IAzManStoreGroup newStoreGroup = newStore.CreateStoreGroup(SqlAzManSID.NewSqlAzManSid(), "My Store Group", "Store Group Description", String.Empty, GroupType.Basic); 
    //Retrieve current user SID 
    IAzManSid mySid = new SqlAzManSID(WindowsIdentity.GetCurrent().User); 
    //Add myself as sid of "My Store Group" 
    IAzManStoreGroupMember storeGroupMember = newStoreGroup.CreateStoreGroupMember(mySid, WhereDefined.Local, true); 
    //Create a new Application 
    IAzManApplication newApp = newStore.CreateApplication("New Application", "Application description"); 
    //Create a new Role 
    IAzManItem newRole = newApp.CreateItem("New Role", "Role description", ItemType.Role); 
    //Create a new Task 
    IAzManItem newTask = newApp.CreateItem("New Task", "Task description", ItemType.Task); 
    //Create a new Operation 
    IAzManItem newOp = newApp.CreateItem("New Operation", "Operation description", ItemType.Operation); 
    //Add "New Operation" as a sid of "New Task" 
    newTask.AddMember(newOp); 
    //Add "New Task" as a sid of "New Role" 
    newRole.AddMember(newTask); 
    //Create an authorization for myself on "New Role" 
    IAzManAuthorization auth = newRole.CreateAuthorization(mySid, WhereDefined.Local, mySid, WhereDefined.Local, AuthorizationType.AllowWithDelegation, null, null); 
    //Create a custom attribute 
    IAzManAttribute<IAzManAuthorization> attr = auth.CreateAttribute("New Key", "New Value"); 
    //Create an authorization for DB User "Andrea" on "New Role" 
    IAzManAuthorization auth2 = newRole.CreateAuthorization(mySid, WhereDefined.Local, storage.GetDBUser("Andrea").CustomSid, WhereDefined.Local, AuthorizationType.AllowWithDelegation, null, null); 
    //Commit transaction 
    storage.CommitTransaction(); 
    //Close connection 
    storage.CloseConnection(); 
} 

这讲述了一个故事,本身。

+0

我只是想指出,有关阿兹曼发文章和点是从张贴在2006年阿兹曼的文章更新和改进(escpecially的API和SQL Server存储支持)在Windows Server 2008出来。但似乎Azman已被抛弃。最后的Azman团队博客更新从2008年开始。 – Haydar 2013-03-13 13:07:05

+0

感谢您的提示。不要加载Azman,但它与特定的操作系统版本相关......这对我来说也是一个麻烦点。但它可能是这些东西之一,是一些更好的东西的灵感...... – granadaCoder 2013-03-13 13:23:37

+0

NETSQL Azman以任何方式依赖于Windows Azman。由于Azman可能在未来的Windows版本中被弃用,这是否意味着NETSQL Azman在发生这种情况时将不起作用? – Donny 2016-04-22 10:44:07

2

我认为缺乏对他们的博客,并在其软件开发工具包,从微软更新的原因有事情做与他们已经将所有的工具和对社交网络/联合设计友好“索赔模式”:

http://msdn.microsoft.com/en-us/magazine/ee335707.aspx

与AzMan的任何变体相比,在低AzMan操作级别(代码要求将其与其他级别脱离)时,我们只有权限类型声明。这种新的操作风格仅仅是从您(或稍后重新配置)定义的签名验证的任何受信任的声明提供程序/服务发出的URN字符串/操作名称。然后,它们只是用户身份中的一个简单的角色列表,可以使用常见的IsInRole方法轻松进行检查。

这个理由很明确。现代互联网解决方案(并且一旦隐私法律得到改进,可能还有一些未来的公司内联网应用)需要多域验证和授权,例如,这个StackOverflow.com用户帐户和连接的Facebook帐户或您可能已链接的任何OpenID帐户。

因此,对于授权,您现在可以在外部索赔和内部“许可索赔”(类似于AzMan操作)之间映射规则。但是没有标准格式,层次结构或管理工具。

也许声明服务(认证)+ AzMan XML/SQL(角色到声明映射)+声明权限需求的混合解决方案是前进的方向。到目前为止我发现的所有样本都只有中间的代码。我希望看到一些将Active Directory中的递归组成员关系解析为角色到任务的东西,就像AzMan已经拥有的声明(操作)。

更多的调查是必要的,以达到“好老”,但仍然是必不可少的“基于角色的安全”与新的技术模式...

如果你正在寻找开始,头朝着微软Windows标识基础(WIF),它最早出现在.NET 3.5.1中,但已经集成到.NET 4.5框架中。

http://msdn.microsoft.com/en-us/library/hh377151(v=vs.110).aspx

+0

对于未来的读者....我已经完全放弃了“旧学校”,现在使用索赔授权。它有一个小小的驼峰来结束,但它最终会结束。 – granadaCoder 2016-04-22 13:21:40

相关问题