2012-01-05 128 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

相關問題